[system] / trunk / wwmoodle / Moodle / wwmoodleset / lib.php Repository:
ViewVC logotype

Diff of /trunk/wwmoodle/Moodle/wwmoodleset/lib.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 4150 Revision 4151
1<?php 1<?php
2// $Id: lib.php,v 1.2 2006-06-24 01:47:01 sh002i Exp $ 2// $Id: lib.php,v 1.3 2006-06-24 13:57:05 gage Exp $
3//require_once("DB.php"); 3//require_once("DB.php");
4function debug_log($obj) { 4function debug_log($obj) {
5 $fh = fopen("/home/gage/moodle_debug", "w"); 5 $fh = fopen("/home/gage/moodle_debug", "w");
6 //fwrite($fh, "wwmoodle\n"); 6 //fwrite($fh, "wwmoodle\n");
7 $struct = print_r($obj, true); 7 $struct = print_r($obj, true);
68 * Essentially, this is just the number of problems in the set. 68 * Essentially, this is just the number of problems in the set.
69 * @param int $iSetId The id of the set. 69 * @param int $iSetId The id of the set.
70 * @param string $sCourseName The name of this course. 70 * @param string $sCourseName The name of this course.
71 * @return int 71 * @return int
72 */ 72 */
73function wwmoodleset_getMaxSetGrade($iSetId, $sCourseName) { 73function _wwrpc_getMaxSetGrade($iSetId, $sCourseName) {
74 global $db, $CFG; 74 global $db, $CFG;
75 if (!$res = $db->Execute($sql)) { 75 if (!$res = $db->Execute($sql)) {
76 if (isset($CFG->debug) and $CFG->debug > 7) { 76 if (isset($CFG->debug) and $CFG->debug > 7) {
77 notify($db->ErrorMsg() .'<br /><br />'. $sql); 77 notify($db->ErrorMsg() .'<br /><br />'. $sql);
78 } 78 }
155 * Gets information about the specified set. 155 * Gets information about the specified set.
156 * @param int $iSetId The id of the set. 156 * @param int $iSetId The id of the set.
157 * @param $sCourseName The name of this course 157 * @param $sCourseName The name of this course
158 * @return array Information about the set. 158 * @return array Information about the set.
159 */ 159 */
160function wwmoodleset_getSetInfo($iSetId, $sCourseName) { 160function _wwrpc_getSetInfo($iSetId, $sCourseName) {
161 global $db, $CFG; 161 global $db, $CFG;
162 $qry = "SELECT * FROM ". WW_TABLE_PREFIX.".{$sCourseName}_set WHERE set_id=?"; 162 $qry = "SELECT * FROM ". WW_TABLE_PREFIX.".{$sCourseName}_set WHERE set_id=?";
163 //error_log("get info for set $iSetID and $sCourseName"); 163 //error_log("get info for set $iSetID and $sCourseName");
164 if (!$res = $db->query($qry, array($iSetId))) { 164 if (!$res = $db->query($qry, array($iSetId))) {
165 if (isset($CFG->debug) and $CFG->debug > 7) { 165 if (isset($CFG->debug) and $CFG->debug > 7) {
240/// (defined by the form in mod.html) this function 240/// (defined by the form in mod.html) this function
241/// will create a new instance and return the id number 241/// will create a new instance and return the id number
242/// of the new instance. 242/// of the new instance.
243 243
244 244
245 $aSetInfo = wwmoodleset_getSetInfo($wwmoodleset->set_id, wwmoodleset_courseIdToShortName($wwmoodleset->course)); 245 $aSetInfo = _wwrpc_getSetInfo($wwmoodleset->set_id, wwmoodleset_courseIdToShortName($wwmoodleset->course));
246 246
247 $wwmoodleset->timemodified = time(); 247 $wwmoodleset->timemodified = time();
248 $wwmoodleset->id = $wwmoodleset->instance; 248 $wwmoodleset->id = $wwmoodleset->instance;
249 $wwmoodleset->timedue = $aSetInfo['due_date']; 249 $wwmoodleset->timedue = $aSetInfo['due_date'];
250 $wwmoodleset->timeavailable = $aSetInfo['open_date']; 250 $wwmoodleset->timeavailable = $aSetInfo['open_date'];
274 274
275function wwmoodleset_update_instance($wwmoodleset) { 275function wwmoodleset_update_instance($wwmoodleset) {
276/// Given an object containing all the necessary data, 276/// Given an object containing all the necessary data,
277/// (defined by the form in mod.html) this function 277/// (defined by the form in mod.html) this function
278/// will update an existing instance with new data. 278/// will update an existing instance with new data.
279 $aSetInfo = wwmoodleset_getSetInfo($wwmoodleset->set_id, wwmoodleset_courseIdToShortName($wwmoodleset->course)); 279 $aSetInfo = _wwrpc_getSetInfo($wwmoodleset->set_id, wwmoodleset_courseIdToShortName($wwmoodleset->course));
280 280
281 $wwmoodleset->timemodified = time(); 281 $wwmoodleset->timemodified = time();
282 $wwmoodleset->id = $wwmoodleset->instance; 282 $wwmoodleset->id = $wwmoodleset->instance;
283 $wwmoodleset->timedue = $aSetInfo['due_date']; 283 $wwmoodleset->timedue = $aSetInfo['due_date'];
284 $wwmoodleset->timeavailable = $aSetInfo['open_date']; 284 $wwmoodleset->timeavailable = $aSetInfo['open_date'];
436 foreach( $aProblems as $p ) { 436 foreach( $aProblems as $p ) {
437 eval($gradeFormula); 437 eval($gradeFormula);
438 } 438 }
439 $oGrades->grades[$s->id] = $fGrade; 439 $oGrades->grades[$s->id] = $fGrade;
440 } 440 }
441 $oGrades->maxgrade = wwmoodleset_getMaxSetGrade($oMod->set_id, $sCourseName); 441 $oGrades->maxgrade = _wwrpc_getMaxSetGrade($oMod->set_id, $sCourseName);
442 return $oGrades; 442 return $oGrades;
443} 443}
444 444
445function wwmoodleset_get_participants($wwmoodlesetid) { 445function wwmoodleset_get_participants($wwmoodlesetid) {
446//Must return an array of user records (all data) who are participants 446//Must return an array of user records (all data) who are participants

Legend:
Removed from v.4150  
changed lines
  Added in v.4151

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9