33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
49 if (!$this->__checkSession($sid)) {
55 'No valid target id given. Please choose an existing reference id of an ILIAS category',
62 $rbacsystem = $DIC[
'rbacsystem'];
65 return $this->
__raiseError(
'No valid target given.',
'Client');
69 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_OBJECT_DELETED');
72 if (!$rbacsystem->checkAccess(
'create',
$target_id,
'crs')) {
73 return $this->
__raiseError(
'Check access failed. No permission to create courses',
'Server');
78 include_once(
"Modules/Course/classes/class.ilObjCourse.php");
81 $newObj->setType(
'crs');
82 $newObj->setTitle(
'dummy');
83 $newObj->setDescription(
"");
84 $newObj->create(
true);
85 $newObj->createReference();
89 include_once
'Modules/Course/classes/class.ilCourseXMLParser.php';
92 $xml_parser->setXMLContent($crs_xml);
93 $xml_parser->startParsing();
94 return $newObj->getRefId() ? $newObj->getRefId() :
"0";
102 if (!$this->__checkSession($sid)) {
106 if (!is_numeric($course_id)) {
108 'No valid course id given. Please choose an existing reference id of an ILIAS course',
113 include_once
"./Services/Utilities/classes/class.ilUtil.php";
116 $rbacsystem = $DIC[
'rbacsystem'];
121 return $this->
__raiseError(
'Invalid course id. Object with id "' . $course_id .
'" is not of type "course"',
'Client');
125 if (!$rbacsystem->checkAccess(
'delete', $course_id)) {
126 return $this->
__raiseError(
'Check access failed. No permission to delete course',
'Server');
132 $tree = $DIC[
'tree'];
133 $rbacadmin = $DIC[
'rbacadmin'];
136 if (
$tree->isDeleted($course_id)) {
137 return $this->
__raiseError(
'Node already deleted',
'Server');
140 $subnodes =
$tree->getSubtree(
$tree->getNodeData($course_id));
141 foreach ($subnodes as $subnode) {
142 $rbacadmin->revokePermission($subnode[
"child"]);
147 if (!
$tree->saveSubTree($course_id,
true)) {
148 return $this->
__raiseError(
'Node already deleted',
'Client');
152 $log->write(
"SOAP ilObjectGUI::confirmedDeleteObject(), moved ref_id " . $course_id .
" to trash");
165 if (!$this->__checkSession($sid)) {
169 if (!is_numeric($course_id)) {
171 'No valid course id given. Please choose an existing reference id of an ILIAS course',
178 $rbacsystem = $DIC[
'rbacsystem'];
183 return $this->
__raiseError(
'Invalid course id. Object with id "' . $course_id .
'" is not of type "course"',
'Client');
187 if (!$rbacsystem->checkAccess(
'manage_members', $course_id)) {
188 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
193 return $this->
__raiseError(
'Invalid user id. User with id "' . $user_id .
' does not exist',
'Client');
198 return $this->
__raiseError(
'Invalid type given. Parameter "type" must be "Admin", "Tutor" or "Member"',
'Client');
202 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
206 return $this->
__raiseError(
'Cannot create user instance!',
'Server');
209 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
215 require_once(
"Services/Administration/classes/class.ilSetting.php");
218 $course_members->updateNotification($tmp_user->getId(), $settings->get(
'mail_crs_admin_notification',
true));
238 if (!$this->__checkSession($sid)) {
241 if (!is_numeric($course_id)) {
243 'No valid course id given. Please choose an existing reference id of an ILIAS course',
250 $rbacsystem = $DIC[
'rbacsystem'];
255 return $this->
__raiseError(
'Invalid course id. Object with id "' . $course_id .
'" is not of type "course"',
'Client');
260 return $this->
__raiseError(
'Invalid user id. User with id "' . $user_id .
' does not exist',
'Client');
264 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
267 if (!$rbacsystem->checkAccess(
'manage_members', $course_id)) {
268 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
271 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
274 if (!$course_members->checkLastAdmin(array($user_id))) {
275 return $this->
__raiseError(
'Cannot deassign last administrator from course',
'Server');
278 $course_members->delete($user_id);
289 if (!$this->__checkSession($sid)) {
292 if (!is_numeric($course_id)) {
294 'No valid course id given. Please choose an existing reference id of an ILIAS course',
300 $rbacsystem = $DIC[
'rbacsystem'];
305 return $this->
__raiseError(
'Invalid course id. Object with id "' . $course_id .
'" is not of type "course"',
'Client');
310 return $this->
__raiseError(
'Invalid user id. User with id "' . $user_id .
' does not exist',
'Client');
314 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
317 if (!$rbacsystem->checkAccess(
'manage_members', $course_id)) {
318 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
321 include_once
'./Modules/Course/classes/class.ilCourseParticipants.php';
324 if ($crs_members->isAdmin($user_id)) {
327 if ($crs_members->isTutor($user_id)) {
330 if ($crs_members->isMember($user_id)) {
343 if (!$this->__checkSession($sid)) {
346 if (!is_numeric($course_id)) {
348 'No valid course id given. Please choose an existing reference id of an ILIAS course',
355 $rbacsystem = $DIC[
'rbacsystem'];
358 if ($this->
isFault($tmp_course)) {
381 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
384 $xml_writer->start();
386 return $xml_writer->getXML();
394 if (!$this->__checkSession($sid)) {
398 if (!is_numeric($course_id)) {
400 'No valid course id given. Please choose an existing reference id of an ILIAS course',
407 $rbacsystem = $DIC[
'rbacsystem'];
412 return $this->
__raiseError(
'Invalid course id. Object with id "' . $course_id .
'" is not of type "course"',
'Client');
417 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
420 if (!$rbacsystem->checkAccess(
'write', $course_id)) {
421 return $this->
__raiseError(
'Check access failed. No permission to write course',
'Server');
426 include_once
'Services/MetaData/classes/class.ilMD.php';
428 $md =
new ilMD($tmp_course->getId(), 0,
'crs');
431 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
435 include_once
'Modules/Course/classes/class.ilCourseWaitingList.php';
438 include_once
'Modules/Course/classes/class.ilCourseXMLParser.php';
441 $xml_parser->setXMLContent(
$xml);
443 $xml_parser->startParsing();
445 $tmp_course->MDUpdateListener(
'General');
464 if (!$this->__checkSession($sid)) {
470 $rbacreview = $DIC[
'rbacreview'];
471 $ilObjDataCache = $DIC[
'ilObjDataCache'];
472 $tree = $DIC[
'tree'];
474 include_once
'webservice/soap/classes/class.ilXMLResultSetParser.php';
479 return $this->
__raiseError($exception->getMessage(),
"Client");
481 $xmlResultSet =
$parser->getXMLResultSet();
483 if (!$xmlResultSet->hasColumn(
"user_id")) {
484 return $this->
__raiseError(
"parameter user_id is missing",
"Client");
487 if (!$xmlResultSet->hasColumn(
"status")) {
488 return $this->
__raiseError(
"parameter status is missing",
"Client");
491 $user_id = (int) $xmlResultSet->getValue(0,
"user_id");
492 $status = (int) $xmlResultSet->getValue(0,
"status");
497 #var_dump($xmlResultSet); 498 #echo "uid:".$user_id; 499 #echo "status:".$status; 503 foreach ($rbacreview->assignedRoles($user_id) as $role_id) {
505 #echo $role->getType(); 506 if ($role->getType() !=
"role") {
509 if ($role->getParent() == ROLE_FOLDER_ID) {
512 $role_title = $role->getTitle();
520 if (ilSoapCourseAdministration::MEMBER == ($status & ilSoapCourseAdministration::MEMBER) && strpos($role_title,
"member") !==
false) {
521 $ref_ids [] = $ref_id;
522 } elseif (ilSoapCourseAdministration::TUTOR == ($status & ilSoapCourseAdministration::TUTOR) && strpos($role_title,
"tutor") !==
false) {
523 $ref_ids [] = $ref_id;
524 } elseif (ilSoapCourseAdministration::ADMIN == ($status & ilSoapCourseAdministration::ADMIN) && strpos($role_title,
"admin") !==
false) {
525 $ref_ids [] = $ref_id;
526 } elseif (($status &
ilSoapCourseAdministration::OWNER) == ilSoapCourseAdministration::OWNER && $ilObjDataCache->lookupOwner($ilObjDataCache->lookupObjId($ref_id)) == $user_id) {
527 $ref_ids [] = $ref_id;
535 foreach ($owned_objects as $obj_id) {
537 foreach ($allrefs as
$r) {
538 if (
$tree->isDeleted($r)) {
541 if (
$tree->isInTree($r)) {
545 if (count($refs) > 0) {
546 $ref_ids[] = array_pop($refs);
550 $ref_ids = array_unique($ref_ids);
554 $ref_ids = array_unique($ref_ids);
556 include_once
'webservice/soap/classes/class.ilXMLResultSetWriter.php';
557 include_once
'Modules/Course/classes/class.ilObjCourse.php';
558 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
561 $xmlResultSet->addColumn(
"ref_id");
562 $xmlResultSet->addColumn(
"xml");
563 $xmlResultSet->addColumn(
"parent_ref_id");
570 $permission = $user_id ==
$ilUser->getId() ?
'read' :
'write';
572 foreach ($ref_ids as $course_id) {
576 $row->setValue(
"ref_id", $course_id);
578 $xmlWriter->setAttachUsers(
false);
580 $row->setValue(
"xml", $xmlWriter->getXML());
581 $row->setValue(
"parent_ref_id",
$tree->getParentId($course_id));
582 $xmlResultSet->addRow(
$row);
586 $xmlResultSetWriter->start();
587 return $xmlResultSetWriter->getXML();
static removeItemFromDesktops($a_id)
removes object from all user's desktops public
static _deleteAllEntries($a_obj_id)
Delete all entries Normally called for course deletion.
XML Writer for XMLResultSet.
checkObjectAccess($ref_id, $expected_type, $permission, $returnObject=false)
check access for ref id: expected type, permission, return object instance if returnobject is true ...
assignCourseMember($sid, $course_id, $user_id, $type)
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
addCourse($sid, $target_id, $crs_xml)
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _isInTrash($a_ref_id)
checks wether object is in trash
SaxParserException thrown by ilSaxParser if property throwException is set.
static _getAllReferences($a_id)
get all reference ids of object
getObjectsForOwner($object_type, $owner_id)
returns all objects of an owner, filtered by type, objects are not deleted!
static __extractRefId($role_title)
extract ref id from role title, e.g.
excludeCourseMember($sid, $course_id, $user_id)
isAssignedToCourse($sid, $course_id, $user_id)
getCourseXML($sid, $course_id)
static _lookupObjId($a_id)
__raiseError($a_message, $a_code)
const IL_CRS_ADMIN
Base class for course and group participants.
updateCourse($sid, $course_id, $xml)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
deleteCourse($sid, $course_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
getCoursesForUser($sid, $parameters)
get courses which belong to a specific user, fullilling the status
initAuth($sid)
Init authentication.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _deleteAll($a_obj_id)
delete all