Public Member Functions | Static Public Member Functions | Data Fields

ilEventItems Class Reference

class ilEvent More...

Public Member Functions

 ilEventItems ($a_event_id)
 getEventId ()
 setEventId ($a_event_id)
 getItems ()
 setItems ($a_items)
 delete ()
 _delete ($a_event_id)
 update ()
 _getItemsOfContainer ($a_obj_id)
 _isAssigned ($a_item_id)
 cloneItems ($a_source_event, $a_copy_id)
 Clone items.
 __read ()

Static Public Member Functions

static _getItemsOfEvent ($a_event_id)
 Get items by event.

Data Fields

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

Detailed Description

class ilEvent

Author:
Stefan Meyer <smeyer@databay.de>
Version:
Id:
class.ilEventItems.php 14156 2007-06-17 11:45:45Z smeyer

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


Member Function Documentation

ilEventItems::__read (  ) 

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

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

Referenced by ilEventItems().

        {
                global $ilDB,$tree;
                
                $query = "SELECT * FROM event_items ".
                        "WHERE event_id = ".$ilDB->quote($this->getEventId())." ";

                $res = $this->db->query($query);
                $this->items = array();
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        if($tree->isDeleted($row->item_id))
                        {
                                continue;
                        }
                        if(!$tree->isInTree($row->item_id))
                        {
                                $query = "DELETE FROM event_items ".
                                        "WHERE item_id = ".$ilDB->quote($row->item_id);
                                $ilDB->query($query);
                                continue;
                        }
                        
                        $this->items[] = (int) $row->item_id;
                }
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilEventItems::_delete ( a_event_id  ) 

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

References $ilDB.

Referenced by delete().

        {
                global $ilDB;

                $query = "DELETE FROM event_items ".
                        "WHERE event_id = ".$ilDB->quote($a_event_id)." ";
                $ilDB->query($query);
                return true;
        }

Here is the caller graph for this function:

ilEventItems::_getItemsOfContainer ( a_obj_id  ) 

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

References $ilDB, $items, and $res.

Referenced by ilCourseItems::getFilteredItems().

        {
                global $ilDB;

                $query = "SELECT * FROM event AS e ".
                        "JOIN event_items AS ei ON e.event_id = ei.event_id ".
                        "WHERE obj_id = ".$ilDB->quote($a_obj_id)." ";

                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $items[] = $row->item_id;
                }
                return $items ? $items : array();
        }

Here is the caller graph for this function:

static ilEventItems::_getItemsOfEvent ( a_event_id  )  [static]

Get items by event.

public

Parameters:
int event id

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

References $ilDB, $items, and $res.

Referenced by cloneItems().

        {
                global $ilDB;
                
                $query = "SELECT * FROM event_items ".
                        "WHERE event_id = ".$ilDB->quote($a_event_id);
                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $items[] = $row->item_id;
                }
                return $items ? $items : array();
        }

Here is the caller graph for this function:

ilEventItems::_isAssigned ( a_item_id  ) 

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

References $ilDB, and $res.

Referenced by ilCourseItems::__isMovable().

        {
                global $ilDB;

                $query = "SELECT * FROM event_items ".
                        "WHERE item_id = ".$ilDB->quote($a_item_id)." ";
                $res = $ilDB->query($query);

                return $res->numRows() ? true : false;
        }

Here is the caller graph for this function:

ilEventItems::cloneItems ( a_source_event,
a_copy_id 
)

Clone items.

public

Parameters:
int source event id
int copy id

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

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

        {
                global $ilObjDataCache,$ilLog;
                
                $ilLog->write(__METHOD__.': Begin course event items ...');
                
                include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
                $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
                $mappings = $cwo->getMappings();
                
                $new_items = array(); 
                foreach(ilEventItems::_getItemsOfEvent($a_source_event) as $item_id)
                {
                        if(isset($mappings[$item_id]) and $mappings[$item_id])
                        {
                                $ilLog->write(__METHOD__.': Clone event item nr. '.$item_id);
                                $new_items[] = $mappings[$item_id];
                        }
                        else
                        {
                                $ilLog->write(__METHOD__.': No mapping found for event item nr. '.$item_id);
                        }
                }
                $this->setItems($new_items);
                $this->update();
                $ilLog->write(__METHOD__.': Finished cloning course event items ...');
                return true;

        }

Here is the call graph for this function:

ilEventItems::delete (  ) 

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

References _delete(), and getEventId().

        {
                return ilEventItems::_delete($this->getEventId());
        }

Here is the call graph for this function:

ilEventItems::getEventId (  ) 

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

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

        {
                return $this->event_id;
        }

Here is the caller graph for this function:

ilEventItems::getItems (  ) 

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

        {
                return $this->items ? $this->items : array();
        }

ilEventItems::ilEventItems ( a_event_id  ) 

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

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

        {
                global $ilErr,$ilDB,$lng,$tree;

                $this->ilErr =& $ilErr;
                $this->db  =& $ilDB;
                $this->lng =& $lng;

                $this->event_id = $a_event_id;
                $this->__read();
        }

Here is the call graph for this function:

ilEventItems::setEventId ( a_event_id  ) 

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

        {
                $this->event_id = $a_event_id;
        }

ilEventItems::setItems ( a_items  ) 

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

Referenced by cloneItems().

        {
                $this->items = array();
                foreach($a_items as $item_id)
                {
                        $this->items[] = (int) $item_id;
                }
        }

Here is the caller graph for this function:

ilEventItems::update (  ) 

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

References $ilDB, and getEventId().

Referenced by cloneItems().

        {
                global $ilDB;
                
                $this->delete();
                
                foreach($this->items as $item)
                {
                        $query = "INSERT INTO event_items ".
                                "SET event_id = ".$ilDB->quote($this->getEventId()).", ".
                                "item_id = ".$ilDB->quote($item)." ";
                        $this->db->query($query);
                }
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

ilEventItems::$event_id = null

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

ilEventItems::$ilDB
ilEventItems::$ilErr

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

Referenced by ilEventItems().

ilEventItems::$items = array()

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

Referenced by _getItemsOfContainer(), and _getItemsOfEvent().

ilEventItems::$lng

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

Referenced by ilEventItems().

ilEventItems::$tree

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

Referenced by __read(), and ilEventItems().


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