Development Guide
Repository Item Lists
There are several places in ILIAS that display lists of repository items like learning modules, tests, glossaries and forums. Those lists exist e.g. on the personal desktop (personal item), within the search feature (search result item list) or within the repository itself (in categories, courses, ...). With ILIAS 3.5.0 the presentation of items in all those lists will use the same code base.
Class ilObjectListGUI
All types of objects must provide a class derived from ilObjectListGUI
now, e.g. named ilObjChatListGUI
, ilObjGlossaryListGUI
and so on. These classes contain several methods for different aspects of the item presentation and use a common template file named tpl.container_list_item.html
. This template file generates currently the following layout:
User interface classes that need to display lists of repository items (e.g. ilPersonalDesktopGUI
or container GUI classes for categories or courses) must create instances of the ObjectListGUI classes via a special factory class called ilObjectListGUIFactory
. The ObjectListGUI classes provide a method getListItemHTML()
that returns the full HTML code for a specified item.
$item_list_gui =& ilObjectListGUIFactory::_getListGUIByType($item["type"]); |
The HTML code can now be included into the HTML template of the upper context, in most cases a repository item list HTML template. Note that you have to provide the referencen ID, the object ID, the title and the description of the object to the getListItemHTML() method, even if this method could derive all this information from the reference ID. But this would require single database queries for all of those data for each item. The upper context should receive this data for the whole collection of items from an appropriate application class. This application class could read the data from the database with one query completely.
Item Commands
The ObjectListGUI classes make use of the ilObjectAccess classes to determine the object type related commands. The ilObjectAccess classes provide a static method _getCommands()
that return an array of all commands that can be performed on objects of the corresponding type. Here is an example for the commands of learning modules as returned by ilObjLearningModuleAccess::_getCommands()
.
class ilObjLearningModuleAccess extends ilObjContentObjectAccess |
The ObjectListGUI classes will check the access permission for each command for the current user via $ilAccess and insert the corresponding HTML code only if the access is granted.
Item Properties
Item Properties can be added by overwriting the getProperties()
method of ilObjectListGUI
. The following example shows the current implementation of this method for learning modules. Depending on the situation it adds up to two properties to the item. The first one outputs a "Status: Offline" alert property, when the learning module is switched offline. The second property outputs the learning module type (ILIAS, SCORM, HTML) for authors (users with write permission).
function getProperties() |