ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilClassificationBlockGUI Class Reference

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

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

Public Member Functions

 __construct ()
 
 getBlockType ()
 
 executeCommand ()
 
 getHTML ()
 
 getAjax ()
 
 fillDataSection ()
 
- Public Member Functions inherited from ilBlockGUI
 getBlockType ()
 
 __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 getScreenMode ()
 
- Static Public Member Functions inherited from ilBlockGUI
static getScreenMode ()
 Get Screen Mode for current command. More...
 

Protected Member Functions

 isRepositoryObject ()
 
 validate ()
 
 filterContainer ()
 
 initProviders ($a_check_post=false)
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 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$

ilClassificationBlockGUI: ilColumnGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilClassificationBlockGUI::__construct ( )

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

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

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  }
global $DIC
Definition: saml.php:7
$_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
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilClassificationBlockGUI::executeCommand ( )

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

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

75  {
77 
78  $cmd = $ilCtrl->getCmd();
79  $next_class = $ilCtrl->getNextClass($this);
80 
81  switch ($next_class) {
82  default:
83  // explorer call
84  if ($ilCtrl->isAsynch() && $cmd != "getAjax" && $cmd != "filterContainer") {
85  $this->getHTML();
86  } else {
87  $this->$cmd();
88  }
89  break;
90  }
91  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ fillDataSection()

ilClassificationBlockGUI::fillDataSection ( )

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

References ilBlockGUI\$ctrl, $html, $ilCtrl, ilBlockGUI\$main_tpl, PHPMailer\PHPMailer\$provider, $tabs, ilBlockGUI\$tpl, and getBlockType().

142  {
144 
146 
147  $html = array();
148  foreach ($this->providers as $provider) {
149  $provider->render($html, $this);
150  }
151 
152  $this->tpl->setVariable("BLOCK_ROW", "");
153 
154  $ajax_block_id = "block_" . $this->getBlockType() . "_0";
155  $ajax_block_url = $ilCtrl->getLinkTarget($this, "getAjax", "", true, false);
156  $ajax_content_id = "il_center_col";
157  $ajax_content_url = $ilCtrl->getLinkTarget($this, "filterContainer", "", true, false);
158 
159  $tabs = new ilTabsGUI();
160  $tabs->setBackTarget($this->lng->txt("clsfct_back_to_cat"), $ilCtrl->getParentReturn($this));
161  $tabs->addTab("sel_objects", $this->lng->txt("clsfct_selected_objects"), "#");
162  $tabs_html = $tabs->getHTML();
163 
164 
165  // #15008 - always load regardless of content (because of redraw)
166  $tpl->addOnLoadCode('il.Classification.setAjax("' . $ajax_block_id . '", "' .
167  $ajax_block_url . '", "' . $ajax_content_id . '", "' . $ajax_content_url . '", ' . json_encode($tabs_html) . ');');
168 
169  if (sizeof($html)) {
170  $btpl = new ilTemplate("tpl.classification_block.html", true, true, "Services/Classification");
171 
172  foreach ($html as $item) {
173  $btpl->setCurrentBlock("provider_chunk_bl");
174  $btpl->setVariable("TITLE", $item["title"]);
175  $btpl->setVariable("CHUNK", $item["html"]);
176  $btpl->parseCurrentBlock();
177  }
178 
179  $this->tpl->setVariable("DATA", $btpl->get());
180  }
181  }
Tabs GUI.
global $ilCtrl
Definition: ilias.php:18
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
+ Here is the call graph for this function:

◆ filterContainer()

ilClassificationBlockGUI::filterContainer ( )
protected

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

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

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

◆ getAjax()

ilClassificationBlockGUI::getAjax ( )

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

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

130  {
132 
133  $this->initProviders(true);
134 
135  echo $this->getHTML();
136  echo $tpl->getOnLoadCodeForAsynch();
137 
138  exit();
139  }
exit
Definition: backend.php:16
+ Here is the call graph for this function:

◆ getBlockType()

ilClassificationBlockGUI::getBlockType ( )

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

Referenced by fillDataSection().

61  : string
62  {
63  return 'clsfct';
64  }
+ Here is the caller graph for this function:

◆ getHTML()

ilClassificationBlockGUI::getHTML ( )

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

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

Referenced by executeCommand(), and getAjax().

110  {
113 
114  if (!$ilCtrl->isAsynch()) {
115  unset($_SESSION[self::getBlockType()]);
116  }
117 
118  $this->initProviders();
119 
120  if (!$this->validate()) {
121  return "";
122  }
123 
124  $tpl->addJavaScript("Services/Classification/js/ilClassification.js");
125 
126  return parent::getHTML();
127  }
$_SESSION["AccountId"]
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScreenMode()

static ilClassificationBlockGUI::getScreenMode ( )
static

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

References $DIC, $ilCtrl, and IL_SCREEN_CENTER.

94  {
95  global $DIC;
96 
97  $ilCtrl = $DIC->ctrl();
98 
99  if ($ilCtrl->isAsynch()) {
100  return;
101  }
102 
103  switch ($ilCtrl->getCmd()) {
104  case "filterContainer":
105  return IL_SCREEN_CENTER;
106  }
107  }
global $DIC
Definition: saml.php:7
global $ilCtrl
Definition: ilias.php:18
const IL_SCREEN_CENTER

◆ initProviders()

ilClassificationBlockGUI::initProviders (   $a_check_post = false)
protected

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

References $_SESSION, $current, $id, $parent_ref_id, PHPMailer\PHPMailer\$provider, and ilClassificationProvider\getValidProviders().

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

340  {
341  if (!isset(self::$providers_cache[$this->parent_ref_id])) {
342  include_once "Services/Classification/classes/class.ilClassificationProvider.php";
344  $this->parent_ref_id,
345  $this->parent_obj_id,
346  $this->parent_obj_typ
347  );
348  }
349  $this->providers = self::$providers_cache[$this->parent_ref_id];
350 
351  if ($a_check_post && (bool) !$_REQUEST["rdrw"]) {
352  foreach ($this->providers as $provider) {
353  $id = get_class($provider);
354  $current = $provider->importPostData($_SESSION[self::getBlockType()][$id]);
355  if ($current) {
356  $_SESSION[self::getBlockType()][$id] = $current;
357  } else {
358  unset($_SESSION[self::getBlockType()][$id]);
359  }
360  }
361  }
362 
363  foreach ($this->providers as $provider) {
364  $id = get_class($provider);
365  $current = $_SESSION[self::getBlockType()][$id];
366  if ($current) {
367  $provider->setSelection($current);
368  }
369  }
370  }
static getValidProviders($a_parent_ref_id, $a_parent_obj_id, $a_parent_obj_type)
Get all valid providers (for parent container)
$_SESSION["AccountId"]
if(!array_key_exists('StateId', $_REQUEST)) $id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRepositoryObject()

ilClassificationBlockGUI::isRepositoryObject ( )
protected

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

69  : bool
70  {
71  return false;
72  }

◆ validate()

ilClassificationBlockGUI::validate ( )
protected

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

References $providers.

Referenced by getHTML().

184  {
185  return sizeof($this->providers);
186  }
+ 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: