ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTimingUser Class Reference

TableGUI class for timings administration. More...

+ Collaboration diagram for ilTimingUser:

Public Member Functions

 __construct (int $a_ref_id, int $a_usr_id)
 
 getUserId ()
 
 getRefId ()
 
 isScheduled ()
 
 getStart ()
 Use to set start date. More...
 
 getEnd ()
 Use to set date. More...
 
 create ()
 
 update ()
 
 delete ()
 
 read ()
 

Protected Attributes

ilDBInterface $db
 

Private Attributes

int $ref_id = 0
 
int $usr_id = 0
 
ilDateTime $start
 
ilDateTime $end
 
bool $is_scheduled = false
 

Detailed Description

TableGUI class for timings administration.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$ \

Definition at line 26 of file class.ilTimingUser.php.

Constructor & Destructor Documentation

◆ __construct()

ilTimingUser::__construct ( int  $a_ref_id,
int  $a_usr_id 
)

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

38 {
39 global $DIC;
40
41 $this->db = $DIC->database();
42
43 $this->ref_id = $a_ref_id;
44 $this->usr_id = $a_usr_id;
45
46 $this->start = new ilDateTime(0, IL_CAL_UNIX);
47 $this->end = new ilDateTime(0, IL_CAL_UNIX);
48 $this->read();
49 }
const IL_CAL_UNIX
@classDescription Date and time handling
global $DIC
Definition: shib_login.php:26

References $DIC, IL_CAL_UNIX, and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilTimingUser::create ( )

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

82 : void
83 {
84 if ($this->isScheduled()) {
85 $this->update();
86 return;
87 }
88
89 $query = 'INSERT INTO crs_timings_user (ref_id, usr_id, sstart, ssend ) VALUES ( ' .
90 $this->db->quote($this->getRefId(), 'integer') . ', ' .
91 $this->db->quote($this->getUserId(), 'integer') . ', ' .
92 $this->db->quote($this->getStart()->get(IL_CAL_UNIX), 'integer') . ', ' .
93 $this->db->quote($this->getEnd()->get(IL_CAL_UNIX), 'integer') . ' ' .
94 ')';
95 $this->db->manipulate($query);
96 $this->is_scheduled = true;
97 }
getStart()
Use to set start date.
getEnd()
Use to set date.

References getEnd(), getRefId(), getStart(), getUserId(), IL_CAL_UNIX, isScheduled(), and update().

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilTimingUser::delete ( )

Definition at line 114 of file class.ilTimingUser.php.

114 : void
115 {
116 $query = 'DELETE FROM crs_timings_user ' . ' ' .
117 'WHERE ref_id = ' . $this->db->quote($this->getRefId(), 'integer') . ' ' .
118 'AND usr_id = ' . $this->db->quote($this->getUserId(), 'integer');
119 $this->db->manipulate($query);
120 $this->is_scheduled = false;
121 }

References getRefId().

+ Here is the call graph for this function:

◆ getEnd()

ilTimingUser::getEnd ( )

Use to set date.

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

78 {
79 return $this->end;
80 }

References $end.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getRefId()

ilTimingUser::getRefId ( )

Definition at line 56 of file class.ilTimingUser.php.

56 : int
57 {
58 return $this->ref_id;
59 }

References $ref_id.

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

+ Here is the caller graph for this function:

◆ getStart()

ilTimingUser::getStart ( )

Use to set start date.

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

70 {
71 return $this->start;
72 }

References $start.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getUserId()

ilTimingUser::getUserId ( )

Definition at line 51 of file class.ilTimingUser.php.

51 : int
52 {
53 return $this->usr_id;
54 }

References $usr_id.

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

+ Here is the caller graph for this function:

◆ isScheduled()

ilTimingUser::isScheduled ( )

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

61 : bool
62 {
64 }

References $is_scheduled.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ read()

ilTimingUser::read ( )

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

123 : void
124 {
125 $query = 'SELECT * FROM crs_timings_user ' .
126 'WHERE ref_id = ' . $this->db->quote($this->getRefId(), 'integer') . ' ' .
127 'AND usr_id = ' . $this->db->quote($this->getUserId(), 'integer');
128 $res = $this->db->query($query);
129 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
130 $this->is_scheduled = true;
131 $this->start = new ilDateTime((int) $row->sstart, IL_CAL_UNIX);
132 $this->end = new ilDateTime((int) $row->ssend, IL_CAL_UNIX);
133 }
134 }
$res
Definition: ltiservices.php:69

References $res, ilDBConstants\FETCHMODE_OBJECT, getRefId(), getUserId(), and IL_CAL_UNIX.

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilTimingUser::update ( )

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

99 : void
100 {
101 if (!$this->isScheduled()) {
102 $this->create();
103 return;
104 }
105
106 $query = 'UPDATE crs_timings_user ' .
107 'SET sstart = ' . $this->db->quote($this->getStart()->get(IL_CAL_UNIX), 'integer') . ', ' .
108 'ssend = ' . $this->db->quote($this->getEnd()->get(IL_CAL_UNIX), 'integer') . ' ' .
109 'WHERE ref_id = ' . $this->db->quote($this->getRefId(), 'integer') . ' ' .
110 'AND usr_id = ' . $this->db->quote($this->getUserId(), 'integer');
111 $this->db->manipulate($query);
112 }

References create(), getEnd(), getRefId(), getStart(), getUserId(), IL_CAL_UNIX, and isScheduled().

Referenced by create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilTimingUser::$db
protected

Definition at line 35 of file class.ilTimingUser.php.

◆ $end

ilDateTime ilTimingUser::$end
private

Definition at line 31 of file class.ilTimingUser.php.

Referenced by getEnd().

◆ $is_scheduled

bool ilTimingUser::$is_scheduled = false
private

Definition at line 33 of file class.ilTimingUser.php.

Referenced by isScheduled().

◆ $ref_id

int ilTimingUser::$ref_id = 0
private

Definition at line 28 of file class.ilTimingUser.php.

Referenced by getRefId().

◆ $start

ilDateTime ilTimingUser::$start
private

Definition at line 30 of file class.ilTimingUser.php.

Referenced by getStart().

◆ $usr_id

int ilTimingUser::$usr_id = 0
private

Definition at line 29 of file class.ilTimingUser.php.

Referenced by getUserId().


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