ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilPluginLP.php
Go to the documentation of this file.
1<?php
2
27{
28 protected $status; // [mixed]
29
30 public const INACTIVE_PLUGIN = -1;
31
32 protected function __construct($a_obj_id)
33 {
34 parent::__construct($a_obj_id);
35
36 $this->initPlugin();
37 }
38
39 protected function initPlugin(): void
40 {
41 // active plugin?
43 $obj = ilObjectFactory::getInstanceByObjId($this->obj_id, false); // #12640
44 if ($obj instanceof ilLPStatusPluginInterface) {
45 $this->status = $obj;
46 }
47 }
48 // inactive plugin?
50 $this->status = self::INACTIVE_PLUGIN;
51 }
52 }
53
54 public function getPluginInstance()
55 {
56 return $this->status;
57 }
58
59 public function getDefaultMode(): int
60 {
62 }
63
64 public function getValidModes(): array
65 {
66 return array(
69 );
70 }
71
72 public function getCurrentMode(): int
73 {
74 if ($this->status !== null) {
76 }
78 }
79
80 protected static function isLPMember(array &$res, int $usr_id, array $obj_ids): bool
81 {
82 global $DIC;
83 $objDefinition = $DIC['objDefinition'];
84
85 $type = $obj_ids;
86 $type = array_shift($type);
87 $type = ilObject::_lookupType($type);
88
89 $location = $objDefinition->getLocation($type);
90 $class_name = "ilObj" . $objDefinition->getClassName($type);
91 include_once $location . "/class." . $class_name . ".php";
92
93 // forward to plugin object
94 if (method_exists($class_name, "isLPMember")) {
95 return $class_name::isLPMember($res, $usr_id, $obj_ids);
96 }
97
98 return false;
99 }
100}
$location
Definition: buildRTE.php:22
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
Base class for object lp connectors.
static _lookupType(int $id, bool $reference=false)
__construct($a_obj_id)
const INACTIVE_PLUGIN
static isLPMember(array &$res, int $usr_id, array $obj_ids)
Find (lp-relevant) members for given object ids.
static isTypePluginWithLP(string $a_type, bool $a_active_status=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$res
Definition: ltiservices.php:69
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26