[Logicampus-cvs] logicampus/src/logicreate/services/lobrepo exam.lcp, 1.1, 1.2
Brought to you by:
trilexcom
From: Mark K <har...@us...> - 2007-10-05 22:38:01
|
Update of /cvsroot/logicampus/logicampus/src/logicreate/services/lobrepo In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9236/services/lobrepo Modified Files: exam.lcp Log Message: Fixes to copy a test down to your classroom and see it in the classroom viewer. Index: exam.lcp =================================================================== RCS file: /cvsroot/logicampus/logicampus/src/logicreate/services/lobrepo/exam.lcp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** exam.lcp 5 Oct 2007 21:35:48 -0000 1.1 --- exam.lcp 5 Oct 2007 22:37:38 -0000 1.2 *************** *** 64,67 **** --- 64,68 ---- $t['qidx'] = -1; } + $t['q'] = $t['questionObj']; //debug($test,1); *************** *** 89,93 **** $u->sessionvars['test_obj']->setQuestion($qidx,$lc->postvars['questionText'], $type); foreach ($lc->postvars['labels'] as $lidx => $label) { ! $isCorrect = $lc->postvars['correct'] === $lidx; if (!$u->sessionvars['test_obj']->addLabel($label, $isCorrect, $qidx)) { die('failed label. label = '.$label); --- 90,95 ---- $u->sessionvars['test_obj']->setQuestion($qidx,$lc->postvars['questionText'], $type); foreach ($lc->postvars['labels'] as $lidx => $label) { ! if ($label == '') { continue; } ! $isCorrect = $lc->postvars['correct'] == $lidx; if (!$u->sessionvars['test_obj']->addLabel($label, $isCorrect, $qidx)) { die('failed label. label = '.$label); *************** *** 95,99 **** } - $this->presentor = 'redirectPresentation'; $t['url'] = appurl('lobrepo/exam/'); --- 97,100 ---- *************** *** 114,117 **** --- 115,137 ---- } + + /** + * Commit the test in the session to the database + */ + function saveTestRun(&$db, &$u, &$lc, &$t) { + // debug($u->sessionvars['test_obj'],1); + $u->sessionvars['test_obj']->save(); + + $lobUserObj = new LobUserLink(); + $lobUserObj->set('lobRepoEntryId',$u->sessionvars['test_obj']->repoObj->getPrimaryKey()); + $lobUserObj->set('userId',$u->userId); + $lobUserObj->set('lobKind','content'); + $lobUserObj->save(); + + unset($u->sessionvars['test_obj']); + + $this->presentor = 'redirectPresentation'; + $t['url'] = appurl('lobrepo/myobj/'); + } } |