33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
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();
94 $newObj->initDefaultRoles();
96 include_once
'Modules/Course/classes/class.ilCourseXMLParser.php';
99 $xml_parser->setXMLContent($crs_xml);
100 $xml_parser->startParsing();
101 return $newObj->getRefId() ? $newObj->getRefId() :
"0";
115 if(!is_numeric($course_id))
117 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
121 include_once
"./Services/Utilities/classes/class.ilUtil.php";
129 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
133 if(!$rbacsystem->checkAccess(
'delete',$course_id))
135 return $this->
__raiseError(
'Check access failed. No permission to delete course',
'Server');
139 global $tree,$rbacadmin,
$log;
141 if($tree->isDeleted($course_id))
143 return $this->
__raiseError(
'Node already deleted',
'Server');
146 $subnodes = $tree->getSubtree($tree->getNodeData($course_id));
147 foreach ($subnodes as $subnode)
149 $rbacadmin->revokePermission($subnode[
"child"]);
155 if(!$tree->saveSubTree($course_id))
157 return $this->
__raiseError(
'Node already deleted',
'Client');
161 $log->write(
"SOAP ilObjectGUI::confirmedDeleteObject(), moved ref_id ".$course_id.
" to trash");
179 if(!is_numeric($course_id))
181 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
192 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
196 if(!$rbacsystem->checkAccess(
'write',$course_id))
198 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
204 return $this->
__raiseError(
'Invalid user id. User with id "'. $user_id.
' does not exist',
'Client');
206 if(
$type !=
'Admin' and
210 return $this->
__raiseError(
'Invalid type given. Parameter "type" must be "Admin", "Tutor" or "Member"',
'Client');
215 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
220 return $this->
__raiseError(
'Cannot create user instance!',
'Server');
223 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
231 $course_members->updateNotification($tmp_user->getId(),1);
255 if(!is_numeric($course_id))
257 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
268 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
274 return $this->
__raiseError(
'Invalid user id. User with id "'. $user_id.
' does not exist',
'Client');
279 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
282 if(!$rbacsystem->checkAccess(
'write',$course_id))
284 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
287 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
290 if(!$course_members->checkLastAdmin(array($user_id)))
292 return $this->
__raiseError(
'Cannot deassign last administrator from course',
'Server');
295 $course_members->delete($user_id);
310 if(!is_numeric($course_id))
312 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
322 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
328 return $this->
__raiseError(
'Invalid user id. User with id "'. $user_id.
' does not exist',
'Client');
333 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
336 if(!$rbacsystem->checkAccess(
'write',$course_id))
338 return $this->
__raiseError(
'Check access failed. No permission to write to course',
'Server');
341 include_once
'./Modules/Course/classes/class.ilCourseParticipants.php';
344 if($crs_members->isAdmin($user_id))
348 if($crs_members->isTutor($user_id))
352 if($crs_members->isMember($user_id))
370 if(!is_numeric($course_id))
372 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
379 if ($this->
isFault($tmp_course)) {
402 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
405 $xml_writer->start();
407 return $xml_writer->getXML();
420 if(!is_numeric($course_id))
422 return $this->
__raiseError(
'No valid course id given. Please choose an existing reference id of an ILIAS course',
433 return $this->
__raiseError(
'Invalid course id. Object with id "'. $course_id.
'" is not of type "course"',
'Client');
439 return $this->
__raiseError(
'Cannot create course instance!',
'Server');
442 if(!$rbacsystem->checkAccess(
'write',$course_id))
444 return $this->
__raiseError(
'Check access failed. No permission to write course',
'Server');
449 include_once
'Services/MetaData/classes/class.ilMD.php';
451 $md =
new ilMD($tmp_course->getId(),0,
'crs');
454 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
458 include_once
'Modules/Course/classes/class.ilCourseWaitingList.php';
461 include_once
'Modules/Course/classes/class.ilCourseXMLParser.php';
464 $xml_parser->setXMLContent($xml);
466 $xml_parser->startParsing();
468 $tmp_course->MDUpdateListener(
'General');
492 global $rbacreview, $ilObjDataCache, $tree;
494 include_once
'webservice/soap/classes/class.ilXMLResultSetParser.php';
497 $parser->startParsing();
499 return $this->
__raiseError($exception->getMessage(),
"Client");
501 $xmlResultSet = $parser->getXMLResultSet();
503 if (!$xmlResultSet->hasColumn (
"user_id"))
504 return $this->
__raiseError(
"parameter user_id is missing",
"Client");
506 if (!$xmlResultSet->hasColumn (
"status"))
507 return $this->
__raiseError(
"parameter status is missing",
"Client");
509 $user_id = (int) $xmlResultSet->getValue (0,
"user_id");
510 $status = (int) $xmlResultSet->getValue (0,
"status");
515 #var_dump($xmlResultSet);
516 #echo "uid:".$user_id;
517 #echo "status:".$status;
521 foreach($rbacreview->assignedRoles($user_id) as $role_id)
525 #echo $role->getType();
526 if ($role->getType() !=
"role")
528 if ($role->getParent() == ROLE_FOLDER_ID)
532 $role_title = $role->getTitle();
540 if (ilSoapCourseAdministration::MEMBER == ($status & ilSoapCourseAdministration::MEMBER) && strpos($role_title,
"member") !==
false)
543 }
elseif (ilSoapCourseAdministration::TUTOR == ($status & ilSoapCourseAdministration::TUTOR) && strpos($role_title,
"tutor") !==
false)
546 }
elseif (ilSoapCourseAdministration::ADMIN == ($status & ilSoapCourseAdministration::ADMIN) && strpos($role_title,
"admin") !==
false)
559 foreach ($owned_objects as $obj_id) {
561 foreach($allrefs as $r)
563 if($tree->isDeleted($r))
567 if ($tree->isInTree($r))
572 if (count($refs) > 0)
573 $ref_ids[] = array_pop($refs);
577 $ref_ids = array_unique($ref_ids);
581 $ref_ids = array_unique($ref_ids);
583 include_once
'webservice/soap/classes/class.ilXMLResultSetWriter.php';
584 include_once
'Modules/Course/classes/class.ilObjCourse.php';
585 include_once
'Modules/Course/classes/class.ilCourseXMLWriter.php';
588 $xmlResultSet->addColumn(
"ref_id");
589 $xmlResultSet->addColumn(
"xml");
590 $xmlResultSet->addColumn(
"parent_ref_id");
592 foreach ($ref_ids as $course_id) {
596 $row->setValue(
"ref_id", $course_id);
598 $xmlWriter->setAttachUsers(
false);
600 $row->setValue(
"xml", $xmlWriter->getXML());
601 $row->setValue(
"parent_ref_id", $tree->getParentId($course_id));
602 $xmlResultSet->addRow(
$row);
606 $xmlResultSetWriter->start();
607 return $xmlResultSetWriter->getXML();