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.

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 }
static getInstance($a_obj_id)
global $ilDB

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

+ Here is the call graph for this function:

Member Function Documentation

◆ __read()

ilLPObjSettings::__read ( )

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

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

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

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

+ 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.

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 }
$query

References $ilDB, $query, and $res.

◆ _deleteByObjId()

static ilLPObjSettings::_deleteByObjId (   $a_obj_id)
static

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

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 }

References $ilDB.

◆ _lookupDBMode()

static ilLPObjSettings::_lookupDBMode (   $a_obj_id)
static

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

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 }

References $ilDB, $query, and $row.

Referenced by ilObjectLP\getCurrentMode().

+ 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.

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 }

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

Referenced by ilLPStatus\checkLPModesForObjects().

+ 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.

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 }
283 }

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

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

+ Here is the caller graph for this function:

◆ _mode2InfoText()

static ilLPObjSettings::_mode2InfoText (   $a_mode)
static

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

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 }
sprintf('%.4f', $callTime)
$info
Definition: index.php:5
global $lng
Definition: privfeed.php:17

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

Referenced by ilObjectLP\getModeInfoText().

+ 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.

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 }

References $lng.

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

+ Here is the caller graph for this function:

◆ cloneSettings()

ilLPObjSettings::cloneSettings (   $a_new_obj_id)

Clone settings.

@access public

Parameters
intnew obj id

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

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 }

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

+ Here is the call graph for this function:

◆ doLPRefresh()

ilLPObjSettings::doLPRefresh ( )
protected

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

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.

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

Referenced by insert(), and update().

+ 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.

347 {
348 $res = array();
349 foreach (self::$map as $mode => $item) {
350 $res[$mode] = $item[0];
351 }
352 return $res;
353 }

References $res.

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

+ Here is the caller graph for this function:

◆ getMode()

ilLPObjSettings::getMode ( )

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

180 {
181 return $this->obj_mode;
182 }

References $obj_mode.

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

+ Here is the caller graph for this function:

◆ getObjId()

ilLPObjSettings::getObjId ( )

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

185 {
186 return (int) $this->obj_id;
187 }

References $obj_id.

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

+ Here is the caller graph for this function:

◆ getObjType()

ilLPObjSettings::getObjType ( )

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

190 {
191 return $this->obj_type;
192 }

References $obj_type.

Referenced by cloneSettings(), and insert().

+ Here is the caller graph for this function:

◆ getVisits()

ilLPObjSettings::getVisits ( )

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

165 {
166 return (int) $this->visits ? $this->visits : self::LP_DEFAULT_VISITS;
167 }

References LP_DEFAULT_VISITS.

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

+ Here is the caller graph for this function:

◆ insert()

ilLPObjSettings::insert ( )

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

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 }

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

Referenced by update().

+ 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.

175 {
176 $this->obj_mode = $a_mode;
177 }

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

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 }

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

+ 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.

Referenced by _lookupVisits(), and getVisits().

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