ILIAS  Release_4_0_x_branch Revision 61816
 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  include_once './Services/Tracking/classes/class.ilChangeEvent.php';
56  $all = ilChangeEvent::_lookupReadEvents($a_obj_id);
57  foreach($all as $event)
58  {
59  if($event['read_count'] < $required_visits)
60  {
61  $user_ids[] = $event['usr_id'];
62  }
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  include_once './Services/Tracking/classes/class.ilChangeEvent.php';
75  $all = ilChangeEvent::_lookupReadEvents($a_obj_id);
76  foreach($all as $event)
77  {
78  if($event['read_count'] >= $required_visits)
79  {
80  $user_ids[] = $event['usr_id'];
81  }
82  }
83  return $user_ids ? $user_ids : array();
84  }
85 
86  function _getStatusInfo($a_obj_id)
87  {
88  include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
89  $status_info['visits'] = ilLPObjSettings::_lookupVisits($a_obj_id);
90 
91  return $status_info;
92  }
93 
94 
95 
96 
97 }
98 ?>