ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 294 of file class.ilPluginSlot.php.

295 {
296 global $ilPluginAdmin;
297
298 return $ilPluginAdmin->getActivePluginsForSlot(
299 $this->getComponentType(),
300 $this->getComponentName(),
301 $this->getSlotId()
302 );
303 }
getSlotId()
Get Slot ID.
getComponentType()
Get Component Type.
getComponentName()
Get Component Name.

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

+ Here is the call graph for this function:

◆ getAllSlots()

static ilPluginSlot::getAllSlots ( )
static

Get all plugin slots.

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

310 {
311 $cached_component = ilCachedComponentData::getInstance();
312 $recs = $cached_component->getIlPluginslotById();
313
314 foreach ($recs as $rec) {
315 $pos = strpos($rec["component"], "/");
316 $slots[] = array(
317 "component_type" => substr($rec["component"], 0, $pos),
318 "component_name" => substr($rec["component"], $pos + 1),
319 "slot_id" => $rec["id"],
320 "slot_name" => $rec["name"]
321 );
322 }
323
324 return $slots;
325 }

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 $ilPluginAdmin;
210
211 // read plugins directory
212 $pl_dir = $this->getPluginsDirectory();
213
214 if (!@is_dir($pl_dir)) {
215 return array();
216 }
217
218 $dir = opendir($pl_dir);
219
220 $plugins = array();
221 while ($file = readdir($dir)) {
222 if ($file != "." and
223 $file != "..") {
224 // directories
225 if (@is_dir($pl_dir . "/" . $file) && substr($file, 0, 1) != "." &&
227 ) {
228 $plugin = array();
229
231 $this->getComponentType(),
232 $this->getComponentName(),
233 $this->getSlotId(),
234 $file
235 );
236
237 // create record in il_plugin table (if not existing)
238 if (count($plugin) == 0) {
240 $this->getComponentType(),
241 $this->getComponentName(),
242 $this->getSlotId(),
243 $file
244 );
245 }
246
247 $pdata = $ilPluginAdmin->getAllData(
248 $this->getComponentType(),
249 $this->getComponentName(),
250 $this->getSlotId(),
251 $file
252 );
253
254 $plugin = array_merge($plugin, $pdata);
255
256 $plugin["name"] = $file;
257 $plugin["plugin_php_file_status"] = $this->checkPluginPhpFileAvailability($file);
258 $plugin["class_file_status"] = $this->checkClassFileAvailability($file);
259 $plugin["class_file"] = $this->getPluginClassFileName($file);
260
261 $plugins[] = $plugin;
262 }
263 }
264 }
265
266 return $plugins;
267 }
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 createPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
static lookupStoredData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Lookup information data in il_plugin.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $file, 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 272 of file class.ilPluginSlot.php.

273 {
274 $cached_component = ilCachedComponentData::getInstance();
275 $rec = $cached_component->lookupPluginSlotByName($a_slot_name);
276
277 return $rec['id'];
278 }

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

284 {
285 $cached_component = ilCachedComponentData::getInstance();
286 $rec = $cached_component->lookupPluginSlotById($a_slot_id);
287
288 return $rec['name'];
289 }

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: