ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilSoapTestAdministration.php
Go to the documentation of this file.
1<?php
2 /*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22 */
23
24
33include_once './webservice/soap/classes/class.ilSoapAdministration.php';
34
36{
37 private function hasWritePermissionForTest($active_id)
38 {
39 global $DIC;
40
41 $ilDB = $DIC['ilDB'];
42 global $DIC;
43
44 $ilAccess = $DIC['ilAccess'];
45
46 $permission_ok = false;
47 $result = $ilDB->queryF(
48 "SELECT tst_tests.obj_fi FROM tst_active, tst_tests WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
49 array('integer'),
50 array($active_id)
51 );
52 $row = $ilDB->fetchAssoc($result);
53 if ($row['obj_fi']) {
54 $obj_id = $row['obj_fi'];
55 foreach ($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id) {
56 if ($ilAccess->checkAccess("write", "", $ref_id)) {
57 $permission_ok = true;
58 break;
59 }
60 }
61 }
62 return $permission_ok;
63 }
64
65 public function isAllowedCall($sid, $active_id, $saveaction = true)
66 {
67 global $DIC;
68
69 $ilDB = $DIC['ilDB'];
70 global $DIC;
71
72 $ilUser = $DIC['ilUser'];
73
74 if ($this->hasWritePermissionForTest($active_id)) {
75 return true;
76 }
77
78 if ($saveaction) {
79 $result = $ilDB->queryF(
80 "SELECT * FROM tst_times WHERE active_fi = %s ORDER BY started DESC",
81 array('integer'),
82 array($active_id)
83 );
84 if ($result->numRows()) {
85 $row = $ilDB->fetchAssoc($result);
86 if (preg_match("/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/", $row["started"], $matches)) {
87 $time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
88 $now = time();
89 $diff = $now - $time;
90 $client = explode("::", $sid);
91 global $DIC;
92
93 $ilClientIniFile = $DIC['ilClientIniFile'];
94 $expires = $ilClientIniFile->readVariable('session', 'expire');
95 if ($diff <= $expires) {
96 return true;
97 } else {
98 return false;
99 }
100 } else {
101 return false;
102 }
103 } else {
104 return false;
105 }
106 } else {
107 $result = $ilDB->queryF(
108 "SELECT user_fi FROM tst_active WHERE active_id = %s",
109 array('integer'),
110 array($active_id)
111 );
112 $row = $ilDB->fetchAssoc($result);
113 if ($row['user_fi'] == $ilUser->getId()) {
114 return true;
115 } else {
116 return false;
117 }
118 }
119 }
120
121 public function saveQuestion($sid, $active_id, $question_id, $pass, $solution)
122 {
123 $this->initAuth($sid);
124 $this->initIlias();
125
126 if (!$this->__checkSession($sid)) {
127 return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
128 }
129 if (!$this->isAllowedCall($sid, $active_id)) {
130 return $this->__raiseError("The required user information is only available for active users.", "");
131 }
132
133 if (is_array($solution) && (array_key_exists("item", $solution))) {
134 $solution = $solution["item"];
135 }
136
137 global $DIC;
138
139 $ilDB = $DIC['ilDB'];
140 $ilUser = $DIC['ilUser'];
141
142 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
143 $processLockerFactory = new ilAssQuestionProcessLockerFactory(new ilSetting('assessment'), $ilDB);
144 $processLockerFactory->setQuestionId($question_id);
145 $processLockerFactory->setUserId($ilUser->getId());
146 include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
147 $processLockerFactory->setAssessmentLogEnabled(ilObjAssessmentFolder::_enabledAssessmentLogging());
148 $processLocker = $processLockerFactory->getLocker();
149
150 $totalrows = 0;
151
152 $processLocker->executePersistWorkingStateLockOperation(function () use (&$totalrows, $processLocker, $active_id, $question_id, $pass, $solution) {
153 $processLocker->executeUserSolutionUpdateLockOperation(function () use (&$totalrows, $active_id, $question_id, $pass, $solution) {
154 $ilDB = $GLOBALS['DIC']['ilDB'];
155 if (($active_id > 0) && ($question_id > 0) && (strlen($pass) > 0)) {
156 $affectedRows = $ilDB->manipulateF(
157 "DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
158 array('integer', 'integer', 'integer'),
159 array($active_id, $question_id, $pass)
160 );
161 }
162 for ($i = 0; $i < count($solution); $i += 3) {
163 $next_id = $ilDB->nextId('tst_solutions');
164 $affectedRows = $ilDB->insert("tst_solutions", array(
165 "solution_id" => array("integer", $next_id),
166 "active_fi" => array("integer", $active_id),
167 "question_fi" => array("integer", $question_id),
168 "value1" => array("clob", $solution[$i]),
169 "value2" => array("clob", $solution[$i+1]),
170 "points" => array("float", $solution[$i+2]),
171 "pass" => array("integer", $pass),
172 "tstamp" => array("integer", time())
173 ));
174 $totalrows += $affectedRows;
175 }
176 });
177
178 if ($totalrows != 0) {
179 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
180 $question = assQuestion::_instanciateQuestion($question_id);
181 $question->setProcessLocker($processLocker);
182 $question->calculateResultsFromSolution($active_id, $pass);
183 }
184 });
185
186 if ($totalrows == 0) {
187 return $this->__raiseError(
188 "Wrong solution data. ILIAS did not execute any database queries: Solution data: " . print_r($solution, true),
189 'No result'
190 );
191 }
192
193 return true;
194 }
195
207 public function saveQuestionSolution($sid, $active_id, $question_id, $pass, $solution)
208 {
209 $this->initAuth($sid);
210 $this->initIlias();
211
212 if (!$this->__checkSession($sid)) {
213 return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
214 }
215 if (!$this->isAllowedCall($sid, $active_id)) {
216 return $this->__raiseError("The required user information is only available for active users.", "");
217 }
218
219 $solutions = array();
220 if (preg_match("/<values>(.*?)<\/values>/is", $solution, $matches)) {
221 if (preg_match_all("/<value>(.*?)<\/value><value>(.*?)<\/value><points>(.*?)<\/points>/is", $solution, $matches, PREG_SET_ORDER)) {
222 foreach ($matches as $match) {
223 if (count($match) == 4) {
224 for ($i = 1; $i < count($match); $i++) {
225 array_push($solutions, trim($match[$i]));
226 }
227 }
228 }
229 }
230 }
231
232 if (count($solutions) == 0) {
233 return $this->__raiseError("Wrong solution data. ILIAS did not find one or more solution triplets: $solution", "");
234 }
235
236 // Include main header
237 $ilDB = $GLOBALS['DIC']['ilDB'];
238 if (($active_id > 0) && ($question_id > 0) && (strlen($pass) > 0)) {
239 $affectedRows = $ilDB->manipulateF(
240 "DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
241 array('integer', 'integer', 'integer'),
242 array($active_id, $question_id, $pass)
243 );
244 }
245 $totalrows = 0;
246 for ($i = 0; $i < count($solutions); $i += 3) {
247 $next_id = $ilDB->nextId('tst_solutions');
248 $affectedRows = $ilDB->insert("tst_solutions", array(
249 "solution_id" => array("integer", $next_id),
250 "active_fi" => array("integer", $active_id),
251 "question_fi" => array("integer", $question_id),
252 "value1" => array("clob", $solutions[$i]),
253 "value2" => array("clob", $solutions[$i+1]),
254 "points" => array("float", $solutions[$i+2]),
255 "pass" => array("integer", $pass),
256 "tstamp" => array("integer", time())
257 ));
258 $totalrows += $affectedRows;
259 }
260 if (count($totalrows) == 0) {
261 return $this->__raiseError("Wrong solution data. ILIAS did not execute any database queries");
262 } else {
263 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
264 $question = assQuestion::_instanciateQuestion($question_id);
265 $question->calculateResultsFromSolution($active_id, $pass);
266 }
267 return "TRUE";
268 }
269
280 public function getQuestionSolution($sid, $active_id, $question_id, $pass)
281 {
282 $this->initAuth($sid);
283 $this->initIlias();
284
285 if (!$this->__checkSession($sid)) {
286 return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
287 }
288 if (!$this->isAllowedCall($sid, $active_id, false)) {
289 return $this->__raiseError("The required user information is only available for active users.", "");
290 }
291 $solution = array();
292 // Include main header
293 global $DIC;
294
295 $ilDB = $DIC['ilDB'];
296
297 $use_previous_answers = 1;
298
299 $result = $ilDB->queryF(
300 "SELECT tst_tests.use_previous_answers FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
301 array('integer'),
302 array($active_id)
303 );
304 if ($result->numRows()) {
305 $row = $ilDB->fetchAssoc($result);
306 $use_previous_answers = $row["use_previous_answers"];
307 }
308 $lastpass = 0;
309 if ($use_previous_answers) {
310 $result = $ilDB->queryF(
311 "SELECT MAX(pass) maxpass FROM tst_test_result WHERE active_fi = %s AND question_fi = %s",
312 array('integer', 'integer'),
313 array($active_id, $question_id)
314 );
315 if ($result->numRows() == 1) {
316 $row = $ilDB->fetchAssoc($result);
317 $lastpass = $row["maxpass"];
318 }
319 } else {
320 $lastpass = $pass;
321 }
322
323 if (($active_id > 0) && ($question_id > 0) && (strlen($lastpass) > 0)) {
324 $result = $ilDB->queryF(
325 "SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
326 array('integer', 'integer', 'integer'),
327 array($active_id, $question_id, $lastpass)
328 );
329 if ($result->numRows()) {
330 while ($row = $ilDB->fetchAssoc($result)) {
331 array_push($solution, $row["value1"]);
332 array_push($solution, $row["value2"]);
333 array_push($solution, $row["points"]);
334 }
335 }
336 }
337 return $solution;
338 }
339
348 public function getTestUserData($sid, $active_id)
349 {
350 $this->initAuth($sid);
351 $this->initIlias();
352
353 if (!$this->__checkSession($sid)) {
354 return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
355 }
356 if (!$this->isAllowedCall($sid, $active_id, false)) {
357 if (!$this->checkActiveIdResultsAccess($active_id)) {
358 return $this->__raiseError("The required user information is only available for active users.", "");
359 }
360 }
361
362 global $DIC;
363
364 $lng = $DIC['lng'];
365 $ilDB = $DIC['ilDB'];
366
367 $result = $ilDB->queryF(
368 "SELECT user_fi, test_fi FROM tst_active WHERE active_id = %s",
369 array('integer'),
370 array($active_id)
371 );
372 $row = $ilDB->fetchAssoc($result);
373 $user_id = $row["user_fi"];
374 $test_id = $row["test_fi"];
375
376 $result = $ilDB->queryF(
377 "SELECT anonymity FROM tst_tests WHERE test_id = %s",
378 array('integer'),
379 array($test_id)
380 );
381 $row = $ilDB->fetchAssoc($result);
382 $anonymity = $row["anonymity"];
383
384 $result = $ilDB->queryF(
385 "SELECT firstname, lastname, title, login FROM usr_data WHERE usr_id = %s",
386 array('integer'),
387 array($user_id)
388 );
389
390 $userdata = array();
391 if ($result->numRows() == 0) {
392 $userdata["fullname"] = $lng->txt("deleted_user");
393 $userdata["title"] = "";
394 $userdata["firstname"] = "";
395 $userdata["lastname"] = $lng->txt("anonymous");
396 $userdata["login"] = "";
397 } else {
398 $data = $ilDB->fetchAssoc($result);
399 if (($user_id == ANONYMOUS_USER_ID) || ($anonymity)) {
400 $userdata["fullname"] = $lng->txt("anonymous");
401 $userdata["title"] = "";
402 $userdata["firstname"] = "";
403 $userdata["lastname"] = $lng->txt("anonymous");
404 $userdata["login"] = "";
405 } else {
406 $userdata["fullname"] = trim($data["title"] . " " . $data["firstname"] . " " . $data["lastname"]);
407 $userdata["title"] = $data["title"];
408 $userdata["firstname"] = $data["firstname"];
409 $userdata["lastname"] = $data["lastname"];
410 $userdata["login"] = $data["login"];
411 }
412 }
413 return array_values($userdata);
414 }
415
426 public function getPositionOfQuestion($sid, $active_id, $question_id, $pass)
427 {
428 $this->initAuth($sid);
429 $this->initIlias();
430
431 if (!$this->__checkSession($sid)) {
432 return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
433 }
434 if (!$this->isAllowedCall($sid, $active_id, false)) {
435 return $this->__raiseError("The required user information is only available for active users.", "");
436 }
437
438 global $DIC;
439
440 $lng = $DIC['lng'];
441 $ilDB = $DIC['ilDB'];
442
443 $result = $ilDB->queryF(
444 "SELECT tst_tests.random_test FROM tst_active, tst_tests WHERE tst_active.active_id = %s AND tst_tests.test_id = tst_active.test_fi",
445 array('integer'),
446 array($active_id)
447 );
448 if ($result->numRows() != 1) {
449 return -1;
450 }
451 $row = $ilDB->fetchAssoc($result);
452 $is_random = $row["random_test"];
453
454 include_once "./Modules/Test/classes/class.ilTestSequence.php";
455 $sequence = new ilTestSequence($active_id, $pass, $is_random);
456 return $sequence->getSequenceForQuestion($question_id);
457 }
458
469 public function getPreviousReachedPoints($sid, $active_id, $question_id, $pass)
470 {
471 $this->initAuth($sid);
472 $this->initIlias();
473
474 if (!$this->__checkSession($sid)) {
475 return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
476 }
477 if (!$this->isAllowedCall($sid, $active_id, false)) {
478 return $this->__raiseError("The required user information is only available for active users.", "");
479 }
480
481 global $DIC;
482
483 $lng = $DIC['lng'];
484 $ilDB = $DIC['ilDB'];
485
486 $result = $ilDB->queryF(
487 "SELECT tst_tests.random_test FROM tst_active, tst_tests WHERE tst_active.active_id = %s AND tst_tests.test_id = tst_active.test_fi",
488 array('integer'),
489 array($active_id)
490 );
491 if ($result->numRows() != 1) {
492 return -1;
493 }
494 $row = $ilDB->fetchAssoc($result);
495 $is_random = $row["random_test"];
496
497 include_once "./Modules/Test/classes/class.ilTestSequence.php";
498 $sequence = new ilTestSequence($active_id, $pass, $is_random);
499 $result = $ilDB->queryF(
500 "SELECT question_fi, points FROM tst_test_result WHERE active_fi = %s AND pass = %s",
501 array('integer', 'integer'),
502 array($active_id, $pass)
503 );
504 $reachedpoints = array();
505 while ($row = $ilDB->fetchAssoc($result)) {
506 $reachedpoints[$row["question_fi"]] = $row["points"];
507 }
508 $atposition = false;
509 $pointsforposition = array();
510 foreach ($sequence->getUserSequence() as $seq) {
511 if (!$atposition) {
512 $qid = $sequence->getQuestionForSequence($seq);
513 if ($qid == $question_id) {
514 $atposition = true;
515 } else {
516 array_push($pointsforposition, $reachedpoints[$qid]);
517 }
518 }
519 }
520 return $pointsforposition;
521 }
522
532 public function getNrOfQuestionsInPass($sid, $active_id, $pass)
533 {
534 $this->initAuth($sid);
535 $this->initIlias();
536
537 if (!$this->__checkSession($sid)) {
538 return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
539 }
540 if (!$this->isAllowedCall($sid, $active_id, false)) {
541 return $this->__raiseError("The required user information is only available for active users.", "");
542 }
543
544 global $DIC;
545
546 $lng = $DIC['lng'];
547 $ilDB = $DIC['ilDB'];
548
549 $result = $ilDB->queryF(
550 "SELECT tst_tests.random_test FROM tst_active, tst_tests WHERE tst_active.active_id = %s AND tst_tests.test_id = tst_active.test_fi",
551 array('integer'),
552 array($active_id)
553 );
554 if ($result->numRows() != 1) {
555 return 0;
556 }
557 $row = $ilDB->fetchAssoc($result);
558 $is_random = $row["random_test"];
559
560 include_once "./Modules/Test/classes/class.ilTestSequence.php";
561 $sequence = new ilTestSequence($active_id, $pass, $is_random);
562 return $sequence->getUserQuestionCount();
563 }
564
572 public function removeTestResults($sid, $test_ref_id, $a_user_ids)
573 {
574 $this->initAuth($sid);
575 $this->initIlias();
576
577 if (!$this->__checkSession($sid)) {
578 return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
579 }
580 if (!strlen($test_ref_id)) {
581 return $this->__raiseError(
582 'No test id given. Aborting!',
583 'Client'
584 );
585 }
586 global $DIC;
587
588 $rbacsystem = $DIC['rbacsystem'];
589 $tree = $DIC['tree'];
590 $ilLog = $DIC['ilLog'];
591
592 if (!$this->checkManageParticipantsAccess($test_ref_id)) {
593 return $this->__raiseError('no permission. Aborting!', 'Client');
594 }
595
596 if (ilObject::_isInTrash($test_ref_id)) {
597 return $this->__raiseError(
598 'Test is trashed. Aborting!',
599 'Client'
600 );
601 }
602
603 if (!$tst = ilObjectFactory::getInstanceByRefId($test_ref_id, false)) {
604 return $this->__raiseError('No test found for id: ' . $test_ref_id, 'Client');
605 }
606 if ($tst->getType() != 'tst') {
607 return $this->__raiseError('Object with ref_id ' . $test_ref_id . ' is not of type test. Aborting', 'Client');
608 }
609
610 // Dirty hack
611 if (isset($a_user_ids['item'])) {
612 $a_user_ids = $a_user_ids['item'];
613 }
614
615 include_once './Modules/Test/classes/class.ilObjTest.php';
616 include_once './Modules/Test/classes/class.ilTestParticipantData.php';
617 require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
618 $part = new ilTestParticipantData($GLOBALS['DIC']['ilDB'], $GLOBALS['DIC']['lng']);
619 $part->setParticipantAccessFilter(
621 );
622 $part->setUserIdsFilter((array) $a_user_ids);
623 $part->load($tst->getTestId());
624 $tst->removeTestResults($part);
625
626 return true;
627 }
628
641 public function getTestResults($sid, $test_ref_id, $sum_only)
642 {
643 $this->initAuth($sid);
644 $this->initIlias();
645
646 if (!$this->__checkSession($sid)) {
647 return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
648 }
649 if (!strlen($test_ref_id)) {
650 return $this->__raiseError(
651 'No test id given. Aborting!',
652 'Client'
653 );
654 }
655 global $DIC;
656
657 $rbacsystem = $DIC['rbacsystem'];
658 $tree = $DIC['tree'];
659 $ilLog = $DIC['ilLog'];
660
661 if (ilObject::_isInTrash($test_ref_id)) {
662 return $this->__raiseError(
663 'Test is trashed. Aborting!',
664 'Client'
665 );
666 }
667
668 // get obj_id
669 if (!$obj_id = ilObject::_lookupObjectId($test_ref_id)) {
670 return $this->__raiseError(
671 'No test found for id: ' . $test_ref_id,
672 'Client'
673 );
674 }
675
676
677 // Check access
678 $permission_ok = false;
679 foreach ($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id) {
680 if ($rbacsystem->checkAccess('write', $ref_id)) {
681 $permission_ok = true;
682 break;
683 }
684 }
685 if (!$permission_ok && $this->checkParticipantsResultsAccess($test_ref_id)) {
686 $permission_ok = $this->checkParticipantsResultsAccess($test_ref_id);
687 }
688
689 if (!$permission_ok) {
690 return $this->__raiseError(
691 'No permission to edit the object with id: ' . $test_ref_id,
692 'Server'
693 );
694 }
695 // store into xml result set
696 include_once './webservice/soap/classes/class.ilXMLResultSet.php';
697 include_once './webservice/soap/classes/class.ilXMLResultSetWriter.php';
698
699 $xmlResultSet = new ilXMLResultSet();
700 $xmlResultSet->addColumn("user_id");
701 $xmlResultSet->addColumn("login");
702 $xmlResultSet->addColumn("firstname");
703 $xmlResultSet->addColumn("lastname");
704 $xmlResultSet->addColumn("matriculation");
705
706 include_once './Modules/Test/classes/class.ilObjTest.php';
707 $test_obj = new ilObjTest($obj_id, false);
708 $participants = $test_obj->getTestParticipants();
709
710 require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
711 require_once 'Modules/Test/classes/class.ilTestParticipantList.php';
713 $participantList = new ilTestParticipantList($test_obj);
714 $participantList->initializeFromDbRows($participants);
715 $participantList = $participantList->getAccessFilteredList($accessFilter);
716 foreach ($participants as $activeId => $part) {
717 if ($participantList->isActiveIdInList($activeId)) {
718 continue;
719 }
720
721 unset($participants[$activeId]);
722 }
723
724 if ($sum_only) {
725 $data = $test_obj->getAllTestResults($participants, false);
726 // create xml
727 $xmlResultSet->addColumn("maximum_points");
728 $xmlResultSet->addColumn("received_points");
729 // skip titles
730 $titles = array_shift($data);
731 foreach ($data as $row) {
732 $xmlRow = new ilXMLResultSetRow();
733 $xmlRow->setValue(0, $row["user_id"]);
734 $xmlRow->setValue(1, $row["login"]);
735 $xmlRow->setValue(2, $row["firstname"]);
736 $xmlRow->setValue(3, $row["lastname"]);
737 $xmlRow->setValue(4, $row["matriculation"]);
738 $xmlRow->setValue(5, $row["max_points"]);
739 $xmlRow->setValue(6, $row["reached_points"]);
740 $xmlResultSet->addRow($xmlRow);
741 }
742 } else {
743 $data = $test_obj->getDetailedTestResults($participants);
744 // create xml
745 $xmlResultSet->addColumn("question_id");
746 $xmlResultSet->addColumn("question_title");
747 $xmlResultSet->addColumn("maximum_points");
748 $xmlResultSet->addColumn("received_points");
749 foreach ($data as $row) {
750 $xmlRow = new ilXMLResultSetRow();
751 $xmlRow->setValue(0, $row["user_id"]);
752 $xmlRow->setValue(1, $row["login"]);
753 $xmlRow->setValue(2, $row["firstname"]);
754 $xmlRow->setValue(3, $row["lastname"]);
755 $xmlRow->setValue(4, $row["matriculation"]);
756 $xmlRow->setValue(5, $row["question_id"]);
757 $xmlRow->setValue(6, $row["question_title"]);
758 $xmlRow->setValue(7, $row["max_points"]);
759 $xmlRow->setValue(8, $row["reached_points"]);
760 $xmlResultSet->addRow($xmlRow);
761 }
762 }
763 // create writer
764 $xmlWriter = new ilXMLResultSetWriter($xmlResultSet);
765 $xmlWriter->start();
766 return $xmlWriter->getXML();
767 }
768
773 protected function checkManageParticipantsAccess($refId)
774 {
775 return $this->getTestAccess($refId)->checkManageParticipantsAccess();
776 }
777
782 protected function checkParticipantsResultsAccess($refId)
783 {
784 return $this->getTestAccess($refId)->checkParticipantsResultsAccess();
785 }
786
791 protected function getTestAccess($refId)
792 {
793 require_once 'Modules/Test/classes/class.ilTestAccess.php';
794
796
797 return new ilTestAccess($refId, $testId);
798 }
799}
$result
An exception for terminatinating execution or to throw for unit testing.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
static _getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object id.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupObjectId($a_ref_id)
lookup object id
static _getAllReferences($a_id)
get all reference ids of object
static _isInTrash($a_ref_id)
checks wether object is in trash
ILIAS Setting Class.
initAuth($sid)
Init authentication.
__raiseError($a_message, $a_code)
getNrOfQuestionsInPass($sid, $active_id, $pass)
Get the number of questions in a given pass for a given user.
isAllowedCall($sid, $active_id, $saveaction=true)
saveQuestion($sid, $active_id, $question_id, $pass, $solution)
saveQuestionSolution($sid, $active_id, $question_id, $pass, $solution)
Save the solution of a question.
removeTestResults($sid, $test_ref_id, $a_user_ids)
Remove test results for the chosen test and users.
getTestUserData($sid, $active_id)
get active user data
getPreviousReachedPoints($sid, $active_id, $question_id, $pass)
Returns the previous reached points in a given pass.
getPositionOfQuestion($sid, $active_id, $question_id, $pass)
get active user data
getQuestionSolution($sid, $active_id, $question_id, $pass)
Get the the answers of a given question and pass for a given user.
getTestResults($sid, $test_ref_id, $sum_only)
get results of test
Test sequence handler.
XML Writer for XMLResultSet.
if($_SERVER['argc']< 4) $client
Definition: cron.php:12
$i
Definition: disco.tpl.php:19
$time
Definition: cron.php:21
$row
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
global $DIC
Definition: saml.php:7
$lng
global $ilDB
$ilUser
Definition: imgupload.php:18
$data
Definition: bench.php:6