33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
44 include_once
'./include/inc.header.php';
47 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
51 include_once
"./Modules/Test/classes/class.ilObjTest.php";
54 if (($active_id > 0) && ($question_id > 0) && (strlen(
$pass) > 0))
56 $deletequery = sprintf(
"DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
57 $ilDB->quote($active_id .
""),
58 $ilDB->quote($question_id .
""),
59 $ilDB->quote(
$pass .
"")
61 $ilDB->query($deletequery);
63 $saved_solutions = FALSE;
64 for($i = 0; $i < count($solution); $i += 3)
66 $query = sprintf(
"INSERT INTO tst_solutions ".
67 "SET active_fi = %s, ".
73 $ilDB->quote($active_id .
""),
74 $ilDB->quote($question_id .
""),
75 $ilDB->quote($solution[$i]),
76 $ilDB->quote($solution[$i+1]),
77 $ilDB->quote($solution[$i+2]),
78 $ilDB->quote(
$pass .
"")
80 $saved_solutions = TRUE;
83 return $saved_solutions;
90 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
93 if (is_array($solution) && (array_key_exists(
"item", $solution))) $solution = $solution[
"item"];
96 include_once
'./include/inc.header.php';
98 if (($active_id > 0) && ($question_id > 0) && (strlen(
$pass) > 0))
100 $deletequery = sprintf(
"DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
101 $ilDB->quote($active_id .
""),
102 $ilDB->quote($question_id .
""),
103 $ilDB->quote(
$pass .
"")
105 $ilDB->query($deletequery);
107 for($i = 0; $i < count($solution); $i += 3)
109 $query = sprintf(
"INSERT INTO tst_solutions ".
110 "SET active_fi = %s, ".
111 "question_fi = %s, ".
116 $ilDB->quote($active_id .
""),
117 $ilDB->quote($question_id .
""),
118 $ilDB->quote($solution[$i]),
119 $ilDB->quote($solution[$i+1]),
120 $ilDB->quote($solution[$i+2]),
121 $ilDB->quote(
$pass .
"")
123 $ilDB->query($query);
132 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
136 include_once
'./include/inc.header.php';
138 if (($active_id > 0) && ($question_id > 0) && (strlen(
$pass) > 0))
140 $query = sprintf(
"SELECT * FROM tst_solutions ".
141 "WHERE active_fi = %s AND ".
142 "question_fi = %s AND ".
144 $ilDB->quote($active_id .
""),
145 $ilDB->quote($question_id .
""),
146 $ilDB->quote(
$pass .
"")
148 $result = $ilDB->query($query);
149 if ($result->numRows())
153 array_push($solution, $row[
"value1"]);
154 array_push($solution, $row[
"value2"]);
155 array_push($solution, $row[
"points"]);
177 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
179 if(!strlen($test_ref_id))
181 return $this->
__raiseError(
'No test id given. Aborting!',
184 include_once
'./include/inc.header.php';
185 global $rbacsystem, $tree,
$ilLog;
189 return $this->
__raiseError(
'Test is trashed. Aborting!',
196 return $this->
__raiseError(
'No test found for id: '.$test_ref_id,
202 $permission_ok =
false;
205 if($rbacsystem->checkAccess(
'edit',$ref_id))
207 $permission_ok =
true;
213 return $this->
__raiseError(
'No permission to edit the object with id: '.$test_ref_id,
217 include_once
'./webservice/soap/classes/class.ilXMLResultSet.php';
218 include_once
'./webservice/soap/classes/class.ilXMLResultSetWriter.php';
221 $xmlResultSet->addColumn(
"user_id");
222 $xmlResultSet->addColumn(
"login");
223 $xmlResultSet->addColumn(
"firstname");
224 $xmlResultSet->addColumn(
"lastname");
225 $xmlResultSet->addColumn(
"matriculation");
227 include_once
'./Modules/Test/classes/class.ilObjTest.php';
228 $test_obj =
new ilObjTest($obj_id,
false);
229 $participants = $test_obj->getTestParticipants();
234 $data = $test_obj->getAllTestResults($participants,
false);
237 $xmlResultSet->addColumn(
"maximum_points");
238 $xmlResultSet->addColumn(
"received_points");
240 $titles = array_shift(
$data);
241 foreach (
$data as $row) {
243 $xmlRow->setValue(0, $row[
"user_id"]);
244 $xmlRow->setValue(1, $row[
"login"]);
245 $xmlRow->setValue(2, $row[
"firstname"]);
246 $xmlRow->setValue(3, $row[
"lastname"]);
247 $xmlRow->setValue(4, $row[
"matriculation"]);
248 $xmlRow->setValue(5, $row[
"max_points"]);
249 $xmlRow->setValue(6, $row[
"reached_points"]);
250 $xmlResultSet->addRow($xmlRow);
253 $data = $test_obj->getDetailedTestResults($participants);
255 $xmlResultSet->addColumn(
"question_id");
256 $xmlResultSet->addColumn(
"question_title");
257 $xmlResultSet->addColumn(
"maximum_points");
258 $xmlResultSet->addColumn(
"received_points");
259 foreach (
$data as $row) {
261 $xmlRow->setValue(0, $row[
"user_id"]);
262 $xmlRow->setValue(1, $row[
"login"]);
263 $xmlRow->setValue(2, $row[
"firstname"]);
264 $xmlRow->setValue(3, $row[
"lastname"]);
265 $xmlRow->setValue(4, $row[
"matriculation"]);
266 $xmlRow->setValue(5, $row[
"question_id"]);
267 $xmlRow->setValue(6, $row[
"question_title"]);
268 $xmlRow->setValue(7, $row[
"max_points"]);
269 $xmlRow->setValue(8, $row[
"reached_points"]);
270 $xmlResultSet->addRow($xmlRow);
279 return $xmlWriter->getXML();