[Logicampus-cvs] logicampus/src/logicreate/lib _classAssignmentObj.php, 1.3, 1.4 Assessment.php, 1.
Brought to you by:
trilexcom
From: Mark K <har...@us...> - 2008-04-13 18:56:05
|
Update of /cvsroot/logicampus/logicampus/src/logicreate/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25977/lib Modified Files: _classAssignmentObj.php Assessment.php Log Message: Style fixes. Index: _classAssignmentObj.php =================================================================== RCS file: /cvsroot/logicampus/logicampus/src/logicreate/lib/_classAssignmentObj.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** _classAssignmentObj.php 8 Oct 2007 14:35:29 -0000 1.3 --- _classAssignmentObj.php 13 Apr 2008 18:55:58 -0000 1.4 *************** *** 39,43 **** $temp = new classAssignmentObj(); $temp->_dsn = $dsn; ! $temp->__loaded = true; $temp->id_class_assignments = $db->record['id_class_assignments']; $temp->title = $db->record['title']; --- 39,43 ---- $temp = new classAssignmentObj(); $temp->_dsn = $dsn; ! $temp->__loaded = TRUE; $temp->id_class_assignments = $db->record['id_class_assignments']; $temp->title = $db->record['title']; *************** *** 66,70 **** $temp = new classAssignmentObj(); $temp->_dsn = $dsn; ! $temp->__loaded = true; $temp->id_class_assignments = $db->record['id_class_assignments']; $temp->title = $db->record['title']; --- 66,70 ---- $temp = new classAssignmentObj(); $temp->_dsn = $dsn; ! $temp->__loaded = TRUE; $temp->id_class_assignments = $db->record['id_class_assignments']; $temp->title = $db->record['title']; *************** *** 86,90 **** ! function _loadArray($array, $pkeyFlag=false) { if ($pkeyFlag) { $this->id_class_assignments = $array['id_class_assignments']; --- 86,90 ---- ! function _loadArray($array, $pkeyFlag=FALSE) { if ($pkeyFlag) { $this->id_class_assignments = $array['id_class_assignments']; *************** *** 103,107 **** function _genPkey($len=50) { ! return str_replace(".","",uniqid(str_replace(" ","",microtime()), $len)); } --- 103,107 ---- function _genPkey($len=50) { ! return str_replace(".", "", uniqid(str_replace(" ", "", microtime()), $len)); } Index: Assessment.php =================================================================== RCS file: /cvsroot/logicampus/logicampus/src/logicreate/lib/Assessment.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Assessment.php 8 Nov 2007 17:08:04 -0000 1.9 --- Assessment.php 13 Apr 2008 18:55:58 -0000 1.10 *************** *** 3,7 **** class AssessmentBase { ! var $_new = true; //not pulled from DB var $_modified; //set() called var $_version = '1.6'; //PBDO version number --- 3,7 ---- class AssessmentBase { ! var $_new = TRUE; //not pulled from DB var $_modified; //set() called var $_version = '1.6'; //PBDO version number *************** *** 62,82 **** function save($dsn="default") { if ( $this->isNew() ) { ! $this->setPrimaryKey(AssessmentPeer::doInsert($this,$dsn)); } else { ! AssessmentPeer::doUpdate($this,$dsn); } } ! function load($key,$dsn="default") { if (is_array($key) ) { ! while (list ($k,$v) = @each($key) ) { $where .= "$k='$v' and "; } ! $where = substr($where,0,-5); } else { $where = "assessment_id='".$key."'"; } ! $array = AssessmentPeer::doSelect($where,$dsn); return $array[0]; } --- 62,82 ---- function save($dsn="default") { if ( $this->isNew() ) { ! $this->setPrimaryKey(AssessmentPeer::doInsert($this, $dsn)); } else { ! AssessmentPeer::doUpdate($this, $dsn); } } ! function load($key, $dsn="default") { if (is_array($key) ) { ! while (list ($k, $v) = @each($key) ) { $where .= "$k='$v' and "; } ! $where = substr($where, 0, -5); } else { $where = "assessment_id='".$key."'"; } ! $array = AssessmentPeer::doSelect($where, $dsn); return $array[0]; } *************** *** 84,94 **** function loadAll($dsn="default") { ! $array = AssessmentPeer::doSelect('',$dsn); return $array; } ! function delete($deep=false,$dsn="default") { ! AssessmentPeer::doDelete($this,$deep,$dsn); } --- 84,94 ---- function loadAll($dsn="default") { ! $array = AssessmentPeer::doSelect('', $dsn); return $array; } ! function delete($deep=FALSE, $dsn="default") { ! AssessmentPeer::doDelete($this, $deep, $dsn); } *************** *** 112,125 **** /** * only sets if the new value is !== the current value ! * returns true if the value was updated ! * also, sets _modified to true on success */ ! function set($key,$val) { if ($this->{$key} !== $val) { ! $this->_modified = true; $this->{$key} = $val; ! return true; } ! return false; } --- 112,125 ---- /** * only sets if the new value is !== the current value ! * returns TRUE if the value was updated ! * also, sets _modified to TRUE on success */ ! function set($key, $val) { if ($this->{$key} !== $val) { ! $this->_modified = TRUE; $this->{$key} = $val; ! return TRUE; } ! return FALSE; } *************** *** 131,138 **** var $tableName = 'assessment'; ! function doSelect($where,$dsn="default") { //use this tableName $db = DB::getHandle($dsn); ! $st = new PBDO_SelectStatement("assessment",$where); $st->fields['assessment_id'] = 'assessment_id'; $st->fields['display_name'] = 'display_name'; --- 131,138 ---- var $tableName = 'assessment'; ! function doSelect($where, $dsn="default") { //use this tableName $db = DB::getHandle($dsn); ! $st = new PBDO_SelectStatement("assessment", $where); $st->fields['assessment_id'] = 'assessment_id'; $st->fields['display_name'] = 'display_name'; *************** *** 158,162 **** } ! function doInsert(&$obj,$dsn="default") { //use this tableName $db = DB::getHandle($dsn); --- 158,162 ---- } ! function doInsert(&$obj, $dsn="default") { //use this tableName $db = DB::getHandle($dsn); *************** *** 190,195 **** $db->executeQuery($st); ! $obj->_new = false; ! $obj->_modified = false; $id = $db->getInsertID(); return $id; --- 190,195 ---- $db->executeQuery($st); ! $obj->_new = FALSE; ! $obj->_modified = FALSE; $id = $db->getInsertID(); return $id; *************** *** 197,201 **** } ! function doUpdate(&$obj,$dsn="default") { //use this tableName $db = DB::getHandle($dsn); --- 197,201 ---- } ! function doUpdate(&$obj, $dsn="default") { //use this tableName $db = DB::getHandle($dsn); *************** *** 228,236 **** $st->key = 'assessment_id'; $db->executeQuery($st); ! $obj->_modified = false; } ! function doReplace($obj,$dsn="default") { //use this tableName $db = DB::getHandle($dsn); --- 228,236 ---- $st->key = 'assessment_id'; $db->executeQuery($st); ! $obj->_modified = FALSE; } ! function doReplace($obj, $dsn="default") { //use this tableName $db = DB::getHandle($dsn); *************** *** 246,253 **** * remove an object */ ! function doDelete(&$obj,$deep=false,$dsn="default") { //use this tableName $db = DB::getHandle($dsn); ! $st = new PBDO_DeleteStatement("assessment","assessment_id = '".$obj->getPrimaryKey()."'"); $db->executeQuery($st); --- 246,253 ---- * remove an object */ ! function doDelete(&$obj, $deep=FALSE, $dsn="default") { //use this tableName $db = DB::getHandle($dsn); ! $st = new PBDO_DeleteStatement("assessment", "assessment_id = '".$obj->getPrimaryKey()."'"); $db->executeQuery($st); *************** *** 257,262 **** } ! $obj->_new = false; ! $obj->_modified = false; $id = $db->getInsertID(); return $id; --- 257,262 ---- } ! $obj->_new = FALSE; ! $obj->_modified = FALSE; $id = $db->getInsertID(); return $id; *************** *** 269,273 **** * send a raw query */ ! function doQuery(&$sql,$dsn="default") { //use this tableName $db = DB::getHandle($dsn); --- 269,273 ---- * send a raw query */ ! function doQuery(&$sql, $dsn="default") { //use this tableName $db = DB::getHandle($dsn); *************** *** 296,300 **** $x->possiblePoints = $row['possible_points']; ! $x->_new = false; return $x; } --- 296,300 ---- $x->possiblePoints = $row['possible_points']; ! $x->_new = FALSE; return $x; } *************** *** 323,330 **** var $idClassGradebookEntries= ''; ! function load($id,$class_id) { ! if ( $class_id == '' ) { trigger_error('load with empty class id'); return false; } $array = AssessmentPeer::doSelect("class_id = $class_id and assessment_id = $id"); ! if (!is_array($array) ) { trigger_error('No permission to load assessment '.$id); return false; } return $array[0]; } --- 323,330 ---- var $idClassGradebookEntries= ''; ! function load($id, $class_id) { ! if ( $class_id == '' ) { trigger_error('load with empty class id'); return FALSE; } $array = AssessmentPeer::doSelect("class_id = $class_id and assessment_id = $id"); ! if (!is_array($array) ) { trigger_error('No permission to load assessment '.$id); return FALSE; } return $array[0]; } *************** *** 333,337 **** function loadAll($class_id) { ! if ( $class_id == '' ) { trigger_error('Peer doSelect with empty key'); return false; } $array = AssessmentPeer::doSelect("class_id = $class_id"); return $array; --- 333,337 ---- function loadAll($class_id) { ! if ( $class_id == '' ) { trigger_error('Peer doSelect with empty key'); return FALSE; } $array = AssessmentPeer::doSelect("class_id = $class_id"); return $array; *************** *** 339,344 **** } ! # boolean returns true if student can take the ! # test, false if they cannot # pass in the time stamp of when the user started taking the test # ($u->sessionvars['asmt_start_date'] for example --- 339,344 ---- } ! # boolean returns TRUE if student can take the ! # test, FALSE if they cannot # pass in the time stamp of when the user started taking the test # ($u->sessionvars['asmt_start_date'] for example *************** *** 365,369 **** $array = AssessmentQuestionPeer::doSelect('assessment_id = \''.$this->getPrimaryKey().'\' order by question_sort'); ! $cc = count ($array); for($x=0; $x<$cc; ++$x) { --- 365,369 ---- $array = AssessmentQuestionPeer::doSelect('assessment_id = \''.$this->getPrimaryKey().'\' order by question_sort'); ! $cc = count($array); for($x=0; $x<$cc; ++$x) { *************** *** 372,376 **** switch($superObj->questionType) { case QUESTION_TRUEFALSE: ! $subObj = new AssessmentQuestionTrueFalse(); break; case QUESTION_MCHOICE: --- 372,376 ---- switch($superObj->questionType) { case QUESTION_TRUEFALSE: ! $subObj = new AssessmentQuestionTRUEFalse(); break; case QUESTION_MCHOICE: *************** *** 394,402 **** if( $superObj->assessmentQuestionId ) ! $subObj->_new = false; else ! $subObj->_new = true; ! $subObj->_modified = false; $subObj->assessmentQuestionId = $superObj->assessmentQuestionId; $subObj->assessmentId = $superObj->assessmentId; --- 394,402 ---- if( $superObj->assessmentQuestionId ) ! $subObj->_new = FALSE; else ! $subObj->_new = TRUE; ! $subObj->_modified = FALSE; $subObj->assessmentQuestionId = $superObj->assessmentQuestionId; $subObj->assessmentId = $superObj->assessmentId; *************** *** 493,497 **** $questions = $this->getAssessmentQuestions(); $answers = AssessmentAnswerPeer::doSelect("assessment_id='".$this->assessmentId."' AND student_id='".$studentId."' AND id_classes='".$id_classes."'"); ! #debug($answers,1); $this->questionCount = count($questions); $answerCount = count($answers); --- 493,497 ---- $questions = $this->getAssessmentQuestions(); $answers = AssessmentAnswerPeer::doSelect("assessment_id='".$this->assessmentId."' AND student_id='".$studentId."' AND id_classes='".$id_classes."'"); ! #debug($answers, 1); $this->questionCount = count($questions); $answerCount = count($answers); *************** *** 503,507 **** #$questions[$i]->grade($answers[$x]); $questions[$i]->answer = $answers[$x]; ! # debug($questions[$i],1); if ($questions[$i]->questionType == QUESTION_MATCHING || $questions[$i]->questionType == QUESTION_MANSWER) { --- 503,507 ---- #$questions[$i]->grade($answers[$x]); $questions[$i]->answer = $answers[$x]; ! # debug($questions[$i], 1); if ($questions[$i]->questionType == QUESTION_MATCHING || $questions[$i]->questionType == QUESTION_MANSWER) { |