ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilPluginLP.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once "Services/Object/classes/class.ilObjectLP.php";
6 
14 class ilPluginLP extends ilObjectLP
15 {
16  protected $status; // [mixed]
17 
18  const INACTIVE_PLUGIN = -1;
19 
20  protected function __construct($a_obj_id)
21  {
22  parent::__construct($a_obj_id);
23 
24  $this->initPlugin();
25  }
26 
27  protected function initPlugin()
28  {
29  // active plugin?
30  include_once 'Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php';
32  {
33  $obj = ilObjectFactory::getInstanceByObjId($this->obj_id, false); // #12640
34  if($obj && $obj instanceof ilLPStatusPluginInterface)
35  {
36  $this->status = $obj;
37  }
38  }
39  // inactive plugin?
41  {
42  $this->status = self::INACTIVE_PLUGIN;
43  }
44  }
45 
46  public function getPluginInstance()
47  {
48  return $this->status;
49  }
50 
51  public function getDefaultMode()
52  {
54  }
55 
56  public function getValidModes()
57  {
58  return array(
61  );
62  }
63 
64  public function getCurrentMode()
65  {
66  if($this->status !== null)
67  {
69  }
71  }
72 
73  protected static function isLPMember(array &$a_res, $a_usr_id, $a_obj_ids)
74  {
75  global $objDefinition;
76 
77  $type = $a_obj_ids;
78  $type = array_shift($type);
79  $type = ilObject::_lookupType($type);
80 
81  $location = $objDefinition->getLocation($type);
82  $class_name = "ilObj".$objDefinition->getClassName($type);
83  include_once $location."/class.".$class_name.".php";
84 
85  // forward to plugin object
86  if(method_exists($class_name, "isLPMember"))
87  {
88  $class_name::isLPMember($a_res, $a_usr_id, $a_obj_ids);
89  }
90  }
91 }
92 
93 ?>
static isTypePluginWithLP($a_type, $a_active_status=true)
Check whether a repository type is a plugin which has active learning progress.
__construct($a_obj_id)
$location
Definition: buildRTE.php:44
const INACTIVE_PLUGIN
Interface for plugin classes that want to support Learning Progress.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static isLPMember(array &$a_res, $a_usr_id, $a_obj_ids)