ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilClassificationBlockGUI Class Reference

Classification block, displayed in different contexts, e.g. More...

+ Inheritance diagram for ilClassificationBlockGUI:
+ Collaboration diagram for ilClassificationBlockGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 
 getHTML ()
 Handle config status. More...
 
 getAjax ()
 
 fillDataSection ()
 Standard implementation for row based data. More...
 
- Public Member Functions inherited from ilBlockGUI
 __construct ()
 Constructor. More...
 
 addHeaderLink ($a_href, $a_text, $status=true)
 
 getHeaderLinks ()
 
 setData ($a_data)
 Set Data. More...
 
 getData ()
 Get Data. More...
 
 setBigMode ($a_bigmode)
 Set Big Mode. More...
 
 getBigMode ()
 Get Big Mode. More...
 
 setBlockId ($a_block_id=0)
 Set Block Id. More...
 
 getBlockId ()
 Get Block Id. More...
 
 setAvailableDetailLevels ($a_max, $a_min=0)
 Set Available Detail Levels. More...
 
 setCurrentDetailLevel ($a_currentdetaillevel)
 Set Current Detail Level. More...
 
 setGuiObject (&$a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 Get GuiObject. More...
 
 getCurrentDetailLevel ()
 Get Current Detail Level. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setImage ($a_image)
 Set Image. More...
 
 getImage ()
 Get Image. More...
 
 setOffset ($a_offset)
 Set Offset. More...
 
 getOffset ()
 Get Offset. More...
 
 correctOffset ()
 
 setLimit ($a_limit)
 Set Limit. More...
 
 getLimit ()
 Get Limit. More...
 
 setEnableEdit ($a_enableedit)
 Set EnableEdit. More...
 
 getEnableEdit ()
 Get EnableEdit. More...
 
 setRepositoryMode ($a_repositorymode)
 Set RepositoryMode. More...
 
 getRepositoryMode ()
 Get RepositoryMode. More...
 
 setFooterInfo ($a_footerinfo, $a_hide_and_icon=false)
 Set Footer Info. More...
 
 getFooterInfo ($a_hide_and_icon=false)
 Get Footer Info. More...
 
 setSubtitle ($a_subtitle)
 Set Subtitle. More...
 
 getSubtitle ()
 Get Subtitle. More...
 
 setRefId ($a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 Get Ref Id (only used if isRepositoryObject() is true). More...
 
 setAdminCommands ($a_admincommands)
 Set Administration Commmands. More...
 
 getAdminCommands ()
 Get Administration Commmands. More...
 
 setColSpan ($a_colspan)
 Set Columns Span. More...
 
 getColSpan ()
 Get Columns Span. More...
 
 setEnableDetailRow ($a_enabledetailrow)
 Set EnableDetailRow. More...
 
 getEnableDetailRow ()
 Get EnableDetailRow. More...
 
 setEnableNumInfo ($a_enablenuminfo)
 Set Enable Item Number Info. More...
 
 getEnableNumInfo ()
 Get Enable Item Number Info. More...
 
 setProperties ($a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty ($a_property)
 
 setProperty ($a_property, $a_value)
 
 setRowTemplate ($a_rowtemplatename, $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getDetailParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 Get Row Template Name. More...
 
 getRowTemplateDir ()
 Get Row Template Directory. More...
 
 addBlockCommand ( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
 Add Block Command. More...
 
 getBlockCommands ()
 Get Block commands. More...
 
 addHeaderCommand ($a_href, $a_text, $a_as_close=false)
 Add Header Block Command. More...
 
 getHeaderCommands ()
 Get Header Block commands. More...
 
 addFooterLink ( $a_text, $a_href="", $a_onclick="", $a_block_id="", $a_top=false, $a_omit_separator=false, $a_checked=false)
 Add a footer text/link. More...
 
 getFooterLinks ()
 Get footer links. More...
 
 clearFooterLinks ()
 Clear footer links. More...
 
 handleDetailLevel ()
 Handle read/write current detail level. More...
 
 getHTML ()
 Handle config status. More...
 
 fillHeaderCommands ()
 Fill header commands block. More...
 
 fillHeaderTitleBlock ()
 Fill header title block (title and. More...
 
 setDataSection ($a_content)
 Call this from overwritten fillDataSection(), if standard row based data is not used. More...
 
 fillDataSection ()
 Standard implementation for row based data. More...
 
 fillRow ($a_set)
 
 fillFooter ()
 
 fillPreviousNext ()
 Fill previous/next row. More...
 
 setPreviousNextLinks ()
 Get previous/next linkbar. More...
 
 fillFooterLinks ($a_top=false, $a_numinfo="")
 Fill footer links. More...
 
 fillDetailRow ()
 Fill Detail Setting Row. More...
 

Static Public Member Functions

static getBlockType ()
 
static isRepositoryObject ()
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 
static getBlockType ()
 
static isRepositoryObject ()
 
static getScreenMode ()
 Get Screen Mode for current command. More...
 

Protected Member Functions

 validate ()
 
 filterContainer ()
 
 initProviders ($a_check_post=false)
 
- Protected Member Functions inherited from ilBlockGUI
 fillRowColor ($a_placeholder="CSS_ROW")
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 

Protected Attributes

 $obj_definition
 
 $tree
 
 $parent_obj_type
 
 $parent_obj_id
 
 $parent_ref_id
 
 $providers
 
 $item_list_gui
 
- Protected Attributes inherited from ilBlockGUI
 $data = array()
 
 $colspan = 1
 
 $enablenuminfo = true
 
 $detail_min = 0
 
 $detail_max = 0
 
 $bigmode = false
 
 $footer_links = array()
 
 $block_id = 0
 
 $header_commands = array()
 
 $allow_moving = true
 
 $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
 $enabledetailrow = true
 
 $header_links = array()
 
 $footerinfo = false
 
 $footerinfo_icon = false
 
 $block_commands = array()
 
 $max_count = false
 
 $close_command = false
 
 $image = false
 
 $property = false
 
 $nav_value = ""
 
 $css_row = ""
 
 $dropdown
 
 $tpl
 
 $main_tpl
 
 $user
 
 $ctrl
 
 $access
 
 $lng
 
 $obj_def
 

Static Protected Attributes

static $providers_cache
 

Detailed Description

Classification block, displayed in different contexts, e.g.

categories

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

@ilCtrl_IsCalledBy ilClassificationBlockGUI: ilColumnGUI

Definition at line 16 of file class.ilClassificationBlockGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilClassificationBlockGUI::__construct ( )

Constructor.

Parameters

Reimplemented from ilBlockGUI.

Definition at line 36 of file class.ilClassificationBlockGUI.php.

37 {
38 global $DIC;
39
40 $this->lng = $DIC->language();
41 $this->ctrl = $DIC->ctrl();
42 $this->obj_definition = $DIC["objDefinition"];
43 $this->tree = $DIC->repositoryTree();
44 $this->access = $DIC->access();
45 $lng = $DIC->language();
46
47 parent::__construct();
48
49 $this->parent_ref_id = (int) $_GET["ref_id"];
50 $this->parent_obj_id = ilObject::_lookupObjId($this->parent_ref_id);
51 $this->parent_obj_type = ilObject::_lookupType($this->parent_obj_id);
52
53 $lng->loadLanguageModule("classification");
54 $this->setTitle($lng->txt("clsfct_block_title"));
55 $this->setFooterInfo($lng->txt("clsfct_block_info"));
56 }
$_GET["client_id"]
setFooterInfo($a_footerinfo, $a_hide_and_icon=false)
Set Footer Info.
setTitle($a_title)
Set Title.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
global $DIC
Definition: saml.php:7

References $_GET, $DIC, ilBlockGUI\$lng, ilObject\_lookupObjId(), ilObject\_lookupType(), ilBlockGUI\setFooterInfo(), and ilBlockGUI\setTitle().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilClassificationBlockGUI::executeCommand ( )

Definition at line 68 of file class.ilClassificationBlockGUI.php.

69 {
71
72 $cmd = $ilCtrl->getCmd();
73 $next_class = $ilCtrl->getNextClass($this);
74
75 switch ($next_class) {
76 default:
77 // explorer call
78 if ($ilCtrl->isAsynch() && $cmd != "getAjax" && $cmd != "filterContainer") {
79 $this->getHTML();
80 } else {
81 $this->$cmd();
82 }
83 break;
84 }
85 }
global $ilCtrl
Definition: ilias.php:18

References ilBlockGUI\$ctrl, $ilCtrl, and getHTML().

+ Here is the call graph for this function:

◆ fillDataSection()

ilClassificationBlockGUI::fillDataSection ( )

Standard implementation for row based data.

Overwrite this and call setContent for other data.

Reimplemented from ilBlockGUI.

Definition at line 135 of file class.ilClassificationBlockGUI.php.

136 {
138
140
141 $html = array();
142 foreach ($this->providers as $provider) {
143 $provider->render($html, $this);
144 }
145
146 $this->tpl->setVariable("BLOCK_ROW", "");
147
148 $ajax_block_id = "block_" . $this->getBlockType() . "_0";
149 $ajax_block_url = $ilCtrl->getLinkTarget($this, "getAjax", "", true, false);
150 $ajax_content_id = "il_center_col";
151 $ajax_content_url = $ilCtrl->getLinkTarget($this, "filterContainer", "", true, false);
152
153 $tabs = new ilTabsGUI();
154 $tabs->setBackTarget($this->lng->txt("clsfct_back_to_cat"), $ilCtrl->getParentReturn($this));
155 $tabs->addTab("sel_objects", $this->lng->txt("clsfct_selected_objects"), "#");
156 $tabs_html = $tabs->getHTML();
157
158
159 // #15008 - always load regardless of content (because of redraw)
160 $tpl->addOnLoadCode('il.Classification.setAjax("' . $ajax_block_id . '", "' .
161 $ajax_block_url . '", "' . $ajax_content_id . '", "' . $ajax_content_url . '", ' . json_encode($tabs_html) . ');');
162
163 if (sizeof($html)) {
164 $btpl = new ilTemplate("tpl.classification_block.html", true, true, "Services/Classification");
165
166 foreach ($html as $item) {
167 $btpl->setCurrentBlock("provider_chunk_bl");
168 $btpl->setVariable("TITLE", $item["title"]);
169 $btpl->setVariable("CHUNK", $item["html"]);
170 $btpl->parseCurrentBlock();
171 }
172
173 $this->tpl->setVariable("DATA", $btpl->get());
174 }
175 }
Tabs GUI.
special template class to simplify handling of ITX/PEAR
if(!empty($this->data['faventry'])) $tabs
Definition: disco.tpl.php:124
$html
Definition: example_001.php:87

References ilBlockGUI\$ctrl, $html, $ilCtrl, ilBlockGUI\$main_tpl, League\OAuth2\Client\Provider\$provider, $tabs, ilBlockGUI\$tpl, and getBlockType().

+ Here is the call graph for this function:

◆ filterContainer()

ilClassificationBlockGUI::filterContainer ( )
protected

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

183 {
184 $objDefinition = $this->obj_definition;
187 $ilAccess = $this->access;
189
190 $this->initProviders();
191
192 // empty selection is invalid
193 if (!$_SESSION[self::getBlockType()]) {
194 exit();
195 }
196
197 $all_matching_provider_object_ids = null;
198
199 foreach ($this->providers as $provider) {
200 $id = get_class($provider);
202 if ($current) {
203 // combine providers AND
204 $provider_object_ids = $provider->getFilteredObjects();
205 if (is_array($all_matching_provider_object_ids)) {
206 $all_matching_provider_object_ids = array_intersect($matching_provider_object_ids, $provider_object_ids);
207 } else {
208 $all_matching_provider_object_ids = $provider_object_ids;
209 }
210 }
211 }
212
213 $has_content = false;
214
215 $ltpl = new ilTemplate("tpl.classification_object_list.html", true, true, "Services/Classification");
216
217 if (sizeof($all_matching_provider_object_ids)) {
218 $fields = array(
219 "object_reference.ref_id"
220 ,"object_data.obj_id"
221 ,"object_data.type"
222 ,"object_data.title"
223 ,"object_data.description"
224 );
225 $matching = $tree->getSubTreeFilteredByObjIds($this->parent_ref_id, $all_matching_provider_object_ids, $fields);
226 if (sizeof($matching)) {
227 $valid_objects = array();
228
229 // :TODO: not sure if this makes sense...
230 include_once "Services/Object/classes/class.ilObjectListGUIPreloader.php";
232
233 foreach ($matching as $item) {
234 if ($item["ref_id"] != $this->parent_ref_id &&
235 !$tree->isDeleted($item["ref_id"]) &&
236 $ilAccess->checkAccess("visible", "", $item["ref_id"])) {
237 // group all valid items in blocks
238 // by their parent group/course or category
239 $block_ref_id = 0;
240 $block_title = "";
241 foreach ($tree->getPathFull($item["ref_id"]) as $p) {
242 if (in_array($p["type"], array("root", "cat", "crs", "grp"))) {
243 $block_ref_id = $p["ref_id"];
244 $block_title = $p["title"];
245 }
246 }
247 if ($block_ref_id > 0) {
248 if (!is_array($valid_objects[$block_ref_id])) {
249 $valid_objects[$block_ref_id] = array(
250 "title" => $block_title,
251 "items" => array()
252 );
253 }
254 $valid_objects[$block_ref_id]["items"][] = $item;
255 }
256
257 $preloader->addItem($item["obj_id"], $item["type"], $item["ref_id"]);
258 }
259 }
260 $valid_objects = ilUtil::sortArray($valid_objects, "title", "asc", false, true);
261 if (sizeof($valid_objects)) {
262 $has_content = true;
263
264 $preloader->preload();
265
266 // see ilPDTaggingBlockGUI::showResourcesForTag()
267
268 $this->item_list_gui = array();
269 foreach ($valid_objects as $block) {
270 $items = ilUtil::sortArray($block["items"], "title", "asc", false, true);
271 foreach ($items as $obj) {
272 $type = $obj["type"];
273
274 // get list gui class for each object type
275 if (empty($this->item_list_gui[$type])) {
276 $class = $objDefinition->getClassName($type);
277 $location = $objDefinition->getLocation($type);
278
279 $full_class = "ilObj" . $class . "ListGUI";
280
281 include_once($location . "/class." . $full_class . ".php");
282 $this->item_list_gui[$type] = new $full_class();
283 $this->item_list_gui[$type]->enableDelete(false);
284 $this->item_list_gui[$type]->enablePath(true, $this->parent_ref_id); // relative path
285 $this->item_list_gui[$type]->enableLinkedPath(true);
286 $this->item_list_gui[$type]->enableCut(false);
287 $this->item_list_gui[$type]->enableCopy(false);
288 $this->item_list_gui[$type]->enableSubscribe(false);
289 $this->item_list_gui[$type]->enableLink(false);
290 $this->item_list_gui[$type]->enableIcon(true);
291
292 // :TOOD: for each item or just for each list?
293 foreach ($this->providers as $provider) {
294 $provider->initListGUI($this->item_list_gui[$type]);
295 }
296 }
297
298 $html = $this->item_list_gui[$type]->getListItemHTML(
299 $obj["ref_id"],
300 $obj["obj_id"],
301 $obj["title"],
302 $obj["description"]
303 );
304
305 if ($html != "") {
306 $ltpl->setCurrentBlock("res_row");
307 $ltpl->setVariable("RESOURCE_HTML", $html);
308 $ltpl->parseCurrentBlock();
309 }
310 }
311 $ltpl->setCurrentBlock("block");
312 $ltpl->setVariable("BLOCK_TITLE", $block["title"]);
313 $ltpl->parseCurrentBlock();
314 }
315 }
316 }
317 }
318
319 if ($has_content) {
320 echo $ltpl->get();
321 } else {
322 //$content_block->setContent($lng->txt("clsfct_content_no_match"));
323 echo $tpl->getMessageHTML($lng->txt("clsfct_content_no_match"), "info");
324 }
325
326 exit();
327 }
$location
Definition: buildRTE.php:44
$_SESSION["AccountId"]
Preloader for object list GUIs.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
if(!array_key_exists('StateId', $_REQUEST)) $id
$type

References $_SESSION, ilBlockGUI\$access, $current, $html, $id, ilBlockGUI\$lng, $location, ilBlockGUI\$main_tpl, $obj_definition, League\OAuth2\Client\Provider\$provider, ilBlockGUI\$tpl, $tree, $type, ilObjectListGUI\CONTEXT_REPOSITORY, exit, getBlockType(), initProviders(), and ilUtil\sortArray().

+ Here is the call graph for this function:

◆ getAjax()

ilClassificationBlockGUI::getAjax ( )

Definition at line 123 of file class.ilClassificationBlockGUI.php.

124 {
126
127 $this->initProviders(true);
128
129 echo $this->getHTML();
130 echo $tpl->getOnLoadCodeForAsynch();
131
132 exit();
133 }

References ilBlockGUI\$main_tpl, ilBlockGUI\$tpl, exit, getHTML(), and initProviders().

+ Here is the call graph for this function:

◆ getBlockType()

static ilClassificationBlockGUI::getBlockType ( )
static

Reimplemented from ilBlockGUI.

Definition at line 58 of file class.ilClassificationBlockGUI.php.

59 {
60 return 'clsfct';
61 }

Referenced by fillDataSection(), filterContainer(), and initProviders().

+ Here is the caller graph for this function:

◆ getHTML()

ilClassificationBlockGUI::getHTML ( )

Handle config status.

Get HTML.

Reimplemented from ilBlockGUI.

Definition at line 103 of file class.ilClassificationBlockGUI.php.

104 {
107
108 if (!$ilCtrl->isAsynch()) {
109 unset($_SESSION[self::getBlockType()]);
110 }
111
112 $this->initProviders();
113
114 if (!$this->validate()) {
115 return "";
116 }
117
118 $tpl->addJavaScript("Services/Classification/js/ilClassification.js");
119
120 return parent::getHTML();
121 }

References $_SESSION, ilBlockGUI\$ctrl, $ilCtrl, ilBlockGUI\$main_tpl, ilBlockGUI\$tpl, initProviders(), and validate().

Referenced by executeCommand(), and getAjax().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScreenMode()

static ilClassificationBlockGUI::getScreenMode ( )
static

Get Screen Mode for current command.

Reimplemented from ilBlockGUI.

Definition at line 87 of file class.ilClassificationBlockGUI.php.

88 {
89 global $DIC;
90
91 $ilCtrl = $DIC->ctrl();
92
93 if ($ilCtrl->isAsynch()) {
94 return;
95 }
96
97 switch ($ilCtrl->getCmd()) {
98 case "filterContainer":
99 return IL_SCREEN_CENTER;
100 }
101 }
const IL_SCREEN_CENTER

References $DIC, $ilCtrl, and IL_SCREEN_CENTER.

◆ initProviders()

ilClassificationBlockGUI::initProviders (   $a_check_post = false)
protected

Definition at line 329 of file class.ilClassificationBlockGUI.php.

330 {
331 if (!isset(self::$providers_cache[$this->parent_ref_id])) {
332 include_once "Services/Classification/classes/class.ilClassificationProvider.php";
334 $this->parent_ref_id,
335 $this->parent_obj_id,
336 $this->parent_obj_typ
337 );
338 }
339 $this->providers = self::$providers_cache[$this->parent_ref_id];
340
341 if ($a_check_post && (bool) !$_REQUEST["rdrw"]) {
342 foreach ($this->providers as $provider) {
343 $id = get_class($provider);
344 $current = $provider->importPostData($_SESSION[self::getBlockType()][$id]);
345 if ($current) {
347 } else {
348 unset($_SESSION[self::getBlockType()][$id]);
349 }
350 }
351 }
352
353 foreach ($this->providers as $provider) {
354 $id = get_class($provider);
356 if ($current) {
357 $provider->setSelection($current);
358 }
359 }
360 }
static getValidProviders($a_parent_ref_id, $a_parent_obj_id, $a_parent_obj_type)
Get all valid providers (for parent container)

References $_SESSION, $current, $id, $parent_ref_id, League\OAuth2\Client\Provider\$provider, getBlockType(), and ilClassificationProvider\getValidProviders().

Referenced by filterContainer(), getAjax(), and getHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRepositoryObject()

static ilClassificationBlockGUI::isRepositoryObject ( )
static

Reimplemented from ilBlockGUI.

Definition at line 63 of file class.ilClassificationBlockGUI.php.

64 {
65 return false;
66 }

◆ validate()

ilClassificationBlockGUI::validate ( )
protected

Definition at line 177 of file class.ilClassificationBlockGUI.php.

References $providers.

Referenced by getHTML().

+ Here is the caller graph for this function:

Field Documentation

◆ $item_list_gui

ilClassificationBlockGUI::$item_list_gui
protected

Definition at line 32 of file class.ilClassificationBlockGUI.php.

◆ $obj_definition

ilClassificationBlockGUI::$obj_definition
protected

Definition at line 21 of file class.ilClassificationBlockGUI.php.

Referenced by filterContainer().

◆ $parent_obj_id

ilClassificationBlockGUI::$parent_obj_id
protected

Definition at line 29 of file class.ilClassificationBlockGUI.php.

◆ $parent_obj_type

ilClassificationBlockGUI::$parent_obj_type
protected

Definition at line 28 of file class.ilClassificationBlockGUI.php.

◆ $parent_ref_id

ilClassificationBlockGUI::$parent_ref_id
protected

Definition at line 30 of file class.ilClassificationBlockGUI.php.

Referenced by initProviders().

◆ $providers

ilClassificationBlockGUI::$providers
protected

Definition at line 31 of file class.ilClassificationBlockGUI.php.

Referenced by validate().

◆ $providers_cache

ilClassificationBlockGUI::$providers_cache
staticprotected

Definition at line 34 of file class.ilClassificationBlockGUI.php.

◆ $tree

ilClassificationBlockGUI::$tree
protected

Definition at line 26 of file class.ilClassificationBlockGUI.php.

Referenced by filterContainer().


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