Public Member Functions | Data Fields

ilEventAppointment Class Reference

Public Member Functions

 ilEventAppointment ($a_appointment_id=null)
 setAppointmentId ($a_appointment_id)
 getAppointmentId ()
 setEventId ($a_event_id)
 getEventId ()
 setStartingTime ($a_starting_time)
 getStartingTime ()
 setEndingTime ($a_ending_time)
 getEndingTime ()
 toggleFullTime ($a_status)
 enabledFullTime ()
 formatTime ()
 _timeToString ($start, $end)
 _appointmentToString ($start, $end, $fulltime)
 appointmentToString ()
 create ()
 update ()
 delete ()
 _delete ($a_appointment_id)
 _deleteByEvent ($a_event_id)
_readAppointmentsByEvent ($a_event_id)
 validate ()
 __read ()

Data Fields

 $ilErr
 $ilDB
 $tree
 $lng
 $starting_time = null
 $ending_time = null

Detailed Description

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


Member Function Documentation

ilEventAppointment::__read (  ) 

Definition at line 250 of file class.ilEventAppointment.php.

References $query, $res, $row, getAppointmentId(), setEndingTime(), setEventId(), setStartingTime(), and toggleFullTime().

Referenced by ilEventAppointment().

        {
                if(!$this->getAppointmentId())
                {
                        return null;
                }

                $query = "SELECT * FROM event_appointment ".
                        "WHERE appointment_id = '".$this->getAppointmentId()."'";
                $res = $this->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->setEventId($row->event_id);
                        $this->setStartingTime($row->starting_time);
                        $this->setEndingTime($row->ending_time);
                        $this->toggleFullTime($row->fulltime);
                }
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilEventAppointment::_appointmentToString ( start,
end,
fulltime 
)

Definition at line 116 of file class.ilEventAppointment.php.

References $lng, and ilFormat::formatUnixTime().

Referenced by ilCourseContentGUI::__renderEvent(), and appointmentToString().

        {
                global $lng;

                $start_day = date('j',$start);
                $start_month = date('n',$start);
                $start_year = date('Y',$start);

                $end_day = date('j',$end);
                $end_month = date('n',$end);
                $end_year = date('Y',$end);

                if($start_day == $end_day and
                   $start_month == $end_month and
                   $start_year == $end_year)
                {
                        $date_time = ilFormat::formatUnixTime($start,false);
                        if(!$fulltime)
                        {
                                $date_time .= (' '.ilEventAppointment::_timeToString($start,$end));
                        }
                        else
                        {
                                $date_time .= (' ('.$lng->txt('event_full_time_info').')');
                        }
                }
                else
                {
                        if(!$fulltime)
                        {
                                $date_time = ilFormat::formatUnixTime($start,true) . ' - '.
                                        ilFormat::formatUnixTime($end,true);
                        }
                        else
                        {
                                $date_time = ilFormat::formatUnixTime($start,false) . ' - '.
                                        ilFormat::formatUnixTime($end,false);
                                $date_time .= (' ('.$lng->txt('event_full_time_info').')');
                        }
                }
                return $date_time;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilEventAppointment::_delete ( a_appointment_id  ) 

Definition at line 201 of file class.ilEventAppointment.php.

References $ilDB, and $query.

Referenced by delete().

        {
                global $ilDB;

                $query = "DELETE FROM event_appointment ".
                        "WHERE appointment_id = '".$a_appointment_id."'";
                $this->db->query($query);

                return true;
        }

Here is the caller graph for this function:

ilEventAppointment::_deleteByEvent ( a_event_id  ) 

Definition at line 212 of file class.ilEventAppointment.php.

References $ilDB, and $query.

Referenced by ilEvent::_delete().

        {
                global $ilDB;

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

                return true;
        }

Here is the caller graph for this function:

& ilEventAppointment::_readAppointmentsByEvent ( a_event_id  ) 

Definition at line 223 of file class.ilEventAppointment.php.

References $ilDB, $query, $res, $row, and ilEventAppointment().

Referenced by ilEvent::__read().

        {
                global $ilDB;

                $query = "SELECT * FROM event_appointment ".
                        "WHERE event_id = '".$a_event_id."' ".
                        "ORDER BY starting_time";

                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $appointments[] =& new ilEventAppointment($row->appointment_id);
                }
                return is_array($appointments) ? $appointments : array();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilEventAppointment::_timeToString ( start,
end 
)

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

Referenced by formatTime().

        {
                $start = date($this->lng->txt('lang_timeformat_no_sec'),$start);
                $end = date($this->lng->txt('lang_timeformat_no_sec'),$end);
        
                return $start.' - '. $end;
        }

Here is the caller graph for this function:

ilEventAppointment::appointmentToString (  ) 

Definition at line 158 of file class.ilEventAppointment.php.

References _appointmentToString(), enabledFullTime(), getEndingTime(), and getStartingTime().

Here is the call graph for this function:

ilEventAppointment::create (  ) 

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

References $query, enabledFullTime(), and getEventId().

        {
                if(!$this->getEventId())
                {
                        return false;
                }
                $query = "INSERT INTO event_appointment ".
                        "SET event_id = '".$this->getEventId()."', ".
                        "starting_time = '".$this->getStartingTime()."', ".
                        "ending_time = '".$this->getEndingTime()."', ".
                        "fulltime = '".(bool) $this->enabledFullTime()."'";

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

Here is the call graph for this function:

ilEventAppointment::delete (  ) 

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

References _delete(), and getAppointmentId().

Here is the call graph for this function:

ilEventAppointment::enabledFullTime (  ) 

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

Referenced by appointmentToString(), and create().

        {
                return $this->fulltime;
        }

Here is the caller graph for this function:

ilEventAppointment::formatTime (  ) 

Definition at line 103 of file class.ilEventAppointment.php.

References _timeToString(), getEndingTime(), and getStartingTime().

Here is the call graph for this function:

ilEventAppointment::getAppointmentId (  ) 

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

Referenced by __read(), and delete().

        {
                return $this->appointment_id;
        }

Here is the caller graph for this function:

ilEventAppointment::getEndingTime (  ) 

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

Referenced by appointmentToString(), and formatTime().

        {
                return isset($this->ending_time) ? $this->ending_time : mktime(16,0,0,date('n',time()),date('d',time()),date('Y',time()));
        }

Here is the caller graph for this function:

ilEventAppointment::getEventId (  ) 

Definition at line 71 of file class.ilEventAppointment.php.

Referenced by create(), and update().

        {
                return $this->event_id;
        }

Here is the caller graph for this function:

ilEventAppointment::getStartingTime (  ) 

Definition at line 80 of file class.ilEventAppointment.php.

Referenced by appointmentToString(), and formatTime().

        {
                return isset($this->starting_time) ? $this->starting_time : mktime(8,0,0,date('n',time()),date('d',time()),date('Y',time()));
        }

Here is the caller graph for this function:

ilEventAppointment::ilEventAppointment ( a_appointment_id = null  ) 

Definition at line 46 of file class.ilEventAppointment.php.

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

Referenced by _readAppointmentsByEvent().

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

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

                $this->appointment_id = $a_appointment_id;
                $this->__read();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilEventAppointment::setAppointmentId ( a_appointment_id  ) 

Definition at line 58 of file class.ilEventAppointment.php.

        {
                $this->appointment_id = $a_appointment_id;
        }

ilEventAppointment::setEndingTime ( a_ending_time  ) 

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

Referenced by __read().

        {
                $this->ending_time = $a_ending_time;
        }

Here is the caller graph for this function:

ilEventAppointment::setEventId ( a_event_id  ) 

Definition at line 67 of file class.ilEventAppointment.php.

Referenced by __read().

        {
                $this->event_id = $a_event_id;
        }

Here is the caller graph for this function:

ilEventAppointment::setStartingTime ( a_starting_time  ) 

Definition at line 76 of file class.ilEventAppointment.php.

Referenced by __read().

        {
                $this->starting_time = $a_starting_time;
        }

Here is the caller graph for this function:

ilEventAppointment::toggleFullTime ( a_status  ) 

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

Referenced by __read().

        {
                $this->fulltime = $a_status;
        }

Here is the caller graph for this function:

ilEventAppointment::update (  ) 

Definition at line 179 of file class.ilEventAppointment.php.

References $query, and getEventId().

        {
                if(!$this->getEventId())
                {
                        return false;
                }
                $query = "UPDATE event_appointment ".
                        "SET event_id = '".$this->getEventId()."', ".
                        "starting_time = '".$this->getStartingTime()."', ".
                        "ending_time = '".$this->getEndingTime()."', ".
                        "fulltime = '".$this->enabledFullTime()."' ".
                        "WHERE appointment_id = '".$this->getAppointmentId()."'";

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

Here is the call graph for this function:

ilEventAppointment::validate (  ) 

Definition at line 239 of file class.ilEventAppointment.php.

        {
                if($this->starting_time > $this->ending_time)
                {
                        $this->ilErr->appendMessage($this->lng->txt('event_etime_smaller_stime'));
                        return false;
                }
                return true;
        }


Field Documentation

ilEventAppointment::$ending_time = null

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

ilEventAppointment::$ilDB
ilEventAppointment::$ilErr

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

Referenced by ilEventAppointment().

ilEventAppointment::$lng

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

Referenced by _appointmentToString(), and ilEventAppointment().

ilEventAppointment::$starting_time = null

Definition at line 43 of file class.ilEventAppointment.php.

ilEventAppointment::$tree

Definition at line 40 of file class.ilEventAppointment.php.

Referenced by ilEventAppointment().


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