ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 @global 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.

47 {
48 global $DIC;
49
50 $ilDB = $DIC['ilDB'];
51
52 $this->db = &$ilDB;
53
54 $this->course_id = $crs_id;
55 $this->user_id = $user_id;
56 }
global $DIC
Definition: saml.php:7
global $ilDB

References $DIC, $ilDB, and $user_id.

Member Function Documentation

◆ _deleteUser()

static ilCourseLMHistory::_deleteUser (   $a_usr_id)
static

Delete user @global type $ilDB.

Parameters
type$a_usr_id
Returns
boolean

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

135 {
136 global $DIC;
137
138 $ilDB = $DIC['ilDB'];
139
140 $query = "DELETE FROM crs_lm_history WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " ";
141 $res = $ilDB->manipulate($query);
142
143 return true;
144 }
$query
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $query, and $res.

Referenced by ilObjCourse\_deleteUser().

+ 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 67 of file class.ilCourseLMHistory.php.

68 {
69 global $DIC;
70
71 $tree = $DIC['tree'];
72 $ilDB = $DIC['ilDB'];
73
74 if (!$crs_ref_id = $tree->checkForParentType($a_lm_ref_id, 'crs')) {
75 return true;
76 }
77
78 $ilDB->replace("crs_lm_history", [
79 "crs_ref_id" => ["integer", $crs_ref_id],
80 "lm_ref_id" => ["integer", $a_lm_ref_id],
81 "usr_id" => ["integer", $a_user_id]
82 ], [
83 "lm_page_id" => ["integer", $a_page_id],
84 "last_access" => ["integer", time()]
85 ]
86 );
87
88 return true;
89 }

References $DIC, $ilDB, and $tree.

Referenced by ilLMPresentationGUI\ilPage().

+ Here is the caller graph for this function:

◆ getCourseRefId()

ilCourseLMHistory::getCourseRefId ( )

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

References $course_id.

Referenced by getLastLM(), and getLMHistory().

+ Here is the caller graph for this function:

◆ getLastLM()

ilCourseLMHistory::getLastLM ( )

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

92 {
93 global $DIC;
94
95 $ilDB = $DIC['ilDB'];
96
97 $query = "SELECT * FROM crs_lm_history " .
98 "WHERE usr_id = " . $ilDB->quote($this->getUserId(), 'integer') . " " .
99 "AND crs_ref_id = " . $ilDB->quote($this->getCourseRefId(), 'integer') . " " .
100 "ORDER BY last_access ";
101
102 $res = $this->db->query($query);
103 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
104 return $row->lm_ref_id;
105 }
106 return false;
107 }
$row

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

+ Here is the call graph for this function:

◆ getLMHistory()

ilCourseLMHistory::getLMHistory ( )

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

110 {
111 global $DIC;
112
113 $ilDB = $DIC['ilDB'];
114
115 $query = "SELECT * FROM crs_lm_history " .
116 "WHERE usr_id = " . $ilDB->quote($this->getUserId(), 'integer') . " " .
117 "AND crs_ref_id = " . $ilDB->quote($this->getCourseRefId(), 'integer') . "";
118
119 $res = $this->db->query($query);
120 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
121 $lm[$row->lm_ref_id]['lm_ref_id'] = $row->lm_ref_id;
122 $lm[$row->lm_ref_id]['lm_page_id'] = $row->lm_page_id;
123 $lm[$row->lm_ref_id]['last_access'] = $row->last_access;
124 }
125 return $lm ? $lm : array();
126 }

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

+ Here is the call graph for this function:

◆ getUserId()

ilCourseLMHistory::getUserId ( )

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

59 {
60 return $this->user_id;
61 }

References $user_id.

Referenced by getLastLM(), and getLMHistory().

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