ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilComponent Class Reference
+ Inheritance diagram for ilComponent:
+ Collaboration diagram for ilComponent:

Public Member Functions

 getVersion ()
 Get Version Number of Component. More...
 
 isCore ()
 
 getName ()
 Get Name. More...
 
 __construct ()
 
 setId ($a_id)
 Set Id. More...
 
 getId ()
 Get Id. More...
 
 setPluginSlots ($a_pluginslots)
 Set Plugin Slots. More...
 
 getPluginSlots ()
 Get Plugin Slots. More...
 
 setSubDirectory ($a_subdirectory)
 Set Sub Directory. More...
 
 getSubDirectory ()
 Get Sub Directory. More...
 
 getPluginSlotName ($a_id)
 Get name of plugin slot. More...
 
 getPluginSlotDirectory ($a_id)
 Get directory of plugin slot. More...
 
 getPluginSlotLanguagePrefix ($a_id)
 Get language prefix for plugin slot. More...
 

Static Public Member Functions

static getComponentType ()
 
static getComponentObject ($a_ctype, $a_cname)
 Get component object. More...
 
static lookupPluginSlots ($a_type, $a_name)
 Lookup all plugin slots of a component. More...
 
static lookupId ($a_type, $a_name)
 Lookup ID of a component. More...
 
static getComponentInfo ($a_type, $a_name)
 
static checkVersionNumber ($a_ver)
 Check version number. More...
 
static isVersionGreaterString ($a_ver1, $a_ver2)
 
static isVersionGreater (string $version1, string $version2)
 
static lookupComponentName ($a_component_id)
 lookup component name type $ilDB More...
 
static getAll ()
 Get all. More...
 

Protected Attributes

 $global_cache
 

Detailed Description

Definition at line 23 of file class.ilComponent.php.

Constructor & Destructor Documentation

◆ __construct()

ilComponent::__construct ( )

Definition at line 59 of file class.ilComponent.php.

References getComponentType(), ilCachedComponentData\getInstance(), getName(), lookupPluginSlots(), setId(), and setPluginSlots().

60  {
61  // global $ilDB;
62  $this->global_cache = ilCachedComponentData::getInstance();
63 
64  $this->setId($this->global_cache->lookCompId($this->getComponentType(), $this->getName()));
66  $this->getComponentType(),
67  $this->getName()
68  ));
69 
70 //
71 // echo '<pre>' . print_r($data, 1) . '</pre>';
72 //
73 //
74 // $set = $ilDB->queryF("SELECT * FROM il_component WHERE type = %s ".
75 // " AND name = %s", array("text", "text"),
76 // array($this->getComponentType(), $this->getName()));
77 // $rec = $ilDB->fetchAssoc($set);
78 //
79 // $this->setId($rec["id"]);
80 // $this->setPluginSlots(ilComponent::lookupPluginSlots(
81 // $this->getComponentType(), $this->getName()));
82  }
setPluginSlots($a_pluginslots)
Set Plugin Slots.
setId($a_id)
Set Id.
static getComponentType()
getName()
Get Name.
static lookupPluginSlots($a_type, $a_name)
Lookup all plugin slots of a component.
+ Here is the call graph for this function:

Member Function Documentation

◆ checkVersionNumber()

static ilComponent::checkVersionNumber (   $a_ver)
staticfinal

Check version number.

Definition at line 282 of file class.ilComponent.php.

References $lng.

Referenced by isVersionGreaterString().

283  {
284  global $lng;
285 
286  $parts = explode(".", $a_ver);
287 
288  if (count($parts) < 2 || count($parts) > 3) {
289  return "Version number does not conform to format a.b or a.b.c";
290  }
291 
292  if (!is_numeric($parts[0]) || !is_numeric($parts[1])) {
293  return "Not all version number parts a.b or a.b.c are numeric.";
294  }
295 
296  if (isset($parts[2]) && !is_numeric($parts[2])) {
297  return "Not all version number parts a.b.c are numeric.";
298  }
299 
300  return $parts;
301  }
global $lng
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ getAll()

static ilComponent::getAll ( )
static

Get all.

Returns
array

Definition at line 348 of file class.ilComponent.php.

References $DIC, and $ilDB.

Referenced by ilObjAdvancedEditingGUI\initGeneralPageSettingsForm().

349  {
350  global $DIC;
351  $ilDB = $DIC->database();
352 
353  $set = $ilDB->query("SELECT * FROM il_component");
354  $comps = [];
355  while ($rec = $ilDB->fetchAssoc($set)) {
356  $comps[$rec["id"]] = $rec;
357  }
358  return $comps;
359  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ getComponentInfo()

static ilComponent::getComponentInfo (   $a_type,
  $a_name 
)
static
Parameters
$a_type
$a_name
Returns
mixed

Definition at line 272 of file class.ilComponent.php.

References $a_type, $global_cache, and ilCachedComponentData\getInstance().

Referenced by ilCtrl\callBaseClass().

273  {
275 
276  return $global_cache->lookupCompInfo($a_type, $a_name);
277  }
$a_type
Definition: workflow.php:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponentObject()

static ilComponent::getComponentObject (   $a_ctype,
  $a_cname 
)
staticfinal

Get component object.

Parameters
string$a_ctypeIL_COMP_MODULE | IL_COMP_SERVICE
string$a_cnamecomponent name

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

References $ilDB, array, IL_COMP_MODULE, and IL_COMP_SERVICE.

Referenced by ilObjComponentSettingsGUI\showPluginSlotInfo().

131  {
132  global $ilDB;
133 
134  $set = $ilDB->queryF(
135  "SELECT * FROM il_component WHERE type = %s " .
136  " AND name = %s",
137  array("text", "text"),
138  array($a_ctype, $a_cname)
139  );
140  if (!$ilDB->fetchAssoc($set)) {
141  return null;
142  }
143 
144  switch ($a_ctype) {
145  case IL_COMP_MODULE:
146  if (is_file("./Modules/" . $a_cname . "/classes/class.il" . $a_cname . "Module.php")) {
147  include_once("./Modules/" . $a_cname . "/classes/class.il" . $a_cname . "Module.php");
148  $class = "il" . $a_cname . "Module";
149  $comp = new $class();
150  return $comp;
151  }
152  break;
153 
154  case IL_COMP_SERVICE:
155  if (is_file("./Services/" . $a_cname . "/classes/class.il" . $a_cname . "Service.php")) {
156  include_once("./Services/" . $a_cname . "/classes/class.il" . $a_cname . "Service.php");
157  $class = "il" . $a_cname . "Service";
158  $comp = new $class();
159  return $comp;
160  }
161  break;
162  }
163 
164  return null;
165  }
const IL_COMP_MODULE
Create styles array
The data for the language used.
global $ilDB
const IL_COMP_SERVICE
+ Here is the caller graph for this function:

◆ getComponentType()

static ilComponent::getComponentType ( )
staticabstract

Referenced by __construct(), and getPluginSlotDirectory().

+ Here is the caller graph for this function:

◆ getId()

ilComponent::getId ( )
final

Get Id.

Returns
string Id

Definition at line 99 of file class.ilComponent.php.

References $id.

Referenced by getPluginSlotLanguagePrefix().

100  {
101  return $this->id;
102  }
if(!array_key_exists('StateId', $_REQUEST)) $id
+ Here is the caller graph for this function:

◆ getName()

ilComponent::getName ( )
abstract

Get Name.

Returns
string Name

Referenced by __construct(), and getPluginSlotDirectory().

+ Here is the caller graph for this function:

◆ getPluginSlotDirectory()

ilComponent::getPluginSlotDirectory (   $a_id)

Get directory of plugin slot.

Parameters
string$a_idPlugin Slot ID

Definition at line 228 of file class.ilComponent.php.

References getComponentType(), getName(), and getPluginSlots().

229  {
230  $slots = $this->getPluginSlots();
231 
232  return "Customizing/global/plugins/" . $this->getComponentType() . "/" .
233  $this->getName() . "/" . $slots[$a_id]["name"];
234  }
getPluginSlots()
Get Plugin Slots.
static getComponentType()
getName()
Get Name.
+ Here is the call graph for this function:

◆ getPluginSlotLanguagePrefix()

ilComponent::getPluginSlotLanguagePrefix (   $a_id)

Get language prefix for plugin slot.

Parameters
string$a_idPlugin Slot ID

Definition at line 241 of file class.ilComponent.php.

References getId(), and getPluginSlots().

242  {
243  $slots = $this->getPluginSlots();
244  return $this->getId() . "_" . $slots[$a_id]["id"] . "_";
245  }
getPluginSlots()
Get Plugin Slots.
+ Here is the call graph for this function:

◆ getPluginSlotName()

ilComponent::getPluginSlotName (   $a_id)

Get name of plugin slot.

Parameters
string$a_idPlugin Slot ID

Definition at line 216 of file class.ilComponent.php.

References getPluginSlots().

217  {
218  $slots = $this->getPluginSlots();
219 
220  return $slots[$a_id]["name"];
221  }
getPluginSlots()
Get Plugin Slots.
+ Here is the call graph for this function:

◆ getPluginSlots()

ilComponent::getPluginSlots ( )
final

Get Plugin Slots.

Returns
array Plugin Slots

Definition at line 119 of file class.ilComponent.php.

Referenced by getPluginSlotDirectory(), getPluginSlotLanguagePrefix(), and getPluginSlotName().

120  {
121  return $this->pluginslots;
122  }
+ Here is the caller graph for this function:

◆ getSubDirectory()

ilComponent::getSubDirectory ( )

Get Sub Directory.

Returns
string Sub Directory

Definition at line 182 of file class.ilComponent.php.

183  {
184  return $this->subdirectory;
185  }

◆ getVersion()

ilComponent::getVersion ( )
abstract

Get Version Number of Component.

The number should be changed if anything in the code is changed. Otherwise ILIAS will not be able to recognize any change in the module.

The format must be: <major number>="">.<minor number>="">.<bugfix number>=""> <bugfix number>=""> should be increased for bugfixes <minor number>=""> should be increased for behavioural changes (and new functionalities) <major number>=""> should be increased for major revisions

The number should be returned directly as string, e.g. return "1.0.2";

Returns
string version number

◆ isCore()

ilComponent::isCore ( )
abstract

◆ isVersionGreater()

static ilComponent::isVersionGreater ( string  $version1,
string  $version2 
)
staticfinal
Parameters
string$version1
string$version2
Returns
bool

Definition at line 320 of file class.ilComponent.php.

Referenced by isVersionGreaterString().

320  : bool
321  {
322  return version_compare($version1, $version2, '>');
323  }
+ Here is the caller graph for this function:

◆ isVersionGreaterString()

static ilComponent::isVersionGreaterString (   $a_ver1,
  $a_ver2 
)
staticfinal

Definition at line 303 of file class.ilComponent.php.

References checkVersionNumber(), and isVersionGreater().

Referenced by ilPluginAdmin\pluginSupportCurrentILIAS(), and ilPluginAdmin\updateRequired().

304  {
305  $a_arr1 = ilComponent::checkVersionNumber($a_ver1);
306  $a_arr2 = ilComponent::checkVersionNumber($a_ver2);
307 
308  if (is_array($a_arr1) && is_array($a_arr2)) {
309  return ilComponent::isVersionGreater($a_ver1, $a_ver2);
310  } else {
311  return false;
312  }
313  }
static checkVersionNumber($a_ver)
Check version number.
static isVersionGreater(string $version1, string $version2)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupComponentName()

static ilComponent::lookupComponentName (   $a_component_id)
static

lookup component name type $ilDB

Parameters
type$a_component_id
Returns
type

Definition at line 331 of file class.ilComponent.php.

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilLogComponentTableGUI\parse().

332  {
333  global $ilDB;
334 
335  $query = 'SELECT name from il_component ' .
336  'WHERE id = ' . $ilDB->quote($a_component_id, 'text');
337 
338  $res = $ilDB->query($query);
339  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
340  return $row->name;
341  }
342  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ lookupId()

static ilComponent::lookupId (   $a_type,
  $a_name 
)
static

Lookup ID of a component.

Definition at line 250 of file class.ilComponent.php.

References $a_type, $global_cache, and ilCachedComponentData\getInstance().

Referenced by ilPlugin\_getImagePath(), ilPluginSlot\getPrefix(), ilPlugin\getStyleSheetLocation(), and lookupPluginSlots().

251  {
253 
254  return $global_cache->lookCompId($a_type, $a_name);
255 
256  //global $ilDB;
257 
258  //$set = $ilDB->queryF("SELECT * FROM il_component WHERE type = %s ".
259  // " AND name = %s", array("text", "text"),
260  // array($a_type, $a_name));
261  //$rec = $ilDB->fetchAssoc($set);
262 
263  //return $rec["id"];
264  }
$a_type
Definition: workflow.php:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupPluginSlots()

static ilComponent::lookupPluginSlots (   $a_type,
  $a_name 
)
static

Lookup all plugin slots of a component.

Definition at line 190 of file class.ilComponent.php.

References $a_type, array, ilCachedComponentData\getInstance(), and lookupId().

Referenced by __construct(), ilPluginsOverviewTableGUI\addPluginData(), and ilComponentsTableGUI\getComponents().

191  {
192  // global $ilDB;
193 
194  $cached_component = ilCachedComponentData::getInstance();
195  $recs = $cached_component->lookupPluginSlotByComponent($a_type . "/" . $a_name);
196 
197  //$set = $ilDB->query("SELECT * FROM il_pluginslot WHERE component = ".
198  // $ilDB->quote($a_type."/".$a_name, "text"));
199  $ps = array();
200  //echo "<br>".$a_type."/".$a_name;
201  //while($rec = $ilDB->fetchAssoc($set))
202  foreach ($recs as $rec) {
203  $rec["dir"] = "Customizing/global/plugins/" . $a_type . "/" . $a_name . "/" . $rec["name"];
204  $rec["dir_pres"] = "Customizing/global/plugins/<br />" . $a_type . "/" . $a_name . "/" . $rec["name"];
205  $rec["lang_prefix"] = ilComponent::lookupId($a_type, $a_name) . "_" . $rec["id"] . "_";
206  $ps[$rec["id"]] = $rec;
207  }
208  return $ps;
209  }
static lookupId($a_type, $a_name)
Lookup ID of a component.
$a_type
Definition: workflow.php:92
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:

◆ setId()

ilComponent::setId (   $a_id)
final

Set Id.

Parameters
string$a_idId

Definition at line 89 of file class.ilComponent.php.

Referenced by __construct().

90  {
91  $this->id = $a_id;
92  }
+ Here is the caller graph for this function:

◆ setPluginSlots()

ilComponent::setPluginSlots (   $a_pluginslots)
final

Set Plugin Slots.

Parameters
array$a_pluginslotsPlugin Slots

Definition at line 109 of file class.ilComponent.php.

Referenced by __construct().

110  {
111  $this->pluginslots = $a_pluginslots;
112  }
+ Here is the caller graph for this function:

◆ setSubDirectory()

ilComponent::setSubDirectory (   $a_subdirectory)

Set Sub Directory.

Parameters
string$a_subdirectorySub Directory

Definition at line 172 of file class.ilComponent.php.

173  {
174  $this->subdirectory = $a_subdirectory;
175  }

Field Documentation

◆ $global_cache

ilComponent::$global_cache
protected

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

Referenced by getComponentInfo(), and lookupId().


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