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

Services/Tracking/classes/class.ilLPStatusCollection.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 ilLPStatusCollection extends ilLPStatus
00037 {
00038 
00039         function ilLPStatusCollection($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                 include_once 'course/classes/class.ilCourseMembers.php';
00050 
00051                 $members = ilCourseMembers::_getMembers($a_obj_id);
00052 
00053                 // diff in progress and completed (use stored result in LPStatusWrapper)
00054                 $users = array_diff((array) $members,$inp = ilLPStatusWrapper::_getInProgress($a_obj_id));
00055                 $users = array_diff((array) $users,$com = ilLPStatusWrapper::_getCompleted($a_obj_id));
00056 
00057                 return $users;
00058         }
00059 
00060         function _getInProgress($a_obj_id)
00061         {
00062                 include_once './Services/Tracking/classes/class.ilLPCollections.php';
00063                 include_once 'course/classes/class.ilCourseMembers.php';
00064 
00065                 global $ilBench;
00066                 $ilBench->start('LearningProgress','9172_LPStatusCollection_inProgress');
00067 
00068                 $in_progress = 0;
00069                 foreach(ilLPCollections::_getItems($a_obj_id) as $item_id)
00070                 {
00071                         // merge arrays of users with status 'in progress'
00072                         $users = array_unique(array_merge((array) $users,ilLPStatusWrapper::_getInProgress($item_id)));
00073                         $users = array_unique(array_merge((array) $users,ilLPStatusWrapper::_getCompleted($item_id)));
00074                 }
00075 
00076                 // Exclude all users with status completed.
00077                 $users = array_diff((array) $users,ilLPStatusWrapper::_getCompleted($a_obj_id));
00078                 // Exclude all non members
00079                 $users = array_intersect(ilCourseMembers::_getMembers($a_obj_id),(array) $users);
00080 
00081                 $ilBench->stop('LearningProgress','9172_LPStatusCollection_inProgress');
00082                 return $users;
00083         }
00084 
00085         function _getCompleted($a_obj_id)
00086         {
00087                 include_once './Services/Tracking/classes/class.ilLPCollections.php';
00088                 include_once 'course/classes/class.ilCourseMembers.php';
00089 
00090                 global $ilBench;
00091                 $ilBench->start('LearningProgress','9173_LPStatusCollection_completed');
00092 
00093 
00094                 $counter = 0;
00095                 foreach(ilLPCollections::_getItems($a_obj_id) as $item_id)
00096                 {
00097                         $tmp_users = ilLPStatusWrapper::_getCompleted($item_id);
00098                         if(!$counter++)
00099                         {
00100                                 $users = $tmp_users;
00101                         }
00102                         else
00103                         {
00104                                 $users = array_intersect($users,$tmp_users);
00105                         }
00106 
00107                 }
00108                 // Exclude all non members
00109                 $users = array_intersect(ilCourseMembers::_getMembers($a_obj_id),(array) $users);
00110 
00111                 $ilBench->stop('LearningProgress','9173_LPStatusCollection_completed');
00112                 return (array) $users;
00113         }               
00114 
00115 }       
00116 ?>

Generated on Fri Dec 13 2013 11:57:59 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1