ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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.

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.
read()
Read properties from DB.
setSlotId($a_slotid)
Set Slot ID.
setComponentType($a_componenttype)
Set Component Type.

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

+ 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.

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.

References lookupSlotName().

Referenced by ilPlugin\_getDirectory().

+ 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.

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.

References getPluginClassFileName().

Referenced by getPluginsInformation().

+ 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.

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.

References getPluginPhpFileName().

Referenced by getPluginsInformation().

+ 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.

301 {
302 global $DIC;
303 $ilPluginAdmin = $DIC['ilPluginAdmin'];
304
305 return $ilPluginAdmin->getActivePluginsForSlot(
306 $this->getComponentType(),
307 $this->getComponentName(),
308 $this->getSlotId()
309 );
310 }
getSlotId()
Get Slot ID.
getComponentType()
Get Component Type.
getComponentName()
Get Component Name.
$DIC
Definition: xapitoken.php:46

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

+ 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.

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 }

References ilCachedComponentData\getInstance().

Referenced by ilObjLanguage\refreshPlugins().

+ 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.

82 {
83 return $this->componentname;
84 }

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

+ 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.

62 {
63 return $this->componenttype;
64 }

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

+ 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.

170 {
171 return $this->getPluginsDirectory() . "/" .
172 $a_plugin_name . "/classes/class.il" . $a_plugin_name . "Plugin.php";
173 }
getPluginsDirectory()
Get directory of.

References getPluginsDirectory().

Referenced by checkClassFileAvailability(), and getPluginsInformation().

+ 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.

149 {
150 return $this->getPluginsDirectory() . "/" .
151 $a_plugin_name . "/plugin.php";
152 }

References getPluginsDirectory().

Referenced by checkPluginPhpFileAvailability().

+ 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.

130 {
131 return "./Customizing/global/plugins/" . $this->getComponentType() .
132 "/" . $this->getComponentName() . "/" . $this->getSlotName();
133 }
getSlotName()
Get Slot Name.

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

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

+ 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.

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) != "." &&
228 ) {
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
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 }
checkClassFileAvailability($a_plugin_name)
Check whether Plugin class file is available for plugin or not.
checkPluginPhpFileAvailability($a_plugin_name)
Check whether plugin.php file is available for plugin or not.
static lookupStoredData(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
Lookup information data in il_plugin.
static createPluginRecord(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)

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

+ 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.

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.

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

+ 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.

102 {
103 return $this->slotid;
104 }

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

+ 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.

122 {
123 return $this->slotname;
124 }

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

+ 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.

279 {
280 $cached_component = ilCachedComponentData::getInstance();
281 $rec = $cached_component->lookupPluginSlotByName($a_slot_name);
282
283 return $rec['id'];
284 }

References ilCachedComponentData\getInstance().

+ 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.

290 {
291 $cached_component = ilCachedComponentData::getInstance();
292 $rec = $cached_component->lookupPluginSlotById($a_slot_id);
293
294 return $rec['name'];
295 }

References ilCachedComponentData\getInstance().

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

+ 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.

40 {
41 $cached_component = ilCachedComponentData::getInstance();
42 $rec = $cached_component->lookupPluginSlotById($this->getSlotId());
43 $this->setSlotName($rec["name"]);
44 }
setSlotName($a_slotname)
Set Slot Name.

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

Referenced by __construct().

+ 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.

72 {
73 $this->componentname = $a_componentname;
74 }

Referenced by __construct().

+ 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.

52 {
53 $this->componenttype = $a_componenttype;
54 }

Referenced by __construct().

+ 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.

92 {
93 $this->slotid = $a_slotid;
94 }

Referenced by __construct().

+ 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.

112 {
113 $this->slotname = $a_slotname;
114 }

Referenced by read().

+ Here is the caller graph for this function:

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