3 declare(strict_types=1);
41 $this->db = $DIC->database();
42 $this->tree = $DIC->repositoryTree();
44 $this->event_id = $a_event_id;
55 $this->event_id = $a_event_id;
66 foreach ($a_items as $item_id) {
67 $this->items[] = (
int) $item_id;
71 public function addItem(
int $a_item_ref_id): void
73 $this->items[] = $a_item_ref_id;
76 public function delete():
bool 81 public static function _delete(
int $a_event_id): bool
85 $ilDB = $DIC->database();
87 $query =
"DELETE FROM event_items " .
88 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer') .
" ";
95 $query =
"DELETE FROM event_items WHERE " . $this->db->in(
'item_id', $a_items,
false,
'integer') .
96 " AND event_id = " . $this->db->quote($this->event_id,
'integer');
107 $ilDB = $DIC->database();
111 foreach ($this->items as $item) {
112 $query =
"INSERT INTO event_items (event_id,item_id) " .
115 $ilDB->quote($item,
'integer') .
" " .
126 $ilDB = $DIC->database();
127 $tree = $DIC->repositoryTree();
131 foreach ($session_nodes as $node) {
132 $session_ids[] = $node[
'obj_id'];
134 $query =
"SELECT item_id FROM event_items " .
135 "WHERE " .
$ilDB->in(
'event_id', $session_ids,
false,
'integer');
141 $items[] = $row->item_id;
150 $ilDB = $DIC->database();
152 $query =
"SELECT * FROM event_items " .
153 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer');
157 $items[] = $row->item_id;
166 $ilDB = $DIC->database();
168 $query =
"SELECT * FROM event_items " .
169 "WHERE item_id = " .
$ilDB->quote($a_item_id,
'integer') .
" ";
172 return $res->numRows() ? true :
false;
183 $db = $DIC->database();
184 $query =
'SELECT e.event_id,e_start FROM event_items e ' .
185 'JOIN event_appointment ea ON e.event_id = ea.event_id ' .
186 'WHERE item_id = ' . $db->
quote($item_ref_id,
'integer') .
' ' .
187 'ORDER BY (e_start)';
193 $events[$row->event_id] = $dt->getUnixTime();
198 public function cloneItems(
int $a_source_id,
int $a_copy_id): bool
202 $ilObjDataCache = $DIC[
'ilObjDataCache'];
203 $ilLog = $DIC->logger()->sess();
205 $ilLog->debug(
'Begin cloning session materials ...');
208 $mappings = $cwo->getMappings();
212 if (isset($mappings[$item_id]) && $mappings[$item_id]) {
213 $ilLog->debug(
'Clone session material nr. ' . $item_id);
214 $new_items[] = $mappings[$item_id];
216 $ilLog->debug(
'No mapping found for session material nr. ' . $item_id);
221 $ilLog->debug(
'Finished cloning session materials ...');
232 $query =
"SELECT * FROM event_items " .
233 "WHERE event_id = " .
$ilDB->quote($this->
getEventId(),
'integer') .
" ";
238 if ($tree->
isDeleted((
int) $row->item_id)) {
241 if (!$tree->
isInTree((
int) $row->item_id)) {
242 $query =
"DELETE FROM event_items " .
243 "WHERE item_id = " .
$ilDB->quote($row->item_id,
'integer');
248 $this->items[] = (
int) $row->item_id;
setEventId(int $a_event_id)
cloneItems(int $a_source_id, int $a_copy_id)
isInTree(?int $a_node_id)
get all information of a node.
isDeleted(int $a_node_id)
This is a wrapper for isSaved() with a more useful name.
quote($value, string $type)
static getEventsForItemOrderedByStartingTime(int $item_ref_id)
static _getItemsOfContainer(int $a_ref_id)
getChildsByType(int $a_node_id, string $a_type)
get child nodes of given node by object type
static _delete(int $a_event_id)
query(string $query)
Run a (read-only) Query on the database.
__construct(int $a_event_id)
_isAssigned(int $a_item_id)
static _getItemsOfEvent(int $a_event_id)
static _getInstance(int $a_copy_id)
removeItems(array $a_items)
addItem(int $a_item_ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...