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');
131 $tree = $DIC->repositoryTree();
132 $user = $DIC->user();
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"]);
144 if (!$tree->moveToTrash($course_id,
true, $user->getId())) {
145 return $this->
__raiseError(
'Node already deleted',
'Client');
149 $log->write(
"SOAP ilObjectGUI::confirmedDeleteObject(), moved ref_id " . $course_id .
" to trash");
159 if (!$this->__checkSession($sid)) {
163 if (!is_numeric($course_id)) {
165 'No valid course id given. Please choose an existing reference id of an ILIAS course',
172 $rbacsystem = $DIC[
'rbacsystem'];
177 return $this->
__raiseError(
'Invalid course id. Object with id "' . $course_id .
'" is not of type "course"',
'Client');
181 if (!$rbacsystem->checkAccess(
'manage_members', $course_id)) {
182 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
187 return $this->
__raiseError(
'Invalid user id. User with id "' . $user_id .
' does not exist',
'Client');
189 if (
$type !=
'Admin' and
192 return $this->
__raiseError(
'Invalid type given. Parameter "type" must be "Admin", "Tutor" or "Member"',
'Client');
196 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
200 return $this->
__raiseError(
'Cannot create user instance!',
'Server');
203 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
209 require_once(
"Services/Administration/classes/class.ilSetting.php");
212 $course_members->updateNotification($tmp_user->getId(), $settings->get(
'mail_crs_admin_notification',
true));
232 if (!$this->__checkSession($sid)) {
235 if (!is_numeric($course_id)) {
237 'No valid course id given. Please choose an existing reference id of an ILIAS course',
244 $rbacsystem = $DIC[
'rbacsystem'];
249 return $this->
__raiseError(
'Invalid course id. Object with id "' . $course_id .
'" is not of type "course"',
'Client');
254 return $this->
__raiseError(
'Invalid user id. User with id "' . $user_id .
' does not exist',
'Client');
258 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
261 if (!$rbacsystem->checkAccess(
'manage_members', $course_id)) {
262 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
265 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
268 if (!$course_members->checkLastAdmin(array($user_id))) {
269 return $this->
__raiseError(
'Cannot deassign last administrator from course',
'Server');
272 $course_members->delete($user_id);
283 if (!$this->__checkSession($sid)) {
286 if (!is_numeric($course_id)) {
288 'No valid course id given. Please choose an existing reference id of an ILIAS course',
294 $rbacsystem = $DIC[
'rbacsystem'];
299 return $this->
__raiseError(
'Invalid course id. Object with id "' . $course_id .
'" is not of type "course"',
'Client');
304 return $this->
__raiseError(
'Invalid user id. User with id "' . $user_id .
' does not exist',
'Client');
308 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
311 if (!$rbacsystem->checkAccess(
'manage_members', $course_id)) {
312 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
315 include_once
'./Modules/Course/classes/class.ilCourseParticipants.php';
318 if ($crs_members->isAdmin($user_id)) {
321 if ($crs_members->isTutor($user_id)) {
324 if ($crs_members->isMember($user_id)) {
337 if (!$this->__checkSession($sid)) {
340 if (!is_numeric($course_id)) {
342 'No valid course id given. Please choose an existing reference id of an ILIAS course',
349 $rbacsystem = $DIC[
'rbacsystem'];
352 if ($this->
isFault($tmp_course)) {
375 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
378 $xml_writer->start();
380 return $xml_writer->getXML();
388 if (!$this->__checkSession($sid)) {
392 if (!is_numeric($course_id)) {
394 'No valid course id given. Please choose an existing reference id of an ILIAS course',
401 $rbacsystem = $DIC[
'rbacsystem'];
406 return $this->
__raiseError(
'Invalid course id. Object with id "' . $course_id .
'" is not of type "course"',
'Client');
411 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
414 if (!$rbacsystem->checkAccess(
'write', $course_id)) {
415 return $this->
__raiseError(
'Check access failed. No permission to write course',
'Server');
420 include_once
'Services/MetaData/classes/class.ilMD.php';
422 $md =
new ilMD($tmp_course->getId(), 0,
'crs');
425 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
429 include_once
'Modules/Course/classes/class.ilCourseWaitingList.php';
432 include_once
'Modules/Course/classes/class.ilCourseXMLParser.php';
435 $xml_parser->setXMLContent(
$xml);
437 $xml_parser->startParsing();
439 $tmp_course->MDUpdateListener(
'General');
458 if (!$this->__checkSession($sid)) {
464 $rbacreview = $DIC[
'rbacreview'];
465 $ilObjDataCache = $DIC[
'ilObjDataCache'];
466 $tree = $DIC[
'tree'];
468 include_once
'webservice/soap/classes/class.ilXMLResultSetParser.php';
473 return $this->
__raiseError($exception->getMessage(),
"Client");
475 $xmlResultSet =
$parser->getXMLResultSet();
477 if (!$xmlResultSet->hasColumn(
"user_id")) {
478 return $this->
__raiseError(
"parameter user_id is missing",
"Client");
481 if (!$xmlResultSet->hasColumn(
"status")) {
482 return $this->
__raiseError(
"parameter status is missing",
"Client");
485 $user_id = (int) $xmlResultSet->getValue(0,
"user_id");
486 $status = (int) $xmlResultSet->getValue(0,
"status");
491 #var_dump($xmlResultSet); 492 #echo "uid:".$user_id; 493 #echo "status:".$status; 497 foreach ($rbacreview->assignedRoles($user_id) as $role_id) {
499 #echo $role->getType(); 500 if ($role->getType() !=
"role") {
503 if ($role->getParent() == ROLE_FOLDER_ID) {
506 $role_title = $role->getTitle();
514 if (ilSoapCourseAdministration::MEMBER == ($status & ilSoapCourseAdministration::MEMBER) && strpos($role_title,
"member") !==
false) {
515 $ref_ids [] = $ref_id;
516 } elseif (ilSoapCourseAdministration::TUTOR == ($status & ilSoapCourseAdministration::TUTOR) && strpos($role_title,
"tutor") !==
false) {
517 $ref_ids [] = $ref_id;
518 } elseif (ilSoapCourseAdministration::ADMIN == ($status & ilSoapCourseAdministration::ADMIN) && strpos($role_title,
"admin") !==
false) {
519 $ref_ids [] = $ref_id;
520 } elseif (($status &
ilSoapCourseAdministration::OWNER) == ilSoapCourseAdministration::OWNER && $ilObjDataCache->lookupOwner($ilObjDataCache->lookupObjId($ref_id)) == $user_id) {
521 $ref_ids [] = $ref_id;
529 foreach ($owned_objects as $obj_id) {
531 foreach ($allrefs as $r) {
532 if ($tree->isDeleted($r)) {
535 if ($tree->isInTree($r)) {
539 if (count($refs) > 0) {
540 $ref_ids[] = array_pop($refs);
544 $ref_ids = array_unique($ref_ids);
548 $ref_ids = array_unique($ref_ids);
550 include_once
'webservice/soap/classes/class.ilXMLResultSetWriter.php';
551 include_once
'Modules/Course/classes/class.ilObjCourse.php';
552 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
555 $xmlResultSet->addColumn(
"ref_id");
556 $xmlResultSet->addColumn(
"xml");
557 $xmlResultSet->addColumn(
"parent_ref_id");
564 $permission = $user_id ==
$ilUser->getId() ?
'read' :
'write';
566 foreach ($ref_ids as $course_id) {
570 $row->setValue(
"ref_id", $course_id);
572 $xmlWriter->setAttachUsers(
false);
574 $row->setValue(
"xml", $xmlWriter->getXML());
575 $row->setValue(
"parent_ref_id", $tree->getParentId($course_id));
576 $xmlResultSet->addRow($row);
580 $xmlResultSetWriter->start();
581 return $xmlResultSetWriter->getXML();
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