ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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)
 
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_DEFAULT_VISITS = 30
 

Protected Member Functions

 doLPRefresh ()
 

Static Protected Attributes

static $map
 

Detailed Description

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

Member Function Documentation

◆ __read()

ilLPObjSettings::__read ( )

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

192 {
193 $res = $this->db->query("SELECT * FROM ut_lp_settings WHERE obj_id = ".
194 $this->db->quote($this->obj_id ,'integer'));
195 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
196 {
197 $this->is_stored = true;
198 $this->obj_type = $row->obj_type;
199 $this->obj_mode = $row->u_mode;
200 $this->visits = $row->visits;
201
202 return true;
203 }
204
205 return false;
206 }
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 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 }
global $ilDB

References $ilDB, $query, and $res.

◆ _deleteByObjId()

static ilLPObjSettings::_deleteByObjId (   $a_obj_id)
static

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

363 {
364 global $ilDB;
365
366 // we are only removing settings for now
367 // invalid ut_lp_collections-entries are filtered
368 // ut_lp_marks is deemed private user data
369
370 $ilDB->manipulate("DELETE FROM ut_lp_settings".
371 " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer"));
372 }

References $ilDB.

Referenced by ilObject\delete().

+ Here is the caller graph for this function:

◆ _lookupDBMode()

static ilLPObjSettings::_lookupDBMode (   $a_obj_id)
static

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

306 {
307 global $ilDB;
308
309 // this does NOT handle default mode!
310
311 $query = "SELECT u_mode FROM ut_lp_settings".
312 " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer");
313 $set = $ilDB->query($query);
314 $row = $ilDB->fetchAssoc($set);
315 if(is_array($row))
316 {
317 return $row['u_mode'];
318 }
319 }

References $ilDB, $query, and $row.

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

+ Here is the caller graph for this function:

◆ _lookupDBModeForObjects()

static ilLPObjSettings::_lookupDBModeForObjects ( array  $a_obj_ids)
static

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

287 {
288 global $ilDB;
289
290 // this does NOT handle default mode!
291
292 $res = array();
293
294 $query = "SELECT obj_id, u_mode FROM ut_lp_settings".
295 " WHERE ".$ilDB->in("obj_id", $a_obj_ids, "", "integer");
296 $set = $ilDB->query($query);
297 while($row = $set->fetchRow(DB_FETCHMODE_OBJECT))
298 {
299 $res[$row->obj_id] = $row->u_mode;
300 }
301
302 return $res;
303 }

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

Referenced by ilLPStatus\checkLPModesForObjects().

+ Here is the caller graph for this function:

◆ _lookupVisits()

ilLPObjSettings::_lookupVisits (   $a_obj_id)

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(DB_FETCHMODE_OBJECT))
280 {
281 return $row->visits;
282 }
284 }

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

333 {
334 global $lng;
335
336 if(array_key_exists($a_mode, self::$map) &&
337 is_array(self::$map[$a_mode]))
338 {
339 $info = $lng->txt(self::$map[$a_mode][2]);
340
341 if($a_mode == self::LP_MODE_TLT)
342 {
343 // dynamic content
344 include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
346 }
347
348 return $info;
349 }
350 }
$info
Definition: example_052.php:80
global $lng
Definition: privfeed.php:40

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

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

322 {
323 global $lng;
324
325 if(array_key_exists($a_mode, self::$map) &&
326 is_array(self::$map[$a_mode]))
327 {
328 return $lng->txt(self::$map[$a_mode][1]);
329 }
330 }

References $lng.

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

147 {
148 global $ilDB;
149
150 $query = "INSERT INTO ut_lp_settings (obj_id,obj_type,u_mode,visits) ".
151 "VALUES( ".
152 $this->db->quote($a_new_obj_id ,'integer').", ".
153 $this->db->quote($this->getObjType() ,'text').", ".
154 $this->db->quote($this->getMode() ,'integer').", ".
155 $this->db->quote($this->getVisits() ,'integer').
156 ")";
157 $res = $ilDB->manipulate($query);
158 return true;
159 }

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 }
_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 352 of file class.ilLPObjSettings.php.

353 {
354 $res = array();
355 foreach(self::$map as $mode => $item)
356 {
357 $res[$mode] = $item[0];
358 }
359 return $res;
360 }

References $res.

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

+ Here is the caller graph for this function:

◆ getMode()

ilLPObjSettings::getMode ( )

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

177 {
178 return $this->obj_mode;
179 }

References $obj_mode.

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

+ Here is the caller graph for this function:

◆ getObjId()

ilLPObjSettings::getObjId ( )

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

182 {
183 return (int) $this->obj_id;
184 }

References $obj_id.

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

+ Here is the caller graph for this function:

◆ getObjType()

ilLPObjSettings::getObjType ( )

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

187 {
188 return $this->obj_type;
189 }

References $obj_type.

Referenced by cloneSettings(), and insert().

+ Here is the caller graph for this function:

◆ getVisits()

ilLPObjSettings::getVisits ( )

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

162 {
163 return (int) $this->visits ? $this->visits : self::LP_DEFAULT_VISITS;
164 }

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

123 {
124 global $ilObjDataCache, $ilDB;
125
126 $this->db = $ilDB;
127 $this->obj_id = $a_obj_id;
128
129 if(!$this->__read())
130 {
131 $this->obj_type = $ilObjDataCache->lookupType($this->obj_id);
132
133 include_once "Services/Object/classes/class.ilObjectLP.php";
134 $olp = ilObjectLP::getInstance($this->obj_id);
135 $this->obj_mode = $olp->getDefaultMode();
136 }
137 }
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 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 171 of file class.ilLPObjSettings.php.

172 {
173 $this->obj_mode = $a_mode;
174 }

◆ setVisits()

ilLPObjSettings::setVisits (   $a_visits)

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

167 {
168 $this->visits = $a_visits;
169 }

◆ update()

ilLPObjSettings::update (   $a_refresh_lp = true)

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

209 {
210 global $ilDB;
211
212 if(!$this->is_stored)
213 {
214 return $this->insert();
215 }
216 $query = "UPDATE ut_lp_settings SET u_mode = ".$ilDB->quote($this->getMode() ,'integer').", ".
217 "visits = ".$ilDB->quote($this->getVisits() ,'integer')." ".
218 "WHERE obj_id = ".$ilDB->quote($this->getObjId() ,'integer');
219 $res = $ilDB->manipulate($query);
220 $this->__read();
221
222 if($a_refresh_lp)
223 {
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 51 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 49 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\getValidModes().

◆ 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

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

Referenced by ilLearningModuleLP\getValidModes().

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