ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilCourseLMHistory Class Reference

class ilCourseLMHistory More...

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

Public Member Functions

 __construct (int $crs_id, int $user_id)
 
 getUserId ()
 
 getCourseRefId ()
 
 getLastLM ()
 
 getLMHistory ()
 

Static Public Member Functions

static _updateLastAccess (int $a_user_id, int $a_lm_ref_id, int $a_page_id)
 
static _deleteUser (int $a_usr_id)
 

Protected Attributes

ilDBInterface $db
 

Private Attributes

int $course_id = 0
 
int $user_id = 0
 

Detailed Description

class ilCourseLMHistory

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

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

Constructor & Destructor Documentation

◆ __construct()

ilCourseLMHistory::__construct ( int  $crs_id,
int  $user_id 
)

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

References $DIC, and $user_id.

34  {
35  global $DIC;
36 
37  $this->db = $DIC->database();
38  $this->course_id = $crs_id;
39  $this->user_id = $user_id;
40  }
global $DIC
Definition: shib_login.php:22

Member Function Documentation

◆ _deleteUser()

static ilCourseLMHistory::_deleteUser ( int  $a_usr_id)
static

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

References $DIC, $ilDB, and $res.

Referenced by ilObjCourse\_deleteUser().

109  : void
110  {
111  global $DIC;
112 
113  $ilDB = $DIC->database();
114  $query = "DELETE FROM crs_lm_history WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer') . " ";
115  $res = $ilDB->manipulate($query);
116  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _updateLastAccess()

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

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

References $DIC, and $ilDB.

Referenced by ilLMContentRendererGUI\render().

52  : bool
53  {
54  global $DIC;
55 
56  $tree = $DIC['tree'];
57  $ilDB = $DIC['ilDB'];
58 
59  if (!$crs_ref_id = $tree->checkForParentType($a_lm_ref_id, 'crs')) {
60  return true;
61  }
62 
63  $ilDB->replace(
64  "crs_lm_history",
65  [
66  "crs_ref_id" => ["integer", $crs_ref_id],
67  "lm_ref_id" => ["integer", $a_lm_ref_id],
68  "usr_id" => ["integer", $a_user_id]
69  ],
70  [
71  "lm_page_id" => ["integer", $a_page_id],
72  "last_access" => ["integer", time()]
73  ]
74  );
75 
76  return true;
77  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getCourseRefId()

ilCourseLMHistory::getCourseRefId ( )

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

References $course_id.

Referenced by getLastLM(), and getLMHistory().

47  : int
48  {
49  return $this->course_id;
50  }
+ Here is the caller graph for this function:

◆ getLastLM()

ilCourseLMHistory::getLastLM ( )

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

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

79  : int
80  {
81  $query = "SELECT * FROM crs_lm_history " .
82  "WHERE usr_id = " . $this->db->quote($this->getUserId(), 'integer') . " " .
83  "AND crs_ref_id = " . $this->db->quote($this->getCourseRefId(), 'integer') . " " .
84  "ORDER BY last_access ";
85 
86  $res = $this->db->query($query);
87  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
88  return (int) $row->lm_ref_id;
89  }
90  return 0;
91  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ getLMHistory()

ilCourseLMHistory::getLMHistory ( )

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

References $res, ilDBConstants\FETCHMODE_OBJECT, getCourseRefId(), getUserId(), and ILIAS\Repository\int().

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

93  : array
94  {
95  $query = "SELECT * FROM crs_lm_history " .
96  "WHERE usr_id = " . $this->db->quote($this->getUserId(), 'integer') . " " .
97  "AND crs_ref_id = " . $this->db->quote($this->getCourseRefId(), 'integer') . "";
98 
99  $res = $this->db->query($query);
100  $lm = [];
101  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
102  $lm[$row->lm_ref_id]['lm_ref_id'] = (int) $row->lm_ref_id;
103  $lm[$row->lm_ref_id]['lm_page_id'] = (int) $row->lm_page_id;
104  $lm[$row->lm_ref_id]['last_access'] = (int) $row->last_access;
105  }
106  return $lm;
107  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserId()

ilCourseLMHistory::getUserId ( )

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

References $user_id.

Referenced by getLastLM(), and getLMHistory().

42  : int
43  {
44  return $this->user_id;
45  }
+ Here is the caller graph for this function:

Field Documentation

◆ $course_id

int ilCourseLMHistory::$course_id = 0
private

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

Referenced by getCourseRefId().

◆ $db

ilDBInterface ilCourseLMHistory::$db
protected

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

◆ $user_id

int ilCourseLMHistory::$user_id = 0
private

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

Referenced by __construct(), and getUserId().


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