Public Member Functions | Static Public Member Functions | Data Fields

ilEvent Class Reference

class ilEvent More...

Inheritance diagram for ilEvent:
Collaboration diagram for ilEvent:

Public Member Functions

 ilEvent ($a_event_id=0)
 setObjId ($a_obj_id)
 getObjId ()
 getEventId ()
 setEventId ($a_event_id)
 getTitle ()
 setTitle ($a_title)
 getDescription ()
 setDescription ($a_description)
 getLocation ()
 setLocation ($a_location)
 setName ($a_name)
 getName ()
 getFirstname ()
 setFirstname ($a_firstname)
 getLastname ()
 setLastname ($a_lastname)
 getPTitle ()
 setPTitle ($a_ptitle)
 getEmail ()
 setEmail ($a_mail)
 getPhone ()
 setPhone ($a_phone)
 setDetails ($a_details)
 getDetails ()
 enabledRegistration ()
 enableRegistration ($a_status)
 enabledParticipation ()
 enableParticipation ($a_status)
getAppointments ()
 addAppointment (&$appointment)
 setAppointments (&$appointments)
getFirstAppointment ()
 validate ()
 getFiles ()
 create ()
 update ()
 delete ()
 readFiles ()
 hasTutorSettings ()
 getFullname ()
 _delete ($a_event_id)
 _deleteAll ($a_obj_id)
 _exists ($a_event_id)
 _lookupCourseId ($a_event_id)
_getEvents ($a_obj_id)
_getEventsAsArray ($a_obj_id)
 __read ()

Static Public Member Functions

static _cloneEvent ($a_source_id, $a_target_id, $a_copy_id)
 Clone events.

Data Fields

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

Detailed Description

class ilEvent

Author:
Stefan Meyer <smeyer@databay.de>
Version:
Id:
class.ilEvent.php 13632 2007-04-13 11:02:45Z smeyer

Definition at line 37 of file class.ilEvent.php.


Member Function Documentation

ilEvent::__read (  ) 

Definition at line 436 of file class.ilEvent.php.

References $ilDB, $res, ilEventAppointment::_readAppointmentsByEvent(), enableParticipation(), enableRegistration(), readFiles(), setDescription(), setDetails(), setEmail(), setLocation(), setName(), setObjId(), setPhone(), and setTitle().

Referenced by ilEvent().

        {
                global $ilDB;
                
                if(!$this->event_id)
                {
                        return true;
                }

                // read event data
                $query = "SELECT * FROM event WHERE event_id = ".$ilDB->quote($this->event_id)." ";
                $res = $this->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->setObjId($row->obj_id);
                        $this->setTitle($row->title);
                        $this->setDescription($row->description);
                        $this->setLocation($row->location);
                        
                        #$this->setPTitle($row->tutor_title);
                        #$this->setFirstname($row->tutor_firstname);
                        $this->setName($row->tutor_name);
                        $this->setPhone($row->tutor_phone);
                        $this->setEmail($row->tutor_email);
                        $this->setDetails($row->details);
                        $this->enableRegistration($row->registration);
                        $this->enableParticipation($row->participation);
                }

                // get assigned appointments
                $this->appointments =& ilEventAppointment::_readAppointmentsByEvent($this->event_id);

                // get assigned files
                $this->readFiles();

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

static ilEvent::_cloneEvent ( a_source_id,
a_target_id,
a_copy_id 
) [static]

Clone events.

public

Parameters:
int source id
int target id
int copy id

Definition at line 219 of file class.ilEvent.php.

References _getEvents(), and ilEvent().

Referenced by ilObjCourse::cloneDependencies().

        {
                include_once('Modules/Course/classes/Event/class.ilEventItems.php');
                
                include_once('Services/Tracking/classes/class.ilLPEventCollections.php');
                $old_event_collection = new ilLPEventCollections($a_source_id);
                $new_event_collection = new ilLPEventCollections($a_target_id);
                
                foreach(ilEvent::_getEvents($a_source_id) as $event_obj)
                {
                        $new_event = new ilEvent();
                        $new_event->setObjId($a_target_id);
                        $new_event->setTitle($event_obj->getTitle());
                        $new_event->setDescription($event_obj->getDescription());
                        $new_event->setLocation($event_obj->getLocation());
                        $new_event->setName($event_obj->getName());
                        $new_event->setPhone($event_obj->getPhone());
                        $new_event->setEmail($event_obj->getEmail());
                        $new_event->setDetails($event_obj->getDetails());
                        $new_event->enableRegistration($event_obj->enabledRegistration());
                        $new_event->enableParticipation($event_obj->enabledParticipation());
                        $new_event->create();
                        
                        // Copy appointments
                        foreach($event_obj->getAppointments() as $app_obj)
                        {
                                $new_app = new ilEventAppointment();
                                $new_app->setEventId($new_event->getEventId());
                                $new_app->setStartingTime($app_obj->getStartingTime());
                                $new_app->setEndingTime($app_obj->getEndingTime());
                                $new_app->toggleFullTime($app_obj->enabledFullTime());
                                $new_app->create();
                        }
                        // Copy files
                        foreach($event_obj->getFiles() as $file_obj)
                        {
                                $file_obj->cloneFiles($new_event->getEventId());
                        }
                        
                        // Copy lp collections
                        if($old_event_collection->isAssigned($event_obj->getEventId()))
                        {
                                $new_event_collection->add($new_event->getEventId());
                        }
                        
                        // Copy assigned materials
                        $new_event_items = new ilEventItems($new_event->getEventId());
                        $new_event_items->cloneItems($event_obj->getEventId(),$a_copy_id);
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilEvent::_delete ( a_event_id  ) 

Definition at line 345 of file class.ilEvent.php.

References $ilDB, ilEventParticipants::_deleteByEvent(), ilEventFile::_deleteByEvent(), and ilEventAppointment::_deleteByEvent().

Referenced by _deleteAll(), ilEventAdministrationGUI::delete(), and delete().

        {
                global $ilDB;

                $query = "DELETE FROM event WHERE event_id = ".$ilDB->quote($a_event_id)." ";
                $ilDB->query($query);

                ilEventAppointment::_deleteByEvent($a_event_id);
                ilEventFile::_deleteByEvent($a_event_id);
                
                include_once 'Modules/Course/classes/Event/class.ilEventItems.php';
                ilEventItems::_delete($a_event_id);

                include_once 'Modules/Course/classes/Event/class.ilEventParticipants.php';
                ilEventParticipants::_deleteByEvent($a_event_id);

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilEvent::_deleteAll ( a_obj_id  ) 

Definition at line 364 of file class.ilEvent.php.

References $ilDB, $res, and _delete().

Referenced by ilObjCourse::delete().

        {
                global $ilDB;

                $query = "SELECT * FROM event ".
                        "WHERE obj_id = ".$ilDB->quote($a_obj_id)." ";
                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        ilEvent::_delete($row->event_id);
                }
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilEvent::_exists ( a_event_id  ) 

Definition at line 378 of file class.ilEvent.php.

References $ilDB, and $res.

Referenced by ilLPEventCollections::__read(), and ilLPEventCollections::_getItems().

        {
                global $ilDB;

                $query = "SELECT * FROM event WHERE event_id = ".$ilDB->quote($a_event_id)." ";
                $res = $ilDB->query($query);
                return $res->numRows() ? true : false;
        }

Here is the caller graph for this function:

& ilEvent::_getEvents ( a_obj_id  ) 

Definition at line 400 of file class.ilEvent.php.

References $ilDB, $res, and ilEvent().

Referenced by ilLPListOfSettingsGUI::__showCollectionTable(), ilCourseContentGUI::__showEvents(), ilCourseObjectivePresentationGUI::__showSessions(), _cloneEvent(), _getEventsAsArray(), ilEventAdministrationGUI::addEvent(), ilEventAdministrationGUI::eventsList(), and ilEventAdministrationGUI::exportCSV().

        {
                global $ilDB;

                $query = "SELECT * FROM event ".
                        "JOIN event_appointment ON event.event_id = event_appointment.event_id ".
                        "WHERE event.obj_id = ".$ilDB->quote($a_obj_id)." ".
                        "ORDER BY starting_time";

                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $events[] =& new ilEvent($row->event_id);
                }
                return $events ? $events : array();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

& ilEvent::_getEventsAsArray ( a_obj_id  ) 

Definition at line 417 of file class.ilEvent.php.

References _getEvents().

Referenced by ilCourseContentGUI::__editAdvancedUserTimings(), and ilCourseContentGUI::__editUserTimings().

        {
                foreach(ilEvent::_getEvents($a_obj_id) as $event_obj)
                {
                        $item[$event_obj->getEventId()]['title'] = $event_obj->getTitle();
                        $item[$event_obj->getEventId()]['description'] = $event_obj->getDescription();
                        $item[$event_obj->getEventId()]['type'] = 'event';
                        $item[$event_obj->getEventId()]['event_id'] = $event_obj->getEventId();

                        $event_appointment =& $event_obj->getFirstAppointment();
                        $item[$event_obj->getEventId()]['start'] = $event_appointment->getStartingTime();
                        $item[$event_obj->getEventId()]['end'] = $event_appointment->getEndingTime();
                        $item[$event_obj->getEventId()]['fulltime'] = $event_appointment->enabledFullTime();
                }

                return $item ? $item : array();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilEvent::_lookupCourseId ( a_event_id  ) 

Definition at line 387 of file class.ilEvent.php.

References $ilDB, and $res.

        {
                global $ilDB;

                $query = "SELECT * FROM event WHERE event_id = ".$ilDB->quote($a_event_id)."";
                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        return $row->obj_id;
                }
                return false;
        }

ilEvent::addAppointment ( &$  appointment  ) 

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

        {
                $this->appointments[] =& $appointment;
        }

ilEvent::create (  ) 

Definition at line 270 of file class.ilEvent.php.

References $ilDB, enabledParticipation(), enabledRegistration(), getDescription(), getDetails(), getEmail(), getEventId(), getLocation(), getName(), getObjId(), getPhone(), getTitle(), and setEventId().

        {
                global $ilDB;
                
                $query = "INSERT INTO event SET ".
                        "obj_id = ".$ilDB->quote($this->getObjId()).", ".
                        "title = ".$ilDB->quote($this->getTitle()).", ".
                        "description = ".$ilDB->quote($this->getDescription()).", ".
                        "location = ".$ilDB->quote($this->getLocation()).",".
                        #"tutor_firstname = '".ilUtil::prepareDBString($this->getFirstname())."', ".
                        #"tutor_lastname = '".ilUtil::prepareDBString($this->getLastname())."', ".
                        "tutor_name = ".$ilDB->quote($this->getName()).", ".
                        #"tutor_title = '".ilUtil::prepareDBString($this->getPTitle())."', ".
                        "tutor_phone = ".$ilDB->quote($this->getPhone()).", ".
                        "tutor_email = ".$ilDB->quote($this->getEmail()).", ".
                        "details = ".$ilDB->quote($this->getDetails()).",".
                        "registration = ".$ilDB->quote($this->enabledRegistration()).", ".
                        "participation = ".$ilDB->quote($this->enabledParticipation())."";

                $this->db->query($query);
                $this->setEventId($this->db->getLastInsertId());

                return $this->getEventId();
        }

Here is the call graph for this function:

ilEvent::delete (  ) 

Definition at line 322 of file class.ilEvent.php.

References _delete(), and getEventId().

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

Here is the call graph for this function:

ilEvent::enabledParticipation (  ) 

Definition at line 167 of file class.ilEvent.php.

Referenced by create(), and update().

        {
                return true;
        }

Here is the caller graph for this function:

ilEvent::enabledRegistration (  ) 

Definition at line 159 of file class.ilEvent.php.

Referenced by create(), and update().

        {
                return (bool) $this->registration;
        }

Here is the caller graph for this function:

ilEvent::enableParticipation ( a_status  ) 

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

Referenced by __read().

        {
                $this->participation = $a_status;
        }

Here is the caller graph for this function:

ilEvent::enableRegistration ( a_status  ) 

Definition at line 163 of file class.ilEvent.php.

Referenced by __read().

        {
                $this->registration = $a_status;
        }

Here is the caller graph for this function:

& ilEvent::getAppointments (  ) 

Definition at line 177 of file class.ilEvent.php.

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

ilEvent::getDescription (  ) 

Definition at line 85 of file class.ilEvent.php.

Referenced by create(), and update().

        {
                return $this->description;
        }

Here is the caller graph for this function:

ilEvent::getDetails (  ) 

Definition at line 155 of file class.ilEvent.php.

Referenced by create(), and update().

        {
                return $this->details;
        }

Here is the caller graph for this function:

ilEvent::getEmail (  ) 

Definition at line 135 of file class.ilEvent.php.

Referenced by create(), hasTutorSettings(), and update().

        {
                return $this->mail;
        }

Here is the caller graph for this function:

ilEvent::getEventId (  ) 

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

Referenced by create(), delete(), readFiles(), and update().

        {
                return $this->event_id;
        }

Here is the caller graph for this function:

ilEvent::getFiles (  ) 

Definition at line 204 of file class.ilEvent.php.

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

& ilEvent::getFirstAppointment (  ) 

Definition at line 189 of file class.ilEvent.php.

        {
                return is_object($this->appointments[0]) ? $this->appointments[0] : ($this->appointments[0] =& new ilEventAppointment());
        }

ilEvent::getFirstname (  ) 

Definition at line 111 of file class.ilEvent.php.

        {
                return $this->firstname;
        }

ilEvent::getFullname (  ) 

Definition at line 340 of file class.ilEvent.php.

References getName().

Referenced by hasTutorSettings().

        {
                return $this->getName();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilEvent::getLastname (  ) 

Definition at line 119 of file class.ilEvent.php.

        {
                return $this->lastname;
        }

ilEvent::getLocation (  ) 

Definition at line 94 of file class.ilEvent.php.

Referenced by create(), and update().

        {
                return $this->location;
        }

Here is the caller graph for this function:

ilEvent::getName (  ) 

Definition at line 106 of file class.ilEvent.php.

Referenced by create(), getFullname(), and update().

        {
                return $this->name;
        }

Here is the caller graph for this function:

ilEvent::getObjId (  ) 

Definition at line 64 of file class.ilEvent.php.

Referenced by create().

        {
                return $this->obj_id;
        }

Here is the caller graph for this function:

ilEvent::getPhone (  ) 

Definition at line 143 of file class.ilEvent.php.

Referenced by create(), hasTutorSettings(), and update().

        {
                return $this->phone;
        }

Here is the caller graph for this function:

ilEvent::getPTitle (  ) 

Definition at line 127 of file class.ilEvent.php.

        {
                return $this->ptitle;
        }

ilEvent::getTitle (  ) 

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

Referenced by create(), update(), and validate().

        {
                return $this->title;
        }

Here is the caller graph for this function:

ilEvent::hasTutorSettings (  ) 

Definition at line 333 of file class.ilEvent.php.

References getEmail(), getFullname(), and getPhone().

        {
                return strlen($this->getFullname()) or 
                        strlen($this->getEmail()) or
                        strlen($this->getPhone());
        }

Here is the call graph for this function:

ilEvent::ilEvent ( a_event_id = 0  ) 

Definition at line 48 of file class.ilEvent.php.

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

Referenced by _cloneEvent(), and _getEvents().

        {
                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:

Here is the caller graph for this function:

ilEvent::readFiles (  ) 

Definition at line 328 of file class.ilEvent.php.

References ilEventFile::_readFilesByEvent(), and getEventId().

Referenced by __read().

        {
                $this->files = ilEventFile::_readFilesByEvent($this->getEventId());
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilEvent::setAppointments ( &$  appointments  ) 

Definition at line 185 of file class.ilEvent.php.

References $appointments.

        {
                $this->appointments =& $appointments;
        }

ilEvent::setDescription ( a_description  ) 

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

Referenced by __read().

        {
                $this->description = $a_description;
        }

Here is the caller graph for this function:

ilEvent::setDetails ( a_details  ) 

Definition at line 151 of file class.ilEvent.php.

Referenced by __read().

        {
                $this->details = $a_details;
        }

Here is the caller graph for this function:

ilEvent::setEmail ( a_mail  ) 

Definition at line 139 of file class.ilEvent.php.

Referenced by __read().

        {
                $this->mail = $a_mail;
        }

Here is the caller graph for this function:

ilEvent::setEventId ( a_event_id  ) 

Definition at line 73 of file class.ilEvent.php.

Referenced by create().

        {
                $this->event_id = $a_event_id;
        }

Here is the caller graph for this function:

ilEvent::setFirstname ( a_firstname  ) 

Definition at line 115 of file class.ilEvent.php.

        {
                $this->firstname = $a_firstname;
        }

ilEvent::setLastname ( a_lastname  ) 

Definition at line 123 of file class.ilEvent.php.

        {
                $this->lastname = $a_lastname;
        }

ilEvent::setLocation ( a_location  ) 

Definition at line 98 of file class.ilEvent.php.

Referenced by __read().

        {
                $this->location = $a_location;
        }

Here is the caller graph for this function:

ilEvent::setName ( a_name  ) 

Definition at line 102 of file class.ilEvent.php.

Referenced by __read().

        {
                $this->name = $a_name;
        }

Here is the caller graph for this function:

ilEvent::setObjId ( a_obj_id  ) 

Definition at line 60 of file class.ilEvent.php.

Referenced by __read().

        {
                $this->obj_id = $a_obj_id;
        }

Here is the caller graph for this function:

ilEvent::setPhone ( a_phone  ) 

Definition at line 147 of file class.ilEvent.php.

Referenced by __read().

        {
                $this->phone = $a_phone;
        }

Here is the caller graph for this function:

ilEvent::setPTitle ( a_ptitle  ) 

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

        {
                $this->ptitle = $a_ptitle;
        }

ilEvent::setTitle ( a_title  ) 

Definition at line 81 of file class.ilEvent.php.

Referenced by __read().

        {
                $this->title = $a_title;
        }

Here is the caller graph for this function:

ilEvent::update (  ) 

Definition at line 295 of file class.ilEvent.php.

References $ilDB, enabledParticipation(), enabledRegistration(), getDescription(), getDetails(), getEmail(), getEventId(), getLocation(), getName(), getPhone(), and getTitle().

        {
                global $ilDB;
                
                if(!$this->event_id)
                {
                        return false;
                }

                $query = "UPDATE event SET ".
                        "title = ".$ilDB->quote($this->getTitle()).", ".
                        "description = ".$ilDB->quote($this->getDescription()).", ".
                        "location = ".$ilDB->quote($this->getLocation()).",".
                        #"tutor_firstname = '".ilUtil::prepareDBString($this->getFirstname())."', ".
                        "tutor_name = ".$ilDB->quote($this->getName()).", ".
                        #"tutor_title = '".ilUtil::prepareDBString($this->getPTitle())."', ".
                        "tutor_phone = ".$ilDB->quote($this->getPhone()).", ".
                        "tutor_email = ".$ilDB->quote($this->getEmail()).", ".
                        "details = ".$ilDB->quote($this->getDetails()).", ".
                        "registration = ".$ilDB->quote($this->enabledRegistration()).", ".
                        "participation = ".$ilDB->quote($this->enabledParticipation())." ".
                        "WHERE event_id = ".$ilDB->quote($this->getEventId())." ";

                $this->db->query($query);
                return true;
        }

Here is the call graph for this function:

ilEvent::validate (  ) 

Definition at line 194 of file class.ilEvent.php.

References getTitle().

        {
                if(!strlen($this->getTitle()))
                {
                        $this->ilErr->appendMessage($this->lng->txt('fill_out_all_required_fields'));
                        return false;
                }
                return true;
        }

Here is the call graph for this function:


Field Documentation

ilEvent::$appointments = array()

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

Referenced by setAppointments().

ilEvent::$event_id = null

Definition at line 44 of file class.ilEvent.php.

ilEvent::$ilDB
ilEvent::$ilErr

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

Referenced by ilEvent().

ilEvent::$lng

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

Referenced by ilEvent().

ilEvent::$tree

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

Referenced by ilEvent().


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