33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
54 if(!$this->__checkSession($sid))
61 return $this->
__raiseError(
'No valid target id given. Please choose an existing reference id of an ILIAS category',
69 return $this->
__raiseError(
'No valid target given.',
'Client');
74 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_OBJECT_DELETED');
77 if(!$rbacsystem->checkAccess(
'create',
$target_id,
'crs'))
79 return $this->
__raiseError(
'Check access failed. No permission to create courses',
'Server');
84 include_once(
"Modules/Course/classes/class.ilObjCourse.php");
87 $newObj->setType(
'crs');
88 $newObj->setTitle(
'dummy');
89 $newObj->setDescription(
"");
90 $newObj->create(
true);
91 $newObj->createReference();
95 include_once
'Modules/Course/classes/class.ilCourseXMLParser.php';
98 $xml_parser->setXMLContent($crs_xml);
99 $xml_parser->startParsing();
100 return $newObj->getRefId() ? $newObj->getRefId() :
"0";
109 if(!$this->__checkSession($sid))
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',
120 include_once
"./Services/Utilities/classes/class.ilUtil.php";
128 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
132 if(!$rbacsystem->checkAccess(
'delete',$course_id))
134 return $this->
__raiseError(
'Check access failed. No permission to delete course',
'Server');
138 global $tree,$rbacadmin,
$log;
140 if($tree->isDeleted($course_id))
142 return $this->
__raiseError(
'Node already deleted',
'Server');
145 $subnodes = $tree->getSubtree($tree->getNodeData($course_id));
146 foreach ($subnodes as $subnode)
148 $rbacadmin->revokePermission($subnode[
"child"]);
154 if(!$tree->saveSubTree($course_id,
true))
156 return $this->
__raiseError(
'Node already deleted',
'Client');
160 $log->write(
"SOAP ilObjectGUI::confirmedDeleteObject(), moved ref_id ".$course_id.
" to trash");
173 if(!$this->__checkSession($sid))
178 if(!is_numeric($course_id))
180 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
191 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
195 if(!$rbacsystem->checkAccess(
'write',$course_id))
197 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
203 return $this->
__raiseError(
'Invalid user id. User with id "'. $user_id.
' does not exist',
'Client');
205 if($type !=
'Admin' and
209 return $this->
__raiseError(
'Invalid type given. Parameter "type" must be "Admin", "Tutor" or "Member"',
'Client');
214 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
219 return $this->
__raiseError(
'Cannot create user instance!',
'Server');
222 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
230 $course_members->updateNotification($tmp_user->getId(),1);
250 if(!$this->__checkSession($sid))
254 if(!is_numeric($course_id))
256 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
267 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
273 return $this->
__raiseError(
'Invalid user id. User with id "'. $user_id.
' does not exist',
'Client');
278 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
281 if(!$rbacsystem->checkAccess(
'write',$course_id))
283 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
286 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
289 if(!$course_members->checkLastAdmin(array($user_id)))
291 return $this->
__raiseError(
'Cannot deassign last administrator from course',
'Server');
294 $course_members->delete($user_id);
305 if(!$this->__checkSession($sid))
309 if(!is_numeric($course_id))
311 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
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))
365 if(!$this->__checkSession($sid))
369 if(!is_numeric($course_id))
371 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
378 if ($this->
isFault($tmp_course)) {
401 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
404 $xml_writer->start();
406 return $xml_writer->getXML();
414 if(!$this->__checkSession($sid))
419 if(!is_numeric($course_id))
421 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
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');
486 if(!$this->__checkSession($sid))
491 global $rbacreview, $ilObjDataCache, $tree;
493 include_once
'webservice/soap/classes/class.ilXMLResultSetParser.php';
496 $parser->startParsing();
498 return $this->
__raiseError($exception->getMessage(),
"Client");
500 $xmlResultSet = $parser->getXMLResultSet();
502 if (!$xmlResultSet->hasColumn (
"user_id"))
503 return $this->
__raiseError(
"parameter user_id is missing",
"Client");
505 if (!$xmlResultSet->hasColumn (
"status"))
506 return $this->
__raiseError(
"parameter status is missing",
"Client");
508 $user_id = (int) $xmlResultSet->getValue (0,
"user_id");
509 $status = (int) $xmlResultSet->getValue (0,
"status");
514 #var_dump($xmlResultSet);
515 #echo "uid:".$user_id;
516 #echo "status:".$status;
520 foreach($rbacreview->assignedRoles($user_id) as $role_id)
524 #echo $role->getType();
525 if ($role->getType() !=
"role")
527 if ($role->getParent() == ROLE_FOLDER_ID)
531 $role_title = $role->getTitle();
539 if (ilSoapCourseAdministration::MEMBER == ($status & ilSoapCourseAdministration::MEMBER) && strpos($role_title,
"member") !==
false)
542 } elseif (ilSoapCourseAdministration::TUTOR == ($status & ilSoapCourseAdministration::TUTOR) && strpos($role_title,
"tutor") !==
false)
545 } elseif (ilSoapCourseAdministration::ADMIN == ($status & ilSoapCourseAdministration::ADMIN) && strpos($role_title,
"admin") !==
false)
558 foreach ($owned_objects as $obj_id) {
560 foreach($allrefs as $r)
562 if($tree->isDeleted($r))
566 if ($tree->isInTree($r))
571 if (count($refs) > 0)
572 $ref_ids[] = array_pop($refs);
576 $ref_ids = array_unique($ref_ids);
580 $ref_ids = array_unique($ref_ids);
582 include_once
'webservice/soap/classes/class.ilXMLResultSetWriter.php';
583 include_once
'Modules/Course/classes/class.ilObjCourse.php';
584 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
587 $xmlResultSet->addColumn(
"ref_id");
588 $xmlResultSet->addColumn(
"xml");
589 $xmlResultSet->addColumn(
"parent_ref_id");
591 foreach ($ref_ids as $course_id) {
595 $row->setValue(
"ref_id", $course_id);
597 $xmlWriter->setAttachUsers(
false);
599 $row->setValue(
"xml", $xmlWriter->getXML());
600 $row->setValue(
"parent_ref_id", $tree->getParentId($course_id));
601 $xmlResultSet->addRow(
$row);
605 $xmlResultSetWriter->start();
606 return $xmlResultSetWriter->getXML();