ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilLPObjSettings Class Reference
+ Collaboration diagram for ilLPObjSettings:

Public Member Functions

 __construct ($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 ()
 

Static Public Member Functions

static _delete ($a_obj_id)
 
static _lookupVisits ($a_obj_id)
 
static _lookupDBModeForObjects (array $a_obj_ids)
 
static _lookupDBMode ($a_obj_id)
 
static _mode2Text ($a_mode)
 
static _mode2InfoText ($a_mode)
 
static getClassMap ()
 
static _deleteByObjId ($a_obj_id)
 

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_MODE_SURVEY_FINISHED = 18
 
const LP_MODE_VISITED_PAGES = 19
 
const LP_MODE_DOWNLOADED = 20
 
const LP_MODE_COLLECTION_MOBS = 21
 
const LP_MODE_STUDY_PROGRAMME = 22
 
const LP_MODE_INDIVIDUAL_ASSESSMENT = 23
 
const LP_DEFAULT_VISITS = 30
 

Protected Member Functions

 doLPRefresh ()
 

Static Protected Attributes

static $map
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilLPObjSettings::__construct (   $a_obj_id)

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

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

127  {
128  global $ilObjDataCache, $ilDB;
129 
130  $this->db = $ilDB;
131  $this->obj_id = $a_obj_id;
132 
133  if(!$this->__read())
134  {
135  $this->obj_type = $ilObjDataCache->lookupType($this->obj_id);
136 
137  include_once "Services/Object/classes/class.ilObjectLP.php";
138  $olp = ilObjectLP::getInstance($this->obj_id);
139  $this->obj_mode = $olp->getDefaultMode();
140  }
141  }
global $ilDB
static getInstance($a_obj_id)
+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilLPObjSettings::__read ( )

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

References $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

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

196  {
197  $res = $this->db->query("SELECT * FROM ut_lp_settings WHERE obj_id = ".
198  $this->db->quote($this->obj_id ,'integer'));
199  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
200  {
201  $this->is_stored = true;
202  $this->obj_type = $row->obj_type;
203  $this->obj_mode = $row->u_mode;
204  $this->visits = $row->visits;
205 
206  return true;
207  }
208 
209  return false;
210  }
+ Here is the caller graph for this function:

◆ _delete()

static ilLPObjSettings::_delete (   $a_obj_id)
static

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

References $ilDB, $query, and $res.

263  {
264  global $ilDB;
265 
266  $query = "DELETE FROM ut_lp_settings WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer');
267  $res = $ilDB->manipulate($query);
268 
269  return true;
270  }
global $ilDB

◆ _deleteByObjId()

static ilLPObjSettings::_deleteByObjId (   $a_obj_id)
static

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

References $ilDB.

Referenced by ilObject\delete().

367  {
368  global $ilDB;
369 
370  // we are only removing settings for now
371  // invalid ut_lp_collections-entries are filtered
372  // ut_lp_marks is deemed private user data
373 
374  $ilDB->manipulate("DELETE FROM ut_lp_settings".
375  " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer"));
376  }
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupDBMode()

static ilLPObjSettings::_lookupDBMode (   $a_obj_id)
static

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

References $ilDB, $query, and $row.

Referenced by ilObjectLP\getCurrentMode(), and ilSoapLearningProgressAdministration\getProgressInfo().

310  {
311  global $ilDB;
312 
313  // this does NOT handle default mode!
314 
315  $query = "SELECT u_mode FROM ut_lp_settings".
316  " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer");
317  $set = $ilDB->query($query);
318  $row = $ilDB->fetchAssoc($set);
319  if(is_array($row))
320  {
321  return $row['u_mode'];
322  }
323  }
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupDBModeForObjects()

static ilLPObjSettings::_lookupDBModeForObjects ( array  $a_obj_ids)
static

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

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

Referenced by ilLPStatus\checkLPModesForObjects().

291  {
292  global $ilDB;
293 
294  // this does NOT handle default mode!
295 
296  $res = array();
297 
298  $query = "SELECT obj_id, u_mode FROM ut_lp_settings".
299  " WHERE ".$ilDB->in("obj_id", $a_obj_ids, "", "integer");
300  $set = $ilDB->query($query);
301  while($row = $set->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
302  {
303  $res[$row->obj_id] = $row->u_mode;
304  }
305 
306  return $res;
307  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupVisits()

static ilLPObjSettings::_lookupVisits (   $a_obj_id)
static

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

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

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

276  {
277  global $ilDB;
278 
279  $query = "SELECT visits FROM ut_lp_settings ".
280  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer');
281 
282  $res = $ilDB->query($query);
283  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
284  {
285  return $row->visits;
286  }
287  return self::LP_DEFAULT_VISITS;
288  }
global $ilDB
+ Here is the caller graph for this function:

◆ _mode2InfoText()

static ilLPObjSettings::_mode2InfoText (   $a_mode)
static

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

References $info, $lng, and ilObjUserTracking\_getValidTimeSpan().

Referenced by ilObjectLP\getModeInfoText().

337  {
338  global $lng;
339 
340  if(array_key_exists($a_mode, self::$map) &&
341  is_array(self::$map[$a_mode]))
342  {
343  $info = $lng->txt(self::$map[$a_mode][2]);
344 
345  if($a_mode == self::LP_MODE_TLT)
346  {
347  // dynamic content
348  include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
350  }
351 
352  return $info;
353  }
354  }
$info
Definition: example_052.php:80
global $lng
Definition: privfeed.php:17
+ 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 325 of file class.ilLPObjSettings.php.

References $lng.

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

326  {
327  global $lng;
328 
329  if(array_key_exists($a_mode, self::$map) &&
330  is_array(self::$map[$a_mode]))
331  {
332  return $lng->txt(self::$map[$a_mode][1]);
333  }
334  }
global $lng
Definition: privfeed.php:17
+ 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 150 of file class.ilLPObjSettings.php.

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

151  {
152  global $ilDB;
153 
154  $query = "INSERT INTO ut_lp_settings (obj_id,obj_type,u_mode,visits) ".
155  "VALUES( ".
156  $this->db->quote($a_new_obj_id ,'integer').", ".
157  $this->db->quote($this->getObjType() ,'text').", ".
158  $this->db->quote($this->getMode() ,'integer').", ".
159  $this->db->quote($this->getVisits() ,'integer').
160  ")";
161  $res = $ilDB->manipulate($query);
162  return true;
163  }
global $ilDB
+ Here is the call graph for this function:

◆ doLPRefresh()

ilLPObjSettings::doLPRefresh ( )
protected

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

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

Referenced by insert(), and update().

256  {
257  // refresh learning progress
258  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
260  }
static _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:

◆ getClassMap()

static ilLPObjSettings::getClassMap ( )
static

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

References $res, and array.

Referenced by ilLPStatusFactory\_getClassById(), and ilLPStatusFactory\_getInstance().

357  {
358  $res = array();
359  foreach(self::$map as $mode => $item)
360  {
361  $res[$mode] = $item[0];
362  }
363  return $res;
364  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getMode()

ilLPObjSettings::getMode ( )

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

References $obj_mode.

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

181  {
182  return $this->obj_mode;
183  }
+ Here is the caller graph for this function:

◆ getObjId()

ilLPObjSettings::getObjId ( )

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

References $obj_id.

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

186  {
187  return (int) $this->obj_id;
188  }
+ Here is the caller graph for this function:

◆ getObjType()

ilLPObjSettings::getObjType ( )

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

References $obj_type.

Referenced by cloneSettings(), and insert().

191  {
192  return $this->obj_type;
193  }
+ Here is the caller graph for this function:

◆ getVisits()

ilLPObjSettings::getVisits ( )

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

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

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

◆ insert()

ilLPObjSettings::insert ( )

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

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

Referenced by update().

235  {
236  global $ilDB,$ilLog;
237 
238  $ilLog->logStack();
239 
240  $query = "INSERT INTO ut_lp_settings (obj_id,obj_type,u_mode,visits) ".
241  "VALUES(".
242  $ilDB->quote($this->getObjId() ,'integer').", ".
243  $ilDB->quote($this->getObjType(),'text').", ".
244  $ilDB->quote($this->getMode(),'integer').", ".
245  $ilDB->quote($this->getVisits(), 'integer'). // #12482
246  ")";
247  $res = $ilDB->manipulate($query);
248  $this->__read();
249 
250  $this->doLPRefresh();
251 
252  return true;
253  }
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 175 of file class.ilLPObjSettings.php.

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

176  {
177  $this->obj_mode = $a_mode;
178  }
+ Here is the caller graph for this function:

◆ setVisits()

ilLPObjSettings::setVisits (   $a_visits)

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

171  {
172  $this->visits = $a_visits;
173  }

◆ update()

ilLPObjSettings::update (   $a_refresh_lp = true)

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

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

213  {
214  global $ilDB;
215 
216  if(!$this->is_stored)
217  {
218  return $this->insert();
219  }
220  $query = "UPDATE ut_lp_settings SET u_mode = ".$ilDB->quote($this->getMode() ,'integer').", ".
221  "visits = ".$ilDB->quote($this->getVisits() ,'integer')." ".
222  "WHERE obj_id = ".$ilDB->quote($this->getObjId() ,'integer');
223  $res = $ilDB->manipulate($query);
224  $this->__read();
225 
226  if($a_refresh_lp)
227  {
228  $this->doLPRefresh();
229  }
230 
231  return true;
232  }
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.

◆ $map

ilLPObjSettings::$map
staticprotected

Definition at line 52 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 50 of file class.ilLPObjSettings.php.

◆ LP_MODE_COLLECTION

◆ LP_MODE_COLLECTION_MANUAL

◆ LP_MODE_COLLECTION_MOBS

◆ LP_MODE_COLLECTION_TLT

◆ LP_MODE_DEACTIVATED

◆ LP_MODE_DOWNLOADED

const ilLPObjSettings::LP_MODE_DOWNLOADED = 20

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

Referenced by ilFileLP\getDefaultModes(), and ilFileLP\getValidModes().

◆ LP_MODE_EVENT

const ilLPObjSettings::LP_MODE_EVENT = 10

◆ LP_MODE_EXERCISE_RETURNED

const ilLPObjSettings::LP_MODE_EXERCISE_RETURNED = 9

◆ LP_MODE_INDIVIDUAL_ASSESSMENT

const ilLPObjSettings::LP_MODE_INDIVIDUAL_ASSESSMENT = 23

◆ 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

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

Referenced by ilScormLP\getDefaultModes(), and ilScormLP\getValidModes().

◆ LP_MODE_STUDY_PROGRAMME

const ilLPObjSettings::LP_MODE_STUDY_PROGRAMME = 22

◆ LP_MODE_SURVEY_FINISHED

const ilLPObjSettings::LP_MODE_SURVEY_FINISHED = 18

◆ LP_MODE_TEST_FINISHED

const ilLPObjSettings::LP_MODE_TEST_FINISHED = 7

◆ LP_MODE_TEST_PASSED

◆ LP_MODE_TLT

◆ LP_MODE_UNDEFINED

◆ LP_MODE_VISITED_PAGES

const ilLPObjSettings::LP_MODE_VISITED_PAGES = 19

◆ LP_MODE_VISITS


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