ILIAS  release_4-4 Revision
ilLPObjSettings Class Reference
+ Collaboration diagram for ilLPObjSettings:

Public Member Functions

 ilLPObjSettings ($a_obj_id)
 
 cloneSettings ($a_new_obj_id)
 Clone settings. More...
 
 getVisits ()
 
 setVisits ($a_visits)
 
 setMode ($a_mode)
 
 getMode ()
 
 getObjId ()
 
 getObjType ()
 
 __read ()
 
 update ($a_refresh_lp=true)
 
 insert ()
 
 _delete ($a_obj_id)
 
 _lookupVisits ($a_obj_id)
 

Static Public Member Functions

static _lookupDBModeForObjects (array $a_obj_ids)
 
static _lookupDBMode ($a_obj_id)
 
static _mode2Text ($a_mode)
 
static _mode2InfoText ($a_mode)
 

Data Fields

 $db = null
 
 $obj_id = null
 
 $obj_type = null
 
 $obj_mode = null
 
 $visits = null
 
 $is_stored = false
 
const LP_MODE_DEACTIVATED = 0
 
const LP_MODE_TLT = 1
 
const LP_MODE_VISITS = 2
 
const LP_MODE_MANUAL = 3
 
const LP_MODE_OBJECTIVES = 4
 
const LP_MODE_COLLECTION = 5
 
const LP_MODE_SCORM = 6
 
const LP_MODE_TEST_FINISHED = 7
 
const LP_MODE_TEST_PASSED = 8
 
const LP_MODE_EXERCISE_RETURNED = 9
 
const LP_MODE_EVENT = 10
 
const LP_MODE_MANUAL_BY_TUTOR = 11
 
const LP_MODE_SCORM_PACKAGE = 12
 
const LP_MODE_UNDEFINED = 13
 
const LP_MODE_PLUGIN = 14
 
const LP_MODE_COLLECTION_TLT = 15
 
const LP_MODE_COLLECTION_MANUAL = 16
 
const LP_DEFAULT_VISITS = 30
 

Protected Member Functions

 doLPRefresh ()
 

Detailed Description

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

Member Function Documentation

◆ __read()

ilLPObjSettings::__read ( )

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

References $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilLPObjSettings(), insert(), and update().

115  {
116  $res = $this->db->query("SELECT * FROM ut_lp_settings WHERE obj_id = ".
117  $this->db->quote($this->obj_id ,'integer'));
118  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
119  {
120  $this->is_stored = true;
121  $this->obj_type = $row->obj_type;
122  $this->obj_mode = $row->u_mode;
123  $this->visits = $row->visits;
124 
125  return true;
126  }
127 
128  return false;
129  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ _delete()

ilLPObjSettings::_delete (   $a_obj_id)

Definition at line 181 of file class.ilLPObjSettings.php.

References $query, and $res.

182  {
183  global $ilDB;
184 
185  $query = "DELETE FROM ut_lp_settings WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer');
186  $res = $ilDB->manipulate($query);
187 
188  return true;
189  }

◆ _lookupDBMode()

static ilLPObjSettings::_lookupDBMode (   $a_obj_id)
static

Definition at line 228 of file class.ilLPObjSettings.php.

References $query, and $row.

Referenced by ilObjectLP\getCurrentMode().

229  {
230  global $ilDB;
231 
232  // this does NOT handle default mode!
233 
234  $query = "SELECT u_mode FROM ut_lp_settings".
235  " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer");
236  $set = $ilDB->query($query);
237  $row = $ilDB->fetchAssoc($set);
238  if(is_array($row))
239  {
240  return $row['u_mode'];
241  }
242  }
+ Here is the caller graph for this function:

◆ _lookupDBModeForObjects()

static ilLPObjSettings::_lookupDBModeForObjects ( array  $a_obj_ids)
static

Definition at line 209 of file class.ilLPObjSettings.php.

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilLPStatus\preloadListGUIData().

210  {
211  global $ilDB;
212 
213  // this does NOT handle default mode!
214 
215  $res = array();
216 
217  $query = "SELECT obj_id, u_mode FROM ut_lp_settings".
218  " WHERE ".$ilDB->in("obj_id", $a_obj_ids, "", "integer");
219  $set = $ilDB->query($query);
220  while($row = $set->fetchRow(DB_FETCHMODE_OBJECT))
221  {
222  $res[$row->obj_id] = $row->u_mode;
223  }
224 
225  return $res;
226  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ _lookupVisits()

ilLPObjSettings::_lookupVisits (   $a_obj_id)

Definition at line 194 of file class.ilLPObjSettings.php.

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilLearningProgressBaseGUI\__readItemStatusInfo(), ilLearningProgressBaseGUI\__showObjectDetails(), ilLPStatusVisits\_getStatusInfo(), and ilLPStatusVisits\determinePercentage().

195  {
196  global $ilDB;
197 
198  $query = "SELECT visits FROM ut_lp_settings ".
199  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer');
200 
201  $res = $ilDB->query($query);
202  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
203  {
204  return $row->visits;
205  }
206  return self::LP_DEFAULT_VISITS;
207  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ _mode2InfoText()

static ilLPObjSettings::_mode2InfoText (   $a_mode)
static

Definition at line 300 of file class.ilLPObjSettings.php.

References $lng, and ilObjUserTracking\_getValidTimeSpan().

Referenced by ilObjectLP\getModeInfoText().

301  {
302  global $lng;
303 
304  switch($a_mode)
305  {
306  case self::LP_MODE_DEACTIVATED:
307  return $lng->txt('trac_mode_deactivated_info_new');
308 
309  case self::LP_MODE_TLT:
310  include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
311  return sprintf($lng->txt('trac_mode_tlt_info'), ilObjUserTracking::_getValidTimeSpan());
312 
313  case self::LP_MODE_VISITS:
314  return $lng->txt('trac_mode_visits_info');
315 
316  case self::LP_MODE_MANUAL:
317  return $lng->txt('trac_mode_manual_info');
318 
319  case self::LP_MODE_MANUAL_BY_TUTOR:
320  return $lng->txt('trac_mode_manual_by_tutor_info');
321 
322  case self::LP_MODE_OBJECTIVES:
323  return $lng->txt('trac_mode_objectives_info');
324 
325  case self::LP_MODE_COLLECTION:
326  return $lng->txt('trac_mode_collection_info');
327 
328  case self::LP_MODE_SCORM:
329  return $lng->txt('trac_mode_scorm_info');
330 
331  case self::LP_MODE_TEST_FINISHED:
332  return $lng->txt('trac_mode_test_finished_info');
333 
334  case self::LP_MODE_TEST_PASSED:
335  return $lng->txt('trac_mode_test_passed_info');
336 
337  case self::LP_MODE_EXERCISE_RETURNED:
338  return $lng->txt('trac_mode_exercise_returned_info');
339 
340  case self::LP_MODE_SCORM_PACKAGE:
341  return $lng->txt('trac_mode_scorm_package_info');
342 
343  case self::LP_MODE_EVENT:
344  return $lng->txt('trac_mode_event_info');
345 
346  case self::LP_MODE_COLLECTION_MANUAL:
347  return $lng->txt('trac_mode_collection_manual_info');
348 
349  case self::LP_MODE_COLLECTION_TLT:
350  return $lng->txt('trac_mode_collection_tlt_info');
351  }
352  }
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _mode2Text()

static ilLPObjSettings::_mode2Text (   $a_mode)
static

Definition at line 244 of file class.ilLPObjSettings.php.

References $lng.

Referenced by ilLPProgressTableGUI\fillRowCSV(), ilLPProgressTableGUI\fillRowExcel(), and ilObjectLP\getModeText().

245  {
246  global $lng;
247 
248  switch($a_mode)
249  {
250  case self::LP_MODE_DEACTIVATED:
251  return $lng->txt('trac_mode_deactivated');
252 
253  case self::LP_MODE_TLT:
254  return $lng->txt('trac_mode_tlt');
255 
256  case self::LP_MODE_VISITS:
257  return $lng->txt('trac_mode_visits');
258 
259  case self::LP_MODE_MANUAL:
260  return $lng->txt('trac_mode_manual');
261 
262  case self::LP_MODE_MANUAL_BY_TUTOR:
263  return $lng->txt('trac_mode_manual_by_tutor');
264 
265  case self::LP_MODE_OBJECTIVES:
266  return $lng->txt('trac_mode_objectives');
267 
268  case self::LP_MODE_COLLECTION:
269  return $lng->txt('trac_mode_collection');
270 
271  case self::LP_MODE_SCORM:
272  return $lng->txt('trac_mode_scorm');
273 
274  case self::LP_MODE_TEST_FINISHED:
275  return $lng->txt('trac_mode_test_finished');
276 
277  case self::LP_MODE_TEST_PASSED:
278  return $lng->txt('trac_mode_test_passed');
279 
280  case self::LP_MODE_EXERCISE_RETURNED:
281  return $lng->txt('trac_mode_exercise_returned');
282 
283  case self::LP_MODE_SCORM_PACKAGE:
284  return $lng->txt('trac_mode_scorm_package');
285 
286  case self::LP_MODE_EVENT:
287  return $lng->txt('trac_mode_event');
288 
289  case self::LP_MODE_PLUGIN:
290  return $lng->txt('trac_mode_plugin');
291 
292  case self::LP_MODE_COLLECTION_MANUAL:
293  return $lng->txt('trac_mode_collection_manual');
294 
295  case self::LP_MODE_COLLECTION_TLT:
296  return $lng->txt('trac_mode_collection_tlt');
297  }
298  }
global $lng
Definition: privfeed.php:40
+ Here is the caller graph for this function:

◆ cloneSettings()

ilLPObjSettings::cloneSettings (   $a_new_obj_id)

Clone settings.

public

Parameters
intnew obj id

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

References $query, $res, getMode(), getObjType(), and getVisits().

70  {
71  global $ilDB;
72 
73  $query = "INSERT INTO ut_lp_settings (obj_id,obj_type,u_mode,visits) ".
74  "VALUES( ".
75  $this->db->quote($a_new_obj_id ,'integer').", ".
76  $this->db->quote($this->getObjType() ,'text').", ".
77  $this->db->quote($this->getMode() ,'integer').", ".
78  $this->db->quote($this->getVisits() ,'integer').
79  ")";
80  $res = $ilDB->manipulate($query);
81  return true;
82  }
+ Here is the call graph for this function:

◆ doLPRefresh()

ilLPObjSettings::doLPRefresh ( )
protected

Definition at line 174 of file class.ilLPObjSettings.php.

References ilLPStatusWrapper\_refreshStatus(), and getObjId().

Referenced by insert(), and update().

175  {
176  // refresh learning progress
177  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
179  }
_refreshStatus($a_obj_id, $a_users=null)
Set dirty.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMode()

ilLPObjSettings::getMode ( )

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

References $obj_mode.

Referenced by cloneSettings(), insert(), and update().

100  {
101  return $this->obj_mode;
102  }
+ Here is the caller graph for this function:

◆ getObjId()

ilLPObjSettings::getObjId ( )

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

References $obj_id.

Referenced by doLPRefresh(), insert(), and update().

105  {
106  return (int) $this->obj_id;
107  }
+ Here is the caller graph for this function:

◆ getObjType()

ilLPObjSettings::getObjType ( )

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

References $obj_type.

Referenced by cloneSettings(), and insert().

110  {
111  return $this->obj_type;
112  }
+ Here is the caller graph for this function:

◆ getVisits()

ilLPObjSettings::getVisits ( )

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

Referenced by cloneSettings(), insert(), and update().

85  {
86  return (int) $this->visits ? $this->visits : self::LP_DEFAULT_VISITS;
87  }
+ Here is the caller graph for this function:

◆ ilLPObjSettings()

ilLPObjSettings::ilLPObjSettings (   $a_obj_id)

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

References __read(), and ilObjectLP\getInstance().

46  {
47  global $ilObjDataCache, $ilDB;
48 
49  $this->db = $ilDB;
50  $this->obj_id = $a_obj_id;
51 
52  if(!$this->__read())
53  {
54  $this->obj_type = $ilObjDataCache->lookupType($this->obj_id);
55 
56  include_once "Services/Object/classes/class.ilObjectLP.php";
57  $olp = ilObjectLP::getInstance($this->obj_id);
58  $this->obj_mode = $olp->getDefaultMode();
59  }
60  }
static getInstance($a_obj_id)
+ Here is the call graph for this function:

◆ insert()

ilLPObjSettings::insert ( )

Definition at line 153 of file class.ilLPObjSettings.php.

References $ilLog, $query, $res, __read(), doLPRefresh(), getMode(), getObjId(), getObjType(), and getVisits().

Referenced by update().

154  {
155  global $ilDB,$ilLog;
156 
157  $ilLog->logStack();
158 
159  $query = "INSERT INTO ut_lp_settings (obj_id,obj_type,u_mode,visits) ".
160  "VALUES(".
161  $ilDB->quote($this->getObjId() ,'integer').", ".
162  $ilDB->quote($this->getObjType(),'text').", ".
163  $ilDB->quote($this->getMode(),'integer').", ".
164  $ilDB->quote($this->getVisits(), 'integer'). // #12482
165  ")";
166  $res = $ilDB->manipulate($query);
167  $this->__read();
168 
169  $this->doLPRefresh();
170 
171  return true;
172  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMode()

ilLPObjSettings::setMode (   $a_mode)

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

95  {
96  $this->obj_mode = $a_mode;
97  }

◆ setVisits()

ilLPObjSettings::setVisits (   $a_visits)

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

90  {
91  $this->visits = $a_visits;
92  }

◆ update()

ilLPObjSettings::update (   $a_refresh_lp = true)

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

References $query, $res, __read(), doLPRefresh(), getMode(), getObjId(), getVisits(), and insert().

132  {
133  global $ilDB;
134 
135  if(!$this->is_stored)
136  {
137  return $this->insert();
138  }
139  $query = "UPDATE ut_lp_settings SET u_mode = ".$ilDB->quote($this->getMode() ,'integer').", ".
140  "visits = ".$ilDB->quote($this->getVisits() ,'integer')." ".
141  "WHERE obj_id = ".$ilDB->quote($this->getObjId() ,'integer');
142  $res = $ilDB->manipulate($query);
143  $this->__read();
144 
145  if($a_refresh_lp)
146  {
147  $this->doLPRefresh();
148  }
149 
150  return true;
151  }
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilLPObjSettings::$db = null

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

◆ $is_stored

ilLPObjSettings::$is_stored = false

Definition at line 23 of file class.ilLPObjSettings.php.

◆ $obj_id

ilLPObjSettings::$obj_id = null

Definition at line 18 of file class.ilLPObjSettings.php.

Referenced by getObjId().

◆ $obj_mode

ilLPObjSettings::$obj_mode = null

Definition at line 20 of file class.ilLPObjSettings.php.

Referenced by getMode().

◆ $obj_type

ilLPObjSettings::$obj_type = null

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

Referenced by getObjType().

◆ $visits

ilLPObjSettings::$visits = null

Definition at line 21 of file class.ilLPObjSettings.php.

◆ LP_DEFAULT_VISITS

const ilLPObjSettings::LP_DEFAULT_VISITS = 30

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

◆ LP_MODE_COLLECTION

◆ LP_MODE_COLLECTION_MANUAL

◆ LP_MODE_COLLECTION_TLT

◆ LP_MODE_DEACTIVATED

◆ LP_MODE_EVENT

const ilLPObjSettings::LP_MODE_EVENT = 10

◆ LP_MODE_EXERCISE_RETURNED

const ilLPObjSettings::LP_MODE_EXERCISE_RETURNED = 9

◆ LP_MODE_MANUAL

◆ LP_MODE_MANUAL_BY_TUTOR

◆ LP_MODE_OBJECTIVES

◆ LP_MODE_PLUGIN

const ilLPObjSettings::LP_MODE_PLUGIN = 14

◆ LP_MODE_SCORM

◆ LP_MODE_SCORM_PACKAGE

const ilLPObjSettings::LP_MODE_SCORM_PACKAGE = 12

◆ LP_MODE_TEST_FINISHED

const ilLPObjSettings::LP_MODE_TEST_FINISHED = 7

◆ LP_MODE_TEST_PASSED

◆ LP_MODE_TLT

◆ LP_MODE_UNDEFINED

◆ LP_MODE_VISITS


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