ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
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 147 of file class.ilPluginSlot.php.

References lookupSlotName().

Referenced by ilPlugin\_getDirectory().

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

References getPluginClassFileName().

Referenced by getPluginsInformation().

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

References getPluginPhpFileName().

Referenced by getPluginsInformation().

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

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

323  {
324  global $ilPluginAdmin;
325 
326  return $ilPluginAdmin->getActivePluginsForSlot($this->getComponentType(),
327  $this->getComponentName(), $this->getSlotId());
328  }
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 334 of file class.ilPluginSlot.php.

References array, and ilCachedComponentData\getInstance().

Referenced by ilObjLanguage\refreshPlugins().

335  {
336  $cached_component = ilCachedComponentData::getInstance();
337  $recs = $cached_component->getIlPluginslotById();
338 
339  //global $ilDB;
340 
341  //$set = $ilDB->query("SELECT * FROM il_pluginslot ");
342  //$slots = array();
343  //while ($rec = $ilDB->fetchAssoc($set))
344  foreach($recs as $rec)
345  {
346  $pos = strpos($rec["component"], "/");
347  $slots[] = array(
348  "component_type" => substr($rec["component"], 0, $pos),
349  "component_name" => substr($rec["component"], $pos + 1),
350  "slot_id" => $rec["id"],
351  "slot_name" => $rec["name"]
352  );
353  }
354 
355  return $slots;
356  }
Create styles array
The data for the language used.
+ 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 90 of file class.ilPluginSlot.php.

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

91  {
92  return $this->componentname;
93  }
+ Here is the caller graph for this function:

◆ getComponentType()

ilPluginSlot::getComponentType ( )

Get Component Type.

Returns
string Component Type

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

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

71  {
72  return $this->componenttype;
73  }
+ Here is the caller graph for this function:

◆ getPluginClassFileName()

ilPluginSlot::getPluginClassFileName (   $a_plugin_name)

Get Class File name for plugin.

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

References getPluginsDirectory().

Referenced by checkClassFileAvailability().

180  {
181  return $this->getPluginsDirectory()."/".
182  $a_plugin_name."/classes/class.il".$a_plugin_name."Plugin.php";
183  }
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 157 of file class.ilPluginSlot.php.

References getPluginsDirectory().

Referenced by checkPluginPhpFileAvailability().

158  {
159  return $this->getPluginsDirectory()."/".
160  $a_plugin_name."/plugin.php";
161  }
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 138 of file class.ilPluginSlot.php.

References getSlotName().

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

139  {
140  return "./Customizing/global/plugins/".$this->getComponentType().
141  "/".$this->getComponentName()."/".$this->getSlotName();
142  }
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 217 of file class.ilPluginSlot.php.

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

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

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

203  {
204  if ($this->prefix == "")
205  {
206  $this->prefix =
208  $this->getComponentName())."_".$this->getSlotId();
209  }
210 
211  return $this->prefix;
212  }
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 110 of file class.ilPluginSlot.php.

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

111  {
112  return $this->slotid;
113  }
+ Here is the caller graph for this function:

◆ getSlotName()

ilPluginSlot::getSlotName ( )

Get Slot Name.

Returns
string Slot Name

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

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

131  {
132  return $this->slotname;
133  }
+ 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 282 of file class.ilPluginSlot.php.

References ilCachedComponentData\getInstance().

283  {
284  $cached_component = ilCachedComponentData::getInstance();
285  $rec = $cached_component->lookupPluginSlotByName($a_slot_name);
286 
287  return $rec['id'];
288 
289  //global $ilDB;
290 
291  //$q = "SELECT * FROM il_pluginslot WHERE component = ".
292  // $ilDB->quote($a_ctype."/".$a_cname, "text").
293  // " AND name = ".$ilDB->quote($a_slot_name, "text");
294  //$set = $ilDB->query($q);
295  //$rec = $ilDB->fetchAssoc($set);
296  //return $rec["id"];
297  }
+ 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 302 of file class.ilPluginSlot.php.

References ilCachedComponentData\getInstance().

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

303  {
304  $cached_component = ilCachedComponentData::getInstance();
305  $rec = $cached_component->lookupPluginSlotById($a_slot_id);
306 
307  return $rec['name'];
308 
309  //global $ilDB;
310 
311  // $q = "SELECT * FROM il_pluginslot WHERE component = ".
312  // $ilDB->quote($a_ctype."/".$a_cname, "text").
313  // " AND id = ".$ilDB->quote($a_slot_id, "text");
314  //$set = $ilDB->query($q);
315  //$rec = $ilDB->fetchAssoc($set);
316  //return $rec["name"];
317  }
+ 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 
44  $rec = $cached_component->lookupPluginSlotById($this->getSlotId());
45  //global $ilDB;
46 
47  //$q = "SELECT * FROM il_pluginslot WHERE component = ".
48  // $ilDB->quote($this->getComponentType()."/".$this->getComponentName(), "text").
49  // " AND id = ".$ilDB->quote($this->getSlotId(), "text");
50  //$set = $ilDB->query($q);
51  //$rec = $ilDB->fetchAssoc($set);
52  $this->setSlotName($rec["name"]);
53  }
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 80 of file class.ilPluginSlot.php.

Referenced by __construct().

81  {
82  $this->componentname = $a_componentname;
83  }
+ Here is the caller graph for this function:

◆ setComponentType()

ilPluginSlot::setComponentType (   $a_componenttype)

Set Component Type.

Parameters
string$a_componenttypeComponent Type

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

Referenced by __construct().

61  {
62  $this->componenttype = $a_componenttype;
63  }
+ Here is the caller graph for this function:

◆ setSlotId()

ilPluginSlot::setSlotId (   $a_slotid)

Set Slot ID.

Parameters
string$a_slotidSlot ID

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

Referenced by __construct().

101  {
102  $this->slotid = $a_slotid;
103  }
+ Here is the caller graph for this function:

◆ setSlotName()

ilPluginSlot::setSlotName (   $a_slotname)

Set Slot Name.

Parameters
string$a_slotnameSlot Name

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

Referenced by read().

121  {
122  $this->slotname = $a_slotname;
123  }
+ Here is the caller graph for this function:

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