ILIAS  release_8 Revision v8.24
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
30include_once './webservice/soap/classes/class.ilSoapAdministration.php';
31
33{
34 private function hasWritePermissionForTest(int $active_id) : bool
35 {
36 global $DIC;
37
38 $ilDB = $DIC['ilDB'];
39 global $DIC;
40
41 $ilAccess = $DIC['ilAccess'];
42
43 $permission_ok = false;
44 $result = $ilDB->queryF(
45 "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",
46 array('integer'),
47 array($active_id)
48 );
49 $row = $ilDB->fetchAssoc($result);
50 if ($row['obj_fi']) {
51 $obj_id = $row['obj_fi'];
52 foreach ($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id) {
53 if ($ilAccess->checkAccess("write", "", $ref_id)) {
54 $permission_ok = true;
55 break;
56 }
57 }
58 }
59 return $permission_ok;
60 }
61
62 public function isAllowedCall(string $sid, int $active_id, bool $saveaction = true) : bool
63 {
64 global $DIC;
65
66 $ilDB = $DIC['ilDB'];
67 global $DIC;
68
69 $ilUser = $DIC['ilUser'];
70
71 if ($this->hasWritePermissionForTest($active_id)) {
72 return true;
73 }
74
75 if ($saveaction) {
76 $result = $ilDB->queryF(
77 "SELECT * FROM tst_times WHERE active_fi = %s ORDER BY started DESC",
78 array('integer'),
79 array($active_id)
80 );
81 if ($result->numRows()) {
82 $row = $ilDB->fetchAssoc($result);
83 if (preg_match("/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/", $row["started"], $matches)) {
84 $time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
85 $now = time();
86 $diff = $now - $time;
87 $client = explode("::", $sid);
88 global $DIC;
89
90 $ilClientIniFile = $DIC['ilClientIniFile'];
91 $expires = $ilClientIniFile->readVariable('session', 'expire');
92 return $diff <= $expires;
93 }
94
95 return false;
96 }
97
98 return false;
99 }
100
101 $result = $ilDB->queryF(
102 "SELECT user_fi FROM tst_active WHERE active_id = %s",
103 array('integer'),
104 array($active_id)
105 );
106 $row = $ilDB->fetchAssoc($result);
107
108 return (int) $row['user_fi'] === $ilUser->getId();
109 }
110
114 public function saveQuestion(string $sid, int $active_id, int $question_id, int $pass, array $solution)
115 {
116 $this->initAuth($sid);
117 $this->initIlias();
118
119 if (!$this->checkSession($sid)) {
120 return $this->raiseError($this->getMessage(), $this->getMessageCode());
121 }
122 if (!$this->isAllowedCall($sid, $active_id)) {
123 return $this->raiseError("The required user information is only available for active users.", "");
124 }
125
126 global $DIC;
127
128 $ilDB = $DIC['ilDB'];
129 $ilUser = $DIC['ilUser'];
130
131 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
132 $processLockerFactory = new ilAssQuestionProcessLockerFactory(new ilSetting('assessment'), $ilDB);
133 $processLockerFactory->setQuestionId($question_id);
134 $processLockerFactory->setUserId($ilUser->getId());
135 include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
136 $processLockerFactory->setAssessmentLogEnabled(ilObjAssessmentFolder::_enabledAssessmentLogging());
137 $processLocker = $processLockerFactory->getLocker();
138
139 $totalrows = 0;
140
141 $processLocker->executePersistWorkingStateLockOperation(function () use (
142 &$totalrows,
143 $processLocker,
144 $active_id,
145 $question_id,
146 $pass,
147 $solution
148 ) {
149 $processLocker->executeUserSolutionUpdateLockOperation(function () use (
150 &$totalrows,
151 $active_id,
152 $question_id,
153 $pass,
154 $solution
155 ) {
156 $ilDB = $GLOBALS['DIC']['ilDB'];
157 if (($active_id > 0) && ($question_id > 0) && ($pass > 0)) {
158 $affectedRows = $ilDB->manipulateF(
159 "DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
160 array('integer', 'integer', 'integer'),
161 array($active_id, $question_id, $pass)
162 );
163 }
164 for ($i = 0, $iMax = count($solution); $i < $iMax; $i += 3) {
165 $next_id = $ilDB->nextId('tst_solutions');
166 $affectedRows = $ilDB->insert("tst_solutions", array(
167 "solution_id" => array("integer", $next_id),
168 "active_fi" => array("integer", $active_id),
169 "question_fi" => array("integer", $question_id),
170 "value1" => array("clob", $solution[$i]),
171 "value2" => array("clob", $solution[$i + 1]),
172 "points" => array("float", $solution[$i + 2]),
173 "pass" => array("integer", $pass),
174 "tstamp" => array("integer", time())
175 ));
176 $totalrows += $affectedRows;
177 }
178 });
179
180 if ($totalrows !== 0) {
181 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
182 $question = assQuestion::instantiateQuestion($question_id);
183 $question->setProcessLocker($processLocker);
184 $question->calculateResultsFromSolution($active_id, $pass);
185 }
186 });
187
188 if ($totalrows === 0) {
189 return $this->raiseError(
190 "Wrong solution data. ILIAS did not execute any database queries: Solution data: " . print_r(
191 $solution,
192 true
193 ),
194 'No result'
195 );
196 }
197 return true;
198 }
199
203 public function saveQuestionSolution(string $sid, int $active_id, int $question_id, int $pass, int $solution)
204 {
205 $this->initAuth($sid);
206 $this->initIlias();
207
208 if (!$this->checkSession($sid)) {
209 return $this->raiseError($this->getMessage(), $this->getMessageCode());
210 }
211 if (!$this->isAllowedCall($sid, $active_id)) {
212 return $this->raiseError("The required user information is only available for active users.", "");
213 }
214
215 $solutions = [];
216 if (preg_match("/<values>(.*?)<\/values>/is", $solution, $matches)) {
217 if (preg_match_all(
218 "/<value>(.*?)<\/value><value>(.*?)<\/value><points>(.*?)<\/points>/is",
219 $solution,
220 $matches,
221 PREG_SET_ORDER
222 )) {
223 foreach ($matches as $match) {
224 if (count($match) === 4) {
225 for ($i = 1, $iMax = count($match); $i < $iMax; $i++) {
226 $solutions[] = trim($match[$i]);
227 }
228 }
229 }
230 }
231 }
232
233 if (count($solutions) === 0) {
234 return $this->raiseError(
235 "Wrong solution data. ILIAS did not find one or more solution triplets: $solution",
236 ""
237 );
238 }
239
240 $ilDB = $GLOBALS['DIC']['ilDB'];
241 if (($active_id > 0) && ($question_id > 0) && ($pass > 0)) {
242 $affectedRows = $ilDB->manipulateF(
243 "DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
244 array('integer', 'integer', 'integer'),
245 array($active_id, $question_id, $pass)
246 );
247 }
248 $totalrows = 0;
249 for ($i = 0, $iMax = count($solutions); $i < $iMax; $i += 3) {
250 $next_id = $ilDB->nextId('tst_solutions');
251 $affectedRows = $ilDB->insert("tst_solutions", array(
252 "solution_id" => array("integer", $next_id),
253 "active_fi" => array("integer", $active_id),
254 "question_fi" => array("integer", $question_id),
255 "value1" => array("clob", $solutions[$i]),
256 "value2" => array("clob", $solutions[$i + 1]),
257 "points" => array("float", $solutions[$i + 2]),
258 "pass" => array("integer", $pass),
259 "tstamp" => array("integer", time())
260 ));
261 $totalrows += $affectedRows;
262 }
263 if ($totalrows === 0) {
264 return $this->raiseError("Wrong solution data. ILIAS did not execute any database queries", '');
265 }
266
267 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
268 $question = assQuestion::instantiateQuestion($question_id);
269 $question->calculateResultsFromSolution($active_id, $pass);
270 return "TRUE";
271 }
272
276 public function getQuestionSolution(string $sid, int $active_id, int $question_id, int $pass)
277 {
278 $this->initAuth($sid);
279 $this->initIlias();
280
281 if (!$this->checkSession($sid)) {
282 return $this->raiseError($this->getMessage(), $this->getMessageCode());
283 }
284 if (!$this->isAllowedCall($sid, $active_id, false)) {
285 return $this->raiseError("The required user information is only available for active users.", "");
286 }
287 $solution = array();
288
289 global $DIC;
290
291 $ilDB = $DIC['ilDB'];
292
293 $use_previous_answers = 1;
294
295 $result = $ilDB->queryF(
296 "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",
297 array('integer'),
298 array($active_id)
299 );
300 if ($result->numRows()) {
301 $row = $ilDB->fetchAssoc($result);
302 $use_previous_answers = $row["use_previous_answers"];
303 }
304 $lastpass = 0;
305 if ($use_previous_answers) {
306 $result = $ilDB->queryF(
307 "SELECT MAX(pass) maxpass FROM tst_test_result WHERE active_fi = %s AND question_fi = %s",
308 array('integer', 'integer'),
309 array($active_id, $question_id)
310 );
311 if ($result->numRows() === 1) {
312 $row = $ilDB->fetchAssoc($result);
313 $lastpass = (int) $row["maxpass"];
314 }
315 } else {
316 $lastpass = $pass;
317 }
318
319 if (($active_id > 0) && ($question_id > 0) && ($lastpass > 0)) {
320 $result = $ilDB->queryF(
321 "SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
322 array('integer', 'integer', 'integer'),
323 array($active_id, $question_id, $lastpass)
324 );
325 if ($result->numRows()) {
326 while ($row = $ilDB->fetchAssoc($result)) {
327 $solution[] = $row["value1"];
328 $solution[] = $row["value2"];
329 $solution[] = $row["points"];
330 }
331 }
332 }
333 return $solution;
334 }
335
339 public function getTestUserData(string $sid, int $active_id)
340 {
341 $this->initAuth($sid);
342 $this->initIlias();
343
344 if (!$this->checkSession($sid)) {
345 return $this->raiseError($this->getMessage(), $this->getMessageCode());
346 }
347 if (!$this->isAllowedCall($sid, $active_id, false)) {
348 return $this->raiseError("The required user information is only available for active users.", "");
349 }
350
351 global $DIC;
352
353 $lng = $DIC['lng'];
354 $ilDB = $DIC['ilDB'];
355
356 $result = $ilDB->queryF(
357 "SELECT user_fi, test_fi FROM tst_active WHERE active_id = %s",
358 array('integer'),
359 array($active_id)
360 );
361 $row = $ilDB->fetchAssoc($result);
362 $user_id = $row["user_fi"];
363 $test_id = $row["test_fi"];
364
365 $result = $ilDB->queryF(
366 "SELECT anonymity FROM tst_tests WHERE test_id = %s",
367 array('integer'),
368 array($test_id)
369 );
370 $row = $ilDB->fetchAssoc($result);
371 $anonymity = $row["anonymity"];
372
373 $result = $ilDB->queryF(
374 "SELECT firstname, lastname, title, login FROM usr_data WHERE usr_id = %s",
375 array('integer'),
376 array($user_id)
377 );
378
379 $userdata = array();
380 if ($result->numRows() === 0) {
381 $userdata["fullname"] = $lng->txt("deleted_user");
382 $userdata["title"] = "";
383 $userdata["firstname"] = "";
384 $userdata["lastname"] = $lng->txt("anonymous");
385 $userdata["login"] = "";
386 } else {
387 $data = $ilDB->fetchAssoc($result);
388 if ((int) $user_id === ANONYMOUS_USER_ID || $anonymity) {
389 $userdata["fullname"] = $lng->txt("anonymous");
390 $userdata["title"] = "";
391 $userdata["firstname"] = "";
392 $userdata["lastname"] = $lng->txt("anonymous");
393 $userdata["login"] = "";
394 } else {
395 $userdata["fullname"] = trim($data["title"] . " " . $data["firstname"] . " " . $data["lastname"]);
396 $userdata["title"] = $data["title"];
397 $userdata["firstname"] = $data["firstname"];
398 $userdata["lastname"] = $data["lastname"];
399 $userdata["login"] = $data["login"];
400 }
401 }
402 return array_values($userdata);
403 }
404
408 public function getPositionOfQuestion(string $sid, int $active_id, int $question_id, int $pass)
409 {
410 $this->initAuth($sid);
411 $this->initIlias();
412
413 if (!$this->checkSession($sid)) {
414 return $this->raiseError($this->getMessage(), $this->getMessageCode());
415 }
416 if (!$this->isAllowedCall($sid, $active_id, false)) {
417 return $this->raiseError("The required user information is only available for active users.", "");
418 }
419
420 global $DIC;
421
422 $lng = $DIC['lng'];
423 $ilDB = $DIC['ilDB'];
424
425 $result = $ilDB->queryF(
426 "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",
427 array('integer'),
428 array($active_id)
429 );
430 if ($result->numRows() !== 1) {
431 return -1;
432 }
433 $row = $ilDB->fetchAssoc($result);
434 $is_random = $row["random_test"];
435
436 include_once "./Modules/Test/classes/class.ilTestSequence.php";
437 $sequence = new ilTestSequence($active_id, $pass, $is_random);
438 return $sequence->getSequenceForQuestion($question_id);
439 }
440
444 public function getPreviousReachedPoints(string $sid, int $active_id, int $question_id, int $pass)
445 {
446 $this->initAuth($sid);
447 $this->initIlias();
448
449 if (!$this->checkSession($sid)) {
450 return $this->raiseError($this->getMessage(), $this->getMessageCode());
451 }
452 if (!$this->isAllowedCall($sid, $active_id, false)) {
453 return $this->raiseError("The required user information is only available for active users.", "");
454 }
455
456 global $DIC;
457
458 $lng = $DIC['lng'];
459 $ilDB = $DIC['ilDB'];
460
461 $result = $ilDB->queryF(
462 "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",
463 array('integer'),
464 array($active_id)
465 );
466 if ($result->numRows() !== 1) {
467 return -1;
468 }
469 $row = $ilDB->fetchAssoc($result);
470 $is_random = $row["random_test"];
471
472 include_once "./Modules/Test/classes/class.ilTestSequence.php";
473 $sequence = new ilTestSequence($active_id, $pass, $is_random);
474 $result = $ilDB->queryF(
475 "SELECT question_fi, points FROM tst_test_result WHERE active_fi = %s AND pass = %s",
476 array('integer', 'integer'),
477 array($active_id, $pass)
478 );
479 $reachedpoints = array();
480 while ($row = $ilDB->fetchAssoc($result)) {
481 $reachedpoints[$row["question_fi"]] = $row["points"];
482 }
483 $atposition = false;
484 $pointsforposition = array();
485 foreach ($sequence->getUserSequence() as $seq) {
486 if (!$atposition) {
487 $qid = $sequence->getQuestionForSequence($seq);
488 if ($qid == $question_id) {
489 $atposition = true;
490 } else {
491 $pointsforposition[] = $reachedpoints[$qid];
492 }
493 }
494 }
495 return $pointsforposition;
496 }
497
501 public function getNrOfQuestionsInPass(string $sid, int $active_id, int $pass)
502 {
503 $this->initAuth($sid);
504 $this->initIlias();
505
506 if (!$this->checkSession($sid)) {
507 return $this->raiseError($this->getMessage(), $this->getMessageCode());
508 }
509 if (!$this->isAllowedCall($sid, $active_id, false)) {
510 return $this->raiseError("The required user information is only available for active users.", "");
511 }
512
513 global $DIC;
514
515 $lng = $DIC['lng'];
516 $ilDB = $DIC['ilDB'];
517
518 $result = $ilDB->queryF(
519 "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",
520 array('integer'),
521 array($active_id)
522 );
523 if ($result->numRows() !== 1) {
524 return 0;
525 }
526 $row = $ilDB->fetchAssoc($result);
527 $is_random = $row["random_test"];
528
529 include_once "./Modules/Test/classes/class.ilTestSequence.php";
530 $sequence = new ilTestSequence($active_id, $pass, $is_random);
531 return $sequence->getUserQuestionCount();
532 }
533
537 public function removeTestResults(string $sid, int $test_ref_id, array $a_user_ids)
538 {
539 $this->initAuth($sid);
540 $this->initIlias();
541
542 if (!$this->checkSession($sid)) {
543 return $this->raiseError($this->getMessage(), $this->getMessageCode());
544 }
545 if (!($test_ref_id > 0)) {
546 return $this->raiseError(
547 'No test id given. Aborting!',
548 'Client'
549 );
550 }
551 global $DIC;
552
553 $rbacsystem = $DIC['rbacsystem'];
554 $tree = $DIC['tree'];
555 $ilLog = $DIC['ilLog'];
556
557 if (!$this->checkManageParticipantsAccess($test_ref_id)) {
558 return $this->raiseError('no permission. Aborting!', 'Client');
559 }
560
561 if (ilObject::_isInTrash($test_ref_id)) {
562 return $this->raiseError(
563 'Test is trashed. Aborting!',
564 'Client'
565 );
566 }
567
568 if (!$tst = ilObjectFactory::getInstanceByRefId($test_ref_id, false)) {
569 return $this->raiseError('No test found for id: ' . $test_ref_id, 'Client');
570 }
571 if ($tst->getType() !== 'tst') {
572 return $this->raiseError(
573 'Object with ref_id ' . $test_ref_id . ' is not of type test. Aborting',
574 'Client'
575 );
576 }
577
578 // Dirty hack
579 if (isset($a_user_ids['item'])) {
580 $a_user_ids = $a_user_ids['item'];
581 }
582
583 include_once './Modules/Test/classes/class.ilObjTest.php';
584 include_once './Modules/Test/classes/class.ilTestParticipantData.php';
585 require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
586 $part = new ilTestParticipantData($GLOBALS['DIC']['ilDB'], $GLOBALS['DIC']['lng']);
587 $part->setParticipantAccessFilter(
589 );
590 $part->setUserIdsFilter((array) $a_user_ids);
591 $part->load($tst->getTestId());
592 $tst->removeTestResults($part);
593
594 return true;
595 }
596
600 public function getTestResults(string $sid, int $test_ref_id, bool $sum_only)
601 {
602 $this->initAuth($sid);
603 $this->initIlias();
604
605 if (!$this->checkSession($sid)) {
606 return $this->raiseError($this->getMessage(), $this->getMessageCode());
607 }
608 if (!($test_ref_id > 0)) {
609 return $this->raiseError(
610 'No test id given. Aborting!',
611 'Client'
612 );
613 }
614 global $DIC;
615
616 $rbacsystem = $DIC['rbacsystem'];
617 $tree = $DIC['tree'];
618 $ilLog = $DIC['ilLog'];
619
620 if (ilObject::_isInTrash($test_ref_id)) {
621 return $this->raiseError(
622 'Test is trashed. Aborting!',
623 'Client'
624 );
625 }
626
627 if (!$obj_id = ilObject::_lookupObjectId($test_ref_id)) {
628 return $this->raiseError(
629 'No test found for id: ' . $test_ref_id,
630 'Client'
631 );
632 }
633
634 $permission_ok = false;
635 foreach ($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id) {
636 if ($rbacsystem->checkAccess('write', $ref_id)) {
637 $permission_ok = true;
638 break;
639 }
640 }
641 if (!$permission_ok && $this->checkParticipantsResultsAccess($test_ref_id)) {
642 $permission_ok = $this->checkParticipantsResultsAccess($test_ref_id);
643 }
644
645 if (!$permission_ok) {
646 return $this->raiseError(
647 'No permission to edit the object with id: ' . $test_ref_id,
648 'Server'
649 );
650 }
651
652 include_once './webservice/soap/classes/class.ilXMLResultSet.php';
653 include_once './webservice/soap/classes/class.ilXMLResultSetWriter.php';
654
655 $xmlResultSet = new ilXMLResultSet();
656 $xmlResultSet->addColumn("user_id");
657 $xmlResultSet->addColumn("login");
658 $xmlResultSet->addColumn("firstname");
659 $xmlResultSet->addColumn("lastname");
660 $xmlResultSet->addColumn("matriculation");
661
662 include_once './Modules/Test/classes/class.ilObjTest.php';
663 $test_obj = new ilObjTest($obj_id, false);
664 $participants = $test_obj->getTestParticipants();
665
666 require_once 'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
667 require_once 'Modules/Test/classes/class.ilTestParticipantList.php';
669 $participantList = new ilTestParticipantList($test_obj);
670 $participantList->initializeFromDbRows($participants);
671 $participantList = $participantList->getAccessFilteredList($accessFilter);
672 $participantList = $participantList->getScoredParticipantList();
673 foreach ($participants as $activeId => $part) {
674 if ($participantList->isActiveIdInList($activeId)) {
675 $participants[$activeId]['passed'] = $participantList->getParticipantByActiveId($activeId)->getScoring()->isPassed();
676 continue;
677 }
678
679 unset($participants[$activeId]);
680 }
681
682 if ($sum_only) {
683 $data = $test_obj->getAllTestResults($participants, false);
684
685 $xmlResultSet->addColumn("maximum_points");
686 $xmlResultSet->addColumn("received_points");
687 $xmlResultSet->addColumn("passed");
688 // skip titles
689 $titles = array_shift($data);
690 foreach ($data as $row) {
691 $xmlRow = new ilXMLResultSetRow();
692 $xmlRow->setValue(0, $row["user_id"]);
693 $xmlRow->setValue(1, $row["login"]);
694 $xmlRow->setValue(2, $row["firstname"]);
695 $xmlRow->setValue(3, $row["lastname"]);
696 $xmlRow->setValue(4, $row["matriculation"]);
697 $xmlRow->setValue(5, $row["max_points"]);
698 $xmlRow->setValue(6, $row["reached_points"]);
699 $xmlRow->setValue(7, $row["passed"]);
700 $xmlResultSet->addRow($xmlRow);
701 }
702 } else {
703 $data = $test_obj->getDetailedTestResults($participants);
704
705 $xmlResultSet->addColumn("question_id");
706 $xmlResultSet->addColumn("question_title");
707 $xmlResultSet->addColumn("maximum_points");
708 $xmlResultSet->addColumn("received_points");
709 $xmlResultSet->addColumn("passed");
710 foreach ($data as $row) {
711 $xmlRow = new ilXMLResultSetRow();
712 $xmlRow->setValue(0, $row["user_id"]);
713 $xmlRow->setValue(1, $row["login"]);
714 $xmlRow->setValue(2, $row["firstname"]);
715 $xmlRow->setValue(3, $row["lastname"]);
716 $xmlRow->setValue(4, $row["matriculation"]);
717 $xmlRow->setValue(5, $row["question_id"]);
718 $xmlRow->setValue(6, $row["question_title"]);
719 $xmlRow->setValue(7, $row["max_points"]);
720 $xmlRow->setValue(8, $row["reached_points"]);
721 $xmlRow->setValue(9, $row["passed"]);
722 $xmlResultSet->addRow($xmlRow);
723 }
724 }
725
726 $xmlWriter = new ilXMLResultSetWriter($xmlResultSet);
727 $xmlWriter->start();
728 return $xmlWriter->getXML();
729 }
730
731 protected function checkManageParticipantsAccess(int $refId) : bool
732 {
733 return $this->getTestAccess($refId)->checkManageParticipantsAccess();
734 }
735
736 protected function checkParticipantsResultsAccess(int $refId) : bool
737 {
738 return $this->getTestAccess($refId)->checkParticipantsResultsAccess();
739 }
740
741 protected function getTestAccess(int $refId) : ilTestAccess
742 {
743 require_once 'Modules/Test/classes/class.ilTestAccess.php';
744
746 return new ilTestAccess($refId, $testId);
747 }
748}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static instantiateQuestion(int $question_id)
static _getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object id.
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupObjectId(int $ref_id)
static _getAllReferences(int $id)
get all reference ids for object ID
static _isInTrash(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
soap server Base class for all SOAP registered methods.
raiseError(string $a_message, $a_code)
saveQuestionSolution(string $sid, int $active_id, int $question_id, int $pass, int $solution)
getPreviousReachedPoints(string $sid, int $active_id, int $question_id, int $pass)
isAllowedCall(string $sid, int $active_id, bool $saveaction=true)
saveQuestion(string $sid, int $active_id, int $question_id, int $pass, array $solution)
getQuestionSolution(string $sid, int $active_id, int $question_id, int $pass)
getPositionOfQuestion(string $sid, int $active_id, int $question_id, int $pass)
removeTestResults(string $sid, int $test_ref_id, array $a_user_ids)
getTestResults(string $sid, int $test_ref_id, bool $sum_only)
getTestUserData(string $sid, int $active_id)
getNrOfQuestionsInPass(string $sid, int $active_id, int $pass)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Row Class for XMLResultSet.
XML Writer for XMLResultSet.
const ANONYMOUS_USER_ID
Definition: constants.php:27
$client
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
$ref_id
Definition: ltiauth.php:67
$i
Definition: metadata.php:41
$lng
$refId
Definition: xapitoken.php:58