[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 5058 - (download) (as text) (annotate)
Thu Jun 28 20:09:32 2007 UTC (5 years, 10 months ago) by mleventi
File size: 3891 byte(s)
Added php4 support.

    1 <?php
    2 // $Id: index.php,v 1.4 2007-06-28 20:09:32 mleventi 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     print_header("$course->shortname: $strwwassignments", "$course->fullname", "$navigation $strwwassignments", "", "", true, "", navmenu($course));
   34 
   35 /// Get all the appropriate data
   36     if (! $wwassignments = get_all_instances_in_course("wwassignment", $course)) {
   37         notice("There are no $strwwassignments", "../../course/view.php?id=$course->id");
   38         die;
   39     }
   40 /// Print the list of instances (your module will probably extend this)
   41 
   42     $timenow = time();
   43     $strname  = get_string("name");
   44     $strweek  = get_string("week");
   45     $strtopic  = get_string("topic");
   46 
   47     $strOpenDate = get_string("openDate", "wwassignment");
   48     $strDueDate = get_string("dueDate", "wwassignment");
   49 
   50     if ($course->format == "weeks") {
   51         $table->head  = array ($strweek, $strname, $strOpenDate, $strDueDate);
   52         $table->align = array ("center", "left", "left", "left");
   53     } else if ($course->format == "topics") {
   54         $table->head  = array ($strtopic, $strname, $strOpenDate, $strDueDate);
   55         $table->align = array ("center", "left", "left", "left", "left", "left");
   56     } else {
   57         $table->head  = array ($strname, $strOpenDate, $strDueDate);
   58         $table->align = array ("left", "left", "left", "left", "left");
   59     }
   60     $webworkclient =& new webwork_client();
   61     $webworkcourse = _wwassignment_mapped_course($COURSE->id,false);
   62     foreach ($wwassignments as $wwassignment) {
   63         // grab specific info for this set:
   64         if(isset($wwassignment)) {
   65             //var_dump($wwassignment);
   66             $wwassignmentsetinfo = $webworkclient->get_assignment_data($webworkcourse,$wwassignment->webwork_set,false);
   67             if (!$wwassignment->visible) {
   68                 //Show dimmed if the mod is hidden
   69                 $link = "<a class=\"dimmed\" href=\"view.php?id=$wwassignment->coursemodule\">$wwassignmentsetinfo->name</a>";
   70             } else {
   71                 //Show normal if the mod is visible
   72                 $setinfoname=$wwassignmentsetinfo['name'];
   73                 $link = "<a href=\"view.php?id=$wwassignment->coursemodule\">$setinfoname</a>";
   74             }
   75             if ($course->format == "weeks" or $course->format == "topics") {
   76                 $table->data[] = array ($wwassignment->section, $link, strftime("%c", $wwassignmentsetinfo['open_date']), strftime("%c", $wwassignmentsetinfo['due_date']));
   77             } else {
   78                 $table->data[] = array ($link, strftime("%c", $wwassignmentsetinfo->open_date), strftime("%c", $wwassignmentsetinfo->due_date));
   79             }
   80         }
   81     }
   82 
   83     echo "<br />";
   84 
   85     print_table($table);
   86     if( isteacher($course->id) ) {
   87         print("<p style='font-size: smaller; color: #aaa; text-align: center;'><a style='color: #666;text-decoration:underline' href='".WWASSIGNMENT_WEBWORK_URL."/$course->shortname/instructor' target='_webwork_edit'>".get_string("goToWeBWorK", "wwassignment")."</a></p>");
   88     }
   89 /// Finish the page
   90     print_footer($course);
   91 
   92 ?>

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9