ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTimingUser Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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.

References $DIC, IL_CAL_UNIX, and read().

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
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilTimingUser::create ( )

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

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

Referenced by update().

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.
const IL_CAL_UNIX
$query
getEnd()
Use to set date.
+ 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.

References $query, getRefId(), and getUserId().

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  }
$query
+ Here is the call graph for this function:

◆ getEnd()

ilTimingUser::getEnd ( )

Use to set date.

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

References $end.

Referenced by create(), and update().

77  : ilDateTime
78  {
79  return $this->end;
80  }
+ Here is the caller graph for this function:

◆ getRefId()

ilTimingUser::getRefId ( )

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

References $ref_id.

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

56  : int
57  {
58  return $this->ref_id;
59  }
+ 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.

References $start.

Referenced by ilObjectActivation\addAdditionalSubItemInformation(), create(), and update().

69  : ilDateTime
70  {
71  return $this->start;
72  }
+ Here is the caller graph for this function:

◆ getUserId()

ilTimingUser::getUserId ( )

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

References $usr_id.

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

51  : int
52  {
53  return $this->usr_id;
54  }
+ Here is the caller graph for this function:

◆ isScheduled()

ilTimingUser::isScheduled ( )

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

References $is_scheduled.

Referenced by create(), and update().

61  : bool
62  {
63  return $this->is_scheduled;
64  }
+ Here is the caller graph for this function:

◆ read()

ilTimingUser::read ( )

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

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

Referenced by __construct().

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
const IL_CAL_UNIX
$query
+ 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.

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

Referenced by create().

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  }
getStart()
Use to set start date.
const IL_CAL_UNIX
$query
getEnd()
Use to set date.
+ 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: