ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCourseLMHistory Class Reference

class ilCourseLMHistory More...

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

Public Member Functions

 ilCourseLMHistory ($crs_id, $user_id)
 
 getUserId ()
 
 getCourseRefId ()
 
 _updateLastAccess ($a_user_id, $a_lm_ref_id, $a_page_id)
 
 getLastLM ()
 
 getLMHistory ()
 
 _deleteUser ($a_usr_id)
 

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.

Member Function Documentation

◆ _deleteUser()

ilCourseLMHistory::_deleteUser (   $a_usr_id)

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

References $ilDB, $query, and $res.

Referenced by ilObjCourse\_deleteUser().

121  {
122  global $ilDB;
123 
124  $query = "DELETE FROM crs_lm_history WHERE usr_id = ".$ilDB->quote($a_usr_id,'integer')." ";
125  $res = $ilDB->manipulate($query);
126 
127  return true;
128  }
global $ilDB
+ Here is the caller graph for this function:

◆ _updateLastAccess()

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

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

References $ilDB, $query, and $res.

Referenced by ilLMPresentationGUI\ilPage().

61  {
62  global $tree,$ilDB;
63 
64  if(!$crs_ref_id = $tree->checkForParentType($a_lm_ref_id,'crs'))
65  {
66  return true;
67  }
68 
69  // Delete old entries
70  $query = "DELETE FROM crs_lm_history ".
71  "WHERE lm_ref_id = ".$ilDB->quote($a_lm_ref_id,'integer')." ".
72  "AND usr_id = ".$ilDB->quote($a_user_id,'integer')."";
73  $res = $ilDB->manipulate($query);
74 
75  // Add new entry
76  $fields = array("usr_id" => array("integer", $a_user_id),
77  "crs_ref_id" => array("integer", $crs_ref_id),
78  "lm_ref_id" => array("integer", $a_lm_ref_id),
79  "lm_page_id" => array("integer", $a_page_id),
80  "last_access" => array("integer", time()));
81  $ilDB->insert("crs_lm_history", $fields);
82  return true;
83  }
global $ilDB
+ Here is the caller graph for this function:

◆ getCourseRefId()

ilCourseLMHistory::getCourseRefId ( )

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

References $course_id.

Referenced by getLastLM(), and getLMHistory().

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

◆ getLastLM()

ilCourseLMHistory::getLastLM ( )

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

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, getCourseRefId(), and getUserId().

86  {
87  global $ilDB;
88 
89  $query = "SELECT * FROM crs_lm_history ".
90  "WHERE usr_id = ".$ilDB->quote($this->getUserId(),'integer')." ".
91  "AND crs_ref_id = ".$ilDB->quote($this->getCourseRefId(),'integer')." ".
92  "ORDER BY last_access ";
93 
94  $res = $this->db->query($query);
95  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
96  {
97  return $row->lm_ref_id;
98  }
99  return false;
100  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the call graph for this function:

◆ getLMHistory()

ilCourseLMHistory::getLMHistory ( )

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

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, getCourseRefId(), and getUserId().

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

103  {
104  global $ilDB;
105 
106  $query = "SELECT * FROM crs_lm_history ".
107  "WHERE usr_id = ".$ilDB->quote($this->getUserId(),'integer')." ".
108  "AND crs_ref_id = ".$ilDB->quote($this->getCourseRefId(),'integer')."";
109 
110  $res = $this->db->query($query);
111  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
112  {
113  $lm[$row->lm_ref_id]['lm_ref_id'] = $row->lm_ref_id;
114  $lm[$row->lm_ref_id]['lm_page_id'] = $row->lm_page_id;
115  $lm[$row->lm_ref_id]['last_access'] = $row->last_access;
116  }
117  return $lm ? $lm : array();
118  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserId()

ilCourseLMHistory::getUserId ( )

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

References $user_id.

Referenced by getLastLM(), and getLMHistory().

52  {
53  return $this->user_id;
54  }
+ Here is the caller graph for this function:

◆ ilCourseLMHistory()

ilCourseLMHistory::ilCourseLMHistory (   $crs_id,
  $user_id 
)

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

References $ilDB, and $user_id.

42  {
43  global $ilDB;
44 
45  $this->db =& $ilDB;
46 
47  $this->course_id = $crs_id;
48  $this->user_id = $user_id;
49  }
global $ilDB

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 getUserId(), and ilCourseLMHistory().


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