ILIAS  release_7 Revision v7.30-3-g800a261c036
ilComponent Class Reference
+ Inheritance diagram for ilComponent:
+ Collaboration diagram for ilComponent:

Public Member Functions

 getVersion ()
 Get Version Number of Component. More...
 
 isCore ()
 
 getComponentType ()
 
 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 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 @global 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 ( )

Reimplemented in ilCloudModule, ilTestModule, ilTestQuestionPoolModule, ilAuthShibbolethService, ilModule, ilCOPageService, ilEventHandlingService, ilPreviewService, ilRepositoryService, and ilUIComponentService.

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

63 {
64 $this->global_cache = ilCachedComponentData::getInstance();
65
66 $this->setId($this->global_cache->lookCompId($this->getComponentType(), $this->getName()));
68 $this->getComponentType(),
69 $this->getName()
70 ));
71 }
setPluginSlots($a_pluginslots)
Set Plugin Slots.
getName()
Get Name.
setId($a_id)
Set Id.
static lookupPluginSlots($a_type, $a_name)
Lookup all plugin slots of a component.

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

+ Here is the call graph for this function:

Member Function Documentation

◆ checkVersionNumber()

static ilComponent::checkVersionNumber (   $a_ver)
staticfinal

Check version number.

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

258 {
259 $parts = explode(".", $a_ver);
260
261 if (count($parts) < 2 || count($parts) > 3) {
262 return "Version number does not conform to format a.b or a.b.c";
263 }
264
265 if (!is_numeric($parts[0]) || !is_numeric($parts[1])) {
266 return "Not all version number parts a.b or a.b.c are numeric.";
267 }
268
269 if (isset($parts[2]) && !is_numeric($parts[2])) {
270 return "Not all version number parts a.b.c are numeric.";
271 }
272
273 return $parts;
274 }

Referenced by isVersionGreaterString().

+ Here is the caller graph for this function:

◆ getAll()

static ilComponent::getAll ( )
static

Get all.

Returns
array

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

323 {
324 global $DIC;
325 $ilDB = $DIC->database();
326
327 $set = $ilDB->query("SELECT * FROM il_component");
328 $comps = [];
329 while ($rec = $ilDB->fetchAssoc($set)) {
330 $comps[$rec["id"]] = $rec;
331 }
332 return $comps;
333 }
global $DIC
Definition: goto.php:24
global $ilDB

References $DIC, and $ilDB.

Referenced by ilObjAdvancedEditingGUI\initGeneralPageSettingsForm().

+ 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 247 of file class.ilComponent.php.

248 {
250
251 return $global_cache->lookupCompInfo($a_type, $a_name);
252 }

References $global_cache, and ilCachedComponentData\getInstance().

Referenced by ilCtrl\callBaseClass().

+ 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 119 of file class.ilComponent.php.

120 {
121 global $DIC;
122 $ilDB = $DIC->database();
123
124 $set = $ilDB->queryF(
125 "SELECT * FROM il_component WHERE type = %s " .
126 " AND name = %s",
127 array("text", "text"),
128 array($a_ctype, $a_cname)
129 );
130 if (!$ilDB->fetchAssoc($set)) {
131 return null;
132 }
133
134 switch ($a_ctype) {
135 case IL_COMP_MODULE:
136 if (is_file("./Modules/" . $a_cname . "/classes/class.il" . $a_cname . "Module.php")) {
137 include_once("./Modules/" . $a_cname . "/classes/class.il" . $a_cname . "Module.php");
138 $class = "il" . $a_cname . "Module";
139 $comp = new $class();
140 return $comp;
141 }
142 break;
143
144 case IL_COMP_SERVICE:
145 if (is_file("./Services/" . $a_cname . "/classes/class.il" . $a_cname . "Service.php")) {
146 include_once("./Services/" . $a_cname . "/classes/class.il" . $a_cname . "Service.php");
147 $class = "il" . $a_cname . "Service";
148 $comp = new $class();
149 return $comp;
150 }
151 break;
152 }
153
154 return null;
155 }
const IL_COMP_SERVICE
const IL_COMP_MODULE

References $DIC, $ilDB, IL_COMP_MODULE, and IL_COMP_SERVICE.

Referenced by ilObjComponentSettingsGUI\showPluginSlotInfo().

+ Here is the caller graph for this function:

◆ getComponentType()

ilComponent::getComponentType ( )
abstract
Returns
string

Reimplemented in ilModule, and ilService.

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 88 of file class.ilComponent.php.

89 {
90 return $this->id;
91 }

Referenced by getPluginSlotLanguagePrefix().

+ Here is the caller graph for this function:

◆ getName()

ilComponent::getName ( )
abstract

Get Name.

Returns
string Name

Reimplemented in ilModule, and ilService.

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 212 of file class.ilComponent.php.

213 {
214 $slots = $this->getPluginSlots();
215
216 return "Customizing/global/plugins/" . $this->getComponentType() . "/" .
217 $this->getName() . "/" . $slots[$a_id]["name"];
218 }
getPluginSlots()
Get Plugin Slots.

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

+ 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 225 of file class.ilComponent.php.

226 {
227 $slots = $this->getPluginSlots();
228 return $this->getId() . "_" . $slots[$a_id]["id"] . "_";
229 }

References getId(), and getPluginSlots().

+ 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 200 of file class.ilComponent.php.

201 {
202 $slots = $this->getPluginSlots();
203
204 return $slots[$a_id]["name"];
205 }

References getPluginSlots().

+ Here is the call graph for this function:

◆ getPluginSlots()

ilComponent::getPluginSlots ( )
final

Get Plugin Slots.

Returns
array Plugin Slots

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

109 {
110 return $this->pluginslots;
111 }

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

+ Here is the caller graph for this function:

◆ getSubDirectory()

ilComponent::getSubDirectory ( )

Get Sub Directory.

Returns
string Sub Directory

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

173 {
174 return $this->subdirectory;
175 }

◆ 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

Reimplemented in ilCloudModule, ilSurveyQuestionPoolModule, ilTestModule, ilTestQuestionPoolModule, ilAdvancedMetaDataService, ilAuthenticationService, ilAuthShibbolethService, ilCalendarService, ilCOPageService, ilCronService, ilDashboardService, ilEventHandlingService, ilLDAPService, ilPDFGenerationService, ilPreviewService, ilRepositoryService, ilUIComponentService, and ilUserService.

◆ isCore()

◆ isVersionGreater()

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

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

293 : bool
294 {
295 return version_compare($version1, $version2, '>');
296 }

Referenced by isVersionGreaterString().

+ Here is the caller graph for this function:

◆ isVersionGreaterString()

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

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

277 {
278 $a_arr1 = ilComponent::checkVersionNumber($a_ver1);
279 $a_arr2 = ilComponent::checkVersionNumber($a_ver2);
280
281 if (is_array($a_arr1) && is_array($a_arr2)) {
282 return ilComponent::isVersionGreater($a_ver1, $a_ver2);
283 } else {
284 return false;
285 }
286 }
static checkVersionNumber($a_ver)
Check version number.
static isVersionGreater(string $version1, string $version2)

References checkVersionNumber(), and isVersionGreater().

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

+ 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 @global type $ilDB

Parameters
type$a_component_id
Returns
type

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

305 {
306 global $DIC;
307 $ilDB = $DIC->database();
308
309 $query = 'SELECT name from il_component ' .
310 'WHERE id = ' . $ilDB->quote($a_component_id, 'text');
311
312 $res = $ilDB->query($query);
313 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
314 return $row->name;
315 }
316 }
$query
foreach($_POST as $key=> $value) $res

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

Referenced by ilLogComponentTableGUI\parse().

+ 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 234 of file class.ilComponent.php.

235 {
237
238 return $global_cache->lookCompId($a_type, $a_name);
239 }

References $global_cache, and ilCachedComponentData\getInstance().

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

+ 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 180 of file class.ilComponent.php.

181 {
182 $cached_component = ilCachedComponentData::getInstance();
183 $recs = $cached_component->lookupPluginSlotByComponent($a_type . "/" . $a_name);
184
185 $ps = array();
186 foreach ($recs as $rec) {
187 $rec["dir"] = "Customizing/global/plugins/" . $a_type . "/" . $a_name . "/" . $rec["name"];
188 $rec["dir_pres"] = "Customizing/global/plugins/<br />" . $a_type . "/" . $a_name . "/" . $rec["name"];
189 $rec["lang_prefix"] = ilComponent::lookupId($a_type, $a_name) . "_" . $rec["id"] . "_";
190 $ps[$rec["id"]] = $rec;
191 }
192 return $ps;
193 }
static lookupId($a_type, $a_name)
Lookup ID of a component.

References ilCachedComponentData\getInstance(), and lookupId().

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

+ 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 78 of file class.ilComponent.php.

79 {
80 $this->id = $a_id;
81 }

Referenced by __construct().

+ 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 98 of file class.ilComponent.php.

99 {
100 $this->pluginslots = $a_pluginslots;
101 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setSubDirectory()

ilComponent::setSubDirectory (   $a_subdirectory)

Set Sub Directory.

Parameters
string$a_subdirectorySub Directory

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

163 {
164 $this->subdirectory = $a_subdirectory;
165 }

Field Documentation

◆ $global_cache

ilComponent::$global_cache
protected

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

Referenced by getComponentInfo(), and lookupId().


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