ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilWebDAVMountInstructionsRepositoryImpl Class Reference
+ Inheritance diagram for ilWebDAVMountInstructionsRepositoryImpl:
+ Collaboration diagram for ilWebDAVMountInstructionsRepositoryImpl:

Public Member Functions

 __construct (ilDBInterface $a_db)
 ilWebDAVMountInstructionsRepository constructor. More...
 
 createMountInstructionsDocumentEntry (ilWebDAVMountInstructionsDocument $document)
 
 getNextMountInstructionsDocumentId ()
 
 getHighestSortingNumber ()
 
 getMountInstructionsDocumentById (int $id)
 
 getMountInstructionsByLanguage (string $language)
 
 getAllMountInstructions ()
 
 doMountInstructionsExistByLanguage (string $language)
 
 updateMountInstructions (ilWebDAVMountInstructionsDocument $document)
 
 updateSortingValueById (int $id, int $a_new_sorting_value)
 
 deleteMountInstructionsById (int $id)
 

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.

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

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
+ Here is the caller graph for this function:

◆ createMountInstructionsDocumentEntry()

ilWebDAVMountInstructionsRepositoryImpl::createMountInstructionsDocumentEntry ( ilWebDAVMountInstructionsDocument  $document)

Implements ilWebDAVMountInstructionsRepository.

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

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

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  }
+ Here is the call graph for this function:

◆ deleteMountInstructionsById()

ilWebDAVMountInstructionsRepositoryImpl::deleteMountInstructionsById ( int  $id)

Implements ilWebDAVMountInstructionsRepository.

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

References $query.

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

◆ doMountInstructionsExistByLanguage()

ilWebDAVMountInstructionsRepositoryImpl::doMountInstructionsExistByLanguage ( string  $language)

Implements ilWebDAVMountInstructionsRepository.

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

References $query, and $result.

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  }
$result
$query

◆ getAllMountInstructions()

ilWebDAVMountInstructionsRepositoryImpl::getAllMountInstructions ( )

Implements ilWebDAVMountInstructionsRepository.

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

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

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  }
$result
buildDocumentFromDatabaseRecord(array $result)
Fills document with results array from database.
$query
+ Here is the call graph for this function:

◆ getHighestSortingNumber()

ilWebDAVMountInstructionsRepositoryImpl::getHighestSortingNumber ( )

Implements ilWebDAVMountInstructionsRepository.

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

References $query, and $result.

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  }
$result
$query

◆ getMountInstructionsByLanguage()

ilWebDAVMountInstructionsRepositoryImpl::getMountInstructionsByLanguage ( string  $language)

Implements ilWebDAVMountInstructionsRepository.

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

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

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  }
$result
buildDocumentFromDatabaseRecord(array $result)
Fills document with results array from database.
$query
+ Here is the call graph for this function:

◆ getMountInstructionsDocumentById()

ilWebDAVMountInstructionsRepositoryImpl::getMountInstructionsDocumentById ( int  $id)

Implements ilWebDAVMountInstructionsRepository.

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

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

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  }
$result
buildDocumentFromDatabaseRecord(array $result)
Fills document with results array from database.
$query
+ Here is the call graph for this function:

◆ getNextMountInstructionsDocumentId()

ilWebDAVMountInstructionsRepositoryImpl::getNextMountInstructionsDocumentId ( )

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)

Implements ilWebDAVMountInstructionsRepository.

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

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

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  }
+ Here is the call graph for this function:

◆ updateSortingValueById()

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

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: