19 declare(strict_types=1);
40 $this->db = $DIC->database();
41 $this->tree = $DIC->repositoryTree();
43 $this->event_id = $a_event_id;
54 $this->event_id = $a_event_id;
65 foreach ($a_items as $item_id) {
66 $this->items[] = (
int) $item_id;
70 public function addItem(
int $a_item_ref_id): void
72 $this->items[] = $a_item_ref_id;
75 public function delete():
bool 80 public static function _delete(
int $a_event_id): bool
84 $ilDB = $DIC->database();
86 $query =
"DELETE FROM event_items " .
87 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer') .
" ";
94 $query =
"DELETE FROM event_items WHERE " . $this->db->in(
'item_id', $a_items,
false,
'integer') .
95 " AND event_id = " . $this->db->quote($this->event_id,
'integer');
97 $res = $this->db->manipulate($query);
106 $ilDB = $DIC->database();
110 foreach ($this->items as $item) {
111 $query =
"INSERT INTO event_items (event_id,item_id) " .
114 $ilDB->quote($item,
'integer') .
" " .
125 $ilDB = $DIC->database();
126 $tree = $DIC->repositoryTree();
130 foreach ($session_nodes as $node) {
131 $session_ids[] = $node[
'obj_id'];
133 $query =
"SELECT item_id FROM event_items " .
134 "WHERE " .
$ilDB->in(
'event_id', $session_ids,
false,
'integer');
140 $items[] = $row->item_id;
149 $ilDB = $DIC->database();
151 $query =
"SELECT * FROM event_items " .
152 "WHERE event_id = " .
$ilDB->quote($a_event_id,
'integer');
156 $items[] = $row->item_id;
165 $ilDB = $DIC->database();
167 $query =
"SELECT * FROM event_items " .
168 "WHERE item_id = " .
$ilDB->quote($a_item_id,
'integer') .
" ";
171 return $res->numRows() ? true :
false;
182 $db = $DIC->database();
183 $query =
'SELECT e.event_id,e_start FROM event_items e ' .
184 'JOIN event_appointment ea ON e.event_id = ea.event_id ' .
185 'WHERE item_id = ' . $db->
quote($item_ref_id,
'integer') .
' ' .
186 'ORDER BY (e_start)';
192 $events[$row->event_id] = $dt->getUnixTime();
197 public function cloneItems(
int $a_source_id,
int $a_copy_id): bool
201 $ilObjDataCache = $DIC[
'ilObjDataCache'];
202 $ilLog = $DIC->logger()->sess();
204 $ilLog->debug(
'Begin cloning session materials ...');
207 $mappings = $cwo->getMappings();
211 if (isset($mappings[$item_id]) && $mappings[$item_id]) {
212 $ilLog->debug(
'Clone session material nr. ' . $item_id);
213 $new_items[] = $mappings[$item_id];
215 $ilLog->debug(
'No mapping found for session material nr. ' . $item_id);
220 $ilLog->debug(
'Finished cloning session materials ...');
231 $query =
"SELECT * FROM event_items " .
232 "WHERE event_id = " .
$ilDB->quote($this->
getEventId(),
'integer') .
" ";
234 $res = $this->db->query($query);
237 if ($tree->
isDeleted((
int) $row->item_id)) {
240 if (!$tree->
isInTree((
int) $row->item_id)) {
241 $query =
"DELETE FROM event_items " .
242 "WHERE item_id = " .
$ilDB->quote($row->item_id,
'integer');
243 $ilDB->manipulate($query);
247 $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)