Parent Directory
|
Revision Log
Prefaced some subroutines with _wwrpc instead of wwmoodleset. These subroutines are internal to wwmoodleset (as far as moodle is concerned) and should eventually be replaced by RPC calls to webwork.
1 <?php 2 // $Id: index.php,v 1.3 2006-06-24 13:57:05 gage Exp $ 3 4 5 /// This page lists all the instances of wwmoodleset in a particular course 6 /// Replace wwmoodleset with the name of your module 7 8 require_once("../../config.php"); 9 require_once("lib.php"); 10 11 $id = required_param('id', PARAM_INT); // course 12 13 if (! $course = get_record("course", "id", $id)) { 14 error("Course ID is incorrect"); 15 } 16 17 require_login($course->id); 18 19 add_to_log($course->id, "wwmoodleset", "view all", "index.php?id=$course->id", ""); 20 21 22 /// Get all required strings 23 24 $strwwmoodlesets = get_string("modulenameplural", "wwmoodleset"); 25 $strwwmoodleset = get_string("modulename", "wwmoodleset"); 26 27 28 /// Print the header 29 30 if ($course->category) { 31 $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> »"; 32 } 33 34 print_header("$course->shortname: $strwwmoodlesets", "$course->fullname", "$navigation $strwwmoodlesets", "", "", true, "", navmenu($course)); 35 36 /// Get all the appropriate data 37 38 if (! $wwmoodlesets = get_all_instances_in_course("wwmoodleset", $course)) { 39 notice("There are no $strwwmoodlesets", "../../course/view.php?id=$course->id"); 40 die; 41 } 42 43 /// Print the list of instances (your module will probably extend this) 44 45 $timenow = time(); 46 $strname = get_string("name"); 47 $strweek = get_string("week"); 48 $strtopic = get_string("topic"); 49 50 $strOpenDate = get_string("openDate", "wwmoodleset"); 51 $strDueDate = get_string("dueDate", "wwmoodleset"); 52 53 if ($course->format == "weeks") { 54 $table->head = array ($strweek, $strname, $strOpenDate, $strDueDate); 55 $table->align = array ("center", "left", "left", "left"); 56 } else if ($course->format == "topics") { 57 $table->head = array ($strtopic, $strname, $strOpenDate, $strDueDate); 58 $table->align = array ("center", "left", "left", "left", "left", "left"); 59 } else { 60 $table->head = array ($strname, $strOpenDate, $strDueDate); 61 $table->align = array ("left", "left", "left", "left", "left"); 62 } 63 64 foreach ($wwmoodlesets as $wwmoodleset) { 65 // grab specific info for this set: 66 $aSetInfo = _wwrpc_getSetInfo($wwmoodleset->set_id, wwmoodleset_courseIdToShortName($course->id)); 67 if (!$wwmoodleset->visible) { 68 //Show dimmed if the mod is hidden 69 $link = "<a class=\"dimmed\" href=\"view.php?id=$wwmoodleset->coursemodule\">$wwmoodleset->name</a>"; 70 } else { 71 //Show normal if the mod is visible 72 $link = "<a href=\"view.php?id=$wwmoodleset->coursemodule\">$wwmoodleset->name</a>"; 73 } 74 75 if ($course->format == "weeks" or $course->format == "topics") { 76 $table->data[] = array ($wwmoodleset->section, $link, strftime("%c", $aSetInfo['open_date']), strftime("%c", $aSetInfo['due_date'])); 77 } else { 78 $table->data[] = array ($link, strftime("%c", $aSetInfo['open_date']), strftime("%c", $aSetInfo['due_date'])); 79 } 80 } 81 82 echo "<br />"; 83 84 print_table($table); 85 if( isteacher($course->id) ) { 86 print("<p style='font-size: smaller; color: #aaa; text-align: center;'><a style='color: #666;text-decoration:underline' href='".WWMOODLE_SET_WEBWORK_URL."/$course->shortname/instructor' target='_webwork_edit'>".get_string("goToWeBWorK", "wwmoodle")."</a></p>"); 87 } 88 /// Finish the page 89 90 print_footer($course); 91 92 ?>
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |