33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
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');
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 return $exerciseXMLParser->start() && $exercise->update() ? $exercise->getRefId() : -1;
129 global $rbacsystem, $tree,
$ilLog;
133 return $this->
__raiseError(
'Cannot perform update since exercise has been deleted.',
'CLIENT_OBJECT_DELETED');
139 'CLIENT_OBJECT_NOT_FOUND');
143 $permission_ok =
false;
146 if($rbacsystem->checkAccess(
'edit',$ref_id))
148 $permission_ok =
true;
155 return $this->
__raiseError(
'No permission to edit the exercise with id: '.$ref_id,
162 if (!is_object($exercise) || $exercise->getType()!=
"exc")
164 return $this->
__raiseError(
'Wrong obj id or type for exercise with id '.$ref_id,
165 'CLIENT_OBJECT_NOI_FOUND');
168 include_once
'./Modules/Exercise/classes/class.ilExerciseXMLParser.php';
169 include_once
'./Modules/Exercise/classes/class.ilExerciseException.php';
174 return $exerciseXMLParser->start() && $exercise->update();
203 return $this->
__raiseError(
'No ref id given. Aborting!',
206 global $rbacsystem, $tree,
$ilLog;
217 return $this->
__raiseError(
"Parent with ID $ref_id has been deleted.",
'Client');
223 $permission_ok =
false;
224 $write_permission_ok =
false;
227 if($rbacsystem->checkAccess(
'edit',$ref_id))
229 $write_permission_ok =
true;
232 if($rbacsystem->checkAccess(
'read',$ref_id))
234 $permission_ok =
true;
240 if(!$permission_ok && !$write_permission_ok)
242 return $this->
__raiseError(
'No permission to edit the object with id: '.$ref_id,
248 if (!is_object($exercise) || $exercise->getType()!=
"exc")
250 return $this->
__raiseError(
'Wrong obj id or type for exercise with id '.$ref_id,
254 include_once
'./Modules/Exercise/classes/class.ilExerciseXMLWriter.php';
258 $xmlWriter->setExercise($exercise);
259 $xmlWriter->setAttachMembers($write_permission_ok);
260 $xmlWriter->setAttachFileContents($attachFileContentsMode);
263 return $xmlWriter->getXML();