ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLPStatusVisits.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
33 include_once 'Services/Tracking/classes/class.ilLPStatus.php';
34 include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
35 include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
36 
38 {
39 
40  function ilLPStatusVisits($a_obj_id)
41  {
42  global $ilDB;
43 
44  parent::ilLPStatus($a_obj_id);
45  $this->db =& $ilDB;
46  }
47 
48  function _getInProgress($a_obj_id)
49  {
50  global $ilDB;
51 
52  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
53  $required_visits = $status_info['visits'];
54 
55  $query = "SELECT DISTINCT(usr_id) FROM read_event ".
56  "WHERE read_count < '".$required_visits."' ".
57  "AND obj_id = '".$a_obj_id."'";
58 
59  $res = $ilDB->query($query);
60  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
61  {
62  $user_ids[] = $row->usr_id;
63  }
64  return $user_ids ? $user_ids : array();
65  }
66 
67  function _getCompleted($a_obj_id)
68  {
69  global $ilDB;
70 
71  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
72  $required_visits = $status_info['visits'];
73 
74  $query = "SELECT DISTINCT(usr_id) FROM read_event ".
75  "WHERE read_count >= '".$required_visits."' ".
76  "AND obj_id = '".$a_obj_id."'";
77 
78 
79  $res = $ilDB->query($query);
80  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
81  {
82  $user_ids[] = $row->usr_id;
83  }
84  return $user_ids ? $user_ids : array();
85  }
86 
87  function _getStatusInfo($a_obj_id)
88  {
89  include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
90  $status_info['visits'] = ilLPObjSettings::_lookupVisits($a_obj_id);
91 
92  return $status_info;
93  }
94 
95 
96 
97 
98 }
99 ?>