ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilTimingPlaned Class Reference

class ilTimingPlaned More...

+ Collaboration diagram for ilTimingPlaned:

Public Member Functions

 __construct ($item_id, $a_usr_id)
 Constructor. More...
 
 getUserId ()
 
 getItemId ()
 
 getPlanedStartingTime ()
 
 setPlanedStartingTime ($a_time)
 
 getPlanedEndingTime ()
 
 setPlanedEndingTime ($a_end)
 
 validate ()
 
 update ()
 
 create ()
 
 delete ()
 
 __read ()
 

Static Public Member Functions

static _delete ($a_item_id, $a_usr_id)
 
static _getPlanedTimings ($a_usr_id, $a_item_id)
 
static _getPlanedTimingsByItem ($a_item_id)
 
static _deleteByItem ($a_item_id)
 
static _deleteByUser ($a_usr_id)
 

Data Fields

 $ilErr
 
 $ilDB
 
 $lng
 

Detailed Description

class ilTimingPlaned

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 34 of file class.ilTimingPlaned.php.

Constructor & Destructor Documentation

◆ __construct()

ilTimingPlaned::__construct (   $item_id,
  $a_usr_id 
)

Constructor.

Parameters
int$item_id
int$a_usr_id

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

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

46  {
47  global $ilErr,$ilDB,$lng,$tree;
48 
49  $this->ilErr =& $ilErr;
50  $this->db =& $ilDB;
51  $this->lng =& $lng;
52 
53  $this->item_id = $item_id;
54  $this->user_id = $a_usr_id;
55 
56  $this->__read();
57  }
+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilTimingPlaned::__read ( )

Definition at line 184 of file class.ilTimingPlaned.php.

References $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, getItemId(), getUserId(), setPlanedEndingTime(), and setPlanedStartingTime().

Referenced by __construct().

185  {
186  global $ilDB;
187 
188  $query = "SELECT * FROM crs_timings_planed ".
189  "WHERE item_id = ".$ilDB->quote($this->getItemId() ,'integer')." ".
190  "AND usr_id = ".$ilDB->quote($this->getUserId() ,'integer')." ";
191  $res = $this->db->query($query);
192  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
193  {
194  $this->setPlanedStartingTime($row->planed_start);
195  $this->setPlanedEndingTime($row->planed_end);
196  }
197  return true;
198  }
setPlanedStartingTime($a_time)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _delete()

static ilTimingPlaned::_delete (   $a_item_id,
  $a_usr_id 
)
static

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

References $ilDB, $query, and $res.

Referenced by delete(), and update().

124  {
125  global $ilDB;
126 
127  $query = "DELETE FROM crs_timings_planed ".
128  "WHERE item_id = ".$ilDB->quote($a_item_id ,'integer')." ".
129  "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ";
130  $res = $ilDB->manipulate($query);
131  }
+ Here is the caller graph for this function:

◆ _deleteByItem()

static ilTimingPlaned::_deleteByItem (   $a_item_id)
static

Definition at line 166 of file class.ilTimingPlaned.php.

References $ilDB, $query, and $res.

167  {
168  global $ilDB;
169 
170  $query = "DELETE FROM crs_timings_planed ".
171  "WHERE item_id = ".$ilDB->quote($a_item_id ,'integer')." ";
172  $res = $ilDB->manipulate($query);
173  }

◆ _deleteByUser()

static ilTimingPlaned::_deleteByUser (   $a_usr_id)
static

Definition at line 175 of file class.ilTimingPlaned.php.

References $ilDB, $query, and $res.

176  {
177  global $ilDB;
178 
179  $query = "DELETE FROM crs_timings_planed ".
180  "WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ";
181  $res = $ilDB->manipulate($query);
182  }

◆ _getPlanedTimings()

static ilTimingPlaned::_getPlanedTimings (   $a_usr_id,
  $a_item_id 
)
static

Definition at line 134 of file class.ilTimingPlaned.php.

References $data, $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjectActivation\addAdditionalSubItemInformation().

135  {
136  global $ilDB;
137 
138  $query = "SELECT * FROM crs_timings_planed ".
139  "WHERE item_id = ".$ilDB->quote($a_item_id ,'integer')." ".
140  "AND usr_id = ".$ilDB->quote($a_usr_id ,'integer')." ";
141  $res = $ilDB->query($query);
142  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
143  {
144  $data['planed_start'] = $row->planed_start;
145  $data['planed_end'] = $row->planed_end;
146  }
147  return $data ? $data : array();
148  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ _getPlanedTimingsByItem()

static ilTimingPlaned::_getPlanedTimingsByItem (   $a_item_id)
static

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

References $data, $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilTimingCache\_getTimings().

152  {
153  global $ilDB;
154 
155  $query = "SELECT * FROM crs_timings_planed ".
156  "WHERE item_id = ".$ilDB->quote($a_item_id ,'integer')." ";
157  $res = $ilDB->query($query);
158  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
159  {
160  $data[$row->usr_id]['start'] = $row->planed_start;
161  $data[$row->usr_id]['end'] = $row->planed_end;
162  }
163  return $data ? $data : array();
164  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ create()

ilTimingPlaned::create ( )

Definition at line 104 of file class.ilTimingPlaned.php.

References $ilDB, $query, $res, getItemId(), getPlanedEndingTime(), getPlanedStartingTime(), and getUserId().

Referenced by update().

105  {
106  global $ilDB;
107 
108  $query = "INSERT INTO crs_timings_planed (item_id,usr_id,planed_start,planed_end) ".
109  "VALUES( ".
110  $ilDB->quote($this->getItemId() ,'integer').", ".
111  $ilDB->quote($this->getUserId() ,'integer').", ".
112  $ilDB->quote($this->getPlanedStartingTime() ,'integer').", ".
113  $ilDB->quote($this->getPlanedEndingTime() ,'integer')." ".
114  ")";
115  $res = $ilDB->manipulate($query);
116  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilTimingPlaned::delete ( )

Definition at line 118 of file class.ilTimingPlaned.php.

References _delete(), getItemId(), and getUserId().

119  {
120  return ilTimingPlaned::_delete($this->getItemId(),$this->getUserId());
121  }
static _delete($a_item_id, $a_usr_id)
+ Here is the call graph for this function:

◆ getItemId()

ilTimingPlaned::getItemId ( )

Definition at line 63 of file class.ilTimingPlaned.php.

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

64  {
65  return $this->item_id;
66  }
+ Here is the caller graph for this function:

◆ getPlanedEndingTime()

ilTimingPlaned::getPlanedEndingTime ( )

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

Referenced by create(), and validate().

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

◆ getPlanedStartingTime()

ilTimingPlaned::getPlanedStartingTime ( )

Definition at line 68 of file class.ilTimingPlaned.php.

References $start.

Referenced by create().

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

◆ getUserId()

ilTimingPlaned::getUserId ( )

Definition at line 59 of file class.ilTimingPlaned.php.

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

60  {
61  return $this->user_id;
62  }
+ Here is the caller graph for this function:

◆ setPlanedEndingTime()

ilTimingPlaned::setPlanedEndingTime (   $a_end)

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

Referenced by __read().

81  {
82  $this->end = $a_end;
83  }
+ Here is the caller graph for this function:

◆ setPlanedStartingTime()

ilTimingPlaned::setPlanedStartingTime (   $a_time)

Definition at line 72 of file class.ilTimingPlaned.php.

Referenced by __read(), and ilCourseContentGUI\updateUserTimings().

73  {
74  $this->start = $a_time;
75  }
+ Here is the caller graph for this function:

◆ update()

ilTimingPlaned::update ( )

Definition at line 97 of file class.ilTimingPlaned.php.

References _delete(), create(), getItemId(), and getUserId().

98  {
99  ilTimingPlaned::_delete($this->getItemId(),$this->getUserId());
100  $this->create();
101  return true;
102  }
static _delete($a_item_id, $a_usr_id)
+ Here is the call graph for this function:

◆ validate()

ilTimingPlaned::validate ( )

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

References ilObjectActivation\getItem(), getItemId(), and getPlanedEndingTime().

86  {
87  include_once './Services/Object/classes/class.ilObjectActivation.php';
88  $item = ilObjectActivation::getItem($this->getItemId());
89  // #9326
90  if($this->getPlanedEndingTime() > $item['latest_end'])
91  {
92  return false;
93  }
94  return true;
95  }
static getItem($a_ref_id)
Get item data.
+ Here is the call graph for this function:

Field Documentation

◆ $ilDB

◆ $ilErr

ilTimingPlaned::$ilErr

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

Referenced by __construct().

◆ $lng

ilTimingPlaned::$lng

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

Referenced by __construct().


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