ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ()
 
 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...
 

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 $ilDB, $ilErr, $lng, $tree, and __read().

46  {
47  global $ilErr,$ilDB,$lng,$tree;
48 
49  $this->ilErr = $ilErr;
50  $this->db = $ilDB;
51  $this->lng = $lng;
52 
53  $this->event_id = $a_event_id;
54  $this->__read();
55  }
+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilEventItems::__read ( )

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

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

Referenced by __construct().

222  {
223  global $ilDB,$tree;
224 
225  $query = "SELECT * FROM event_items ".
226  "WHERE event_id = ".$ilDB->quote($this->getEventId() ,'integer')." ";
227 
228  $res = $this->db->query($query);
229  $this->items = array();
230  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
231  {
232  if($tree->isDeleted($row->item_id))
233  {
234  continue;
235  }
236  if(!$tree->isInTree($row->item_id))
237  {
238  $query = "DELETE FROM event_items ".
239  "WHERE item_id = ".$ilDB->quote($row->item_id ,'integer');
240  $ilDB->manipulate($query);
241  continue;
242  }
243 
244  $this->items[] = (int) $row->item_id;
245  }
246  return true;
247  }
Create styles array
The data for the language used.
+ 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 100 of file class.ilEventItems.php.

References $ilDB, $query, and $res.

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

101  {
102  global $ilDB;
103 
104  $query = "DELETE FROM event_items ".
105  "WHERE event_id = ".$ilDB->quote($a_event_id ,'integer')." ";
106  $res = $ilDB->manipulate($query);
107  return true;
108  }
+ Here is the caller graph for this function:

◆ _getItemsOfContainer()

static ilEventItems::_getItemsOfContainer (   $a_ref_id)
static

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

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

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

129  {
130  global $ilDB,$tree;
131 
132  $session_nodes = $tree->getChildsByType($a_ref_id,'sess');
133  foreach($session_nodes as $node)
134  {
135  $session_ids[] = $node['obj_id'];
136  }
137  $query = "SELECT item_id FROM event_items ".
138  "WHERE ".$ilDB->in('event_id',$session_ids,false,'integer');
139 
140 
141  $res = $ilDB->query($query);
142  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
143  {
144  $items[] = $row->item_id;
145  }
146  return $items ? $items : array();
147  }
Create styles array
The data for the language used.
+ 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 157 of file class.ilEventItems.php.

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

Referenced by cloneItems().

158  {
159  global $ilDB;
160 
161  $query = "SELECT * FROM event_items ".
162  "WHERE event_id = ".$ilDB->quote($a_event_id ,'integer');
163  $res = $ilDB->query($query);
164  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
165  {
166  $items[] = $row->item_id;
167  }
168  return $items ? $items : array();
169  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ _isAssigned()

ilEventItems::_isAssigned (   $a_item_id)

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

References $ilDB, $query, and $res.

172  {
173  global $ilDB;
174 
175  $query = "SELECT * FROM event_items ".
176  "WHERE item_id = ".$ilDB->quote($a_item_id ,'integer')." ";
177  $res = $ilDB->query($query);
178 
179  return $res->numRows() ? true : false;
180  }

◆ addItem()

ilEventItems::addItem (   $a_item_ref_id)

Add one item.

Parameters
object$a_item_ref_id
Returns

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

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

90  {
91  $this->items[] = (int) $a_item_ref_id;
92  }
+ 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 190 of file class.ilEventItems.php.

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

191  {
192  global $ilObjDataCache,$ilLog;
193 
194  $ilLog->write(__METHOD__.': Begin cloning session materials ...');
195 
196  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
197  $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
198  $mappings = $cwo->getMappings();
199 
200  $new_items = array();
201  foreach(ilEventItems::_getItemsOfEvent($a_source_id) as $item_id)
202  {
203  if(isset($mappings[$item_id]) and $mappings[$item_id])
204  {
205  $ilLog->write(__METHOD__.': Clone session material nr. '.$item_id);
206  $new_items[] = $mappings[$item_id];
207  }
208  else
209  {
210  $ilLog->write(__METHOD__.': No mapping found for session material nr. '.$item_id);
211  }
212  }
213  $this->setItems($new_items);
214  $this->update();
215  $ilLog->write(__METHOD__.': Finished cloning session materials ...');
216  return true;
217  }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
Create styles array
The data for the language used.
static _getItemsOfEvent($a_event_id)
Get items by event.
+ Here is the call graph for this function:

◆ delete()

ilEventItems::delete ( )

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

References _delete(), and getEventId().

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

◆ getEventId()

ilEventItems::getEventId ( )

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

References $event_id.

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

58  {
59  return $this->event_id;
60  }
+ Here is the caller graph for this function:

◆ getItems()

ilEventItems::getItems ( )

get assigned items

Returns
array $items Assigned items.

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

References array.

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

71  {
72  return $this->items ? $this->items : array();
73  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ setEventId()

ilEventItems::setEventId (   $a_event_id)

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

62  {
63  $this->event_id = $a_event_id;
64  }

◆ setItems()

ilEventItems::setItems (   $a_items)

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

References array.

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

75  {
76  $this->items = array();
77  foreach($a_items as $item_id)
78  {
79  $this->items[] = (int) $item_id;
80  }
81  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ update()

ilEventItems::update ( )

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

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

Referenced by cloneItems().

111  {
112  global $ilDB;
113 
114  $this->delete();
115 
116  foreach($this->items as $item)
117  {
118  $query = "INSERT INTO event_items (event_id,item_id) ".
119  "VALUES( ".
120  $ilDB->quote($this->getEventId() ,'integer').", ".
121  $ilDB->quote($item ,'integer')." ".
122  ")";
123  $res = $ilDB->manipulate($query);
124  }
125  return true;
126  }
+ 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: