19declare(strict_types=1);
24use InvalidArgumentException;
37 self::TABLE_MOUNT_INSTRUCTIONS,
39 'id' => [
'int', $document->
getId()],
40 'title' => [
'text', $document->
getTitle()],
55 if (!$this->db->sequenceExists(self::TABLE_MOUNT_INSTRUCTIONS)) {
56 $this->db->createSequence(self::TABLE_MOUNT_INSTRUCTIONS);
59 return $this->db->nextId(self::TABLE_MOUNT_INSTRUCTIONS);
64 $query =
"SELECT max(sorting) as max_sort FROM " . $this->db->quoteIdentifier(self::TABLE_MOUNT_INSTRUCTIONS);
65 $result = $this->db->query($query);
67 $row = $this->db->fetchAssoc($result);
68 return isset($row) && !is_null($row[
'max_sort']) ? (
int) $row[
'max_sort'] : 0;
73 $query =
"SELECT * FROM " . $this->db->quoteIdentifier(self::TABLE_MOUNT_INSTRUCTIONS)
74 .
" WHERE id=" . $this->db->quote(
$id,
'int');
76 $result = $this->db->query($query);
77 $record = $this->db->fetchAssoc($result);
80 throw new InvalidArgumentException(
"Document with the id $id not found");
88 $query =
"SELECT * FROM " . $this->db->quoteIdentifier(self::TABLE_MOUNT_INSTRUCTIONS)
89 .
" WHERE lng=" . $this->db->quote($language,
'text');
91 $result = $this->db->query($query);
92 $record = $this->db->fetchAssoc($result);
95 throw new InvalidArgumentException(
"Document for the language $language not found");
103 $query =
"SELECT * FROM " . $this->db->quoteIdentifier(self::TABLE_MOUNT_INSTRUCTIONS) .
" ORDER BY sorting";
104 $result = $this->db->query($query);
107 while ($record = $this->db->fetchAssoc($result)) {
111 return $document_list;
116 $query =
"SELECT id FROM " . $this->db->quoteIdentifier(self::TABLE_MOUNT_INSTRUCTIONS)
117 .
" WHERE lng=" . $this->db->quote($language,
'text');
119 $result = $this->db->query($query);
120 $record = $this->db->fetchAssoc($result);
122 return ($record ===
null ? 0 : (
int) $record[
'id']);
128 self::TABLE_MOUNT_INSTRUCTIONS,
130 'title' => [
'text', $document->
getTitle()],
136 'sorting' => [
'int', $document->
getSorting()],
139 'id' => [
'int', $document->
getId()],
147 self::TABLE_MOUNT_INSTRUCTIONS,
149 'sorting' => [
'int', $a_new_sorting_value],
152 'id' => [
'int',
$id],
159 $query =
"DELETE FROM " . $this->db->quoteIdentifier(self::TABLE_MOUNT_INSTRUCTIONS)
160 .
' WHERE id=' . $this->db->quote(
$id,
'integer');
162 $this->db->manipulate($query);
170 $result[
'uploaded_instructions'],
171 $result[
'processed_instructions'],
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']
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getProcessedInstructions()
getUploadedInstructions()
getLastModificationUsrId()
deleteMountInstructionsById(int $id)
buildDocumentFromDatabaseRecord(array $result)
getHighestSortingNumber()
__construct(protected ilDBInterface $db)
getMountInstructionsDocumentById(int $id)
doMountInstructionsExistByLanguage(string $language)
updateSortingValueById(int $id, int $a_new_sorting_value)
getAllMountInstructions()
getMountInstructionsByLanguage(string $language)
const string TABLE_MOUNT_INSTRUCTIONS
getNextMountInstructionsDocumentId()
createMountInstructionsDocumentEntry(Document $document)
updateMountInstructions(Document $document)