ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjectDAV.php
Go to the documentation of this file.
1<?php
2
3use Sabre\DAV\Exception\Forbidden;
4
15abstract class ilObjectDAV extends Sabre\DAV\Node
16{
18 protected $ref_id;
19
21 protected $obj;
22
24 protected $request;
25
27 protected $repo_helper;
28
30 protected $dav_helper;
31
43 {
44 $this->obj = &$a_obj;
45 $this->ref_id = $a_obj->getRefId();
46
47 global $DIC;
48 $this->request = $DIC->http()->request();
49
50 $this->dav_helper = $dav_helper;
51 $this->repo_helper = $repo_helper;
52 }
53
58 public function getRefId()
59 {
60 return $this->ref_id;
61 }
62
67 public function getObjectId()
68 {
69 return ($this->obj == null) ? null : $this->obj->getId();
70 }
71
79 public function getLastModified()
80 {
81 return ($this->obj == null) ? null : strtotime($this->obj->getLastUpdateDate());
82 }
83
91 public function delete()
92 {
93 if ($this->repo_helper->checkAccess('delete', $this->ref_id)) {
94 $this->repo_helper->deleteObject($this->ref_id);
95 } else {
96 throw new Forbidden("Permission denied");
97 }
98 }
99
107 public function setName($a_name)
108 {
109 if ($this->repo_helper->checkAccess("write", $this->obj->getRefId())) {
110 if ($this->dav_helper->isDAVableObjTitle($a_name)) {
111 $this->obj->setTitle($a_name);
112 $this->obj->update();
113 } else {
114 throw new Forbidden('Forbidden characters in title');
115 }
116 } else {
117 throw new Forbidden('Permission denied');
118 }
119 }
120
126 public function getName()
127 {
128 return $this->obj->getTitle();
129 }
130
136 public function getObject()
137 {
138 return $this->obj;
139 }
140}
An exception for terminatinating execution or to throw for unit testing.
Class ilObjectDAV.
__construct(ilObject $a_obj, ilWebDAVRepositoryHelper $repo_helper, ilWebDAVObjDAVHelper $dav_helper)
Constructor for DAV Object.
getObject()
Returns ILIAS Object.
setName($a_name)
Renames the node.
getObjectId()
Returns the object id of this object.
getRefId()
Returns the ref id of this object.
getName()
SabreDAV interface function .
getLastModified()
Returns the last modification time as a unix timestamp.
Class ilObject Basic functions for all objects.
getRefId()
get reference id @access public
Class ilWebDAVObjDAVHelper.
Class ilWebDAVRepositoryHelper.
global $DIC
Definition: goto.php:24