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

Public Member Functions

 __construct (protected int $container_ref_id, protected ilWebDAVRepositoryHelper $repo_helper, protected ilWebDAVObjFactory $dav_object_factory, protected 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)
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

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

38 {
39 }

Member Function Documentation

◆ analyseObjectsOfDAVContainer()

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

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

80 : array
81 {
82 $already_seen_titles = [];
83
84 $problem_infos = [
85 self::PROBLEM_DUPLICATE_OBJECTNAME => [],
86 self::PROBLEM_FORBIDDEN_CHARACTERS => [],
87 self::PROBLEM_INFO_NAME_DUPLICATE => false
88 ];
89
90 foreach ($this->repo_helper->getChildrenOfRefId($this->container_ref_id) as $ref_id) {
91 try {
92 $dav_object = $this->dav_object_factory->retrieveDAVObjectByRefID($ref_id);
93
94 $title = $dav_object->getName();
95
96 if ($title === self::PROBLEM_INFO_FILE_NAME) {
97 $problem_infos[self::PROBLEM_INFO_NAME_DUPLICATE] = true;
98 } elseif (in_array($title, $already_seen_titles)) {
99 $problem_infos[self::PROBLEM_DUPLICATE_OBJECTNAME][] = $title;
100 } else {
101 $already_seen_titles[] = $title;
102 }
105 $title = $this->repo_helper->getObjectTitleFromRefId($ref_id);
106 $problem_infos[self::PROBLEM_FORBIDDEN_CHARACTERS][] = $title;
107 }
108 } catch (Forbidden|NotFound|RuntimeException) {
109 }
110 }
111
112 return $problem_infos;
113 }
$ref_id
Definition: ltiauth.php:66

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 118 of file class.ilDAVProblemInfoFile.php.

118 : string
119 {
120 $message_string = "";
121
122 if ($problem_infos[self::PROBLEM_INFO_NAME_DUPLICATE]) {
123 $message_string .= "# " . $this->language->txt('webdav_problem_info_duplicate') . "\n\n";
124 }
125
126 $duplicates_list = $problem_infos[self::PROBLEM_DUPLICATE_OBJECTNAME];
127 if (count($duplicates_list) > 0) {
128 $message_string .= "# " . $this->language->txt('webdav_duplicate_detected_title') . "\n";
129 foreach ($duplicates_list as $duplicate_title) {
130 $message_string .= $duplicate_title . "\n";
131 }
132 $message_string .= "\n";
133 }
134
135 $forbidden_character_titles_list = $problem_infos[self::PROBLEM_FORBIDDEN_CHARACTERS];
136 if (count($forbidden_character_titles_list) > 0) {
137 $message_string .= "# " . $this->language->txt('webdav_forbidden_chars_title') . "\n";
138 foreach ($forbidden_character_titles_list as $forbidden_character_title) {
139 $message_string .= $forbidden_character_title . "\n";
140 }
141 $message_string .= "\n";
142 }
143
144 if ($message_string === '') {
145 return $this->language->txt('webdav_problem_free_container');
146 }
147
148 return $message_string;
149 }

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 151 of file class.ilDAVProblemInfoFile.php.

151 : void
152 {
153 throw new Forbidden("It is not possible to delete this file since it is just virtual.");
154 }

◆ get()

ilDAVProblemInfoFile::get ( )

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

47 {
48 $problem_infos = $this->analyseObjectsOfDAVContainer();
49 return $this->createMessageStringFromProblemInfoArray($problem_infos);
50 }
createMessageStringFromProblemInfoArray(array $problem_infos)

References analyseObjectsOfDAVContainer(), and createMessageStringFromProblemInfoArray().

+ Here is the call graph for this function:

◆ getContentType()

ilDAVProblemInfoFile::getContentType ( )

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

58 {
59 return 'text/plain';
60 }

◆ getETag()

ilDAVProblemInfoFile::getETag ( )

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

63 {
64 return null;
65 }

◆ getLastModified()

ilDAVProblemInfoFile::getLastModified ( )

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

157 {
158 return time();
159 }

◆ getName()

ilDAVProblemInfoFile::getName ( )

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

References PROBLEM_INFO_FILE_NAME.

◆ getSize()

ilDAVProblemInfoFile::getSize ( )

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

67 : int
68 {
69 return 0;
70 }

◆ put()

ilDAVProblemInfoFile::put (   $data)

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

42 {
43 throw new Forbidden("The error info file is virtual and can therefore not be overwritten");
44 }

◆ setName()

ilDAVProblemInfoFile::setName (   $a_name)

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

72 : void
73 {
74 throw new Forbidden("The error info file cannot be renamed");
75 }

Field Documentation

◆ 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 27 of file class.ilDAVProblemInfoFile.php.

Referenced by getName().

◆ PROBLEM_INFO_NAME_DUPLICATE

const ilDAVProblemInfoFile::PROBLEM_INFO_NAME_DUPLICATE = 'info_name_duplicate'

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

Referenced by analyseObjectsOfDAVContainer().


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