From: Mike G. v. a. <we...@ma...> - 2009-09-20 22:18:19
|
Log Message: ----------- Major changes are in index.php which adds a column with the total number of points for the homework set. locallib.php which correctly calculates the points (using the actual weight assigned to the problem) rather than just counting the number of problems. the rest are minor changes and updates Modified Files: -------------- wwmoodle/wwassignment4/moodle/mod/wwassignment: index.php lib.php locallib.php view.php wwmoodle/wwassignment4/moodle/mod/wwassignment/db: upgrade.php wwmoodle/wwassignment4/moodle/mod/wwassignment/lang/en_utf8: wwassignment.php Revision Data ------------- Index: upgrade.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwassignment4/moodle/mod/wwassignment/db/upgrade.php,v retrieving revision 1.6 retrieving revision 1.7 diff -Lwwassignment4/moodle/mod/wwassignment/db/upgrade.php -Lwwassignment4/moodle/mod/wwassignment/db/upgrade.php -u -r1.6 -r1.7 --- wwassignment4/moodle/mod/wwassignment/db/upgrade.php +++ wwassignment4/moodle/mod/wwassignment/db/upgrade.php @@ -15,7 +15,7 @@ // will tell you what you need to do. // // The commands in here will all be database-neutral, -// using the functions defined in lib/ddllib.php +// using the functions defined in lib/ddllib.ph function xmldb_wwassignment_upgrade($oldversion=0) { @@ -33,7 +33,6 @@ /// } //===== 1.9.0 upgrade line ======// - notify("running 1.9 upgrade"); if ($result && $oldversion < 2008092818) { @@ -42,8 +41,6 @@ $table = new XMLDBTable('wwassignment'); $field = new XMLDBField('grade'); $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'webwork_set'); - // can't do this until you are connected to webwork -- which you won't be on initial upgrades - // add this either to wwlink block or to configuration /// Launch add field grade Index: index.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwassignment4/moodle/mod/wwassignment/index.php,v retrieving revision 1.1 retrieving revision 1.2 diff -Lwwassignment4/moodle/mod/wwassignment/index.php -Lwwassignment4/moodle/mod/wwassignment/index.php -u -r1.1 -r1.2 --- wwassignment4/moodle/mod/wwassignment/index.php +++ wwassignment4/moodle/mod/wwassignment/index.php @@ -42,9 +42,12 @@ $strdescription = get_string('description'); $stropendate = get_string("open_date", "wwassignment"); $strduedate = get_string("due_date", "wwassignment"); +$strtotalpoints = get_string("total_points","wwassignment"); + + if ($course->format == "weeks") { - $table->head = array ($strweek, $strname,$strdescription, $stropendate, $strduedate); + $table->head = array ($strweek, $strname,$strdescription, $stropendate, $strduedate, $strtotalpoints); $table->align = array ("center", "left", "left", "left", "left"); } else if ($course->format == "topics") { $table->head = array ($strtopic, $strname,$strdescription, $stropendate, $strduedate); @@ -71,7 +74,8 @@ $link = "<a href=\"view.php?id=$wwassignment->coursemodule\">$wwassignment->name</a>"; } if ($course->format == "weeks" or $course->format == "topics") { - $table->data[] = array ($wwassignment->section, $link, $wwassignment->description, strftime("%c", $wwsetinfo['open_date']), strftime("%c", $wwsetinfo['due_date'])); + $totalpoints = $wwclient->get_max_grade($wwcoursename, $wwsetname,false); + $table->data[] = array ($wwassignment->section, $link, $wwassignment->description, strftime("%c", $wwsetinfo['open_date']), strftime("%c", $wwsetinfo['due_date']), $totalpoints); } else { $table->data[] = array ($link, $wwassignment->description, strftime("%c", $wwsetinfo['open_date']), strftime("%c", $wwsetinfo['due_date'])); } Index: view.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwassignment4/moodle/mod/wwassignment/view.php,v retrieving revision 1.1 retrieving revision 1.2 diff -Lwwassignment4/moodle/mod/wwassignment/view.php -Lwwassignment4/moodle/mod/wwassignment/view.php -u -r1.1 -r1.2 --- wwassignment4/moodle/mod/wwassignment/view.php +++ wwassignment4/moodle/mod/wwassignment/view.php @@ -35,8 +35,9 @@ //catch the guests global $USER; -if($USER->username == 'guest') { - print_error('Guests cannot view WeBWorK Problem Sets'); +if($USER->username == 'guest') { # this allows guests to view webwork (signed in as user guest) + #FIXME -- replace this with a method that uses the automatic guest sign in on webwork. + // print_error('Guests cannot view WeBWorK Problem Sets'); } //force login @@ -50,6 +51,7 @@ $wwsetname = $wwassignment->webwork_set; _wwassignment_mapcreate_user($wwcoursename,$wwusername); _wwassignment_mapcreate_user_set($wwcoursename,$wwusername,$wwsetname); + $wwkey = _wwassignment_login_user($wwcoursename,$wwusername); $wwsetlink = _wwassignment_link_to_set_auto_login($wwcoursename,$wwsetname,$wwusername,$wwkey); Index: lib.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwassignment4/moodle/mod/wwassignment/lib.php,v retrieving revision 1.6 retrieving revision 1.7 diff -Lwwassignment4/moodle/mod/wwassignment/lib.php -Lwwassignment4/moodle/mod/wwassignment/lib.php -u -r1.6 -r1.7 --- wwassignment4/moodle/mod/wwassignment/lib.php +++ wwassignment4/moodle/mod/wwassignment/lib.php @@ -55,7 +55,7 @@ debugLog("Begin wwassignment_add_instance"); debugLog("input wwassignment "); - //debugLot( print_r($wwassignment, true) ); + //debugLog( print_r($wwassignment, true) ); //Get data about the set from WebWorK $wwclient = new wwassignment_client(); @@ -66,8 +66,8 @@ //Attaching Moodle Set to WeBWorK Set - //debugLog("saving wwassignment "); - //debugLog( print_r($wwassignment,true)); + debugLog("saving wwassignment "); + debugLog( print_r($wwassignment,true)); $wwassignment->timemodified = time(); if ($returnid = insert_record("wwassignment", $wwassignment)) { @@ -75,7 +75,7 @@ //Creating events _wwassignment_create_events($wwsetname,$wwassignment->id,$wwsetdata['open_date'],$wwsetdata['due_date']); - + debugLog("notify gradebook"); //notify gradebook wwassignment_grade_item_update($wwassignment); } Index: locallib.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwassignment4/moodle/mod/wwassignment/locallib.php,v retrieving revision 1.10 retrieving revision 1.11 diff -Lwwassignment4/moodle/mod/wwassignment/locallib.php -Lwwassignment4/moodle/mod/wwassignment/locallib.php -u -r1.10 -r1.11 --- wwassignment4/moodle/mod/wwassignment/locallib.php +++ wwassignment4/moodle/mod/wwassignment/locallib.php @@ -469,10 +469,27 @@ * @return integer The max grade on success or -1 on failure. */ //FIXME -- this assumes each problem gets 1 point which is false +// function get_max_grade($webworkcourse,$webworkset,$silent = true) { +// $record = $this->handler('list_global_problems',array('courseName' => $webworkcourse,'setID' => $webworkset)); +// if(isset($record)) { +// return count($record); +// } +// if(!$silent) { +// print_error('webwork_set_map_failure','wwassignment'); +// } +// return -1; +// +// } + function get_max_grade($webworkcourse,$webworkset,$silent = true) { - $record = $this->handler('list_global_problems',array('courseName' => $webworkcourse,'setID' => $webworkset)); + $record = $this->handler('get_all_global_problems',array('courseName' => $webworkcourse,'setID' => $webworkset)); + $totalpoints =0; if(isset($record)) { - return count($record); + foreach ($record as $set) { + $totalpoints = $totalpoints + $set[value]; + + } + return $totalpoints; } if(!$silent) { print_error('webwork_set_map_failure','wwassignment'); Index: wwassignment.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwassignment4/moodle/mod/wwassignment/lang/en_utf8/wwassignment.php,v retrieving revision 1.1 retrieving revision 1.2 diff -Lwwassignment4/moodle/mod/wwassignment/lang/en_utf8/wwassignment.php -Lwwassignment4/moodle/mod/wwassignment/lang/en_utf8/wwassignment.php -u -r1.1 -r1.2 --- wwassignment4/moodle/mod/wwassignment/lang/en_utf8/wwassignment.php +++ wwassignment4/moodle/mod/wwassignment/lang/en_utf8/wwassignment.php @@ -10,6 +10,7 @@ //index list $string['open_date'] = "Opened"; $string['due_date'] = "Due"; +$string['total_points'] = "Total points"; //viewing page $string['go_to_webwork'] = "Administer the WeBWorK portion of this course."; |