ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPluginSlot Class Reference

Plugin Slot. More...

+ Collaboration diagram for ilPluginSlot:

Public Member Functions

 __construct ($a_c_type, $a_c_name, $a_slot_id)
 Constructor. More...
 
 read ()
 Read properties from DB. More...
 
 setComponentType ($a_componenttype)
 Set Component Type. More...
 
 getComponentType ()
 Get Component Type. More...
 
 setComponentName ($a_componentname)
 Set Component Name. More...
 
 getComponentName ()
 Get Component Name. More...
 
 setSlotId ($a_slotid)
 Set Slot ID. More...
 
 getSlotId ()
 Get Slot ID. More...
 
 setSlotName ($a_slotname)
 Set Slot Name. More...
 
 getSlotName ()
 Get Slot Name. More...
 
 getPluginsDirectory ()
 Get directory of. More...
 
 getPluginPhpFileName ($a_plugin_name)
 Get File name for plugin.php. More...
 
 checkPluginPhpFileAvailability ($a_plugin_name)
 Check whether plugin.php file is available for plugin or not. More...
 
 getPluginClassFileName ($a_plugin_name)
 Get Class File name for plugin. More...
 
 checkClassFileAvailability ($a_plugin_name)
 Check whether Plugin class file is available for plugin or not. More...
 
 getPrefix ()
 Get slot prefix, used for lang vars and db tables. More...
 
 getPluginsInformation ()
 Get information an all plugins and their status. More...
 
 getPluginInformationFor (string $name)
 
 getActivePlugins ()
 Get active plugins of slot. More...
 

Static Public Member Functions

static _getPluginsDirectory ($a_ctype, $a_cname, $a_slot_id)
 Get plugins directory. More...
 
static lookupSlotId ($a_ctype, $a_cname, $a_slot_name)
 Lookup slot ID for component and slot name. More...
 
static lookupSlotName ($a_ctype, $a_cname, $a_slot_id)
 Lookup slot name for component and slot id. More...
 
static getAllSlots ()
 Get all plugin slots. More...
 
static getAvailableSlots ()
 Get all plugin slots where plugins are available. More...
 

Protected Member Functions

 readPluginInformation (string $pl_dir, string $file)
 

Protected Attributes

 $prefix = ""
 

Detailed Description

Plugin Slot.

A plugin slot defines an interface for a set of plugins that share the same characteristics

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 19 of file class.ilPluginSlot.php.

Constructor & Destructor Documentation

◆ __construct()

ilPluginSlot::__construct (   $a_c_type,
  $a_c_name,
  $a_slot_id 
)

Constructor.

Definition at line 26 of file class.ilPluginSlot.php.

References read(), setComponentName(), setComponentType(), and setSlotId().

27  {
28  $this->setComponentType($a_c_type);
29  $this->setComponentName($a_c_name);
30  $this->setSlotId($a_slot_id);
31 
32  if ($a_slot_id != "") {
33  $this->read();
34  }
35  }
setComponentName($a_componentname)
Set Component Name.
setSlotId($a_slotid)
Set Slot ID.
setComponentType($a_componenttype)
Set Component Type.
read()
Read properties from DB.
+ Here is the call graph for this function:

Member Function Documentation

◆ _getPluginsDirectory()

static ilPluginSlot::_getPluginsDirectory (   $a_ctype,
  $a_cname,
  $a_slot_id 
)
static

Get plugins directory.

Definition at line 139 of file class.ilPluginSlot.php.

References lookupSlotName().

Referenced by ilPlugin\_getDirectory().

140  {
141  return "./Customizing/global/plugins/" . $a_ctype .
142  "/" . $a_cname . "/" . ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
143  }
static lookupSlotName($a_ctype, $a_cname, $a_slot_id)
Lookup slot name for component and slot id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkClassFileAvailability()

ilPluginSlot::checkClassFileAvailability (   $a_plugin_name)

Check whether Plugin class file is available for plugin or not.

Definition at line 179 of file class.ilPluginSlot.php.

References getPluginClassFileName().

Referenced by readPluginInformation().

180  {
181  if (@is_file($this->getPluginClassFileName($a_plugin_name))) {
182  return true;
183  }
184 
185  return false;
186  }
getPluginClassFileName($a_plugin_name)
Get Class File name for plugin.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkPluginPhpFileAvailability()

ilPluginSlot::checkPluginPhpFileAvailability (   $a_plugin_name)

Check whether plugin.php file is available for plugin or not.

Definition at line 158 of file class.ilPluginSlot.php.

References getPluginPhpFileName().

Referenced by readPluginInformation().

159  {
160  if (@is_file($this->getPluginPhpFileName($a_plugin_name))) {
161  return true;
162  }
163 
164  return false;
165  }
getPluginPhpFileName($a_plugin_name)
Get File name for plugin.php.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActivePlugins()

ilPluginSlot::getActivePlugins ( )

Get active plugins of slot.

Definition at line 317 of file class.ilPluginSlot.php.

References $DIC, getComponentName(), getComponentType(), and getSlotId().

318  {
319  global $DIC;
320  $ilPluginAdmin = $DIC['ilPluginAdmin'];
321 
322  return $ilPluginAdmin->getActivePluginsForSlot(
323  $this->getComponentType(),
324  $this->getComponentName(),
325  $this->getSlotId()
326  );
327  }
global $DIC
Definition: goto.php:24
getSlotId()
Get Slot ID.
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
+ Here is the call graph for this function:

◆ getAllSlots()

static ilPluginSlot::getAllSlots ( )
static

Get all plugin slots.

Definition at line 333 of file class.ilPluginSlot.php.

References ilCachedComponentData\getInstance().

Referenced by ilObjLanguage\refreshPlugins().

334  {
335  $cached_component = ilCachedComponentData::getInstance();
336  $recs = $cached_component->getIlPluginslotById();
337 
338  foreach ($recs as $rec) {
339  $pos = strpos($rec["component"], "/");
340  $slots[] = array(
341  "component_type" => substr($rec["component"], 0, $pos),
342  "component_name" => substr($rec["component"], $pos + 1),
343  "slot_id" => $rec["id"],
344  "slot_name" => $rec["name"]
345  );
346  }
347 
348  return $slots;
349  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAvailableSlots()

static ilPluginSlot::getAvailableSlots ( )
static

Get all plugin slots where plugins are available.

Definition at line 355 of file class.ilPluginSlot.php.

References ilCachedComponentData\getInstance().

Referenced by ilPluginsOverviewTableFilterGUI\__construct().

355  : array
356  {
357  $cached_component = ilCachedComponentData::getInstance();
358  $recs = $cached_component->getIlPluginslotById();
359  $slots = array();
360  foreach ($recs as $rec) {
361  if($cached_component->lookupPluginsBySlotId($rec["id"])) {
362  $pos = strpos($rec["component"], "/");
363  $slots[] = array(
364  "component_type" => substr($rec["component"], 0, $pos),
365  "component_name" => substr($rec["component"], $pos + 1),
366  "slot_id" => $rec["id"],
367  "slot_name" => $rec["name"]
368  );
369  }
370  }
371  return $slots;
372  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponentName()

ilPluginSlot::getComponentName ( )

Get Component Name.

Returns
string Component Name

Definition at line 82 of file class.ilPluginSlot.php.

Referenced by getActivePlugins(), getPluginsDirectory(), getPrefix(), and readPluginInformation().

83  {
84  return $this->componentname;
85  }
+ Here is the caller graph for this function:

◆ getComponentType()

ilPluginSlot::getComponentType ( )

Get Component Type.

Returns
string Component Type

Definition at line 62 of file class.ilPluginSlot.php.

Referenced by getActivePlugins(), getPluginsDirectory(), getPrefix(), and readPluginInformation().

63  {
64  return $this->componenttype;
65  }
+ Here is the caller graph for this function:

◆ getPluginClassFileName()

ilPluginSlot::getPluginClassFileName (   $a_plugin_name)

Get Class File name for plugin.

Definition at line 170 of file class.ilPluginSlot.php.

References getPluginsDirectory().

Referenced by checkClassFileAvailability(), and readPluginInformation().

171  {
172  return $this->getPluginsDirectory() . "/" .
173  $a_plugin_name . "/classes/class.il" . $a_plugin_name . "Plugin.php";
174  }
getPluginsDirectory()
Get directory of.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPluginInformationFor()

ilPluginSlot::getPluginInformationFor ( string  $name)

Definition at line 234 of file class.ilPluginSlot.php.

References getPluginsDirectory(), and readPluginInformation().

234  : ?array
235  {
236  $pl_dir = $this->getPluginsDirectory();
237 
238  return $this->readPluginInformation($pl_dir, $name);
239  }
readPluginInformation(string $pl_dir, string $file)
if($format !==null) $name
Definition: metadata.php:230
getPluginsDirectory()
Get directory of.
+ Here is the call graph for this function:

◆ getPluginPhpFileName()

ilPluginSlot::getPluginPhpFileName (   $a_plugin_name)

Get File name for plugin.php.

Definition at line 149 of file class.ilPluginSlot.php.

References getPluginsDirectory().

Referenced by checkPluginPhpFileAvailability().

150  {
151  return $this->getPluginsDirectory() . "/" .
152  $a_plugin_name . "/plugin.php";
153  }
getPluginsDirectory()
Get directory of.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPluginsDirectory()

ilPluginSlot::getPluginsDirectory ( )

Get directory of.

Definition at line 130 of file class.ilPluginSlot.php.

References getComponentName(), getComponentType(), and getSlotName().

Referenced by ilPluginsOverviewTableGUI\gatherPluginData(), getPluginClassFileName(), getPluginInformationFor(), getPluginPhpFileName(), and getPluginsInformation().

131  {
132  return "./Customizing/global/plugins/" . $this->getComponentType() .
133  "/" . $this->getComponentName() . "/" . $this->getSlotName();
134  }
getSlotName()
Get Slot Name.
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPluginsInformation()

ilPluginSlot::getPluginsInformation ( )

Get information an all plugins and their status.

Definition at line 208 of file class.ilPluginSlot.php.

References XapiProxy\$plugin, getPluginsDirectory(), and readPluginInformation().

209  {
210  // read plugins directory
211  $pl_dir = $this->getPluginsDirectory();
212 
213  if (!@is_dir($pl_dir)) {
214  return array();
215  }
216 
217  $dir = opendir($pl_dir);
218 
219  $plugins = array();
220  while ($file = readdir($dir)) {
221  if ($file != "." and
222  $file != "..") {
223  // directories
224  $plugin = $this->readPluginInformation($pl_dir, $file);
225  if (!is_null($plugin)) {
226  $plugins[] = $plugin;
227  }
228  }
229  }
230 
231  return $plugins;
232  }
readPluginInformation(string $pl_dir, string $file)
getPluginsDirectory()
Get directory of.
+ Here is the call graph for this function:

◆ getPrefix()

ilPluginSlot::getPrefix ( )

Get slot prefix, used for lang vars and db tables.

Needs plugin id appended.

Definition at line 192 of file class.ilPluginSlot.php.

References $prefix, getComponentName(), getComponentType(), getSlotId(), and ilComponent\lookupId().

193  {
194  if ($this->prefix == "") {
195  $this->prefix =
197  $this->getComponentType(),
198  $this->getComponentName()
199  ) . "_" . $this->getSlotId();
200  }
201 
202  return $this->prefix;
203  }
static lookupId($a_type, $a_name)
Lookup ID of a component.
getSlotId()
Get Slot ID.
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
+ Here is the call graph for this function:

◆ getSlotId()

ilPluginSlot::getSlotId ( )

Get Slot ID.

Returns
string Slot ID

Definition at line 102 of file class.ilPluginSlot.php.

Referenced by ilPluginsOverviewTableGUI\gatherPluginData(), getActivePlugins(), getPrefix(), read(), and readPluginInformation().

103  {
104  return $this->slotid;
105  }
+ Here is the caller graph for this function:

◆ getSlotName()

ilPluginSlot::getSlotName ( )

Get Slot Name.

Returns
string Slot Name

Definition at line 122 of file class.ilPluginSlot.php.

Referenced by ilPluginsOverviewTableGUI\gatherPluginData(), and getPluginsDirectory().

123  {
124  return $this->slotname;
125  }
+ Here is the caller graph for this function:

◆ lookupSlotId()

static ilPluginSlot::lookupSlotId (   $a_ctype,
  $a_cname,
  $a_slot_name 
)
static

Lookup slot ID for component and slot name.

Definition at line 295 of file class.ilPluginSlot.php.

References ilCachedComponentData\getInstance().

296  {
297  $cached_component = ilCachedComponentData::getInstance();
298  $rec = $cached_component->lookupPluginSlotByName($a_slot_name);
299 
300  return $rec['id'];
301  }
+ Here is the call graph for this function:

◆ lookupSlotName()

static ilPluginSlot::lookupSlotName (   $a_ctype,
  $a_cname,
  $a_slot_id 
)
static

Lookup slot name for component and slot id.

Definition at line 306 of file class.ilPluginSlot.php.

References ilCachedComponentData\getInstance().

Referenced by ilPluginDBUpdate\__construct(), _getPluginsDirectory(), ilPluginAdmin\getPluginData(), ilPlugin\getPluginObject(), and ilObjComponentSettingsGUI\showPlugin().

307  {
308  $cached_component = ilCachedComponentData::getInstance();
309  $rec = $cached_component->lookupPluginSlotById($a_slot_id);
310 
311  return $rec['name'];
312  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilPluginSlot::read ( )

Read properties from DB.

Definition at line 40 of file class.ilPluginSlot.php.

References ilCachedComponentData\getInstance(), getSlotId(), and setSlotName().

Referenced by __construct().

41  {
42  $cached_component = ilCachedComponentData::getInstance();
43  $rec = $cached_component->lookupPluginSlotById($this->getSlotId());
44  $this->setSlotName($rec["name"]);
45  }
getSlotId()
Get Slot ID.
setSlotName($a_slotname)
Set Slot Name.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readPluginInformation()

ilPluginSlot::readPluginInformation ( string  $pl_dir,
string  $file 
)
protected

Definition at line 241 of file class.ilPluginSlot.php.

References $DIC, XapiProxy\$plugin, checkClassFileAvailability(), checkPluginPhpFileAvailability(), ilPlugin\createPluginRecord(), getComponentName(), getComponentType(), getPluginClassFileName(), getSlotId(), and ilPlugin\lookupStoredData().

Referenced by getPluginInformationFor(), and getPluginsInformation().

241  : ?array
242  {
243  global $DIC;
244  $ilPluginAdmin = $DIC['ilPluginAdmin'];
245 
246  if (@is_dir($pl_dir . "/" . $file) && substr($file, 0, 1) != "." &&
247  $this->checkPluginPhpFileAvailability($file)
248  ) {
250  $this->getComponentType(),
251  $this->getComponentName(),
252  $this->getSlotId(),
253  $file
254  );
255 
256  // create record in il_plugin table (if not existing)
257  if (count($plugin) == 0) {
259  $this->getComponentType(),
260  $this->getComponentName(),
261  $this->getSlotId(),
262  $file
263  );
264 
266  $this->getComponentType(),
267  $this->getComponentName(),
268  $this->getSlotId(),
269  $file
270  );
271  }
272 
273  $pdata = $ilPluginAdmin->getAllData(
274  $this->getComponentType(),
275  $this->getComponentName(),
276  $this->getSlotId(),
277  $file
278  );
279 
280  $plugin = array_merge($plugin, $pdata);
281 
282  $plugin["name"] = $file;
283  $plugin["plugin_php_file_status"] = $this->checkPluginPhpFileAvailability($file);
284  $plugin["class_file_status"] = $this->checkClassFileAvailability($file);
285  $plugin["class_file"] = $this->getPluginClassFileName($file);
286 
287  return $plugin;
288  }
289  return null;
290  }
checkPluginPhpFileAvailability($a_plugin_name)
Check whether plugin.php file is available for plugin or not.
static createPluginRecord(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
static lookupStoredData(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
Lookup information data in il_plugin.
global $DIC
Definition: goto.php:24
getSlotId()
Get Slot ID.
checkClassFileAvailability($a_plugin_name)
Check whether Plugin class file is available for plugin or not.
getComponentName()
Get Component Name.
getComponentType()
Get Component Type.
getPluginClassFileName($a_plugin_name)
Get Class File name for plugin.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setComponentName()

ilPluginSlot::setComponentName (   $a_componentname)

Set Component Name.

Parameters
string$a_componentnameComponent Name

Definition at line 72 of file class.ilPluginSlot.php.

Referenced by __construct().

73  {
74  $this->componentname = $a_componentname;
75  }
+ Here is the caller graph for this function:

◆ setComponentType()

ilPluginSlot::setComponentType (   $a_componenttype)

Set Component Type.

Parameters
string$a_componenttypeComponent Type

Definition at line 52 of file class.ilPluginSlot.php.

Referenced by __construct().

53  {
54  $this->componenttype = $a_componenttype;
55  }
+ Here is the caller graph for this function:

◆ setSlotId()

ilPluginSlot::setSlotId (   $a_slotid)

Set Slot ID.

Parameters
string$a_slotidSlot ID

Definition at line 92 of file class.ilPluginSlot.php.

Referenced by __construct().

93  {
94  $this->slotid = $a_slotid;
95  }
+ Here is the caller graph for this function:

◆ setSlotName()

ilPluginSlot::setSlotName (   $a_slotname)

Set Slot Name.

Parameters
string$a_slotnameSlot Name

Definition at line 112 of file class.ilPluginSlot.php.

Referenced by read().

113  {
114  $this->slotname = $a_slotname;
115  }
+ Here is the caller graph for this function:

Field Documentation

◆ $prefix

ilPluginSlot::$prefix = ""
protected

Definition at line 21 of file class.ilPluginSlot.php.

Referenced by getPrefix().


The documentation for this class was generated from the following file: