ILIAS  release_4-4 Revision
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 checkVersionNumber ($a_ver)
 Check version number. More...
 
static isVersionGreaterString ($a_ver1, $a_ver2)
 
static isVersionGreater ($a_ver1, $a_ver2)
 Check whether version number is greater than another version number. More...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilComponent::__construct ( )

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

References getComponentType(), getName(), lookupPluginSlots(), setId(), and setPluginSlots().

54  {
55  global $ilDB;
56 
57  $set = $ilDB->queryF("SELECT * FROM il_component WHERE type = %s ".
58  " AND name = %s", array("text", "text"),
59  array($this->getComponentType(), $this->getName()));
60  $rec = $ilDB->fetchAssoc($set);
61 
62  $this->setId($rec["id"]);
64  $this->getComponentType(), $this->getName()));
65  }
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 246 of file class.ilComponent.php.

References $lng.

Referenced by isVersionGreaterString().

247  {
248  global $lng;
249 
250  $parts = explode(".", $a_ver);
251 
252  if (count($parts) != 3)
253  {
254  return "Version Number does not conform to format a.b.c";
255  }
256 
257  if (!is_numeric($parts[0]) || !is_numeric($parts[1]) || !is_numeric($parts[2]))
258  {
259  return "Not all version number parts a.b.c are numeric.";
260  }
261 
262  return $parts;
263  }
global $lng
Definition: privfeed.php:40
+ 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 113 of file class.ilComponent.php.

References IL_COMP_MODULE, and IL_COMP_SERVICE.

Referenced by ilObjComponentSettingsGUI\showPluginSlotInfo().

114  {
115  global $ilDB;
116 
117  $set = $ilDB->queryF("SELECT * FROM il_component WHERE type = %s ".
118  " AND name = %s", array("text", "text"),
119  array($a_ctype, $a_cname));
120  if (!$ilDB->fetchAssoc($set))
121  {
122  return null;
123  }
124 
125  switch ($a_ctype)
126  {
127  case IL_COMP_MODULE:
128  if (is_file("./Modules/".$a_cname."/classes/class.il".$a_cname."Module.php"))
129  {
130  include_once("./Modules/".$a_cname."/classes/class.il".$a_cname."Module.php");
131  $class = "il".$a_cname."Module";
132  $comp = new $class();
133  return $comp;
134  }
135  break;
136 
137  case IL_COMP_SERVICE:
138  if (is_file("./Services/".$a_cname."/classes/class.il".$a_cname."Service.php"))
139  {
140  include_once("./Services/".$a_cname."/classes/class.il".$a_cname."Service.php");
141  $class = "il".$a_cname."Service";
142  $comp = new $class();
143  return $comp;
144  }
145  break;
146  }
147 
148  return null;
149  }
const IL_COMP_MODULE
const IL_COMP_SERVICE
+ Here is the caller graph for this function:

◆ getComponentType()

static ilComponent::getComponentType ( )
staticabstract

Referenced by __construct().

+ Here is the caller graph for this function:

◆ getId()

ilComponent::getId ( )
final

Get Id.

Returns
string Id

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

Referenced by getPluginSlotLanguagePrefix().

83  {
84  return $this->id;
85  }
+ 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 209 of file class.ilComponent.php.

References getName(), and getPluginSlots().

210  {
211  $slots = $this->getPluginSlots();
212 
213  return "Customizing/global/plugins/".$this->getComponentType()."/".
214  $this->getName()."/".$slots[$a_id]["name"];
215  }
getPluginSlots()
Get Plugin Slots.
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 222 of file class.ilComponent.php.

References getId(), and getPluginSlots().

223  {
224  $slots = $this->getPluginSlots();
225  return $this->getId()."_".$slots[$a_id]["id"]."_";
226  }
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 197 of file class.ilComponent.php.

References getPluginSlots().

198  {
199  $slots = $this->getPluginSlots();
200 
201  return $slots[$a_id]["name"];
202  }
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 102 of file class.ilComponent.php.

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

103  {
104  return $this->pluginslots;
105  }
+ Here is the caller graph for this function:

◆ getSubDirectory()

ilComponent::getSubDirectory ( )

Get Sub Directory.

Returns
string Sub Directory

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

167  {
168  return $this->subdirectory;
169  }

◆ 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 (   $a_ver1,
  $a_ver2 
)
staticfinal

Check whether version number is greater than another version number.

Parameters
$a_ver1array version number as array as returned by checkVersionNumber()
$a_ver2array version number as array as returned by checkVersionNumber()

$return boolean true, if $a_ver1 is greater than $a_ver2

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

Referenced by isVersionGreaterString().

288  {
289  if ($a_ver1[0] > $a_ver2[0])
290  {
291  return true;
292  }
293  else if ($a_ver1[0] < $a_ver2[0])
294  {
295  return false;
296  }
297  else if ($a_ver1[1] > $a_ver2[1])
298  {
299  return true;
300  }
301  else if ($a_ver1[1] < $a_ver2[1])
302  {
303  return false;
304  }
305  else if ($a_ver1[2] > $a_ver2[2])
306  {
307  return true;
308  }
309 
310  return false;
311  }
+ Here is the caller graph for this function:

◆ isVersionGreaterString()

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

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

References checkVersionNumber(), and isVersionGreater().

Referenced by ilPluginAdmin\getPluginData().

266  {
267  $a_arr1 = ilComponent::checkVersionNumber($a_ver1);
268  $a_arr2 = ilComponent::checkVersionNumber($a_ver2);
269  if (is_array($a_arr1) && is_array($a_arr2))
270  {
271  return ilComponent::isVersionGreater($a_arr1, $a_arr2);
272  }
273  else
274  {
275  return false;
276  }
277  }
static checkVersionNumber($a_ver)
Check version number.
static isVersionGreater($a_ver1, $a_ver2)
Check whether version number is greater than another version number.
+ Here is the call graph for this function:
+ 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 231 of file class.ilComponent.php.

Referenced by ilPluginSlot\getPrefix(), and lookupPluginSlots().

232  {
233  global $ilDB;
234 
235  $set = $ilDB->queryF("SELECT * FROM il_component WHERE type = %s ".
236  " AND name = %s", array("text", "text"),
237  array($a_type, $a_name));
238  $rec = $ilDB->fetchAssoc($set);
239 
240  return $rec["id"];
241  }
+ 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 174 of file class.ilComponent.php.

References lookupId().

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

175  {
176  global $ilDB;
177 
178  $set = $ilDB->query("SELECT * FROM il_pluginslot WHERE component = ".
179  $ilDB->quote($a_type."/".$a_name, "text"));
180  $ps = array();
181 //echo "<br>".$a_type."/".$a_name;
182  while($rec = $ilDB->fetchAssoc($set))
183  {
184  $rec["dir"] = "Customizing/global/plugins/".$a_type."/".$a_name."/".$rec["name"];
185  $rec["dir_pres"] = "Customizing/global/plugins/<br />".$a_type."/".$a_name."/".$rec["name"];
186  $rec["lang_prefix"] = ilComponent::lookupId($a_type,$a_name)."_".$rec["id"]."_";
187  $ps[$rec["id"]] = $rec;
188  }
189  return $ps;
190  }
static lookupId($a_type, $a_name)
Lookup ID of a component.
+ 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 72 of file class.ilComponent.php.

Referenced by __construct().

73  {
74  $this->id = $a_id;
75  }
+ 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 92 of file class.ilComponent.php.

Referenced by __construct().

93  {
94  $this->pluginslots = $a_pluginslots;
95  }
+ Here is the caller graph for this function:

◆ setSubDirectory()

ilComponent::setSubDirectory (   $a_subdirectory)

Set Sub Directory.

Parameters
string$a_subdirectorySub Directory

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

157  {
158  $this->subdirectory = $a_subdirectory;
159  }

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