ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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.

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

References $res, $row, and DB_FETCHMODE_OBJECT.

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

+ Here is the caller graph for this function:

◆ _delete()

ilLPObjSettings::_delete (   $a_obj_id)

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

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

References $ilDB, $query, and $res.

◆ _lookupDBMode()

static ilLPObjSettings::_lookupDBMode (   $a_obj_id)
static

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

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 }

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 211 of file class.ilLPObjSettings.php.

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 }

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

Referenced by ilLPStatus\preloadListGUIData().

+ Here is the caller graph for this function:

◆ _lookupVisits()

ilLPObjSettings::_lookupVisits (   $a_obj_id)

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

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

References $ilDB, $query, $res, $row, DB_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 305 of file class.ilLPObjSettings.php.

306 {
307 global $lng;
308
309 switch($a_mode)
310 {
312 return $lng->txt('trac_mode_deactivated_info_new');
313
315 include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
316 return sprintf($lng->txt('trac_mode_tlt_info'), ilObjUserTracking::_getValidTimeSpan());
317
319 return $lng->txt('trac_mode_visits_info');
320
322 return $lng->txt('trac_mode_manual_info');
323
325 return $lng->txt('trac_mode_manual_by_tutor_info');
326
328 return $lng->txt('trac_mode_objectives_info');
329
331 return $lng->txt('trac_mode_collection_info');
332
334 return $lng->txt('trac_mode_scorm_info');
335
337 return $lng->txt('trac_mode_test_finished_info');
338
340 return $lng->txt('trac_mode_test_passed_info');
341
343 return $lng->txt('trac_mode_exercise_returned_info');
344
346 return $lng->txt('trac_mode_scorm_package_info');
347
349 return $lng->txt('trac_mode_event_info');
350
352 return $lng->txt('trac_mode_collection_manual_info');
353
355 return $lng->txt('trac_mode_collection_tlt_info');
356
358 return $lng->txt('trac_mode_questions_info');
359 }
360 }
global $lng
Definition: privfeed.php:40

References $lng, ilObjUserTracking\_getValidTimeSpan(), LP_MODE_COLLECTION, LP_MODE_COLLECTION_MANUAL, LP_MODE_COLLECTION_TLT, LP_MODE_DEACTIVATED, LP_MODE_EVENT, LP_MODE_EXERCISE_RETURNED, LP_MODE_MANUAL, LP_MODE_MANUAL_BY_TUTOR, LP_MODE_OBJECTIVES, LP_MODE_QUESTIONS, LP_MODE_SCORM, LP_MODE_SCORM_PACKAGE, LP_MODE_TEST_FINISHED, LP_MODE_TEST_PASSED, LP_MODE_TLT, and LP_MODE_VISITS.

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 246 of file class.ilLPObjSettings.php.

247 {
248 global $lng;
249
250 switch($a_mode)
251 {
253 return $lng->txt('trac_mode_deactivated');
254
256 return $lng->txt('trac_mode_tlt');
257
259 return $lng->txt('trac_mode_visits');
260
262 return $lng->txt('trac_mode_manual');
263
265 return $lng->txt('trac_mode_manual_by_tutor');
266
268 return $lng->txt('trac_mode_objectives');
269
271 return $lng->txt('trac_mode_collection');
272
274 return $lng->txt('trac_mode_scorm');
275
277 return $lng->txt('trac_mode_test_finished');
278
280 return $lng->txt('trac_mode_test_passed');
281
283 return $lng->txt('trac_mode_exercise_returned');
284
286 return $lng->txt('trac_mode_scorm_package');
287
289 return $lng->txt('trac_mode_event');
290
292 return $lng->txt('trac_mode_plugin');
293
295 return $lng->txt('trac_mode_collection_manual');
296
298 return $lng->txt('trac_mode_collection_tlt');
299
301 return $lng->txt('trac_mode_questions');
302 }
303 }

References $lng, LP_MODE_COLLECTION, LP_MODE_COLLECTION_MANUAL, LP_MODE_COLLECTION_TLT, LP_MODE_DEACTIVATED, LP_MODE_EVENT, LP_MODE_EXERCISE_RETURNED, LP_MODE_MANUAL, LP_MODE_MANUAL_BY_TUTOR, LP_MODE_OBJECTIVES, LP_MODE_PLUGIN, LP_MODE_QUESTIONS, LP_MODE_SCORM, LP_MODE_SCORM_PACKAGE, LP_MODE_TEST_FINISHED, LP_MODE_TEST_PASSED, LP_MODE_TLT, and LP_MODE_VISITS.

Referenced by ilLPProgressTableGUI\fillRowCSV(), ilLPProgressTableGUI\fillRowExcel(), ilObjectLP\getModeText(), 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 71 of file class.ilLPObjSettings.php.

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 }

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

+ Here is the call graph for this function:

◆ doLPRefresh()

ilLPObjSettings::doLPRefresh ( )
protected

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

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

◆ getMode()

ilLPObjSettings::getMode ( )

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

102 {
103 return $this->obj_mode;
104 }

References $obj_mode.

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

+ Here is the caller graph for this function:

◆ getObjId()

ilLPObjSettings::getObjId ( )

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

107 {
108 return (int) $this->obj_id;
109 }

References $obj_id.

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

+ Here is the caller graph for this function:

◆ getObjType()

ilLPObjSettings::getObjType ( )

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

112 {
113 return $this->obj_type;
114 }

References $obj_type.

Referenced by cloneSettings(), and insert().

+ Here is the caller graph for this function:

◆ getVisits()

ilLPObjSettings::getVisits ( )

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

87 {
88 return (int) $this->visits ? $this->visits : self::LP_DEFAULT_VISITS;
89 }

References LP_DEFAULT_VISITS.

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

+ Here is the caller graph for this function:

◆ ilLPObjSettings()

ilLPObjSettings::ilLPObjSettings (   $a_obj_id)

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

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

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

+ Here is the call graph for this function:

◆ insert()

ilLPObjSettings::insert ( )

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

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 }

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 96 of file class.ilLPObjSettings.php.

97 {
98 $this->obj_mode = $a_mode;
99 }

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

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 }

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.

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

Referenced by _lookupVisits(), and getVisits().

◆ LP_MODE_COLLECTION

◆ LP_MODE_COLLECTION_MANUAL

◆ LP_MODE_COLLECTION_TLT

◆ LP_MODE_DEACTIVATED

◆ LP_MODE_EVENT

◆ LP_MODE_EXERCISE_RETURNED

◆ LP_MODE_MANUAL

◆ LP_MODE_MANUAL_BY_TUTOR

◆ LP_MODE_OBJECTIVES

◆ LP_MODE_PLUGIN

◆ 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

◆ LP_MODE_TEST_PASSED

◆ LP_MODE_TLT

◆ LP_MODE_UNDEFINED

◆ LP_MODE_VISITS


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