ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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_MODE_QUESTIONS = 17
 
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 116 of file class.ilLPObjSettings.php.

References $res, $row, and DB_FETCHMODE_OBJECT.

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

117  {
118  $res = $this->db->query("SELECT * FROM ut_lp_settings WHERE obj_id = ".
119  $this->db->quote($this->obj_id ,'integer'));
120  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
121  {
122  $this->is_stored = true;
123  $this->obj_type = $row->obj_type;
124  $this->obj_mode = $row->u_mode;
125  $this->visits = $row->visits;
126 
127  return true;
128  }
129 
130  return false;
131  }
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 183 of file class.ilLPObjSettings.php.

References $ilDB, $query, and $res.

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

◆ _lookupDBMode()

static ilLPObjSettings::_lookupDBMode (   $a_obj_id)
static

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

References $ilDB, $query, and $row.

Referenced by ilObjectLP\getCurrentMode().

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

◆ _lookupDBModeForObjects()

static ilLPObjSettings::_lookupDBModeForObjects ( array  $a_obj_ids)
static

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

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

Referenced by ilLPStatus\preloadListGUIData().

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

◆ _lookupVisits()

ilLPObjSettings::_lookupVisits (   $a_obj_id)

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

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

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

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

◆ _mode2InfoText()

static ilLPObjSettings::_mode2InfoText (   $a_mode)
static

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

References $lng, and ilObjUserTracking\_getValidTimeSpan().

Referenced by ilObjectLP\getModeInfoText().

306  {
307  global $lng;
308 
309  switch($a_mode)
310  {
311  case self::LP_MODE_DEACTIVATED:
312  return $lng->txt('trac_mode_deactivated_info_new');
313 
314  case self::LP_MODE_TLT:
315  include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
316  return sprintf($lng->txt('trac_mode_tlt_info'), ilObjUserTracking::_getValidTimeSpan());
317 
318  case self::LP_MODE_VISITS:
319  return $lng->txt('trac_mode_visits_info');
320 
321  case self::LP_MODE_MANUAL:
322  return $lng->txt('trac_mode_manual_info');
323 
324  case self::LP_MODE_MANUAL_BY_TUTOR:
325  return $lng->txt('trac_mode_manual_by_tutor_info');
326 
327  case self::LP_MODE_OBJECTIVES:
328  return $lng->txt('trac_mode_objectives_info');
329 
330  case self::LP_MODE_COLLECTION:
331  return $lng->txt('trac_mode_collection_info');
332 
333  case self::LP_MODE_SCORM:
334  return $lng->txt('trac_mode_scorm_info');
335 
336  case self::LP_MODE_TEST_FINISHED:
337  return $lng->txt('trac_mode_test_finished_info');
338 
339  case self::LP_MODE_TEST_PASSED:
340  return $lng->txt('trac_mode_test_passed_info');
341 
342  case self::LP_MODE_EXERCISE_RETURNED:
343  return $lng->txt('trac_mode_exercise_returned_info');
344 
345  case self::LP_MODE_SCORM_PACKAGE:
346  return $lng->txt('trac_mode_scorm_package_info');
347 
348  case self::LP_MODE_EVENT:
349  return $lng->txt('trac_mode_event_info');
350 
351  case self::LP_MODE_COLLECTION_MANUAL:
352  return $lng->txt('trac_mode_collection_manual_info');
353 
354  case self::LP_MODE_COLLECTION_TLT:
355  return $lng->txt('trac_mode_collection_tlt_info');
356 
357  case self::LP_MODE_QUESTIONS:
358  return $lng->txt('trac_mode_questions_info');
359  }
360  }
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 246 of file class.ilLPObjSettings.php.

References $lng.

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

247  {
248  global $lng;
249 
250  switch($a_mode)
251  {
252  case self::LP_MODE_DEACTIVATED:
253  return $lng->txt('trac_mode_deactivated');
254 
255  case self::LP_MODE_TLT:
256  return $lng->txt('trac_mode_tlt');
257 
258  case self::LP_MODE_VISITS:
259  return $lng->txt('trac_mode_visits');
260 
261  case self::LP_MODE_MANUAL:
262  return $lng->txt('trac_mode_manual');
263 
264  case self::LP_MODE_MANUAL_BY_TUTOR:
265  return $lng->txt('trac_mode_manual_by_tutor');
266 
267  case self::LP_MODE_OBJECTIVES:
268  return $lng->txt('trac_mode_objectives');
269 
270  case self::LP_MODE_COLLECTION:
271  return $lng->txt('trac_mode_collection');
272 
273  case self::LP_MODE_SCORM:
274  return $lng->txt('trac_mode_scorm');
275 
276  case self::LP_MODE_TEST_FINISHED:
277  return $lng->txt('trac_mode_test_finished');
278 
279  case self::LP_MODE_TEST_PASSED:
280  return $lng->txt('trac_mode_test_passed');
281 
282  case self::LP_MODE_EXERCISE_RETURNED:
283  return $lng->txt('trac_mode_exercise_returned');
284 
285  case self::LP_MODE_SCORM_PACKAGE:
286  return $lng->txt('trac_mode_scorm_package');
287 
288  case self::LP_MODE_EVENT:
289  return $lng->txt('trac_mode_event');
290 
291  case self::LP_MODE_PLUGIN:
292  return $lng->txt('trac_mode_plugin');
293 
294  case self::LP_MODE_COLLECTION_MANUAL:
295  return $lng->txt('trac_mode_collection_manual');
296 
297  case self::LP_MODE_COLLECTION_TLT:
298  return $lng->txt('trac_mode_collection_tlt');
299 
300  case self::LP_MODE_QUESTIONS:
301  return $lng->txt('trac_mode_questions');
302  }
303  }
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 71 of file class.ilLPObjSettings.php.

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

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

◆ doLPRefresh()

ilLPObjSettings::doLPRefresh ( )
protected

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

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

Referenced by insert(), and update().

177  {
178  // refresh learning progress
179  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
181  }
_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 101 of file class.ilLPObjSettings.php.

References $obj_mode.

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

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

◆ getObjId()

ilLPObjSettings::getObjId ( )

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

References $obj_id.

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

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

◆ getObjType()

ilLPObjSettings::getObjType ( )

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

References $obj_type.

Referenced by cloneSettings(), and insert().

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

◆ getVisits()

ilLPObjSettings::getVisits ( )

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

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

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

◆ ilLPObjSettings()

ilLPObjSettings::ilLPObjSettings (   $a_obj_id)

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

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

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

◆ insert()

ilLPObjSettings::insert ( )

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

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

Referenced by update().

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

◆ setMode()

ilLPObjSettings::setMode (   $a_mode)

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

Referenced by ilObjSessionGUI\createRecurringSessions(), and ilObjSessionGUI\saveObject().

97  {
98  $this->obj_mode = $a_mode;
99  }
+ Here is the caller graph for this function:

◆ setVisits()

ilLPObjSettings::setVisits (   $a_visits)

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

92  {
93  $this->visits = $a_visits;
94  }

◆ update()

ilLPObjSettings::update (   $a_refresh_lp = true)

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

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

134  {
135  global $ilDB;
136 
137  if(!$this->is_stored)
138  {
139  return $this->insert();
140  }
141  $query = "UPDATE ut_lp_settings SET u_mode = ".$ilDB->quote($this->getMode() ,'integer').", ".
142  "visits = ".$ilDB->quote($this->getVisits() ,'integer')." ".
143  "WHERE obj_id = ".$ilDB->quote($this->getObjId() ,'integer');
144  $res = $ilDB->manipulate($query);
145  $this->__read();
146 
147  if($a_refresh_lp)
148  {
149  $this->doLPRefresh();
150  }
151 
152  return true;
153  }
global $ilDB
+ 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 45 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_QUESTIONS

const ilLPObjSettings::LP_MODE_QUESTIONS = 17

◆ 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: