ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilWebDAVRepositoryHelper Class Reference
+ Collaboration diagram for ilWebDAVRepositoryHelper:

Public Member Functions

 __construct (protected ilAccessHandler $access, protected ilTree $tree, protected ilRepUtil $repository_util, protected ilWebDAVLocksRepository $locks_repository, protected ilObjFileInfoRepository $file_info_repository)
 
 deleteObject (int $ref_id)
 
 checkAccess (string $permission, int $ref_id)
 
 checkCreateAccessForType (int $ref_id, string $type)
 
 objectWithRefIdExists (int $ref_id)
 
 getObjectIdFromRefId (int $ref_id)
 
 getObjectTitleFromObjId (int $obj_id, bool $escape_forbidden_fileextension=false)
 
 getFilenameWithSanitizedFileExtension (int $obj_id)
 
 getParentOfRefId (int $ref_id)
 
 getObjectTypeFromObjId (int $obj_id)
 
 getObjectTitleFromRefId (int $ref_id, bool $escape_forbidden_fileextension=false)
 
 getObjectTypeFromRefId (int $ref_id)
 
 getChildrenOfRefId (int $ref_id)
 
 updateLocksAfterResettingObject (int $old_obj_id, int $new_obj_id)
 
 getFileInfo (int $obj_id)
 
 locks ()
 

Protected Member Functions

 getRawObjectTitleFromObjId (int $obj_id)
 

Detailed Description

Definition at line 23 of file class.ilWebDAVRepositoryHelper.php.

Constructor & Destructor Documentation

◆ __construct()

ilWebDAVRepositoryHelper::__construct ( protected ilAccessHandler  $access,
protected ilTree  $tree,
protected ilRepUtil  $repository_util,
protected ilWebDAVLocksRepository  $locks_repository,
protected ilObjFileInfoRepository  $file_info_repository 
)

Definition at line 25 of file class.ilWebDAVRepositoryHelper.php.

31 {
32 }

Member Function Documentation

◆ checkAccess()

ilWebDAVRepositoryHelper::checkAccess ( string  $permission,
int  $ref_id 
)

Definition at line 44 of file class.ilWebDAVRepositoryHelper.php.

44 : bool
45 {
46 return $this->access->checkAccess($permission, '', $ref_id);
47 }
$ref_id
Definition: ltiauth.php:66

References $ref_id, and ILIAS\Repository\access().

Referenced by deleteObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkCreateAccessForType()

ilWebDAVRepositoryHelper::checkCreateAccessForType ( int  $ref_id,
string  $type 
)

Definition at line 49 of file class.ilWebDAVRepositoryHelper.php.

49 : bool
50 {
51 return $this->access->checkAccess('create', '', $ref_id, $type);
52 }

References ILIAS\Repository\access().

+ Here is the call graph for this function:

◆ deleteObject()

ilWebDAVRepositoryHelper::deleteObject ( int  $ref_id)

Definition at line 34 of file class.ilWebDAVRepositoryHelper.php.

34 : void
35 {
36 if (!$this->checkAccess('delete', $ref_id)) {
37 throw new Forbidden("Permission denied");
38 }
39
40 $parent = $this->tree->getParentId($ref_id);
41 $this->repository_util->deleteObjects($parent, [$ref_id]);
42 }
checkAccess(string $permission, int $ref_id)

References $ref_id, and checkAccess().

+ Here is the call graph for this function:

◆ getChildrenOfRefId()

ilWebDAVRepositoryHelper::getChildrenOfRefId ( int  $ref_id)
Returns
int[]

Definition at line 117 of file class.ilWebDAVRepositoryHelper.php.

117 : array
118 {
119 return array_map(
120 'intval',
121 $this->tree->getChildIds($ref_id)
122 );
123 }

References $ref_id.

◆ getFileInfo()

ilWebDAVRepositoryHelper::getFileInfo ( int  $obj_id)

Definition at line 130 of file class.ilWebDAVRepositoryHelper.php.

131 {
132 return $this->file_info_repository->getByObjectId($obj_id);
133 }

◆ getFilenameWithSanitizedFileExtension()

ilWebDAVRepositoryHelper::getFilenameWithSanitizedFileExtension ( int  $obj_id)

Definition at line 73 of file class.ilWebDAVRepositoryHelper.php.

73 : string
74 {
75 $unescaped_title = $this->getRawObjectTitleFromObjId($obj_id);
76
77 try {
78 $escaped_title = ilFileUtils::getValidFilename($unescaped_title);
79 } catch (ilFileUtilsException) {
80 $escaped_title = '';
81 }
82
83 return $escaped_title;
84 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getValidFilename(string $a_filename)

References getRawObjectTitleFromObjId(), and ilFileUtils\getValidFilename().

Referenced by getObjectTitleFromObjId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjectIdFromRefId()

ilWebDAVRepositoryHelper::getObjectIdFromRefId ( int  $ref_id)

Definition at line 59 of file class.ilWebDAVRepositoryHelper.php.

59 : int
60 {
62 }
static _lookupObjectId(int $ref_id)

References $ref_id, and ilObject\_lookupObjectId().

Referenced by getObjectTitleFromRefId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjectTitleFromObjId()

ilWebDAVRepositoryHelper::getObjectTitleFromObjId ( int  $obj_id,
bool  $escape_forbidden_fileextension = false 
)

Definition at line 64 of file class.ilWebDAVRepositoryHelper.php.

64 : string
65 {
66 if ($escape_forbidden_fileextension && ilObject::_lookupType($obj_id) === 'file') {
67 return $this->getFilenameWithSanitizedFileExtension($obj_id);
68 }
69
70 return $this->getRawObjectTitleFromObjId($obj_id);
71 }
static _lookupType(int $id, bool $reference=false)

References ilObject\_lookupType(), getFilenameWithSanitizedFileExtension(), and getRawObjectTitleFromObjId().

Referenced by getObjectTitleFromRefId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjectTitleFromRefId()

ilWebDAVRepositoryHelper::getObjectTitleFromRefId ( int  $ref_id,
bool  $escape_forbidden_fileextension = false 
)

Definition at line 101 of file class.ilWebDAVRepositoryHelper.php.

101 : string
102 {
103 $obj_id = $this->getObjectIdFromRefId($ref_id);
104
105 return $this->getObjectTitleFromObjId($obj_id, $escape_forbidden_fileextension);
106 }
getObjectTitleFromObjId(int $obj_id, bool $escape_forbidden_fileextension=false)

References getObjectIdFromRefId(), and getObjectTitleFromObjId().

+ Here is the call graph for this function:

◆ getObjectTypeFromObjId()

ilWebDAVRepositoryHelper::getObjectTypeFromObjId ( int  $obj_id)

Definition at line 96 of file class.ilWebDAVRepositoryHelper.php.

96 : string
97 {
98 return ilObject::_lookupType($obj_id);
99 }

References ilObject\_lookupType().

+ Here is the call graph for this function:

◆ getObjectTypeFromRefId()

ilWebDAVRepositoryHelper::getObjectTypeFromRefId ( int  $ref_id)

Definition at line 108 of file class.ilWebDAVRepositoryHelper.php.

108 : string
109 {
110 return ilObject::_lookupType($ref_id, true);
111 }

References $ref_id, and ilObject\_lookupType().

+ Here is the call graph for this function:

◆ getParentOfRefId()

ilWebDAVRepositoryHelper::getParentOfRefId ( int  $ref_id)

Definition at line 91 of file class.ilWebDAVRepositoryHelper.php.

91 : int
92 {
93 return $this->tree->getParentId($ref_id);
94 }

References $ref_id.

◆ getRawObjectTitleFromObjId()

ilWebDAVRepositoryHelper::getRawObjectTitleFromObjId ( int  $obj_id)
protected

Definition at line 86 of file class.ilWebDAVRepositoryHelper.php.

86 : string
87 {
88 return ilObject::_lookupTitle($obj_id);
89 }
static _lookupTitle(int $obj_id)

References ilObject\_lookupTitle().

Referenced by getFilenameWithSanitizedFileExtension(), and getObjectTitleFromObjId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ locks()

ilWebDAVRepositoryHelper::locks ( )

Definition at line 135 of file class.ilWebDAVRepositoryHelper.php.

136 {
137 return $this->locks_repository;
138 }

◆ objectWithRefIdExists()

ilWebDAVRepositoryHelper::objectWithRefIdExists ( int  $ref_id)

Definition at line 54 of file class.ilWebDAVRepositoryHelper.php.

54 : bool
55 {
56 return ilObject::_exists($ref_id, true);
57 }
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data

References $ref_id, and ilObject\_exists().

+ Here is the call graph for this function:

◆ updateLocksAfterResettingObject()

ilWebDAVRepositoryHelper::updateLocksAfterResettingObject ( int  $old_obj_id,
int  $new_obj_id 
)

Definition at line 125 of file class.ilWebDAVRepositoryHelper.php.

125 : void
126 {
127 $this->locks_repository->updateLocks($old_obj_id, $new_obj_id);
128 }

The documentation for this class was generated from the following file: