ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
ILIAS\WebDAV\Mount\RepositoryDB Class Reference
+ Inheritance diagram for ILIAS\WebDAV\Mount\RepositoryDB:
+ Collaboration diagram for ILIAS\WebDAV\Mount\RepositoryDB:

Public Member Functions

 __construct (protected ilDBInterface $db)
 
 createMountInstructionsDocumentEntry (Document $document)
 
 getNextMountInstructionsDocumentId ()
 
 getHighestSortingNumber ()
 
 getMountInstructionsDocumentById (int $id)
 
 getMountInstructionsByLanguage (string $language)
 
 getAllMountInstructions ()
 
 doMountInstructionsExistByLanguage (string $language)
 
 updateMountInstructions (Document $document)
 
 updateSortingValueById (int $id, int $a_new_sorting_value)
 
 deleteMountInstructionsById (int $id)
 
 createMountInstructionsDocumentEntry (Document $document)
 
 getNextMountInstructionsDocumentId ()
 
 getHighestSortingNumber ()
 
 getMountInstructionsDocumentById (int $id)
 
 getMountInstructionsByLanguage (string $language)
 
 getAllMountInstructions ()
 
 doMountInstructionsExistByLanguage (string $language)
 
 updateMountInstructions (Document $document)
 
 updateSortingValueById (int $id, int $a_new_sorting_value)
 
 deleteMountInstructionsById (int $id)
 

Data Fields

const string TABLE_MOUNT_INSTRUCTIONS = 'webdav_instructions'
 

Protected Member Functions

 buildDocumentFromDatabaseRecord (array $result)
 

Detailed Description

Definition at line 26 of file RepositoryDB.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\WebDAV\Mount\RepositoryDB::__construct ( protected ilDBInterface  $db)

Definition at line 30 of file RepositoryDB.php.

31 {
32 }

Member Function Documentation

◆ buildDocumentFromDatabaseRecord()

ILIAS\WebDAV\Mount\RepositoryDB::buildDocumentFromDatabaseRecord ( array  $result)
protected

Definition at line 165 of file RepositoryDB.php.

165 : Document
166 {
167 return new Document(
168 (int) $result['id'],
169 $result['title'],
170 $result['uploaded_instructions'],
171 $result['processed_instructions'],
172 $result['lng'],
173 $result['creation_ts'],
174 $result['modification_ts'],
175 (int) $result['owner_usr_id'],
176 (int) $result['last_modification_usr_id'],
177 (int) $result['sorting']
178 );
179 }

Referenced by ILIAS\WebDAV\Mount\RepositoryDB\getAllMountInstructions(), ILIAS\WebDAV\Mount\RepositoryDB\getMountInstructionsByLanguage(), and ILIAS\WebDAV\Mount\RepositoryDB\getMountInstructionsDocumentById().

+ Here is the caller graph for this function:

◆ createMountInstructionsDocumentEntry()

ILIAS\WebDAV\Mount\RepositoryDB::createMountInstructionsDocumentEntry ( Document  $document)

Implements ILIAS\WebDAV\Mount\Repository.

Definition at line 34 of file RepositoryDB.php.

34 : void
35 {
36 $this->db->insert(
37 self::TABLE_MOUNT_INSTRUCTIONS,
38 [
39 'id' => ['int', $document->getId()],
40 'title' => ['text', $document->getTitle()],
41 'uploaded_instructions' => ['clob', $document->getUploadedInstructions()],
42 'processed_instructions' => ['clob', $document->getProcessedInstructions()],
43 'lng' => ['text', $document->getLanguage()],
44 'creation_ts' => ['timestamp', $document->getCreationTs()],
45 'modification_ts' => ['timestamp', $document->getModificationTs()],
46 'owner_usr_id' => ['int', $document->getOwnerUsrId()],
47 'last_modification_usr_id' => ['int', $document->getLastModificationUsrId()],
48 'sorting' => ['int', $document->getSorting()],
49 ]
50 );
51 }

References ILIAS\WebDAV\Mount\Document\getCreationTs(), ILIAS\WebDAV\Mount\Document\getId(), ILIAS\WebDAV\Mount\Document\getLanguage(), ILIAS\WebDAV\Mount\Document\getLastModificationUsrId(), ILIAS\WebDAV\Mount\Document\getModificationTs(), ILIAS\WebDAV\Mount\Document\getOwnerUsrId(), ILIAS\WebDAV\Mount\Document\getProcessedInstructions(), ILIAS\WebDAV\Mount\Document\getSorting(), ILIAS\WebDAV\Mount\Document\getTitle(), and ILIAS\WebDAV\Mount\Document\getUploadedInstructions().

+ Here is the call graph for this function:

◆ deleteMountInstructionsById()

ILIAS\WebDAV\Mount\RepositoryDB::deleteMountInstructionsById ( int  $id)

Implements ILIAS\WebDAV\Mount\Repository.

Definition at line 157 of file RepositoryDB.php.

157 : void
158 {
159 $query = "DELETE FROM " . $this->db->quoteIdentifier(self::TABLE_MOUNT_INSTRUCTIONS)
160 . ' WHERE id=' . $this->db->quote($id, 'integer');
161
162 $this->db->manipulate($query);
163 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

◆ doMountInstructionsExistByLanguage()

ILIAS\WebDAV\Mount\RepositoryDB::doMountInstructionsExistByLanguage ( string  $language)

Implements ILIAS\WebDAV\Mount\Repository.

Definition at line 114 of file RepositoryDB.php.

114 : int
115 {
116 $query = "SELECT id FROM " . $this->db->quoteIdentifier(self::TABLE_MOUNT_INSTRUCTIONS)
117 . " WHERE lng=" . $this->db->quote($language, 'text');
118
119 $result = $this->db->query($query);
120 $record = $this->db->fetchAssoc($result);
121
122 return ($record === null ? 0 : (int) $record['id']);
123 }

◆ getAllMountInstructions()

ILIAS\WebDAV\Mount\RepositoryDB::getAllMountInstructions ( )

Implements ILIAS\WebDAV\Mount\Repository.

Definition at line 101 of file RepositoryDB.php.

101 : array
102 {
103 $query = "SELECT * FROM " . $this->db->quoteIdentifier(self::TABLE_MOUNT_INSTRUCTIONS) . " ORDER BY sorting";
104 $result = $this->db->query($query);
105
106 $document_list = [];
107 while ($record = $this->db->fetchAssoc($result)) {
108 $document_list[] = $this->buildDocumentFromDatabaseRecord($record);
109 }
110
111 return $document_list;
112 }
buildDocumentFromDatabaseRecord(array $result)

References ILIAS\WebDAV\Mount\RepositoryDB\buildDocumentFromDatabaseRecord().

+ Here is the call graph for this function:

◆ getHighestSortingNumber()

ILIAS\WebDAV\Mount\RepositoryDB::getHighestSortingNumber ( )

Implements ILIAS\WebDAV\Mount\Repository.

Definition at line 62 of file RepositoryDB.php.

62 : int
63 {
64 $query = "SELECT max(sorting) as max_sort FROM " . $this->db->quoteIdentifier(self::TABLE_MOUNT_INSTRUCTIONS);
65 $result = $this->db->query($query);
66
67 $row = $this->db->fetchAssoc($result);
68 return isset($row) && !is_null($row['max_sort']) ? (int) $row['max_sort'] : 0;
69 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getMountInstructionsByLanguage()

ILIAS\WebDAV\Mount\RepositoryDB::getMountInstructionsByLanguage ( string  $language)

Implements ILIAS\WebDAV\Mount\Repository.

Definition at line 86 of file RepositoryDB.php.

86 : Document
87 {
88 $query = "SELECT * FROM " . $this->db->quoteIdentifier(self::TABLE_MOUNT_INSTRUCTIONS)
89 . " WHERE lng=" . $this->db->quote($language, 'text');
90
91 $result = $this->db->query($query);
92 $record = $this->db->fetchAssoc($result);
93
94 if (!$record) {
95 throw new InvalidArgumentException("Document for the language $language not found");
96 }
97
98 return $this->buildDocumentFromDatabaseRecord($record);
99 }

References ILIAS\WebDAV\Mount\RepositoryDB\buildDocumentFromDatabaseRecord().

+ Here is the call graph for this function:

◆ getMountInstructionsDocumentById()

ILIAS\WebDAV\Mount\RepositoryDB::getMountInstructionsDocumentById ( int  $id)

Implements ILIAS\WebDAV\Mount\Repository.

Definition at line 71 of file RepositoryDB.php.

71 : Document
72 {
73 $query = "SELECT * FROM " . $this->db->quoteIdentifier(self::TABLE_MOUNT_INSTRUCTIONS)
74 . " WHERE id=" . $this->db->quote($id, 'int');
75
76 $result = $this->db->query($query);
77 $record = $this->db->fetchAssoc($result);
78
79 if (!$record) {
80 throw new InvalidArgumentException("Document with the id $id not found");
81 }
82
83 return $this->buildDocumentFromDatabaseRecord($record);
84 }

References $id, and ILIAS\WebDAV\Mount\RepositoryDB\buildDocumentFromDatabaseRecord().

+ Here is the call graph for this function:

◆ getNextMountInstructionsDocumentId()

ILIAS\WebDAV\Mount\RepositoryDB::getNextMountInstructionsDocumentId ( )

Implements ILIAS\WebDAV\Mount\Repository.

Definition at line 53 of file RepositoryDB.php.

53 : int
54 {
55 if (!$this->db->sequenceExists(self::TABLE_MOUNT_INSTRUCTIONS)) {
56 $this->db->createSequence(self::TABLE_MOUNT_INSTRUCTIONS);
57 }
58
59 return $this->db->nextId(self::TABLE_MOUNT_INSTRUCTIONS);
60 }

◆ updateMountInstructions()

ILIAS\WebDAV\Mount\RepositoryDB::updateMountInstructions ( Document  $document)

Implements ILIAS\WebDAV\Mount\Repository.

Definition at line 125 of file RepositoryDB.php.

125 : void
126 {
127 $this->db->update(
128 self::TABLE_MOUNT_INSTRUCTIONS,
129 [
130 'title' => ['text', $document->getTitle()],
131 'lng' => ['text', $document->getLanguage()],
132 'creation_ts' => ['timestamp', $document->getCreationTs()],
133 'modification_ts' => ['timestamp', $document->getModificationTs()],
134 'owner_usr_id' => ['int', $document->getOwnerUsrId()],
135 'last_modification_usr_id' => ['int', $document->getLastModificationUsrId()],
136 'sorting' => ['int', $document->getSorting()],
137 ],
138 [
139 'id' => ['int', $document->getId()],
140 ]
141 );
142 }

References ILIAS\WebDAV\Mount\Document\getCreationTs(), ILIAS\WebDAV\Mount\Document\getId(), ILIAS\WebDAV\Mount\Document\getLanguage(), ILIAS\WebDAV\Mount\Document\getLastModificationUsrId(), ILIAS\WebDAV\Mount\Document\getModificationTs(), ILIAS\WebDAV\Mount\Document\getOwnerUsrId(), ILIAS\WebDAV\Mount\Document\getSorting(), and ILIAS\WebDAV\Mount\Document\getTitle().

+ Here is the call graph for this function:

◆ updateSortingValueById()

ILIAS\WebDAV\Mount\RepositoryDB::updateSortingValueById ( int  $id,
int  $a_new_sorting_value 
)

Implements ILIAS\WebDAV\Mount\Repository.

Definition at line 144 of file RepositoryDB.php.

144 : void
145 {
146 $this->db->update(
147 self::TABLE_MOUNT_INSTRUCTIONS,
148 [
149 'sorting' => ['int', $a_new_sorting_value],
150 ],
151 [
152 'id' => ['int', $id],
153 ]
154 );
155 }

References $id.

Field Documentation

◆ TABLE_MOUNT_INSTRUCTIONS

const string ILIAS\WebDAV\Mount\RepositoryDB::TABLE_MOUNT_INSTRUCTIONS = 'webdav_instructions'

Definition at line 28 of file RepositoryDB.php.


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