[system] / trunk / wwmoodle / wwassignment / index.php Repository:
ViewVC logotype

View of /trunk/wwmoodle/wwassignment/index.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4175 - (download) (as text) (annotate)
Tue Jun 27 20:08:02 2006 UTC (13 years, 7 months ago) by gage
File size: 3533 byte(s)
Adding more files for wwassignment

    1 <?php
    2 // $Id: index.php,v 1.1 2006-06-27 20:08:02 gage Exp $
    3 
    4 
    5 /// This page lists all the instances of wwassignment in a particular course
    6 /// Replace wwassignment 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, "wwassignment", "view all", "index.php?id=$course->id", "");
   20 
   21 
   22 /// Get all required strings
   23 
   24     $strwwassignments = get_string("modulenameplural", "wwassignment");
   25     $strwwassignment  = get_string("modulename", "wwassignment");
   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: $strwwassignments", "$course->fullname", "$navigation $strwwassignments", "", "", true, "", navmenu($course));
   35 
   36 /// Get all the appropriate data
   37 
   38     if (! $wwassignments = get_all_instances_in_course("wwassignment", $course)) {
   39         notice("There are no $strwwassignments", "../../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", "wwassignment");
   51     $strDueDate = get_string("dueDate", "wwassignment");
   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 ($wwassignments as $wwassignment) {
   65         // grab specific info for this set:
   66         $aSetInfo = _wwrpc_getSetInfo($wwassignment->set_id, wwassignment_courseIdToShortName($course->id));
   67         if (!$wwassignment->visible) {
   68             //Show dimmed if the mod is hidden
   69             $link = "<a class=\"dimmed\" href=\"view.php?id=$wwassignment->coursemodule\">$wwassignment->name</a>";
   70         } else {
   71             //Show normal if the mod is visible
   72             $link = "<a href=\"view.php?id=$wwassignment->coursemodule\">$wwassignment->name</a>";
   73         }
   74 
   75         if ($course->format == "weeks" or $course->format == "topics") {
   76             $table->data[] = array ($wwassignment->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