ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilObjectDAV.php
Go to the documentation of this file.
1<?php
2
3use Sabre\DAV\Exception\BadRequest;
4use Sabre\DAV\Exception\Forbidden;
5use Sabre\DAV\Exception\NotImplemented;
6
17abstract class ilObjectDAV extends Sabre\DAV\Node
18{
20 protected $ref_id;
21
23 protected $obj;
24
26 protected $repo_helper;
27
29 protected $dav_helper;
30
42 {
43 $this->obj = &$a_obj;
44 $this->ref_id = $a_obj->getRefId();
45
46 $this->dav_helper = $dav_helper;
47 $this->repo_helper = $repo_helper;
48 }
49
54 public function getRefId()
55 {
56 return $this->ref_id;
57 }
58
63 public function getObjectId()
64 {
65 return ($this->obj == null) ? null : $this->obj->getId();
66 }
67
75 public function getLastModified()
76 {
77 return ($this->obj == null) ? null : strtotime($this->obj->getLastUpdateDate());
78 }
79
87 public function delete()
88 {
89 if ($this->repo_helper->checkAccess('delete', $this->ref_id)) {
90 $this->repo_helper->deleteObject($this->ref_id);
91 } else {
92 throw new Forbidden("Permission denied");
93 }
94 }
95
103 public function setName($a_name)
104 {
105 if ($this->repo_helper->checkAccess("write", $this->obj->getRefId())) {
106 if ($this->dav_helper->isDAVableObjTitle($a_name)) {
107 $this->obj->setTitle($a_name);
108 $this->obj->update();
109 } else {
110 throw new Forbidden('Forbidden characters in title');
111 }
112 } else {
113 throw new Forbidden('Permission denied');
114 }
115 }
116
122 public function getName()
123 {
124 return $this->obj->getTitle();
125 }
126
132 public function getObject()
133 {
134 return $this->obj;
135 }
136}
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.