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',
63 return $this->
__raiseError(
'No valid target given.',
'Client');
67 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_OBJECT_DELETED');
70 if (!$rbacsystem->checkAccess(
'create',
$target_id,
'crs')) {
71 return $this->
__raiseError(
'Check access failed. No permission to create courses',
'Server');
76 include_once(
"Modules/Course/classes/class.ilObjCourse.php");
79 $newObj->setType(
'crs');
80 $newObj->setTitle(
'dummy');
81 $newObj->setDescription(
"");
82 $newObj->create(
true);
83 $newObj->createReference();
87 include_once
'Modules/Course/classes/class.ilCourseXMLParser.php';
90 $xml_parser->setXMLContent($crs_xml);
91 $xml_parser->startParsing();
92 return $newObj->getRefId() ? $newObj->getRefId() :
"0";
100 if (!$this->__checkSession($sid)) {
104 if (!is_numeric($course_id)) {
106 'No valid course id given. Please choose an existing reference id of an ILIAS course',
111 include_once
"./Services/Utilities/classes/class.ilUtil.php";
117 return $this->
__raiseError(
'Invalid course id. Object with id "' . $course_id .
'" is not of type "course"',
'Client');
121 if (!$rbacsystem->checkAccess(
'delete', $course_id)) {
122 return $this->
__raiseError(
'Check access failed. No permission to delete course',
'Server');
126 global $tree,$rbacadmin,
$log;
128 if ($tree->isDeleted($course_id)) {
129 return $this->
__raiseError(
'Node already deleted',
'Server');
132 $subnodes = $tree->getSubtree($tree->getNodeData($course_id));
133 foreach ($subnodes as $subnode) {
134 $rbacadmin->revokePermission($subnode[
"child"]);
139 if (!$tree->saveSubTree($course_id,
true)) {
140 return $this->
__raiseError(
'Node already deleted',
'Client');
144 $log->write(
"SOAP ilObjectGUI::confirmedDeleteObject(), moved ref_id " . $course_id .
" to trash");
157 if (!$this->__checkSession($sid)) {
161 if (!is_numeric($course_id)) {
163 'No valid course id given. Please choose an existing reference id of an ILIAS course',
173 return $this->
__raiseError(
'Invalid course id. Object with id "' . $course_id .
'" is not of type "course"',
'Client');
177 if (!$rbacsystem->checkAccess(
'manage_members', $course_id)) {
178 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
183 return $this->
__raiseError(
'Invalid user id. User with id "' . $user_id .
' does not exist',
'Client');
185 if (
$type !=
'Admin' and
188 return $this->
__raiseError(
'Invalid type given. Parameter "type" must be "Admin", "Tutor" or "Member"',
'Client');
192 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
196 return $this->
__raiseError(
'Cannot create user instance!',
'Server');
199 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
205 require_once(
"Services/Administration/classes/class.ilSetting.php");
208 $course_members->updateNotification($tmp_user->getId(), $settings->get(
'mail_crs_admin_notification',
true));
228 if (!$this->__checkSession($sid)) {
231 if (!is_numeric($course_id)) {
233 'No valid course id given. Please choose an existing reference id of an ILIAS course',
243 return $this->
__raiseError(
'Invalid course id. Object with id "' . $course_id .
'" is not of type "course"',
'Client');
248 return $this->
__raiseError(
'Invalid user id. User with id "' . $user_id .
' does not exist',
'Client');
252 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
255 if (!$rbacsystem->checkAccess(
'manage_members', $course_id)) {
256 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
259 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
262 if (!$course_members->checkLastAdmin(
array($user_id))) {
263 return $this->
__raiseError(
'Cannot deassign last administrator from course',
'Server');
266 $course_members->delete($user_id);
277 if (!$this->__checkSession($sid)) {
280 if (!is_numeric($course_id)) {
282 'No valid course id given. Please choose an existing reference id of an ILIAS course',
291 return $this->
__raiseError(
'Invalid course id. Object with id "' . $course_id .
'" is not of type "course"',
'Client');
296 return $this->
__raiseError(
'Invalid user id. User with id "' . $user_id .
' does not exist',
'Client');
300 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
303 if (!$rbacsystem->checkAccess(
'manage_members', $course_id)) {
304 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
307 include_once
'./Modules/Course/classes/class.ilCourseParticipants.php';
310 if ($crs_members->isAdmin($user_id)) {
313 if ($crs_members->isTutor($user_id)) {
316 if ($crs_members->isMember($user_id)) {
329 if (!$this->__checkSession($sid)) {
332 if (!is_numeric($course_id)) {
334 'No valid course id given. Please choose an existing reference id of an ILIAS course',
342 if ($this->
isFault($tmp_course)) {
365 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
368 $xml_writer->start();
370 return $xml_writer->getXML();
378 if (!$this->__checkSession($sid)) {
382 if (!is_numeric($course_id)) {
384 'No valid course id given. Please choose an existing reference id of an ILIAS course',
394 return $this->
__raiseError(
'Invalid course id. Object with id "' . $course_id .
'" is not of type "course"',
'Client');
399 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
402 if (!$rbacsystem->checkAccess(
'write', $course_id)) {
403 return $this->
__raiseError(
'Check access failed. No permission to write course',
'Server');
408 include_once
'Services/MetaData/classes/class.ilMD.php';
410 $md =
new ilMD($tmp_course->getId(), 0,
'crs');
413 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
417 include_once
'Modules/Course/classes/class.ilCourseWaitingList.php';
420 include_once
'Modules/Course/classes/class.ilCourseXMLParser.php';
423 $xml_parser->setXMLContent(
$xml);
425 $xml_parser->startParsing();
427 $tmp_course->MDUpdateListener(
'General');
446 if (!$this->__checkSession($sid)) {
450 global $rbacreview, $ilObjDataCache, $tree;
452 include_once
'webservice/soap/classes/class.ilXMLResultSetParser.php';
457 return $this->
__raiseError($exception->getMessage(),
"Client");
459 $xmlResultSet =
$parser->getXMLResultSet();
461 if (!$xmlResultSet->hasColumn(
"user_id")) {
462 return $this->
__raiseError(
"parameter user_id is missing",
"Client");
465 if (!$xmlResultSet->hasColumn(
"status")) {
466 return $this->
__raiseError(
"parameter status is missing",
"Client");
469 $user_id = (int) $xmlResultSet->getValue(0,
"user_id");
470 $status = (int) $xmlResultSet->getValue(0,
"status");
475 #var_dump($xmlResultSet); 476 #echo "uid:".$user_id; 477 #echo "status:".$status; 481 foreach ($rbacreview->assignedRoles($user_id) as $role_id) {
483 #echo $role->getType(); 484 if ($role->getType() !=
"role") {
487 if ($role->getParent() == ROLE_FOLDER_ID) {
490 $role_title = $role->getTitle();
498 if (ilSoapCourseAdministration::MEMBER == ($status & ilSoapCourseAdministration::MEMBER) && strpos($role_title,
"member") !==
false) {
499 $ref_ids [] = $ref_id;
500 } elseif (ilSoapCourseAdministration::TUTOR == ($status & ilSoapCourseAdministration::TUTOR) && strpos($role_title,
"tutor") !==
false) {
501 $ref_ids [] = $ref_id;
502 } elseif (ilSoapCourseAdministration::ADMIN == ($status & ilSoapCourseAdministration::ADMIN) && strpos($role_title,
"admin") !==
false) {
503 $ref_ids [] = $ref_id;
504 } elseif (($status &
ilSoapCourseAdministration::OWNER) == ilSoapCourseAdministration::OWNER && $ilObjDataCache->lookupOwner($ilObjDataCache->lookupObjId($ref_id)) == $user_id) {
505 $ref_ids [] = $ref_id;
513 foreach ($owned_objects as $obj_id) {
515 foreach ($allrefs as
$r) {
516 if ($tree->isDeleted($r)) {
519 if ($tree->isInTree($r)) {
523 if (count($refs) > 0) {
524 $ref_ids[] = array_pop($refs);
528 $ref_ids = array_unique($ref_ids);
532 $ref_ids = array_unique($ref_ids);
534 include_once
'webservice/soap/classes/class.ilXMLResultSetWriter.php';
535 include_once
'Modules/Course/classes/class.ilObjCourse.php';
536 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
539 $xmlResultSet->addColumn(
"ref_id");
540 $xmlResultSet->addColumn(
"xml");
541 $xmlResultSet->addColumn(
"parent_ref_id");
546 $permission = $user_id == $ilUser->getId() ?
'read' :
'write';
548 foreach ($ref_ids as $course_id) {
552 $row->setValue(
"ref_id", $course_id);
554 $xmlWriter->setAttachUsers(
false);
556 $row->setValue(
"xml", $xmlWriter->getXML());
557 $row->setValue(
"parent_ref_id", $tree->getParentId($course_id));
558 $xmlResultSet->addRow(
$row);
562 $xmlResultSetWriter->start();
563 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)
Create styles array
The data for the language used.
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