ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCourseLMHistory Class Reference

class ilCourseLMHistory More...

+ Inheritance diagram for ilCourseLMHistory:
+ Collaboration diagram for ilCourseLMHistory:

Public Member Functions

 __construct ($crs_id, $user_id)
 Constructor. More...
 
 getUserId ()
 
 getCourseRefId ()
 
 getLastLM ()
 
 getLMHistory ()
 

Static Public Member Functions

static _updateLastAccess ($a_user_id, $a_lm_ref_id, $a_page_id)
 
static _deleteUser ($a_usr_id)
 Delete user type $ilDB. More...
 

Data Fields

 $db
 
 $course_id
 
 $user_id
 

Detailed Description

class ilCourseLMHistory

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 34 of file class.ilCourseLMHistory.php.

Constructor & Destructor Documentation

◆ __construct()

ilCourseLMHistory::__construct (   $crs_id,
  $user_id 
)

Constructor.

Parameters
int$crs_id
int$user_id

Definition at line 46 of file class.ilCourseLMHistory.php.

References $ilDB, and $user_id.

47  {
48  global $ilDB;
49 
50  $this->db =&$ilDB;
51 
52  $this->course_id = $crs_id;
53  $this->user_id = $user_id;
54  }
global $ilDB

Member Function Documentation

◆ _deleteUser()

static ilCourseLMHistory::_deleteUser (   $a_usr_id)
static

Delete user type $ilDB.

Parameters
type$a_usr_id
Returns
boolean

Definition at line 128 of file class.ilCourseLMHistory.php.

References $ilDB, $query, and $res.

Referenced by ilObjCourse\_deleteUser().

129  {
130  global $ilDB;
131 
132  $query = "DELETE FROM crs_lm_history WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " ";
133  $res = $ilDB->manipulate($query);
134 
135  return true;
136  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ _updateLastAccess()

static ilCourseLMHistory::_updateLastAccess (   $a_user_id,
  $a_lm_ref_id,
  $a_page_id 
)
static

Definition at line 65 of file class.ilCourseLMHistory.php.

References $ilDB, $query, $res, array, and time.

Referenced by ilLMPresentationGUI\ilPage().

66  {
67  global $tree,$ilDB;
68 
69  if (!$crs_ref_id = $tree->checkForParentType($a_lm_ref_id, 'crs')) {
70  return true;
71  }
72 
73  // Delete old entries
74  $query = "DELETE FROM crs_lm_history " .
75  "WHERE lm_ref_id = " . $ilDB->quote($a_lm_ref_id, 'integer') . " " .
76  "AND usr_id = " . $ilDB->quote($a_user_id, 'integer') . "";
77  $res = $ilDB->manipulate($query);
78 
79  // Add new entry
80  $fields = array("usr_id" => array("integer", $a_user_id),
81  "crs_ref_id" => array("integer", $crs_ref_id),
82  "lm_ref_id" => array("integer", $a_lm_ref_id),
83  "lm_page_id" => array("integer", $a_page_id),
84  "last_access" => array("integer", time()));
85  $ilDB->insert("crs_lm_history", $fields);
86  return true;
87  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the caller graph for this function:

◆ getCourseRefId()

ilCourseLMHistory::getCourseRefId ( )

Definition at line 60 of file class.ilCourseLMHistory.php.

References $course_id.

Referenced by getLastLM(), and getLMHistory().

61  {
62  return $this->course_id;
63  }
+ Here is the caller graph for this function:

◆ getLastLM()

ilCourseLMHistory::getLastLM ( )

Definition at line 89 of file class.ilCourseLMHistory.php.

References $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, getCourseRefId(), and getUserId().

90  {
91  global $ilDB;
92 
93  $query = "SELECT * FROM crs_lm_history " .
94  "WHERE usr_id = " . $ilDB->quote($this->getUserId(), 'integer') . " " .
95  "AND crs_ref_id = " . $ilDB->quote($this->getCourseRefId(), 'integer') . " " .
96  "ORDER BY last_access ";
97 
98  $res = $this->db->query($query);
99  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
100  return $row->lm_ref_id;
101  }
102  return false;
103  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ getLMHistory()

ilCourseLMHistory::getLMHistory ( )

Definition at line 105 of file class.ilCourseLMHistory.php.

References $ilDB, $query, $res, $row, array, ilDBConstants\FETCHMODE_OBJECT, getCourseRefId(), and getUserId().

Referenced by ilContainerStartObjectsContentTableGUI\getItems(), and ilCourseContentGUI\showStartObjects().

106  {
107  global $ilDB;
108 
109  $query = "SELECT * FROM crs_lm_history " .
110  "WHERE usr_id = " . $ilDB->quote($this->getUserId(), 'integer') . " " .
111  "AND crs_ref_id = " . $ilDB->quote($this->getCourseRefId(), 'integer') . "";
112 
113  $res = $this->db->query($query);
114  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
115  $lm[$row->lm_ref_id]['lm_ref_id'] = $row->lm_ref_id;
116  $lm[$row->lm_ref_id]['lm_page_id'] = $row->lm_page_id;
117  $lm[$row->lm_ref_id]['last_access'] = $row->last_access;
118  }
119  return $lm ? $lm : array();
120  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserId()

ilCourseLMHistory::getUserId ( )

Definition at line 56 of file class.ilCourseLMHistory.php.

References $user_id.

Referenced by getLastLM(), and getLMHistory().

57  {
58  return $this->user_id;
59  }
+ Here is the caller graph for this function:

Field Documentation

◆ $course_id

ilCourseLMHistory::$course_id

Definition at line 38 of file class.ilCourseLMHistory.php.

Referenced by getCourseRefId().

◆ $db

ilCourseLMHistory::$db

Definition at line 36 of file class.ilCourseLMHistory.php.

◆ $user_id

ilCourseLMHistory::$user_id

Definition at line 39 of file class.ilCourseLMHistory.php.

Referenced by __construct(), and getUserId().


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