33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
56 if(!$this->__checkSession($sid))
60 global $rbacsystem, $tree,
$ilLog;
64 return $this->
__raiseError(
'No valid target given.',
'Client');
69 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_OBJECT_DELETED');
73 $allowed_types = array(
'cat',
'grp',
'crs',
'fold',
'root');
74 if(!in_array($target_obj->getType(), $allowed_types))
76 return $this->
__raiseError(
'No valid target type. Target must be reference id of "course, group, category or folder"',
'Client');
79 if(!$rbacsystem->checkAccess(
'create',
$target_id,
"exc"))
85 include_once
'./Modules/Exercise/classes/class.ilObjExercise.php';
86 include_once
'./Modules/Exercise/classes/class.ilExerciseXMLParser.php';
87 include_once
'./Modules/Exercise/classes/class.ilExerciseException.php';
92 $exercise->createReference();
95 $exercise->saveData();
103 if ($exerciseXMLParser->start()) {
104 $exerciseXMLParser->getAssignment()->update();
105 return $exercise->update() ? $exercise->getRefId() : -1;
129 if(!$this->__checkSession($sid))
133 global $rbacsystem, $tree,
$ilLog;
137 return $this->
__raiseError(
'Cannot perform update since exercise has been deleted.',
'CLIENT_OBJECT_DELETED');
143 'CLIENT_OBJECT_NOT_FOUND');
147 $permission_ok =
false;
150 if($rbacsystem->checkAccess(
'edit',$ref_id))
152 $permission_ok =
true;
159 return $this->
__raiseError(
'No permission to edit the exercise with id: '.$ref_id,
166 if (!is_object($exercise) || $exercise->getType()!=
"exc")
168 return $this->
__raiseError(
'Wrong obj id or type for exercise with id '.$ref_id,
169 'CLIENT_OBJECT_NOI_FOUND');
172 include_once
'./Modules/Exercise/classes/class.ilExerciseXMLParser.php';
173 include_once
'./Modules/Exercise/classes/class.ilExerciseException.php';
178 if ($exerciseXMLParser->start()) {
179 $exerciseXMLParser->getAssignment()->update();
180 return $exercise->update();
205 if(!$this->__checkSession($sid))
211 return $this->
__raiseError(
'No ref id given. Aborting!',
214 global $rbacsystem, $tree,
$ilLog;
225 return $this->
__raiseError(
"Parent with ID $ref_id has been deleted.",
'Client');
231 $permission_ok =
false;
232 $write_permission_ok =
false;
235 if($rbacsystem->checkAccess(
'write',$ref_id))
237 $write_permission_ok =
true;
240 if($rbacsystem->checkAccess(
'read',$ref_id))
242 $permission_ok =
true;
248 if(!$permission_ok && !$write_permission_ok)
250 return $this->
__raiseError(
'No permission to edit the object with id: '.$ref_id,
256 if (!is_object($exercise) || $exercise->getType()!=
"exc")
258 return $this->
__raiseError(
'Wrong obj id or type for exercise with id '.$ref_id,
262 include_once
'./Modules/Exercise/classes/class.ilExerciseXMLWriter.php';
266 $xmlWriter->setExercise($exercise);
267 $xmlWriter->setAttachMembers($write_permission_ok);
268 $xmlWriter->setAttachFileContents($attachFileContentsMode);
271 return $xmlWriter->getXML();