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

Services/Tracking/classes/class.ilLPStatusWrapper.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 
00038 include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
00039 include_once 'Services/Tracking/classes/class.ilLPStatusFactory.php';
00040 
00041 class ilLPStatusWrapper
00042 {
00043 
00047         function _getCountNotAttempted($a_obj_id)
00048         {
00049                 return count(ilLPStatusWrapper::_getNotAttempted($a_obj_id));
00050         }
00051 
00055         function _getNotAttempted($a_obj_id)
00056         {
00057                 static $cache = array();
00058 
00059                 if(isset($cache[$a_obj_id]))
00060                 {
00061                         return $cache[$a_obj_id];
00062                 }
00063 
00064                 $class = ilLPStatusFactory::_getClassById($a_obj_id);
00065 
00066                 $cache[$a_obj_id] = call_user_func(array($class,'_getNotAttempted'),$a_obj_id);
00067                 
00068                 return $cache[$a_obj_id];
00069         }
00070 
00074         function _getCountInProgress($a_obj_id)
00075         {
00076                 return count(ilLPStatusWrapper::_getInProgress($a_obj_id));
00077         }
00078 
00082         function _getInProgress($a_obj_id)
00083         {
00084                 static $cache = array();
00085 
00086                 if(isset($cache[$a_obj_id]))
00087                 {
00088                         return $cache[$a_obj_id];
00089                 }
00090 
00091                 global $ilBench;
00092 
00093                 $class = ilLPStatusFactory::_getClassById($a_obj_id);
00094 
00095                 $cache[$a_obj_id] = call_user_func($tmp = array($class,'_getInProgress'),$a_obj_id);
00096 
00097                 return $cache[$a_obj_id];
00098         }
00099         
00103         function _getCountCompleted($a_obj_id)
00104         {
00105                 return count(ilLPStatusWrapper::_getCompleted($a_obj_id));
00106         }
00107 
00111         function _getCompleted($a_obj_id)
00112         {
00113                 static $cache = array();
00114 
00115                 if(isset($cache[$a_obj_id]))
00116                 {
00117                         return $cache[$a_obj_id];
00118                 }
00119 
00120                 $class = ilLPStatusFactory::_getClassById($a_obj_id);
00121                 $cache[$a_obj_id] = call_user_func(array($class,'_getCompleted'),$a_obj_id);
00122 
00123                 return $cache[$a_obj_id];
00124         }
00125 
00129         function _getCountFailed($a_obj_id)
00130         {
00131                 return count(ilLPStatusWrapper::_getFailed($a_obj_id));
00132         }
00133 
00137         function _getFailed($a_obj_id)
00138         {
00139                 static $cache = array();
00140 
00141                 if(isset($cache[$a_obj_id]))
00142                 {
00143                         return $cache[$a_obj_id];
00144                 }
00145 
00146                 $class = ilLPStatusFactory::_getClassById($a_obj_id);
00147 
00148                 $cache[$a_obj_id] = call_user_func(array($class,'_getFailed'),$a_obj_id);
00149 
00150                 return $cache[$a_obj_id];
00151         }
00152 
00156         function _getStatusInfo($a_obj_id)
00157         {
00158                 static $cache = array();
00159 
00160                 if(isset($cache[$a_obj_id]))
00161                 {
00162                         return $cache[$a_obj_id];
00163                 }
00164 
00165                 $class = ilLPStatusFactory::_getClassById($a_obj_id);
00166                 $cache[$a_obj_id] = call_user_func(array($class,'_getStatusInfo'),$a_obj_id);
00167                 return $cache[$a_obj_id];
00168         }
00169 
00173         function _getTypicalLearningTime($a_obj_id)
00174         {
00175                 static $cache = array();
00176 
00177                 if(isset($cache[$a_obj_id]))
00178                 {
00179                         return $cache[$a_obj_id];
00180                 }
00181 
00182                 $class = ilLPStatusFactory::_getClassById($a_obj_id);
00183 
00184                 $cache[$a_obj_id] = call_user_func(array($class,'_getTypicalLearningTime'),$a_obj_id);
00185 
00186                 return $cache[$a_obj_id];
00187         }
00188 
00190         // Special functions for 'objects' that have not an entry in object_data
00191         // E.g. events
00193 
00197         function _getCountNotAttemptedByType($a_obj_id,$a_type)
00198         {
00199                 return count(ilLPStatusWrapper::_getNotAttemptedByType($a_obj_id,$a_type));
00200         }
00201         function _getNotAttemptedByType($a_obj_id,$a_type)
00202         {
00203                 static $cache = array();
00204 
00205                 if(isset($cache[$a_obj_id.'_'.$a_type]))
00206                 {
00207                         return $cache[$a_obj_id.'_'.$a_type];
00208                 }
00209 
00210                 $class = ilLPStatusFactory::_getClassByIdAndType($a_obj_id,$a_type);
00211 
00212                 $cache[$a_obj_id.'_'.$a_type] = call_user_func(array($class,'_getNotAttempted'),$a_obj_id);
00213 
00214                 return $cache[$a_obj_id.'_'.$a_type];
00215         }
00216         function _getCountInProgressByType($a_obj_id,$a_type)
00217         {
00218                 return count(ilLPStatusWrapper::_getInProgressByType($a_obj_id,$a_type));
00219         }
00220         function _getInProgressByType($a_obj_id,$a_type)
00221         {
00222                 static $cache = array();
00223 
00224                 if(isset($cache[$a_obj_id.'_'.$a_type]))
00225                 {
00226                         return $cache[$a_obj_id.'_'.$a_type];
00227                 }
00228 
00229                 $class = ilLPStatusFactory::_getClassByIdAndType($a_obj_id,$a_type);
00230 
00231                 $cache[$a_obj_id.'_'.$a_type] = call_user_func(array($class,'_getInProgress'),$a_obj_id);
00232 
00233                 return $cache[$a_obj_id.'_'.$a_type];
00234         }
00235         function _getCountCompletedByType($a_obj_id,$a_type)
00236         {
00237                 return count(ilLPStatusWrapper::_getCompletedByType($a_obj_id,$a_type));
00238         }
00239         function _getCompletedByType($a_obj_id,$a_type)
00240         {
00241                 static $cache = array();
00242 
00243                 if(isset($cache[$a_obj_id.'_'.$a_type]))
00244                 {
00245                         return $cache[$a_obj_id.'_'.$a_type];
00246                 }
00247 
00248                 $class = ilLPStatusFactory::_getClassByIdAndType($a_obj_id,$a_type);
00249                 $cache[$a_obj_id.'_'.$a_type] = call_user_func(array($class,'_getCompleted'),$a_obj_id);
00250                 return $cache[$a_obj_id.'_'.$a_type];
00251         }
00252         function _getCountFailedByType($a_obj_id,$a_type)
00253         {
00254                 return count(ilLPStatusWrapper::_getFailedByType($a_obj_id,$a_type));
00255         }
00256         function _getFailedByType($a_obj_id,$a_type)
00257         {
00258                 static $cache = array();
00259 
00260                 if(isset($cache[$a_obj_id.'_'.$a_type]))
00261                 {
00262                         return $cache[$a_obj_id.'_'.$a_type];
00263                 }
00264 
00265                 $class = ilLPStatusFactory::_getClassByIdAndType($a_obj_id,$a_type);
00266                 $cache[$a_obj_id.'_'.$a_type] = call_user_func(array($class,'_getFailed'),$a_obj_id);
00267                 return $cache[$a_obj_id.'_'.$a_type];
00268         }
00269         function _getStatusInfoByType($a_obj_id,$a_type)
00270         {
00271                 static $cache = array();
00272 
00273                 if(isset($cache[$a_obj_id.'_'.$a_type]))
00274                 {
00275                         return $cache[$a_obj_id.'_'.$a_type];
00276                 }
00277 
00278                 $class = ilLPStatusFactory::_getClassByIdAndType($a_obj_id,$a_type);
00279 
00280                 $cache[$a_obj_id.'_'.$a_type] = call_user_func(array($class,'_getStatusInfo'),$a_obj_id);
00281 
00282                 return $cache[$a_obj_id.'_'.$a_type];
00283         }
00284 }       
00285 ?>

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