ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 $ilDB;
49
50 $this->db =& $ilDB;
51
52 $this->course_id = $crs_id;
53 $this->user_id = $user_id;
54 }
global $ilDB

References $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 131 of file class.ilCourseLMHistory.php.

132 {
133 global $ilDB;
134
135 $query = "DELETE FROM crs_lm_history WHERE usr_id = ".$ilDB->quote($a_usr_id,'integer')." ";
136 $res = $ilDB->manipulate($query);
137
138 return true;
139 }

References $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 65 of file class.ilCourseLMHistory.php.

66 {
67 global $tree,$ilDB;
68
69 if(!$crs_ref_id = $tree->checkForParentType($a_lm_ref_id,'crs'))
70 {
71 return true;
72 }
73
74 // Delete old entries
75 $query = "DELETE FROM crs_lm_history ".
76 "WHERE lm_ref_id = ".$ilDB->quote($a_lm_ref_id,'integer')." ".
77 "AND usr_id = ".$ilDB->quote($a_user_id,'integer')."";
78 $res = $ilDB->manipulate($query);
79
80 // Add new entry
81 $fields = array("usr_id" => array("integer", $a_user_id),
82 "crs_ref_id" => array("integer", $crs_ref_id),
83 "lm_ref_id" => array("integer", $a_lm_ref_id),
84 "lm_page_id" => array("integer", $a_page_id),
85 "last_access" => array("integer", time()));
86 $ilDB->insert("crs_lm_history", $fields);
87 return true;
88 }

References $ilDB, $query, and $res.

Referenced by ilLMPresentationGUI\ilPage().

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

+ Here is the caller graph for this function:

◆ getLastLM()

ilCourseLMHistory::getLastLM ( )

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

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

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

+ Here is the call graph for this function:

◆ getLMHistory()

ilCourseLMHistory::getLMHistory ( )

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

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

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

+ Here is the call graph for this function:

◆ getUserId()

ilCourseLMHistory::getUserId ( )

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

57 {
58 return $this->user_id;
59 }

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: