ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilWebDAVMountInstructionsRepositoryImpl Class Reference
+ Inheritance diagram for ilWebDAVMountInstructionsRepositoryImpl:
+ Collaboration diagram for ilWebDAVMountInstructionsRepositoryImpl:

Public Member Functions

 __construct (ilDBInterface $a_db)
 ilWebDAVMountInstructionsRepository constructor. More...
 
 createMountInstructionsDocumentEntry (ilWebDAVMountInstructionsDocument $document)
 @inheritDoc More...
 
 getNextMountInstructionsDocumentId ()
 @inheritDoc More...
 
 getHighestSortingNumber ()
 @inheritDoc More...
 
 getMountInstructionsDocumentById (int $id)
 @inheritDoc More...
 
 getMountInstructionsByLanguage (string $language)
 @inheritDoc More...
 
 getAllMountInstructions ()
 @inheritDoc More...
 
 doMountInstructionsExistByLanguage (string $language)
 @inheritDoc More...
 
 updateMountInstructions (ilWebDAVMountInstructionsDocument $document)
 @inheritDoc More...
 
 updateSortingValueById (int $id, int $a_new_sorting_value)
 @inheritDoc More...
 
 deleteMountInstructionsById (int $id)
 @inheritDoc More...
 
 createMountInstructionsDocumentEntry (ilWebDAVMountInstructionsDocument $document)
 Create new database entry for given mount instructions document. More...
 
 getNextMountInstructionsDocumentId ()
 Return next free ID for mount instructions document. More...
 
 getHighestSortingNumber ()
 Get currently highest sorting number for mount instructions document. More...
 
 getMountInstructionsDocumentById (int $id)
 Gets mount instructions document by id. More...
 
 getMountInstructionsByLanguage (string $language)
 Gets mount instructions document by language -> language is two letters like "en" for English etc. More...
 
 getAllMountInstructions ()
 Returns an array with all existing mount instructions documents. More...
 
 doMountInstructionsExistByLanguage (string $language)
 Check if mount instructions for language exists. More...
 
 updateMountInstructions (ilWebDAVMountInstructionsDocument $document)
 Update existing mount instructions document. More...
 
 updateSortingValueById (int $id, int $a_new_sorting_value)
 Update sorting value of a mount instructions document. More...
 
 deleteMountInstructionsById (int $id)
 Delete mount instructions document by id. More...
 

Data Fields

const TABLE_MOUNT_INSTRUCTIONS = 'webdav_instructions'
 

Protected Member Functions

 buildDocumentFromDatabaseRecord (array $result)
 Fills document with results array from database. More...
 

Protected Attributes

 $db
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWebDAVMountInstructionsRepositoryImpl::__construct ( ilDBInterface  $a_db)

ilWebDAVMountInstructionsRepository constructor.

Parameters
ilDBInterface$a_db

Definition at line 16 of file class.ilWebDAVMountInstructionsRepositoryImpl.php.

17 {
18 $this->db = $a_db;
19 }

Member Function Documentation

◆ buildDocumentFromDatabaseRecord()

ilWebDAVMountInstructionsRepositoryImpl::buildDocumentFromDatabaseRecord ( array  $result)
protected

Fills document with results array from database.

Parameters
array$result
Returns
ilWebDAVMountInstructionsDocument

Definition at line 201 of file class.ilWebDAVMountInstructionsRepositoryImpl.php.

202 {
204 $result['id'],
205 $result['title'],
206 $result['uploaded_instructions'],
207 $result['processed_instructions'],
208 $result['lng'],
209 $result['creation_ts'],
210 $result['modification_ts'],
211 $result['owner_usr_id'],
212 $result['last_modification_usr_id'],
213 $result['sorting']
214 );
215 }
$result

References $result.

Referenced by getAllMountInstructions(), getMountInstructionsByLanguage(), and getMountInstructionsDocumentById().

+ Here is the caller graph for this function:

◆ createMountInstructionsDocumentEntry()

ilWebDAVMountInstructionsRepositoryImpl::createMountInstructionsDocumentEntry ( ilWebDAVMountInstructionsDocument  $document)

@inheritDoc

Implements ilWebDAVMountInstructionsRepository.

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

25 {
26 $this->db->insert(
27 // table
28 self::TABLE_MOUNT_INSTRUCTIONS,
29
30 // values
31 array(
32 'id' => array('int', $document->getId()),
33 'title' => array('text', $document->getTitle()),
34 'uploaded_instructions' => array('clob', $document->getUploadedInstructions()),
35 'processed_instructions' => array('clob', $document->getProcessedInstructions()),
36 'lng' => array('text', $document->getLanguage()),
37 'creation_ts' => array('timestamp', $document->getCreationTs()),
38 'modification_ts' => array('timestamp', $document->getModificationTs()),
39 'owner_usr_id' => array('int', $document->getOwnerUsrId()),
40 'last_modification_usr_id' => array('int', $document->getLastModificationUsrId()),
41 'sorting' => array('int', $document->getSorting())
42 )
43 );
44 }

References ilWebDAVMountInstructionsDocument\getCreationTs(), ilWebDAVMountInstructionsDocument\getId(), ilWebDAVMountInstructionsDocument\getLanguage(), ilWebDAVMountInstructionsDocument\getLastModificationUsrId(), ilWebDAVMountInstructionsDocument\getModificationTs(), ilWebDAVMountInstructionsDocument\getOwnerUsrId(), ilWebDAVMountInstructionsDocument\getProcessedInstructions(), ilWebDAVMountInstructionsDocument\getSorting(), ilWebDAVMountInstructionsDocument\getTitle(), and ilWebDAVMountInstructionsDocument\getUploadedInstructions().

+ Here is the call graph for this function:

◆ deleteMountInstructionsById()

ilWebDAVMountInstructionsRepositoryImpl::deleteMountInstructionsById ( int  $id)

@inheritDoc

Implements ilWebDAVMountInstructionsRepository.

Definition at line 187 of file class.ilWebDAVMountInstructionsRepositoryImpl.php.

188 {
189 $query = "DELETE FROM " . $this->db->quoteIdentifier(self::TABLE_MOUNT_INSTRUCTIONS)
190 . ' WHERE id=' . $this->db->quote($id, 'integer');
191
192 $this->db->manipulate($query);
193 }
$query

References $query.

◆ doMountInstructionsExistByLanguage()

ilWebDAVMountInstructionsRepositoryImpl::doMountInstructionsExistByLanguage ( string  $language)

@inheritDoc

Implements ilWebDAVMountInstructionsRepository.

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

125 : int
126 {
127 $query = "SELECT * FROM " . $this->db->quoteIdentifier(self::TABLE_MOUNT_INSTRUCTIONS)
128 . " WHERE lng=" . $this->db->quote($language, 'text');
129
130 $result = $this->db->query($query);
131 $record = $this->db->fetchAssoc($result);
132
133 return ($record == null ? 0 : $record['id']);
134 }

References $query, and $result.

◆ getAllMountInstructions()

ilWebDAVMountInstructionsRepositoryImpl::getAllMountInstructions ( )

@inheritDoc

Implements ilWebDAVMountInstructionsRepository.

Definition at line 109 of file class.ilWebDAVMountInstructionsRepositoryImpl.php.

109 : array
110 {
111 $query = "SELECT * FROM " . $this->db->quoteIdentifier(self::TABLE_MOUNT_INSTRUCTIONS) . " ORDER BY sorting";
112 $result = $this->db->query($query);
113
114 $document_list = array();
115 while ($record = $this->db->fetchAssoc($result)) {
116 $document_list[] = $this->buildDocumentFromDatabaseRecord($record);
117 }
118
119 return $document_list;
120 }
buildDocumentFromDatabaseRecord(array $result)
Fills document with results array from database.

References $query, $result, and buildDocumentFromDatabaseRecord().

+ Here is the call graph for this function:

◆ getHighestSortingNumber()

ilWebDAVMountInstructionsRepositoryImpl::getHighestSortingNumber ( )

@inheritDoc

Implements ilWebDAVMountInstructionsRepository.

Definition at line 61 of file class.ilWebDAVMountInstructionsRepositoryImpl.php.

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

References $query, and $result.

◆ getMountInstructionsByLanguage()

ilWebDAVMountInstructionsRepositoryImpl::getMountInstructionsByLanguage ( string  $language)

@inheritDoc

Implements ilWebDAVMountInstructionsRepository.

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

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

References $query, $result, and buildDocumentFromDatabaseRecord().

+ Here is the call graph for this function:

◆ getMountInstructionsDocumentById()

ilWebDAVMountInstructionsRepositoryImpl::getMountInstructionsDocumentById ( int  $id)

@inheritDoc

Implements ilWebDAVMountInstructionsRepository.

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

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

References $query, $result, and buildDocumentFromDatabaseRecord().

+ Here is the call graph for this function:

◆ getNextMountInstructionsDocumentId()

ilWebDAVMountInstructionsRepositoryImpl::getNextMountInstructionsDocumentId ( )

@inheritDoc

Implements ilWebDAVMountInstructionsRepository.

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

49 : int
50 {
51 if (!$this->db->sequenceExists(self::TABLE_MOUNT_INSTRUCTIONS)) {
52 $this->db->createSequence(self::TABLE_MOUNT_INSTRUCTIONS);
53 }
54
55 return $this->db->nextId(self::TABLE_MOUNT_INSTRUCTIONS);
56 }

◆ updateMountInstructions()

ilWebDAVMountInstructionsRepositoryImpl::updateMountInstructions ( ilWebDAVMountInstructionsDocument  $document)

@inheritDoc

Implements ilWebDAVMountInstructionsRepository.

Definition at line 139 of file class.ilWebDAVMountInstructionsRepositoryImpl.php.

140 {
141 $this->db->update(
142 // table name
143 self::TABLE_MOUNT_INSTRUCTIONS,
144
145 // values to update
146 array(
147 'title' => array('text', $document->getTitle()),
148 'lng' => array('text', $document->getLanguage()),
149 'creation_ts' => array('timestamp', $document->getCreationTs()),
150 'modification_ts' => array('timestamp', $document->getModificationTs()),
151 'owner_usr_id' => array('int', $document->getOwnerUsrId()),
152 'last_modification_usr_id' => array('int', $document->getLastModificationUsrId()),
153 'sorting' => array('int', $document->getSorting())
154 ),
155
156 // which rows to update
157 array(
158 'id' => array('int', $document->getId()),
159 )
160 );
161 }

References ilWebDAVMountInstructionsDocument\getCreationTs(), ilWebDAVMountInstructionsDocument\getId(), ilWebDAVMountInstructionsDocument\getLanguage(), ilWebDAVMountInstructionsDocument\getLastModificationUsrId(), ilWebDAVMountInstructionsDocument\getModificationTs(), ilWebDAVMountInstructionsDocument\getOwnerUsrId(), ilWebDAVMountInstructionsDocument\getSorting(), and ilWebDAVMountInstructionsDocument\getTitle().

+ Here is the call graph for this function:

◆ updateSortingValueById()

ilWebDAVMountInstructionsRepositoryImpl::updateSortingValueById ( int  $id,
int  $a_new_sorting_value 
)

@inheritDoc

Implements ilWebDAVMountInstructionsRepository.

Definition at line 166 of file class.ilWebDAVMountInstructionsRepositoryImpl.php.

167 {
168 $this->db->update(
169 // table name
170 self::TABLE_MOUNT_INSTRUCTIONS,
171
172 // values to update
173 array(
174 'sorting' => array('int', $a_new_sorting_value)
175 ),
176
177 // which rows to update
178 array(
179 'id' => array('int', $id),
180 )
181 );
182 }

Field Documentation

◆ $db

ilWebDAVMountInstructionsRepositoryImpl::$db
protected

◆ TABLE_MOUNT_INSTRUCTIONS

const ilWebDAVMountInstructionsRepositoryImpl::TABLE_MOUNT_INSTRUCTIONS = 'webdav_instructions'

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