ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilEventItems Class Reference

class ilEvent More...

+ Collaboration diagram for ilEventItems:

Public Member Functions

 __construct ($a_event_id)
 
 getEventId ()
 
 setEventId ($a_event_id)
 
 getItems ()
 get assigned items More...
 
 setItems ($a_items)
 
 addItem ($a_item_ref_id)
 Add one item. More...
 
 delete ()
 
 removeItems ($a_items)
 Remove specific items from the DB. More...
 
 update ()
 
 _isAssigned ($a_item_id)
 
 cloneItems ($a_source_id, $a_copy_id)
 Clone items. More...
 
 __read ()
 

Static Public Member Functions

static _delete ($a_event_id)
 
static _getItemsOfContainer ($a_ref_id)
 
static _getItemsOfEvent ($a_event_id)
 Get items by event. More...
 
static getEventsForItemOrderedByStartingTime ($item_ref_id)
 

Data Fields

 $ilErr
 
 $ilDB
 
 $tree
 
 $lng
 
 $event_id = null
 
 $items = array()
 

Detailed Description

class ilEvent

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilEventItems.php 15697 2008-01-08 20:04:33Z hschottm

Definition at line 34 of file class.ilEventItems.php.

Constructor & Destructor Documentation

◆ __construct()

ilEventItems::__construct (   $a_event_id)

Definition at line 45 of file class.ilEventItems.php.

References $DIC, $ilDB, $ilErr, $lng, $tree, and __read().

46  {
47  global $DIC;
48 
49  $ilErr = $DIC['ilErr'];
50  $ilDB = $DIC['ilDB'];
51  $lng = $DIC['lng'];
52  $tree = $DIC['tree'];
53 
54  $this->ilErr = $ilErr;
55  $this->db = $ilDB;
56  $this->lng = $lng;
57 
58  $this->event_id = $a_event_id;
59  $this->__read();
60  }
global $DIC
Definition: saml.php:7
+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilEventItems::__read ( )

Definition at line 271 of file class.ilEventItems.php.

References $DIC, $ilDB, $query, $res, $row, $tree, ilDBConstants\FETCHMODE_OBJECT, and getEventId().

Referenced by __construct().

272  {
273  global $DIC;
274 
275  $ilDB = $DIC['ilDB'];
276  $tree = $DIC['tree'];
277 
278  $query = "SELECT * FROM event_items " .
279  "WHERE event_id = " . $ilDB->quote($this->getEventId(), 'integer') . " ";
280 
281  $res = $this->db->query($query);
282  $this->items = array();
283  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
284  if ($tree->isDeleted($row->item_id)) {
285  continue;
286  }
287  if (!$tree->isInTree($row->item_id)) {
288  $query = "DELETE FROM event_items " .
289  "WHERE item_id = " . $ilDB->quote($row->item_id, 'integer');
290  $ilDB->manipulate($query);
291  continue;
292  }
293 
294  $this->items[] = (int) $row->item_id;
295  }
296  return true;
297  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _delete()

static ilEventItems::_delete (   $a_event_id)
static

Definition at line 104 of file class.ilEventItems.php.

References $DIC, $ilDB, $query, and $res.

Referenced by delete(), and ilObjSession\delete().

105  {
106  global $DIC;
107 
108  $ilDB = $DIC['ilDB'];
109 
110  $query = "DELETE FROM event_items " .
111  "WHERE event_id = " . $ilDB->quote($a_event_id, 'integer') . " ";
112  $res = $ilDB->manipulate($query);
113  return true;
114  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
+ Here is the caller graph for this function:

◆ _getItemsOfContainer()

static ilEventItems::_getItemsOfContainer (   $a_ref_id)
static

Definition at line 150 of file class.ilEventItems.php.

References $DIC, $ilDB, $items, $query, $res, $row, $tree, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilContainer\getSubItems(), ilObjectActivation\getTimingsItems(), ilRepositoryExplorerGUI\isNodeVisible(), ilRepositoryExplorer\isVisible(), and ilContainerGUI\redrawListItemObject().

151  {
152  global $DIC;
153 
154  $ilDB = $DIC['ilDB'];
155  $tree = $DIC['tree'];
156 
157  $session_nodes = $tree->getChildsByType($a_ref_id, 'sess');
158  $session_ids = [];
159  foreach ($session_nodes as $node) {
160  $session_ids[] = $node['obj_id'];
161  }
162  $query = "SELECT item_id FROM event_items " .
163  "WHERE " . $ilDB->in('event_id', $session_ids, false, 'integer');
164 
165 
166  $res = $ilDB->query($query);
167  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
168  $items[] = $row->item_id;
169  }
170  return $items ? $items : array();
171  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the caller graph for this function:

◆ _getItemsOfEvent()

static ilEventItems::_getItemsOfEvent (   $a_event_id)
static

Get items by event.

public

Parameters
intevent id

Definition at line 181 of file class.ilEventItems.php.

References $DIC, $ilDB, $items, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by cloneItems().

182  {
183  global $DIC;
184 
185  $ilDB = $DIC['ilDB'];
186 
187  $query = "SELECT * FROM event_items " .
188  "WHERE event_id = " . $ilDB->quote($a_event_id, 'integer');
189  $res = $ilDB->query($query);
190  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
191  $items[] = $row->item_id;
192  }
193  return $items ? $items : array();
194  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the caller graph for this function:

◆ _isAssigned()

ilEventItems::_isAssigned (   $a_item_id)

Definition at line 196 of file class.ilEventItems.php.

References $DIC, $ilDB, $query, and $res.

197  {
198  global $DIC;
199 
200  $ilDB = $DIC['ilDB'];
201 
202  $query = "SELECT * FROM event_items " .
203  "WHERE item_id = " . $ilDB->quote($a_item_id, 'integer') . " ";
204  $res = $ilDB->query($query);
205 
206  return $res->numRows() ? true : false;
207  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query

◆ addItem()

ilEventItems::addItem (   $a_item_ref_id)

Add one item.

Parameters
object$a_item_ref_id
Returns

Definition at line 93 of file class.ilEventItems.php.

Referenced by ilObjSessionGUI\afterSaveCallback(), and ilSessionDataSet\importRecord().

94  {
95  $this->items[] = (int) $a_item_ref_id;
96  }
+ Here is the caller graph for this function:

◆ cloneItems()

ilEventItems::cloneItems (   $a_source_id,
  $a_copy_id 
)

Clone items.

public

Parameters
intsource event id
intcopy id

Definition at line 241 of file class.ilEventItems.php.

References $DIC, $ilLog, ilCopyWizardOptions\_getInstance(), _getItemsOfEvent(), setItems(), and update().

242  {
243  global $DIC;
244 
245  $ilObjDataCache = $DIC['ilObjDataCache'];
246  $ilLog = $DIC->logger()->sess();
247 
248  $ilLog->debug('Begin cloning session materials ...');
249 
250  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
251  $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
252  $mappings = $cwo->getMappings();
253 
254  $new_items = array();
255  foreach (ilEventItems::_getItemsOfEvent($a_source_id) as $item_id) {
256  if (isset($mappings[$item_id]) and $mappings[$item_id]) {
257  $ilLog->debug('Clone session material nr. ' . $item_id);
258  $new_items[] = $mappings[$item_id];
259  } else {
260  $ilLog->debug('No mapping found for session material nr. ' . $item_id);
261  }
262  }
263  $this->setItems($new_items);
264  $this->update();
265  $ilLog->debug('Finished cloning session materials ...');
266  return true;
267  }
global $DIC
Definition: saml.php:7
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static _getItemsOfEvent($a_event_id)
Get items by event.
+ Here is the call graph for this function:

◆ delete()

ilEventItems::delete ( )

Definition at line 99 of file class.ilEventItems.php.

References _delete(), and getEventId().

100  {
101  return ilEventItems::_delete($this->getEventId());
102  }
static _delete($a_event_id)
+ Here is the call graph for this function:

◆ getEventId()

ilEventItems::getEventId ( )

Definition at line 62 of file class.ilEventItems.php.

References $event_id.

Referenced by __read(), delete(), and update().

63  {
64  return $this->event_id;
65  }
+ Here is the caller graph for this function:

◆ getEventsForItemOrderedByStartingTime()

static ilEventItems::getEventsForItemOrderedByStartingTime (   $item_ref_id)
static
Parameters
int$item_ref_id
Returns
int[]

Definition at line 213 of file class.ilEventItems.php.

References $DIC, $events, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, and IL_CAL_DATETIME.

Referenced by ilSessionClassificationPathGUI\findSessionContainerForItem().

214  {
215  global $DIC;
216 
217  $db = $DIC->database();
218  $query = 'SELECT e.event_id,e_start FROM event_items e ' .
219  'JOIN event_appointment ea ON e.event_id = ea.event_id ' .
220  'WHERE item_id = ' . $db->quote($item_ref_id, 'integer') . ' ' .
221  'ORDER BY (e_start)';
222  $res = $db->query($query);
223 
224  $events = [];
225  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
226  $dt = new ilDateTime($row->e_start, IL_CAL_DATETIME);
227  $events[$row->event_id] = $dt->getUnixTime();
228  }
229  return $events;
230  }
const IL_CAL_DATETIME
global $DIC
Definition: saml.php:7
if($argc< 2) $events
foreach($_POST as $key=> $value) $res
Date and time handling
$query
$row
+ Here is the caller graph for this function:

◆ getItems()

ilEventItems::getItems ( )

get assigned items

Returns
array $items Assigned items.

Definition at line 75 of file class.ilEventItems.php.

Referenced by ilObjSessionGUI\createRecurringSessions(), ilObjSessionGUI\handleFileUpload(), and ilObjSessionGUI\saveMaterialsObject().

76  {
77  return $this->items ? $this->items : array();
78  }
+ Here is the caller graph for this function:

◆ removeItems()

ilEventItems::removeItems (   $a_items)

Remove specific items from the DB.

Parameters
$a_itemsarray
Returns
bool

Definition at line 121 of file class.ilEventItems.php.

References $query, and $res.

Referenced by ilObjSessionGUI\removeMaterialsObject().

122  {
123  $query = "DELETE FROM event_items WHERE " . $this->db->in('item_id', $a_items, false, 'integer') .
124  " AND event_id = " . $this->db->quote($this->event_id, 'integer');
125 
126  $res = $this->db->manipulate($query);
127 
128  return true;
129  }
foreach($_POST as $key=> $value) $res
$query
+ Here is the caller graph for this function:

◆ setEventId()

ilEventItems::setEventId (   $a_event_id)

Definition at line 66 of file class.ilEventItems.php.

67  {
68  $this->event_id = $a_event_id;
69  }

◆ setItems()

ilEventItems::setItems (   $a_items)

Definition at line 79 of file class.ilEventItems.php.

Referenced by cloneItems(), ilObjSessionGUI\createRecurringSessions(), and ilObjSessionGUI\handleFileUpload().

80  {
81  $this->items = array();
82  foreach ($a_items as $item_id) {
83  $this->items[] = (int) $item_id;
84  }
85  }
+ Here is the caller graph for this function:

◆ update()

ilEventItems::update ( )

Definition at line 131 of file class.ilEventItems.php.

References $DIC, $ilDB, $query, $res, and getEventId().

Referenced by cloneItems().

132  {
133  global $DIC;
134 
135  $ilDB = $DIC['ilDB'];
136 
137  $this->delete();
138 
139  foreach ($this->items as $item) {
140  $query = "INSERT INTO event_items (event_id,item_id) " .
141  "VALUES( " .
142  $ilDB->quote($this->getEventId(), 'integer') . ", " .
143  $ilDB->quote($item, 'integer') . " " .
144  ")";
145  $res = $ilDB->manipulate($query);
146  }
147  return true;
148  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $event_id

ilEventItems::$event_id = null

Definition at line 41 of file class.ilEventItems.php.

Referenced by getEventId().

◆ $ilDB

ilEventItems::$ilDB

◆ $ilErr

ilEventItems::$ilErr

Definition at line 36 of file class.ilEventItems.php.

Referenced by __construct().

◆ $items

ilEventItems::$items = array()

Definition at line 42 of file class.ilEventItems.php.

Referenced by _getItemsOfContainer(), and _getItemsOfEvent().

◆ $lng

ilEventItems::$lng

Definition at line 39 of file class.ilEventItems.php.

Referenced by __construct().

◆ $tree

ilEventItems::$tree

Definition at line 38 of file class.ilEventItems.php.

Referenced by __construct(), __read(), and _getItemsOfContainer().


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