3 declare(strict_types=1);
28 if (!$request_ref_id) {
30 'No ref id given. Aborting!',
36 $rbacsystem = $DIC[
'rbacsystem'];
38 $ilLog = $DIC[
'ilLog'];
43 'No weblink found for id: ' . $request_ref_id,
49 return $this->
raiseError(
"Parent with ID $request_ref_id has been deleted.",
'Client');
53 $permission_ok =
false;
54 $write_permission_ok =
false;
57 if ($rbacsystem->checkAccess(
'edit', $ref_id)) {
58 $write_permission_ok =
true;
61 if ($rbacsystem->checkAccess(
'read', $ref_id)) {
62 $permission_ok =
true;
67 if (!$permission_ok && !$write_permission_ok) {
69 'No permission to edit the object with id: ' . $request_ref_id,
75 include_once
'./Modules/WebResource/classes/class.ilWebLinkXmlWriter.php';
77 $writer->setObjId($obj_id);
80 return $writer->xmlDumpMem(
true);
82 return $this->
raiseError($e->getMessage(),
'Client');
89 public function createWebLink(
string $sid,
int $target_id,
string $weblink_xml)
99 $rbacsystem = $DIC[
'rbacsystem'];
100 $tree = $DIC[
'tree'];
101 $ilLog = $DIC[
'ilLog'];
104 return $this->
raiseError(
'No valid target given.',
'Client');
108 return $this->
raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_OBJECT_DELETED');
113 $allowed_types = array(
'cat',
'grp',
'crs',
'fold',
'root');
114 if (!in_array($target_obj->getType(), $allowed_types)) {
116 'No valid target type. Target must be reference id of "course, group, root, category or folder"',
121 if (!$rbacsystem->checkAccess(
'create', $target_id,
"webr")) {
122 return $this->
raiseError(
'No permission to create weblink in target ' . $target_id .
'!',
'Client');
126 include_once
'./Modules/WebResource/classes/class.ilObjLinkResource.php';
127 include_once
'./Modules/WebResource/classes/class.ilWebLinkXmlParser.php';
130 $webl->setTitle(
'XML Import');
132 $webl->createReference();
133 $webl->putInTree($target_id);
134 $webl->setPermissions($target_id);
141 return $this->
raiseError($e->getMessage(),
'Client');
145 return $webl->getRefId();
151 public function updateWebLink(
string $sid,
int $request_ref_id,
string $weblink_xml)
161 $rbacsystem = $DIC[
'rbacsystem'];
162 $tree = $DIC[
'tree'];
163 $ilLog = $DIC[
'ilLog'];
167 'Cannot perform update since weblink has been deleted.',
168 'CLIENT_OBJECT_DELETED' 174 'No weblink found for id: ' . $request_ref_id,
175 'CLIENT_OBJECT_NOT_FOUND' 180 $permission_ok =
false;
182 if ($rbacsystem->checkAccess(
'edit', $ref_id)) {
183 $permission_ok =
true;
188 if (!$permission_ok) {
190 'No permission to edit the weblink with id: ' . $request_ref_id,
198 'Wrong obj id or type for weblink with id ' . $request_ref_id,
204 include_once
'./Modules/WebResource/classes/class.ilWebLinkXmlParser.php';
210 return $this->
raiseError($e->getMessage(),
'Client');
XML parser for weblink xml.
static _getAllReferences(int $id)
get all reference ids for object ID
raiseError(string $a_message, $a_code)
SaxParserException thrown by ilSaxParser if property throwException is set.
readWebLink(string $sid, int $request_ref_id)
createWebLink(string $sid, int $target_id, string $weblink_xml)
Soap methods for adminstrating web links.
checkSession(string $sid)
static _isInTrash(int $ref_id)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupObjectId(int $ref_id)
updateWebLink(string $sid, int $request_ref_id, string $weblink_xml)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...