ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 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...
 

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 25 of file class.ilPluginSlot.php.

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

26  {
27  $this->setComponentType($a_c_type);
28  $this->setComponentName($a_c_name);
29  $this->setSlotId($a_slot_id);
30 
31  if ($a_slot_id != "") {
32  $this->read();
33  }
34  }
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 138 of file class.ilPluginSlot.php.

References lookupSlotName().

Referenced by ilPlugin\_getDirectory().

139  {
140  return "./Customizing/global/plugins/" . $a_ctype .
141  "/" . $a_cname . "/" . ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
142  }
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 178 of file class.ilPluginSlot.php.

References getPluginClassFileName().

Referenced by getPluginsInformation().

179  {
180  if (@is_file($this->getPluginClassFileName($a_plugin_name))) {
181  return true;
182  }
183 
184  return false;
185  }
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 157 of file class.ilPluginSlot.php.

References getPluginPhpFileName().

Referenced by getPluginsInformation().

158  {
159  if (@is_file($this->getPluginPhpFileName($a_plugin_name))) {
160  return true;
161  }
162 
163  return false;
164  }
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 300 of file class.ilPluginSlot.php.

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

301  {
302  global $DIC;
303  $ilPluginAdmin = $DIC['ilPluginAdmin'];
304 
305  return $ilPluginAdmin->getActivePluginsForSlot(
306  $this->getComponentType(),
307  $this->getComponentName(),
308  $this->getSlotId()
309  );
310  }
global $DIC
Definition: saml.php:7
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 316 of file class.ilPluginSlot.php.

References ilCachedComponentData\getInstance().

Referenced by ilObjLanguage\refreshPlugins().

317  {
318  $cached_component = ilCachedComponentData::getInstance();
319  $recs = $cached_component->getIlPluginslotById();
320 
321  foreach ($recs as $rec) {
322  $pos = strpos($rec["component"], "/");
323  $slots[] = array(
324  "component_type" => substr($rec["component"], 0, $pos),
325  "component_name" => substr($rec["component"], $pos + 1),
326  "slot_id" => $rec["id"],
327  "slot_name" => $rec["name"]
328  );
329  }
330 
331  return $slots;
332  }
+ 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 81 of file class.ilPluginSlot.php.

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

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

◆ getComponentType()

ilPluginSlot::getComponentType ( )

Get Component Type.

Returns
string Component Type

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

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

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

◆ getPluginClassFileName()

ilPluginSlot::getPluginClassFileName (   $a_plugin_name)

Get Class File name for plugin.

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

References getPluginsDirectory().

Referenced by checkClassFileAvailability(), and getPluginsInformation().

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

◆ getPluginPhpFileName()

ilPluginSlot::getPluginPhpFileName (   $a_plugin_name)

Get File name for plugin.php.

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

References getPluginsDirectory().

Referenced by checkPluginPhpFileAvailability().

149  {
150  return $this->getPluginsDirectory() . "/" .
151  $a_plugin_name . "/plugin.php";
152  }
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 129 of file class.ilPluginSlot.php.

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

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

130  {
131  return "./Customizing/global/plugins/" . $this->getComponentType() .
132  "/" . $this->getComponentName() . "/" . $this->getSlotName();
133  }
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 207 of file class.ilPluginSlot.php.

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

208  {
209  global $DIC;
210  $ilPluginAdmin = $DIC['ilPluginAdmin'];
211 
212  // read plugins directory
213  $pl_dir = $this->getPluginsDirectory();
214 
215  if (!@is_dir($pl_dir)) {
216  return array();
217  }
218 
219  $dir = opendir($pl_dir);
220 
221  $plugins = array();
222  while ($file = readdir($dir)) {
223  if ($file != "." and
224  $file != "..") {
225  // directories
226  if (@is_dir($pl_dir . "/" . $file) && substr($file, 0, 1) != "." &&
227  $this->checkPluginPhpFileAvailability($file)
228  ) {
229  $plugin = ilPlugin::lookupStoredData(
230  $this->getComponentType(),
231  $this->getComponentName(),
232  $this->getSlotId(),
233  $file
234  );
235 
236  // create record in il_plugin table (if not existing)
237  if (count($plugin) == 0) {
239  $this->getComponentType(),
240  $this->getComponentName(),
241  $this->getSlotId(),
242  $file
243  );
244 
245  $plugin = ilPlugin::lookupStoredData(
246  $this->getComponentType(),
247  $this->getComponentName(),
248  $this->getSlotId(),
249  $file
250  );
251  }
252 
253  $pdata = $ilPluginAdmin->getAllData(
254  $this->getComponentType(),
255  $this->getComponentName(),
256  $this->getSlotId(),
257  $file
258  );
259 
260  $plugin = array_merge($plugin, $pdata);
261 
262  $plugin["name"] = $file;
263  $plugin["plugin_php_file_status"] = $this->checkPluginPhpFileAvailability($file);
264  $plugin["class_file_status"] = $this->checkClassFileAvailability($file);
265  $plugin["class_file"] = $this->getPluginClassFileName($file);
266 
267  $plugins[] = $plugin;
268  }
269  }
270  }
271 
272  return $plugins;
273  }
global $DIC
Definition: saml.php:7
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.
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.
getPluginsDirectory()
Get directory of.
getPluginClassFileName($a_plugin_name)
Get Class File name for plugin.
+ 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 191 of file class.ilPluginSlot.php.

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

192  {
193  if ($this->prefix == "") {
194  $this->prefix =
196  $this->getComponentType(),
197  $this->getComponentName()
198  ) . "_" . $this->getSlotId();
199  }
200 
201  return $this->prefix;
202  }
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 101 of file class.ilPluginSlot.php.

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

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

◆ getSlotName()

ilPluginSlot::getSlotName ( )

Get Slot Name.

Returns
string Slot Name

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

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

122  {
123  return $this->slotname;
124  }
+ 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 278 of file class.ilPluginSlot.php.

References ilCachedComponentData\getInstance().

279  {
280  $cached_component = ilCachedComponentData::getInstance();
281  $rec = $cached_component->lookupPluginSlotByName($a_slot_name);
282 
283  return $rec['id'];
284  }
+ 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 289 of file class.ilPluginSlot.php.

References ilCachedComponentData\getInstance().

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

290  {
291  $cached_component = ilCachedComponentData::getInstance();
292  $rec = $cached_component->lookupPluginSlotById($a_slot_id);
293 
294  return $rec['name'];
295  }
+ 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 39 of file class.ilPluginSlot.php.

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

Referenced by __construct().

40  {
41  $cached_component = ilCachedComponentData::getInstance();
42  $rec = $cached_component->lookupPluginSlotById($this->getSlotId());
43  $this->setSlotName($rec["name"]);
44  }
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:

◆ setComponentName()

ilPluginSlot::setComponentName (   $a_componentname)

Set Component Name.

Parameters
string$a_componentnameComponent Name

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

Referenced by __construct().

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

◆ setComponentType()

ilPluginSlot::setComponentType (   $a_componenttype)

Set Component Type.

Parameters
string$a_componenttypeComponent Type

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

Referenced by __construct().

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

◆ setSlotId()

ilPluginSlot::setSlotId (   $a_slotid)

Set Slot ID.

Parameters
string$a_slotidSlot ID

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

Referenced by __construct().

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

◆ setSlotName()

ilPluginSlot::setSlotName (   $a_slotname)

Set Slot Name.

Parameters
string$a_slotnameSlot Name

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

Referenced by read().

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

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