ILIAS  release_7 Revision v7.30-3-g800a261c036
ilTimingUser Class Reference

TableGUI class for timings administration. More...

+ Collaboration diagram for ilTimingUser:

Public Member Functions

 __construct ($a_ref_id, $a_usr_id)
 Constructor. More...
 
 getUserId ()
 get user id More...
 
 getRefId ()
 Get ref_id. More...
 
 isScheduled ()
 Check if an entry exists for user. More...
 
 getStart ()
 Use to set start date. More...
 
 getEnd ()
 Use to set date. More...
 
 create ()
 Create new entry. More...
 
 update ()
 Update @global type $ilDB. More...
 
 delete ()
 Delete entry @global type $ilDB. More...
 
 read ()
 Read from db. More...
 

Private Attributes

 $ref_id = 0
 
 $usr_id = 0
 
 $start = null
 
 $end = null
 
 $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 12 of file class.ilTimingUser.php.

Constructor & Destructor Documentation

◆ __construct()

ilTimingUser::__construct (   $a_ref_id,
  $a_usr_id 
)

Constructor.

Parameters
type$a_ref_id
type$a_usr_id

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

27 {
28 $this->ref_id = $a_ref_id;
29 $this->usr_id = $a_usr_id;
30
31 $this->start = new ilDateTime(0, IL_CAL_UNIX);
32 $this->end = new ilDateTime(0, IL_CAL_UNIX);
33
34 $this->read();
35 }
const IL_CAL_UNIX
@classDescription Date and time handling
read()
Read from db.

References IL_CAL_UNIX, and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilTimingUser::create ( )

Create new entry.

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

85 {
86 global $DIC;
87
88 $ilDB = $DIC->database();
89
90 if ($this->isScheduled()) {
91 return $this->update();
92 }
93
94 $query = 'INSERT INTO crs_timings_user (ref_id, usr_id, sstart, ssend ) VALUES ( ' .
95 $ilDB->quote($this->getRefId(), 'integer') . ', ' .
96 $ilDB->quote($this->getUserId(), 'integer') . ', ' .
97 $ilDB->quote($this->getStart()->get(IL_CAL_UNIX, 'integer')) . ', ' .
98 $ilDB->quote($this->getEnd()->get(IL_CAL_UNIX, 'integer')) . ' ' .
99 ')';
100 $ilDB->manipulate($query);
101
102 $this->is_scheduled = true;
103 }
getUserId()
get user id
update()
Update @global type $ilDB.
getRefId()
Get ref_id.
isScheduled()
Check if an entry exists for user.
getStart()
Use to set start date.
getEnd()
Use to set date.
global $DIC
Definition: goto.php:24
$query
global $ilDB

References $DIC, $ilDB, $query, 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 ( )

Delete entry @global type $ilDB.

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

132 {
133 global $DIC;
134
135 $ilDB = $DIC->database();
136
137 $query = 'DELETE FROM crs_timings_user ' . ' ' .
138 'WHERE ref_id = ' . $ilDB->quote($this->getRefId(), 'integer') . ' ' .
139 'AND usr_id = ' . $ilDB->quote($this->getUserId(), 'integer');
140 $ilDB->manipulate($query);
141
142 $this->is_scheduled = false;
143 }

References $DIC, $ilDB, $query, and getRefId().

+ Here is the call graph for this function:

◆ getEnd()

ilTimingUser::getEnd ( )

Use to set date.

Returns
ilDateTime

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

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

References $end.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getRefId()

ilTimingUser::getRefId ( )

Get ref_id.

Returns
type

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

51 {
52 return $this->ref_id;
53 }

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.

Returns
ilDateTime

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

68 {
69 return $this->start;
70 }

References $start.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getUserId()

ilTimingUser::getUserId ( )

get user id

Returns
type

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

42 {
43 return $this->usr_id;
44 }

References $usr_id.

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

+ Here is the caller graph for this function:

◆ isScheduled()

ilTimingUser::isScheduled ( )

Check if an entry exists for user.

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

59 {
61 }

References $is_scheduled.

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

+ Here is the caller graph for this function:

◆ read()

ilTimingUser::read ( )

Read from db.

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

151 {
152 global $DIC;
153
154 $ilDB = $DIC->database();
155
156 $query = 'SELECT * FROM crs_timings_user ' .
157 'WHERE ref_id = ' . $ilDB->quote($this->getRefId(), 'integer') . ' ' .
158 'AND usr_id = ' . $ilDB->quote($this->getUserId(), 'integer');
159 $res = $ilDB->query($query);
160 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
161 $this->is_scheduled = true;
162 $this->start = new ilDateTime($row->sstart, IL_CAL_UNIX);
163 $this->end = new ilDateTime($row->ssend, IL_CAL_UNIX);
164 }
165 return $this->isScheduled();
166 }
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, getRefId(), getUserId(), IL_CAL_UNIX, and isScheduled().

Referenced by __construct().

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

◆ update()

ilTimingUser::update ( )

Update @global type $ilDB.

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

110 {
111 global $DIC;
112
113 $ilDB = $DIC->database();
114
115 if (!$this->isScheduled()) {
116 return $this->create();
117 }
118
119 $query = 'UPDATE crs_timings_user ' .
120 'SET sstart = ' . $ilDB->quote($this->getStart()->get(IL_CAL_UNIX, 'integer')) . ', ' .
121 'ssend = ' . $ilDB->quote($this->getEnd()->get(IL_CAL_UNIX, 'integer')) . ' ' .
122 'WHERE ref_id = ' . $ilDB->quote($this->getRefId(), 'integer') . ' ' .
123 'AND usr_id = ' . $ilDB->quote($this->getUserId(), 'integer');
124 $ilDB->manipulate($query);
125 }
create()
Create new entry.

References $DIC, $ilDB, $query, 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

◆ $end

ilTimingUser::$end = null
private

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

Referenced by getEnd().

◆ $is_scheduled

ilTimingUser::$is_scheduled = false
private

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

Referenced by isScheduled().

◆ $ref_id

ilTimingUser::$ref_id = 0
private

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

Referenced by getRefId().

◆ $start

ilTimingUser::$start = null
private

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

Referenced by getStart().

◆ $usr_id

ilTimingUser::$usr_id = 0
private

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

Referenced by getUserId().


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