ILIAS  release_4-4 Revision
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...
 
 _getPluginsDirectory ($a_ctype, $a_cname, $a_slot_id)
 Get plugins directory. 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 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  {
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()

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

Get plugins directory.

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

References lookupSlotName().

Referenced by ilPlugin\_getDirectory().

145  {
146  return "./Customizing/global/plugins/".$a_ctype.
147  "/".$a_cname."/".ilPluginSlot::lookupSlotName($a_ctype, $a_cname, $a_slot_id);
148  }
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 185 of file class.ilPluginSlot.php.

References getPluginClassFileName().

Referenced by getPluginsInformation().

186  {
187  if (@is_file($this->getPluginClassFileName($a_plugin_name)))
188  {
189  return true;
190  }
191 
192  return false;
193  }
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 163 of file class.ilPluginSlot.php.

References getPluginPhpFileName().

Referenced by getPluginsInformation().

164  {
165  if (@is_file($this->getPluginPhpFileName($a_plugin_name)))
166  {
167  return true;
168  }
169 
170  return false;
171  }
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 309 of file class.ilPluginSlot.php.

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

310  {
311  global $ilPluginAdmin;
312 
313  return $ilPluginAdmin->getActivePluginsForSlot($this->getComponentType(),
314  $this->getComponentName(), $this->getSlotId());
315  }
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 321 of file class.ilPluginSlot.php.

Referenced by ilObjLanguage\refreshAll().

322  {
323  global $ilDB;
324 
325  $set = $ilDB->query("SELECT * FROM il_pluginslot ");
326  $slots = array();
327  while ($rec = $ilDB->fetchAssoc($set))
328  {
329  $pos = strpos($rec["component"], "/");
330  $slots[] = array(
331  "component_type" => substr($rec["component"], 0, $pos),
332  "component_name" => substr($rec["component"], $pos + 1),
333  "slot_id" => $rec["id"],
334  "slot_name" => $rec["name"]
335  );
336  }
337 
338  return $slots;
339  }
+ Here is the caller graph for this function:

◆ getComponentName()

ilPluginSlot::getComponentName ( )

Get Component Name.

Returns
string Component Name

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

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

88  {
89  return $this->componentname;
90  }
+ Here is the caller graph for this function:

◆ getComponentType()

ilPluginSlot::getComponentType ( )

Get Component Type.

Returns
string Component Type

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

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

68  {
69  return $this->componenttype;
70  }
+ Here is the caller graph for this function:

◆ getPluginClassFileName()

ilPluginSlot::getPluginClassFileName (   $a_plugin_name)

Get Class File name for plugin.

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

References getPluginsDirectory().

Referenced by checkClassFileAvailability().

177  {
178  return $this->getPluginsDirectory()."/".
179  $a_plugin_name."/classes/class.il".$a_plugin_name."Plugin.php";
180  }
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 154 of file class.ilPluginSlot.php.

References getPluginsDirectory().

Referenced by checkPluginPhpFileAvailability().

155  {
156  return $this->getPluginsDirectory()."/".
157  $a_plugin_name."/plugin.php";
158  }
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 135 of file class.ilPluginSlot.php.

References getSlotName().

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

136  {
137  return "./Customizing/global/plugins/".$this->getComponentType().
138  "/".$this->getComponentName()."/".$this->getSlotName();
139  }
getSlotName()
Get Slot Name.
+ 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 214 of file class.ilPluginSlot.php.

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

215  {
216  global $ilPluginAdmin;
217 
218  // read plugins directory
219  $pl_dir = $this->getPluginsDirectory();
220 
221  if (!@is_dir($pl_dir))
222  {
223  return array();
224  }
225 
226  $dir = opendir($pl_dir);
227 
228  $plugins = array();
229  while($file = readdir($dir))
230  {
231  if ($file != "." and
232  $file != "..")
233  {
234  // directories
235  if (@is_dir($pl_dir."/".$file) && substr($file, 0, 1) != "." &&
236  is_file($pl_dir."/".$file."/plugin.php"))
237  {
238 
239 
240  $plugin = array();
241 
242  $plugin = ilPlugin::lookupStoredData($this->getComponentType(),
243  $this->getComponentName(), $this->getSlotId(), $file);
244 
245  // create record in il_plugin table (if not existing)
247  $this->getComponentName(), $this->getSlotId(), $file);
248 
249  $pdata = $ilPluginAdmin->getAllData($this->getComponentType(),
250  $this->getComponentName(), $this->getSlotId(), $file);
251 
252  $plugin["version"] = $pdata["version"];
253  $plugin["id"] = $pdata["id"];
254  $plugin["is_active"] = $pdata["is_active"];
255  $plugin["inactive_reason"] = $pdata["inactive_reason"];
256  $plugin["needs_update"] = $pdata["needs_update"];
257  $plugin["ilias_min_version"] = $pdata["ilias_min_version"];
258  $plugin["ilias_max_version"] = $pdata["ilias_max_version"];
259  $plugin["activation_possible"] = $pdata["activation_possible"];
260  $plugin["responsible"] = $pdata["responsible"];
261  $plugin["responsible_mail"] = $pdata["responsible_mail"];
262 
263  $plugin["name"] = $file;
264  $plugin["plugin_php_file_status"] = $this->checkPluginPhpFileAvailability($file);
265  $plugin["class_file_status"] = $this->checkClassFileAvailability($file);
266  $plugin["class_file"] = "class.il".$plugin["name"]."Plugin.php";
267 
268  $plugins[] = $plugin;
269  }
270  }
271  }
272 
273  return $plugins;
274  }
print $file
static lookupStoredData($a_ctype, $a_cname, $a_slot_id, $a_pname)
Lookup information data in il_plugin.
checkPluginPhpFileAvailability($a_plugin_name)
Check whether plugin.php file is available for plugin or not.
getSlotId()
Get Slot ID.
checkClassFileAvailability($a_plugin_name)
Check whether Plugin class file is available for plugin or not.
getComponentName()
Get Component Name.
static createPluginRecord($a_ctype, $a_cname, $a_slot_id, $a_pname)
Create plugin record, if not existing.
getComponentType()
Get Component Type.
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 199 of file class.ilPluginSlot.php.

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

200  {
201  if ($this->prefix == "")
202  {
203  $this->prefix =
205  $this->getComponentName())."_".$this->getSlotId();
206  }
207 
208  return $this->prefix;
209  }
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 107 of file class.ilPluginSlot.php.

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

108  {
109  return $this->slotid;
110  }
+ Here is the caller graph for this function:

◆ getSlotName()

ilPluginSlot::getSlotName ( )

Get Slot Name.

Returns
string Slot Name

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

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

128  {
129  return $this->slotname;
130  }
+ 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 279 of file class.ilPluginSlot.php.

280  {
281  global $ilDB;
282 
283  $q = "SELECT * FROM il_pluginslot WHERE component = ".
284  $ilDB->quote($a_ctype."/".$a_cname, "text").
285  " AND name = ".$ilDB->quote($a_slot_name, "text");
286  $set = $ilDB->query($q);
287  $rec = $ilDB->fetchAssoc($set);
288  return $rec["id"];
289  }

◆ lookupSlotName()

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

Lookup slot name for component and slot id.

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

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

295  {
296  global $ilDB;
297 
298  $q = "SELECT * FROM il_pluginslot WHERE component = ".
299  $ilDB->quote($a_ctype."/".$a_cname, "text").
300  " AND id = ".$ilDB->quote($a_slot_id, "text");
301  $set = $ilDB->query($q);
302  $rec = $ilDB->fetchAssoc($set);
303  return $rec["name"];
304  }
+ 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 getComponentName(), getComponentType(), getSlotId(), and setSlotName().

Referenced by __construct().

41  {
42  global $ilDB;
43 
44  $q = "SELECT * FROM il_pluginslot WHERE component = ".
45  $ilDB->quote($this->getComponentType()."/".$this->getComponentName(), "text").
46  " AND id = ".$ilDB->quote($this->getSlotId(), "text");
47  $set = $ilDB->query($q);
48  $rec = $ilDB->fetchAssoc($set);
49  $this->setSlotName($rec["name"]);
50  }
getSlotId()
Get Slot ID.
setSlotName($a_slotname)
Set 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:

◆ setComponentName()

ilPluginSlot::setComponentName (   $a_componentname)

Set Component Name.

Parameters
string$a_componentnameComponent Name

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

Referenced by __construct().

78  {
79  $this->componentname = $a_componentname;
80  }
+ Here is the caller graph for this function:

◆ setComponentType()

ilPluginSlot::setComponentType (   $a_componenttype)

Set Component Type.

Parameters
string$a_componenttypeComponent Type

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

Referenced by __construct().

58  {
59  $this->componenttype = $a_componenttype;
60  }
+ Here is the caller graph for this function:

◆ setSlotId()

ilPluginSlot::setSlotId (   $a_slotid)

Set Slot ID.

Parameters
string$a_slotidSlot ID

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

Referenced by __construct().

98  {
99  $this->slotid = $a_slotid;
100  }
+ Here is the caller graph for this function:

◆ setSlotName()

ilPluginSlot::setSlotName (   $a_slotname)

Set Slot Name.

Parameters
string$a_slotnameSlot Name

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

Referenced by read().

118  {
119  $this->slotname = $a_slotname;
120  }
+ Here is the caller graph for this function:

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