ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  $obj = ilObjectFactory::getInstanceByObjId($this->obj_id, false); // #12640
33  if ($obj && $obj instanceof ilLPStatusPluginInterface) {
34  $this->status = $obj;
35  }
36  }
37  // inactive plugin?
39  $this->status = self::INACTIVE_PLUGIN;
40  }
41  }
42 
43  public function getPluginInstance()
44  {
45  return $this->status;
46  }
47 
48  public function getDefaultMode()
49  {
51  }
52 
53  public function getValidModes()
54  {
55  return array(
58  );
59  }
60 
61  public function getCurrentMode()
62  {
63  if ($this->status !== null) {
65  }
67  }
68 
69  protected static function isLPMember(array &$a_res, $a_usr_id, $a_obj_ids)
70  {
71  global $objDefinition;
72 
73  $type = $a_obj_ids;
74  $type = array_shift($type);
76 
77  $location = $objDefinition->getLocation($type);
78  $class_name = "ilObj" . $objDefinition->getClassName($type);
79  include_once $location . "/class." . $class_name . ".php";
80 
81  // forward to plugin object
82  if (method_exists($class_name, "isLPMember")) {
83  $class_name::isLPMember($a_res, $a_usr_id, $a_obj_ids);
84  }
85  }
86 }
static isTypePluginWithLP($a_type, $a_active_status=true)
Check whether a repository type is a plugin which has active learning progress.
$type
__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)