ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  $this->obj_type = $ilObjDataCache->lookupType($this->obj_id);
135 
136  include_once "Services/Object/classes/class.ilObjectLP.php";
137  $olp = ilObjectLP::getInstance($this->obj_id);
138  $this->obj_mode = $olp->getDefaultMode();
139  }
140  }
global $ilDB
static getInstance($a_obj_id)
+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilLPObjSettings::__read ( )

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

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

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

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

◆ _delete()

static ilLPObjSettings::_delete (   $a_obj_id)
static

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

References $ilDB, $query, and $res.

259  {
260  global $ilDB;
261 
262  $query = "DELETE FROM ut_lp_settings WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer');
263  $res = $ilDB->manipulate($query);
264 
265  return true;
266  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB

◆ _deleteByObjId()

static ilLPObjSettings::_deleteByObjId (   $a_obj_id)
static

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

References $ilDB.

Referenced by ilObject\countReferences().

356  {
357  global $ilDB;
358 
359  // we are only removing settings for now
360  // invalid ut_lp_collections-entries are filtered
361  // ut_lp_marks is deemed private user data
362 
363  $ilDB->manipulate("DELETE FROM ut_lp_settings" .
364  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer"));
365  }
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupDBMode()

static ilLPObjSettings::_lookupDBMode (   $a_obj_id)
static

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

References $ilDB, $query, and $row.

Referenced by ilObjectLP\getCurrentMode().

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

◆ _lookupDBModeForObjects()

static ilLPObjSettings::_lookupDBModeForObjects ( array  $a_obj_ids)
static

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

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

Referenced by ilLPStatus\checkLPModesForObjects().

286  {
287  global $ilDB;
288 
289  // this does NOT handle default mode!
290 
291  $res = array();
292 
293  $query = "SELECT obj_id, u_mode FROM ut_lp_settings" .
294  " WHERE " . $ilDB->in("obj_id", $a_obj_ids, "", "integer");
295  $set = $ilDB->query($query);
296  while ($row = $set->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
297  $res[$row->obj_id] = $row->u_mode;
298  }
299 
300  return $res;
301  }
foreach($_POST as $key=> $value) $res
$query
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 271 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().

272  {
273  global $ilDB;
274 
275  $query = "SELECT visits FROM ut_lp_settings " .
276  "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer');
277 
278  $res = $ilDB->query($query);
279  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
280  return $row->visits;
281  }
282  return self::LP_DEFAULT_VISITS;
283  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ _mode2InfoText()

static ilLPObjSettings::_mode2InfoText (   $a_mode)
static

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

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

Referenced by ilObjectLP\getModeInfoText().

329  {
330  global $lng;
331 
332  if (array_key_exists($a_mode, self::$map) &&
333  is_array(self::$map[$a_mode])) {
334  $info = $lng->txt(self::$map[$a_mode][2]);
335 
336  if ($a_mode == self::LP_MODE_TLT) {
337  // dynamic content
338  include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
340  }
341 
342  return $info;
343  }
344  }
global $lng
Definition: privfeed.php:17
$info
Definition: index.php:5
+ 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 318 of file class.ilLPObjSettings.php.

References $lng.

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

319  {
320  global $lng;
321 
322  if (array_key_exists($a_mode, self::$map) &&
323  is_array(self::$map[$a_mode])) {
324  return $lng->txt(self::$map[$a_mode][1]);
325  }
326  }
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 149 of file class.ilLPObjSettings.php.

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

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

◆ doLPRefresh()

ilLPObjSettings::doLPRefresh ( )
protected

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

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

Referenced by insert(), and update().

252  {
253  // refresh learning progress
254  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
256  }
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 346 of file class.ilLPObjSettings.php.

References $res, and array.

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

347  {
348  $res = array();
349  foreach (self::$map as $mode => $item) {
350  $res[$mode] = $item[0];
351  }
352  return $res;
353  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getMode()

ilLPObjSettings::getMode ( )

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

References $obj_mode.

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

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

◆ getObjId()

ilLPObjSettings::getObjId ( )

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

References $obj_id.

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

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

◆ getObjType()

ilLPObjSettings::getObjType ( )

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

References $obj_type.

Referenced by cloneSettings(), and insert().

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

◆ getVisits()

ilLPObjSettings::getVisits ( )

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

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

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

◆ insert()

ilLPObjSettings::insert ( )

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

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

Referenced by update().

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

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

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

◆ setVisits()

ilLPObjSettings::setVisits (   $a_visits)

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

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

◆ update()

ilLPObjSettings::update (   $a_refresh_lp = true)

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

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

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