ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
5include_once "Services/Object/classes/class.ilObjectLP.php";
6
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 $DIC;
72 $objDefinition = $DIC['objDefinition'];
73
74 $type = $a_obj_ids;
75 $type = array_shift($type);
77
78 $location = $objDefinition->getLocation($type);
79 $class_name = "ilObj" . $objDefinition->getClassName($type);
80 include_once $location . "/class." . $class_name . ".php";
81
82 // forward to plugin object
83 if (method_exists($class_name, "isLPMember")) {
84 $class_name::isLPMember($a_res, $a_usr_id, $a_obj_ids);
85 }
86 }
87}
$location
Definition: buildRTE.php:44
An exception for terminatinating execution or to throw for unit testing.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupType($a_id, $a_reference=false)
lookup object type
__construct($a_obj_id)
const INACTIVE_PLUGIN
static isLPMember(array &$a_res, $a_usr_id, $a_obj_ids)
Find (lp-relevant) members for given object ids.
static isTypePluginWithLP($a_type, $a_active_status=true)
Check whether a repository type is a plugin which has active learning progress.
Interface for plugin classes that want to support Learning Progress.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$type
$DIC
Definition: xapitoken.php:46