• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/Tracking/classes/class.ilLPStatusEvent.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00033 include_once './Services/Tracking/classes/class.ilLPStatus.php';
00034 include_once './Services/Tracking/classes/class.ilLPStatusWrapper.php';
00035 
00036 class ilLPStatusEvent extends ilLPStatus
00037 {
00038 
00039         function ilLPStatusEvent($a_obj_id)
00040         {
00041                 global $ilDB;
00042 
00043                 parent::ilLPStatus($a_obj_id);
00044                 $this->db =& $ilDB;
00045         }
00046 
00047         function _getNotAttempted($a_obj_id)
00048         {
00049                 global $ilObjDataCache;
00050 
00051                 $status_info = ilLPStatusWrapper::_getStatusInfoByType($a_obj_id,'event');
00052 
00053                 include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
00054                 $member_obj = ilCourseParticipants::_getInstanceByObjId($status_info['crs_id']);
00055                 $members = $member_obj->getParticipants();
00056                 
00057                 // diff in progress and completed (use stored result in LPStatusWrapper)
00058                 $users = array_diff((array) $members,$inp = ilLPStatusWrapper::_getInProgressByType($a_obj_id,'event'));
00059                 $users = array_diff((array) $users,$com = ilLPStatusWrapper::_getCompletedByType($a_obj_id,'event'));
00060                 return $users;
00061         }
00062 
00063         function _getInProgress($a_obj_id)
00064         {
00065                 $status_info = ilLPStatusWrapper::_getStatusInfoByType($a_obj_id,'event');
00066 
00067                 // If registration is disabled in_progress is not available
00068                 if(!$status_info['registration'])
00069                 {
00070                         return array();
00071                 }
00072                 // If event has occured in_progress is impossible
00073                 if($status_info['starting_time'] < time())
00074                 {
00075                         return array();
00076                 }
00077 
00078                 // Otherwise all users who registered will get the status in progress
00079                 return $status_info['registered_users'] ? $status_info['registered_users'] : array();
00080         }
00081 
00082         function _getCompleted($a_obj_id)
00083         {
00084 
00085                 $status_info = ilLPStatusWrapper::_getStatusInfoByType($a_obj_id,'event');
00086                 return $status_info['participated_users'] ? $status_info['participated_users'] : array();
00087         }
00088 
00089         function _getStatusInfo($a_obj_id)
00090         {
00091                 include_once 'Modules/Course/classes/Event/class.ilEvent.php';
00092                 include_once 'Modules/Course/classes/Event/class.ilEventParticipants.php';
00093 
00094                 $event = new ilEvent($a_obj_id);
00095                 
00096                 $status_info['crs_id'] = $event->getObjId();
00097                 $status_info['registration'] = $event->enabledRegistration();
00098                 $status_info['title'] = $event->getTitle();
00099                 $status_info['description'] = $event->getDescription();
00100 
00101                 $appointment =& $event->getFirstAppointment(); 
00102                 $status_info['starting_time'] = $appointment->getStartingTime();
00103                 $status_info['ending_time'] = $appointment->getEndingTime();
00104 
00105                 $status_info['registered_users'] = ilEventParticipants::_getRegistered($a_obj_id);
00106                 $status_info['participated_users'] = ilEventParticipants::_getParticipated($a_obj_id);
00107 
00108                 return $status_info;
00109         }
00110 
00111 }       
00112 ?>

Generated on Fri Dec 13 2013 17:57:01 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1