33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
49 if(!$this->__checkSession($sid))
56 return $this->
__raiseError(
'No valid target id given. Please choose an existing reference id of an ILIAS category',
64 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'))
74 return $this->
__raiseError(
'Check access failed. No permission to create courses',
'Server');
79 include_once(
"Modules/Course/classes/class.ilObjCourse.php");
82 $newObj->setType(
'crs');
83 $newObj->setTitle(
'dummy');
84 $newObj->setDescription(
"");
85 $newObj->create(
true);
86 $newObj->createReference();
90 include_once
'Modules/Course/classes/class.ilCourseXMLParser.php';
93 $xml_parser->setXMLContent($crs_xml);
94 $xml_parser->startParsing();
95 return $newObj->getRefId() ? $newObj->getRefId() :
"0";
104 if(!$this->__checkSession($sid))
109 if(!is_numeric($course_id))
111 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
115 include_once
"./Services/Utilities/classes/class.ilUtil.php";
123 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
127 if(!$rbacsystem->checkAccess(
'delete',$course_id))
129 return $this->
__raiseError(
'Check access failed. No permission to delete course',
'Server');
133 global $tree,$rbacadmin,
$log;
135 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)
143 $rbacadmin->revokePermission($subnode[
"child"]);
149 if(!$tree->saveSubTree($course_id,
true))
151 return $this->
__raiseError(
'Node already deleted',
'Client');
155 $log->write(
"SOAP ilObjectGUI::confirmedDeleteObject(), moved ref_id ".$course_id.
" to trash");
168 if(!$this->__checkSession($sid))
173 if(!is_numeric($course_id))
175 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
186 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
190 if(!$rbacsystem->checkAccess(
'write',$course_id))
192 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
198 return $this->
__raiseError(
'Invalid user id. User with id "'. $user_id.
' does not exist',
'Client');
200 if($type !=
'Admin' and 204 return $this->
__raiseError(
'Invalid type given. Parameter "type" must be "Admin", "Tutor" or "Member"',
'Client');
209 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
214 return $this->
__raiseError(
'Cannot create user instance!',
'Server');
217 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
224 require_once(
"Services/Administration/classes/class.ilSetting.php");
227 $course_members->updateNotification($tmp_user->getId(),$settings->get(
'mail_crs_admin_notification',
true));
247 if(!$this->__checkSession($sid))
251 if(!is_numeric($course_id))
253 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
264 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
270 return $this->
__raiseError(
'Invalid user id. User with id "'. $user_id.
' does not exist',
'Client');
275 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
278 if(!$rbacsystem->checkAccess(
'write',$course_id))
280 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
283 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
286 if(!$course_members->checkLastAdmin(
array($user_id)))
288 return $this->
__raiseError(
'Cannot deassign last administrator from course',
'Server');
291 $course_members->delete($user_id);
302 if(!$this->__checkSession($sid))
306 if(!is_numeric($course_id))
308 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
318 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
324 return $this->
__raiseError(
'Invalid user id. User with id "'. $user_id.
' does not exist',
'Client');
329 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
332 if(!$rbacsystem->checkAccess(
'write',$course_id))
334 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
337 include_once
'./Modules/Course/classes/class.ilCourseParticipants.php';
340 if($crs_members->isAdmin($user_id))
344 if($crs_members->isTutor($user_id))
348 if($crs_members->isMember($user_id))
362 if(!$this->__checkSession($sid))
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',
375 if ($this->
isFault($tmp_course)) {
398 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
401 $xml_writer->start();
403 return $xml_writer->getXML();
411 if(!$this->__checkSession($sid))
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',
429 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
435 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
438 if(!$rbacsystem->checkAccess(
'write',$course_id))
440 return $this->
__raiseError(
'Check access failed. No permission to write course',
'Server');
445 include_once
'Services/MetaData/classes/class.ilMD.php';
447 $md =
new ilMD($tmp_course->getId(),0,
'crs');
450 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
454 include_once
'Modules/Course/classes/class.ilCourseWaitingList.php';
457 include_once
'Modules/Course/classes/class.ilCourseXMLParser.php';
460 $xml_parser->setXMLContent($xml);
462 $xml_parser->startParsing();
464 $tmp_course->MDUpdateListener(
'General');
483 if(!$this->__checkSession($sid))
488 global $rbacreview, $ilObjDataCache, $tree;
490 include_once
'webservice/soap/classes/class.ilXMLResultSetParser.php';
495 return $this->
__raiseError($exception->getMessage(),
"Client");
497 $xmlResultSet =
$parser->getXMLResultSet();
499 if (!$xmlResultSet->hasColumn (
"user_id"))
500 return $this->
__raiseError(
"parameter user_id is missing",
"Client");
502 if (!$xmlResultSet->hasColumn (
"status"))
503 return $this->
__raiseError(
"parameter status is missing",
"Client");
505 $user_id = (int) $xmlResultSet->getValue (0,
"user_id");
506 $status = (int) $xmlResultSet->getValue (0,
"status");
511 #var_dump($xmlResultSet); 512 #echo "uid:".$user_id; 513 #echo "status:".$status; 517 foreach($rbacreview->assignedRoles($user_id) as $role_id)
521 #echo $role->getType(); 522 if ($role->getType() !=
"role")
524 if ($role->getParent() == ROLE_FOLDER_ID)
528 $role_title = $role->getTitle();
536 if (ilSoapCourseAdministration::MEMBER == ($status & ilSoapCourseAdministration::MEMBER) && strpos($role_title,
"member") !==
false)
539 } elseif (ilSoapCourseAdministration::TUTOR == ($status & ilSoapCourseAdministration::TUTOR) && strpos($role_title,
"tutor") !==
false)
542 } elseif (ilSoapCourseAdministration::ADMIN == ($status & ilSoapCourseAdministration::ADMIN) && strpos($role_title,
"admin") !==
false)
555 foreach ($owned_objects as $obj_id) {
557 foreach($allrefs as
$r)
559 if($tree->isDeleted($r))
563 if ($tree->isInTree($r))
568 if (count($refs) > 0)
569 $ref_ids[] = array_pop($refs);
573 $ref_ids = array_unique($ref_ids);
577 $ref_ids = array_unique($ref_ids);
579 include_once
'webservice/soap/classes/class.ilXMLResultSetWriter.php';
580 include_once
'Modules/Course/classes/class.ilObjCourse.php';
581 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
584 $xmlResultSet->addColumn(
"ref_id");
585 $xmlResultSet->addColumn(
"xml");
586 $xmlResultSet->addColumn(
"parent_ref_id");
591 $permission = $user_id == $ilUser->getId() ?
'read' :
'write';
593 foreach ($ref_ids as $course_id) {
597 $row->setValue(
"ref_id", $course_id);
599 $xmlWriter->setAttachUsers(
false);
601 $row->setValue(
"xml", $xmlWriter->getXML());
602 $row->setValue(
"parent_ref_id", $tree->getParentId($course_id));
603 $xmlResultSet->addRow(
$row);
607 $xmlResultSetWriter->start();
608 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