33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
53 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
58 return $this->
__raiseError(
'No valid target id given. Please choose an existing reference id of an ILIAS category',
63 include_once
'./include/inc.header.php';
68 return $this->
__raiseError(
'No valid target given.',
'Client');
73 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_OBJECT_DELETED');
76 if(!$rbacsystem->checkAccess(
'create',
$target_id,
'crs'))
78 return $this->
__raiseError(
'Check access failed. No permission to create courses',
'Server');
82 include_once(
"Modules/Course/classes/class.ilObjCourse.php");
85 $newObj->setType(
'crs');
86 $newObj->setTitle(
'dummy');
87 $newObj->setDescription(
"");
88 $newObj->create(
true);
89 $newObj->createReference();
92 $newObj->initDefaultRoles();
94 include_once
'Modules/Course/classes/class.ilCourseXMLParser.php';
97 $xml_parser->setXMLContent($crs_xml);
99 $xml_parser->startParsing();
101 $newObj->MDUpdateListener(
'General');
103 return $newObj->getRefId() ? $newObj->getRefId() :
"0";
111 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
114 if(!is_numeric($course_id))
116 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
121 include_once
'./include/inc.header.php';
122 include_once
"./Services/Utilities/classes/class.ilUtil.php";
130 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
134 if(!$rbacsystem->checkAccess(
'delete',$course_id))
136 return $this->
__raiseError(
'Check access failed. No permission to delete course',
'Server');
140 global $tree,$rbacadmin,
$log;
142 if($tree->isDeleted($course_id))
144 return $this->
__raiseError(
'Node already deleted',
'Server');
147 $subnodes = $tree->getSubtree($tree->getNodeData($course_id));
148 foreach ($subnodes as $subnode)
150 $rbacadmin->revokePermission($subnode[
"child"]);
156 if(!$tree->saveSubTree($course_id))
158 return $this->
__raiseError(
'Node already deleted',
'Client');
162 $log->write(
"SOAP ilObjectGUI::confirmedDeleteObject(), moved ref_id ".$course_id.
" to trash");
174 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
177 if(!is_numeric($course_id))
179 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
184 include_once
'./include/inc.header.php';
193 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
197 if(!$rbacsystem->checkAccess(
'write',$course_id))
199 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
205 return $this->
__raiseError(
'Invalid user id. User with id "'. $user_id.
' does not exist',
'Client');
207 if($type !=
'Admin' and
211 return $this->
__raiseError(
'Invalid type given. Parameter "type" must be "Admin", "Tutor" or "Member"',
'Client');
216 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
221 return $this->
__raiseError(
'Cannot create user instance!',
'Server');
224 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
232 $course_members->updateNotification($tmp_user->getId(),1);
251 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
253 if(!is_numeric($course_id))
255 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
260 include_once
'./include/inc.header.php';
268 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
274 return $this->
__raiseError(
'Invalid user id. User with id "'. $user_id.
' does not exist',
'Client');
279 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
282 if(!$rbacsystem->checkAccess(
'write',$course_id))
284 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
287 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
290 if(!$course_members->checkLastAdmin(array($user_id)))
292 return $this->
__raiseError(
'Cannot deassign last administrator from course',
'Server');
295 $course_members->delete($user_id);
305 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
307 if(!is_numeric($course_id))
309 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
313 include_once
'./include/inc.header.php';
321 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
327 return $this->
__raiseError(
'Invalid user id. User with id "'. $user_id.
' does not exist',
'Client');
332 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
335 if(!$rbacsystem->checkAccess(
'write',$course_id))
337 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
340 include_once
'./Modules/Course/classes/class.ilCourseParticipants.php';
343 if($crs_members->isAdmin($user_id))
347 if($crs_members->isTutor($user_id))
351 if($crs_members->isMember($user_id))
364 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
366 if(!is_numeric($course_id))
368 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
373 include_once
'./include/inc.header.php';
378 if ($this->
isFault($tmp_course)) {
401 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
404 $xml_writer->start();
406 return $xml_writer->getXML();
413 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
416 if(!is_numeric($course_id))
418 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
423 include_once
'./include/inc.header.php';
432 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
438 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
441 if(!$rbacsystem->checkAccess(
'write',$course_id))
443 return $this->
__raiseError(
'Check access failed. No permission to write course',
'Server');
448 include_once
'Services/MetaData/classes/class.ilMD.php';
450 $md =
new ilMD($tmp_course->getId(),0,
'crs');
453 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
457 include_once
'Modules/Course/classes/class.ilCourseWaitingList.php';
460 include_once
'Modules/Course/classes/class.ilCourseXMLParser.php';
463 $xml_parser->setXMLContent($xml);
465 $xml_parser->startParsing();
467 $tmp_course->MDUpdateListener(
'General');
485 return $this->
__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
488 include_once
'./include/inc.header.php';
489 global $rbacreview, $ilObjDataCache, $tree;
491 include_once
'webservice/soap/classes/class.ilXMLResultSetParser.php';
494 $parser->startParsing();
496 return $this->
__raiseError($exception->getMessage(),
"Client");
498 $xmlResultSet = $parser->getXMLResultSet();
500 if (!$xmlResultSet->hasColumn (
"user_id"))
501 return $this->
__raiseError(
"parameter user_id is missing",
"Client");
503 if (!$xmlResultSet->hasColumn (
"status"))
504 return $this->
__raiseError(
"parameter status is missing",
"Client");
506 $user_id = (int) $xmlResultSet->getValue (0,
"user_id");
507 $status = (int) $xmlResultSet->getValue (0,
"status");
512 #var_dump($xmlResultSet);
513 #echo "uid:".$user_id;
514 #echo "status:".$status;
518 foreach($rbacreview->assignedRoles($user_id) as $role_id)
522 #echo $role->getType();
523 if ($role->getType() !=
"role")
525 if ($role->getParent() == ROLE_FOLDER_ID)
529 $role_title = $role->getTitle();
537 if (ilSoapCourseAdministration::MEMBER == ($status & ilSoapCourseAdministration::MEMBER) && strpos($role_title,
"member") !==
false)
540 } elseif (ilSoapCourseAdministration::TUTOR == ($status & ilSoapCourseAdministration::TUTOR) && strpos($role_title,
"tutor") !==
false)
543 } elseif (ilSoapCourseAdministration::ADMIN == ($status & ilSoapCourseAdministration::ADMIN) && strpos($role_title,
"admin") !==
false)
556 foreach ($owned_objects as $obj_id) {
558 foreach($allrefs as $r)
560 if ($tree->isInTree($r))
565 if (count($refs) > 0)
566 $ref_ids[] = array_pop($refs);
570 $ref_ids = array_unique($ref_ids);
574 $ref_ids = array_unique($ref_ids);
576 include_once
'webservice/soap/classes/class.ilXMLResultSetWriter.php';
577 include_once
'Modules/Course/classes/class.ilObjCourse.php';
578 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
581 $xmlResultSet->addColumn(
"ref_id");
582 $xmlResultSet->addColumn(
"xml");
583 $xmlResultSet->addColumn(
"parent_ref_id");
585 foreach ($ref_ids as $course_id) {
589 $row->setValue(
"ref_id", $course_id);
591 $xmlWriter->setAttachUsers(
false);
593 $row->setValue(
"xml", $xmlWriter->getXML());
594 $row->setValue(
"parent_ref_id", $tree->getParentId($course_id));
595 $xmlResultSet->addRow($row);
599 $xmlResultSetWriter->start();
600 return $xmlResultSetWriter->getXML();