ILIAS  release_8 Revision v8.24
ilDAVProblemInfoFile Class Reference
+ Inheritance diagram for ilDAVProblemInfoFile:
+ Collaboration diagram for ilDAVProblemInfoFile:

Public Member Functions

 __construct (int $container_ref_id, ilWebDAVRepositoryHelper $repo_helper, ilWebDAVObjFactory $dav_object_factory, ilLanguage $language)
 
 put ($data)
 
 get ()
 
 getName ()
 
 getContentType ()
 
 getETag ()
 
 getSize ()
 
 setName ($a_name)
 
 delete ()
 
 getLastModified ()
 

Data Fields

const PROBLEM_INFO_FILE_NAME = '#!_WEBDAV_INFORMATION.txt'
 
const PROBLEM_DUPLICATE_OBJECTNAME = 'duplicate'
 
const PROBLEM_FORBIDDEN_CHARACTERS = 'forbidden_characters'
 
const PROBLEM_INFO_NAME_DUPLICATE = 'info_name_duplicate'
 

Protected Member Functions

 analyseObjectsOfDAVContainer ()
 
 createMessageStringFromProblemInfoArray (array $problem_infos)
 

Protected Attributes

int $container_ref_id
 
ilWebDAVRepositoryHelper $repo_helper
 
ilWebDAVObjFactory $dav_object_factory
 
ilLanguage $language
 

Detailed Description

Definition at line 24 of file class.ilDAVProblemInfoFile.php.

Constructor & Destructor Documentation

◆ __construct()

ilDAVProblemInfoFile::__construct ( int  $container_ref_id,
ilWebDAVRepositoryHelper  $repo_helper,
ilWebDAVObjFactory  $dav_object_factory,
ilLanguage  $language 
)

Definition at line 37 of file class.ilDAVProblemInfoFile.php.

42 {
43 $this->container_ref_id = $container_ref_id;
44 $this->repo_helper = $repo_helper;
45 $this->dav_object_factory = $dav_object_factory;
46 $this->language = $language;
47 }
ilWebDAVRepositoryHelper $repo_helper
ilWebDAVObjFactory $dav_object_factory

References $container_ref_id, $dav_object_factory, $language, $repo_helper, and ILIAS\UI\examples\Symbol\Glyph\Language\language().

+ Here is the call graph for this function:

Member Function Documentation

◆ analyseObjectsOfDAVContainer()

ilDAVProblemInfoFile::analyseObjectsOfDAVContainer ( )
protected
Returns
array<string, array<int, string>|bool>

Definition at line 88 of file class.ilDAVProblemInfoFile.php.

88 : array
89 {
90 $already_seen_titles = array();
91
92 $problem_infos = array(
93 self::PROBLEM_DUPLICATE_OBJECTNAME => array(),
94 self::PROBLEM_FORBIDDEN_CHARACTERS => array(),
95 self::PROBLEM_INFO_NAME_DUPLICATE => false
96 );
97
98 foreach ($this->repo_helper->getChildrenOfRefId($this->container_ref_id) as $ref_id) {
99 try {
100 $dav_object = $this->dav_object_factory->retrieveDAVObjectByRefID($ref_id);
101
102 $title = $dav_object->getName();
103
104 if ($title === self::PROBLEM_INFO_FILE_NAME) {
105 $problem_infos[self::PROBLEM_INFO_NAME_DUPLICATE] = true;
106 } elseif (in_array($title, $already_seen_titles)) {
107 $problem_infos[self::PROBLEM_DUPLICATE_OBJECTNAME][] = $title;
108 } else {
109 $already_seen_titles[] = $title;
110 }
113 $title = $this->repo_helper->getObjectTitleFromRefId($ref_id);
114 $problem_infos[self::PROBLEM_FORBIDDEN_CHARACTERS][] = $title;
115 }
116 } catch (Forbidden | NotFound | RuntimeException $e) {
117 }
118 }
119
120 return $problem_infos;
121 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:67

References Vendor\Package\$e, $ref_id, ilWebDAVNotDavableException\OBJECT_TITLE_NOT_DAVABLE, PROBLEM_DUPLICATE_OBJECTNAME, PROBLEM_FORBIDDEN_CHARACTERS, and PROBLEM_INFO_NAME_DUPLICATE.

Referenced by get().

+ Here is the caller graph for this function:

◆ createMessageStringFromProblemInfoArray()

ilDAVProblemInfoFile::createMessageStringFromProblemInfoArray ( array  $problem_infos)
protected
Parameters
array[]$problem_infos

Definition at line 126 of file class.ilDAVProblemInfoFile.php.

126 : string
127 {
128 $message_string = "";
129
130 if ($problem_infos[self::PROBLEM_INFO_NAME_DUPLICATE]) {
131 $message_string .= "# " . $this->language->txt('webdav_problem_info_duplicate') . "\n\n";
132 }
133
134 $duplicates_list = $problem_infos[self::PROBLEM_DUPLICATE_OBJECTNAME];
135 if (count($duplicates_list) > 0) {
136 $message_string .= "# " . $this->language->txt('webdav_duplicate_detected_title') . "\n";
137 foreach ($duplicates_list as $duplicate_title) {
138 $message_string .= $duplicate_title . "\n";
139 }
140 $message_string .= "\n";
141 }
142
143 $forbidden_character_titles_list = $problem_infos[self::PROBLEM_FORBIDDEN_CHARACTERS];
144 if (count($forbidden_character_titles_list) > 0) {
145 $message_string .= "# " . $this->language->txt('webdav_forbidden_chars_title') . "\n";
146 foreach ($forbidden_character_titles_list as $forbidden_character_title) {
147 $message_string .= $forbidden_character_title . "\n";
148 }
149 $message_string .= "\n";
150 }
151
152 if (strlen($message_string) === 0) {
153 $message_string = $this->language->txt('webdav_problem_free_container');
154 }
155
156 return $message_string;
157 }

References ILIAS\UI\examples\Symbol\Glyph\Language\language(), PROBLEM_DUPLICATE_OBJECTNAME, and PROBLEM_FORBIDDEN_CHARACTERS.

Referenced by get().

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

◆ delete()

ilDAVProblemInfoFile::delete ( )

Definition at line 159 of file class.ilDAVProblemInfoFile.php.

159 : void
160 {
161 throw new Forbidden("It is not possible to delete this file since it is just virtual.");
162 }

◆ get()

ilDAVProblemInfoFile::get ( )

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

55 {
56 $problem_infos = $this->analyseObjectsOfDAVContainer();
57 return $this->createMessageStringFromProblemInfoArray($problem_infos);
58 }
createMessageStringFromProblemInfoArray(array $problem_infos)

References analyseObjectsOfDAVContainer(), and createMessageStringFromProblemInfoArray().

+ Here is the call graph for this function:

◆ getContentType()

ilDAVProblemInfoFile::getContentType ( )

Definition at line 65 of file class.ilDAVProblemInfoFile.php.

66 {
67 return 'text/plain';
68 }

◆ getETag()

ilDAVProblemInfoFile::getETag ( )

Definition at line 70 of file class.ilDAVProblemInfoFile.php.

71 {
72 return null;
73 }

◆ getLastModified()

ilDAVProblemInfoFile::getLastModified ( )

Definition at line 164 of file class.ilDAVProblemInfoFile.php.

165 {
166 return time();
167 }

◆ getName()

ilDAVProblemInfoFile::getName ( )

Definition at line 60 of file class.ilDAVProblemInfoFile.php.

References PROBLEM_INFO_FILE_NAME.

◆ getSize()

ilDAVProblemInfoFile::getSize ( )

Definition at line 75 of file class.ilDAVProblemInfoFile.php.

75 : int
76 {
77 return 0;
78 }

◆ put()

ilDAVProblemInfoFile::put (   $data)

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

50 {
51 throw new Forbidden("The error info file is virtual and can therefore not be overwritten");
52 }

◆ setName()

ilDAVProblemInfoFile::setName (   $a_name)

Definition at line 80 of file class.ilDAVProblemInfoFile.php.

80 : void
81 {
82 throw new Forbidden("The error info file cannot be renamed");
83 }

Field Documentation

◆ $container_ref_id

int ilDAVProblemInfoFile::$container_ref_id
protected

Definition at line 32 of file class.ilDAVProblemInfoFile.php.

Referenced by __construct().

◆ $dav_object_factory

ilWebDAVObjFactory ilDAVProblemInfoFile::$dav_object_factory
protected

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

Referenced by __construct().

◆ $language

ilLanguage ilDAVProblemInfoFile::$language
protected

Definition at line 35 of file class.ilDAVProblemInfoFile.php.

Referenced by __construct().

◆ $repo_helper

ilWebDAVRepositoryHelper ilDAVProblemInfoFile::$repo_helper
protected

Definition at line 33 of file class.ilDAVProblemInfoFile.php.

Referenced by __construct().

◆ PROBLEM_DUPLICATE_OBJECTNAME

const ilDAVProblemInfoFile::PROBLEM_DUPLICATE_OBJECTNAME = 'duplicate'

◆ PROBLEM_FORBIDDEN_CHARACTERS

const ilDAVProblemInfoFile::PROBLEM_FORBIDDEN_CHARACTERS = 'forbidden_characters'

◆ PROBLEM_INFO_FILE_NAME

const ilDAVProblemInfoFile::PROBLEM_INFO_FILE_NAME = '#!_WEBDAV_INFORMATION.txt'

Definition at line 26 of file class.ilDAVProblemInfoFile.php.

Referenced by getName().

◆ PROBLEM_INFO_NAME_DUPLICATE

const ilDAVProblemInfoFile::PROBLEM_INFO_NAME_DUPLICATE = 'info_name_duplicate'

Definition at line 30 of file class.ilDAVProblemInfoFile.php.

Referenced by analyseObjectsOfDAVContainer().


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