ILIAS  release_8 Revision v8.24
class.ilPluginLP.php
Go to the documentation of this file.
1<?php
19include_once "Services/Object/classes/class.ilObjectLP.php";
20
29{
30 protected $status; // [mixed]
31
32 public const INACTIVE_PLUGIN = -1;
33
34 protected function __construct($a_obj_id)
35 {
36 parent::__construct($a_obj_id);
37
38 $this->initPlugin();
39 }
40
41 protected function initPlugin(): void
42 {
43 // active plugin?
45 $obj = ilObjectFactory::getInstanceByObjId($this->obj_id, false); // #12640
46 if ($obj instanceof ilLPStatusPluginInterface) {
47 $this->status = $obj;
48 }
49 }
50 // inactive plugin?
52 $this->status = self::INACTIVE_PLUGIN;
53 }
54 }
55
56 public function getPluginInstance()
57 {
58 return $this->status;
59 }
60
61 public function getDefaultMode(): int
62 {
64 }
65
66 public function getValidModes(): array
67 {
68 return array(
71 );
72 }
73
74 public function getCurrentMode(): int
75 {
76 if ($this->status !== null) {
78 }
80 }
81
82 protected static function isLPMember(array &$res, int $usr_id, array $obj_ids): bool
83 {
84 global $DIC;
85 $objDefinition = $DIC['objDefinition'];
86
87 $type = $obj_ids;
88 $type = array_shift($type);
90
91 $location = $objDefinition->getLocation($type);
92 $class_name = "ilObj" . $objDefinition->getClassName($type);
93 include_once $location . "/class." . $class_name . ".php";
94
95 // forward to plugin object
96 if (method_exists($class_name, "isLPMember")) {
97 return $class_name::isLPMember($res, $usr_id, $obj_ids);
98 }
99
100 return false;
101 }
102}
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
global $DIC
Definition: feed.php:28
Interface for plugin classes that want to support Learning Progress.
$res
Definition: ltiservices.php:69
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$type