33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
54 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
56 include_once
'./include/inc.header.php';
57 global $rbacsystem, $tree,
$ilLog;
61 return $this->
__raiseError(
'No valid target given.',
'Client');
66 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_OBJECT_DELETED');
70 $allowed_types = array(
'cat',
'grp',
'crs',
'fold');
71 if(!in_array($target_obj->getType(), $allowed_types))
73 return $this->
__raiseError(
'No valid target type. Target must be reference id of "course, group, category or folder"',
'Client');
76 if(!$rbacsystem->checkAccess(
'create',
$target_id,
"exc"))
82 include_once
'./Modules/Exercise/classes/class.ilObjExercise.php';
83 include_once
'./Modules/Exercise/classes/class.ilExerciseXMLParser.php';
84 include_once
'./Modules/Exercise/classes/class.ilExerciseException.php';
89 $exercise->createReference();
92 $exercise->saveData();
100 return $exerciseXMLParser->start() && $exercise->update() ? $exercise->getRefId() : -1;
120 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
122 include_once
'./include/inc.header.php';
123 global $rbacsystem, $tree,
$ilLog;
127 return $this->
__raiseError(
'Cannot perform update since exercise has been deleted.',
'CLIENT_OBJECT_DELETED');
133 'CLIENT_OBJECT_NOT_FOUND');
137 $permission_ok =
false;
140 if($rbacsystem->checkAccess(
'edit',$ref_id))
142 $permission_ok =
true;
149 return $this->
__raiseError(
'No permission to edit the exercise with id: '.$ref_id,
156 if (!is_object($exercise) || $exercise->getType()!=
"exc")
158 return $this->
__raiseError(
'Wrong obj id or type for exercise with id '.$ref_id,
159 'CLIENT_OBJECT_NOI_FOUND');
162 include_once
'./Modules/Exercise/classes/class.ilExerciseXMLParser.php';
163 include_once
'./Modules/Exercise/classes/class.ilExerciseException.php';
168 return $exerciseXMLParser->start() && $exercise->update();
189 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
193 return $this->
__raiseError(
'No ref id given. Aborting!',
196 include_once
'./include/inc.header.php';
197 global $rbacsystem, $tree,
$ilLog;
208 return $this->
__raiseError(
"Parent with ID $ref_id has been deleted.",
'Client');
214 $permission_ok =
false;
215 $write_permission_ok =
false;
218 if($rbacsystem->checkAccess(
'edit',$ref_id))
220 $write_permission_ok =
true;
223 if($rbacsystem->checkAccess(
'read',$ref_id))
225 $permission_ok =
true;
231 if(!$permission_ok && !$write_permission_ok)
233 return $this->
__raiseError(
'No permission to edit the object with id: '.$ref_id,
239 if (!is_object($exercise) || $exercise->getType()!=
"exc")
241 return $this->
__raiseError(
'Wrong obj id or type for exercise with id '.$ref_id,
245 include_once
'./Modules/Exercise/classes/class.ilExerciseXMLWriter.php';
249 $xmlWriter->setExercise($exercise);
250 $xmlWriter->setAttachMembers($write_permission_ok);
251 $xmlWriter->setAttachFileContents($attachFileContentsMode);
254 return $xmlWriter->getXML();