3 declare(strict_types=1);
    30 include_once 
'./webservice/soap/classes/class.ilSoapAdministration.php';
    37     public function addExercise(
string $sid, 
int $target_id, 
string $exercise_xml)
    47         $rbacsystem = $DIC[
'rbacsystem'];
    49         $ilLog = $DIC[
'ilLog'];
    52             return $this->
raiseError(
'No valid target given.', 
'Client');
    56             return $this->
raiseError(
"Parent with ID $target_id has been deleted.", 
'CLIENT_OBJECT_DELETED');
    59         $allowed_types = array(
'cat', 
'grp', 
'crs', 
'fold', 
'root');
    60         if (!in_array($target_obj->getType(), $allowed_types)) {
    62                 'No valid target type. Target must be reference id of "course, group, category or folder"',
    67         if (!$rbacsystem->checkAccess(
'create', $target_id, 
"exc")) {
    68             return $this->
raiseError(
'No permission to create exercises in target  ' . $target_id . 
'!', 
'Client');
    72         include_once 
'./Modules/Exercise/classes/class.ilObjExercise.php';
    73         include_once 
'./Modules/Exercise/classes/class.ilExerciseXMLParser.php';
    74         include_once 
'./Modules/Exercise/exceptions/class.ilExerciseException.php';
    88             if ($exerciseXMLParser->start()) {
    89                 $exerciseXMLParser->getAssignment()->update();
    95                 $exception->getMessage(),
   104     public function updateExercise(
string $sid, 
int $requested_ref_id, 
string $exercise_xml)
   114         $rbacsystem = $DIC[
'rbacsystem'];
   115         $tree = $DIC[
'tree'];
   116         $ilLog = $DIC[
'ilLog'];
   120                 'Cannot perform update since exercise has been deleted.',
   121                 'CLIENT_OBJECT_DELETED'   127                 'No exercise found for id: ' . $requested_ref_id,
   128                 'CLIENT_OBJECT_NOT_FOUND'   132         $permission_ok = 
false;
   134             if ($rbacsystem->checkAccess(
'edit', $ref_id)) {
   135                 $permission_ok = 
true;
   140         if (!$permission_ok) {
   142                 'No permission to edit the exercise with id: ' . $requested_ref_id,
   152                 'Wrong obj id or type for exercise with id ' . $requested_ref_id,
   153                 'CLIENT_OBJECT_NOI_FOUND'   157         include_once 
'./Modules/Exercise/classes/class.ilExerciseXMLParser.php';
   158         include_once 
'./Modules/Exercise/exceptions/class.ilExerciseException.php';
   162             if ($exerciseXMLParser->start()) {
   163                 $exerciseXMLParser->getAssignment()->update();
   169                 $exception->getMessage(),
   178     public function getExerciseXML(
string $sid, 
int $requested_ref_id, 
int $attachFileContentsMode)
   186         if (!$requested_ref_id) {
   188                 'No ref id given. Aborting!',
   194         $rbacsystem = $DIC[
'rbacsystem'];
   195         $tree = $DIC[
'tree'];
   196         $ilLog = $DIC[
'ilLog'];
   201                 'No exercise found for id: ' . $requested_ref_id,
   207             return $this->
raiseError(
"Parent with ID $requested_ref_id has been deleted.", 
'Client');
   210         $permission_ok = 
false;
   211         $write_permission_ok = 
false;
   213             if ($rbacsystem->checkAccess(
'write', $ref_id)) {  
   214                 $write_permission_ok = 
true;
   217             if ($rbacsystem->checkAccess(
'read', $ref_id)) {
   218                 $permission_ok = 
true;
   223         if (!$permission_ok && !$write_permission_ok) {
   225                 'No permission to edit the object with id: ' . $requested_ref_id,
   235                 'Wrong obj id or type for exercise with id ' . $requested_ref_id,
   240         include_once 
'./Modules/Exercise/classes/class.ilExerciseXMLWriter.php';
   244         $xmlWriter->setAttachMembers($write_permission_ok);
   245         $xmlWriter->setAttachFileContents($attachFileContentsMode);
   248         return $xmlWriter->getXML();
 
static _getAllReferences(int $id)
get all reference ids for object ID 
 
raiseError(string $a_message, $a_code)
 
Soap exercise administration methods. 
 
checkSession(string $sid)
 
static _isInTrash(int $ref_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)
 
addExercise(string $sid, int $target_id, string $exercise_xml)
 
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...