ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilContainerContentGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 
16 abstract class ilContainerContentGUI
17 {
19  const DETAILS_TITLE = 1;
20  const DETAILS_ALL = 2;
21 
23 
26 
31  function __construct(&$container_gui_obj)
32  {
33  $this->container_gui = $container_gui_obj;
34  $this->container_obj = $this->container_gui->object;
35  }
36 
44  protected function getDetailsLevel($a_item_id)
45  {
46  return $this->details_level;
47  }
48 
54  public function getContainerObject()
55  {
56  return $this->container_obj;
57  }
58 
64  public function getContainerGUI()
65  {
66  return $this->container_gui;
67  }
68 
75  public function setOutput()
76  {
77  global $tpl, $ilCtrl;
78 
79  // note: we do not want to get the center html in case of
80  // asynchronous calls to blocks in the right column (e.g. news)
81  // see #13012
82  if ($ilCtrl->getNextClass() == "ilcolumngui" &&
83  $ilCtrl->isAsynch())
84  {
85  $tpl->setRightContent($this->getRightColumnHTML());
86  }
87 
88  // BEGIN ChangeEvent: record read event.
89  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
90  global $ilUser;
91 //global $log;
92 //$log->write("setOutput");
93 
94  $obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
96  $this->getContainerObject()->getType(),
97  $this->getContainerObject()->getRefId(),
98  $obj_id, $ilUser->getId());
99  // END ChangeEvent: record read event.
100 
101 
102  $tpl->setContent($this->getCenterColumnHTML());
103 
104  // see above, all other cases (this was the old position of setRightContent,
105  // maybe the position above is ok and all ifs can be removed)
106  if ($ilCtrl->getNextClass() != "ilcolumngui" ||
107  !$ilCtrl->isAsynch())
108  {
109  $tpl->setRightContent($this->getRightColumnHTML());
110  }
111 
112  }
113 
117  protected function getRightColumnHTML()
118  {
119  global $ilUser, $lng, $ilCtrl, $ilAccess, $ilPluginAdmin;;
120 
121  $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
122 
123  $obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
124  $obj_type = ilObject::_lookupType($obj_id);
125 
126  include_once("Services/Block/classes/class.ilColumnGUI.php");
127  $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
128 
129  if ($column_gui->getScreenMode() == IL_SCREEN_FULL)
130  {
131  return "";
132  }
133 
134  $this->getContainerGUI()->setColumnSettings($column_gui);
135 
136  if ($ilCtrl->getNextClass() == "ilcolumngui" &&
137  $column_gui->getCmdSide() == IL_COL_RIGHT &&
138  $column_gui->getScreenMode() == IL_SCREEN_SIDE)
139  {
140 
141  $html = $ilCtrl->forwardCommand($column_gui);
142  }
143  else
144  {
145  if (!$ilCtrl->isAsynch())
146  {
147  $html = "";
148 
149  // user interface plugin slot + default rendering
150  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
151  $uip = new ilUIHookProcessor("Services/Container", "right_column",
152  array("container_content_gui" => $this));
153  if (!$uip->replaced())
154  {
155  $html = $ilCtrl->getHTML($column_gui);
156  }
157  $html = $uip->getHTML($html);
158  }
159  }
160 
161  return $html;
162  }
163 
167  protected function getCenterColumnHTML()
168  {
169  global $ilCtrl, $tpl, $ilDB;
170 
171  $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
172 
173  $tpl->addOnLoadCode("il.Object.setRedrawListItemUrl('".
174  $ilCtrl->getLinkTarget($this->container_gui, "redrawListItem", "", true)."');");
175 
176  $tpl->addOnLoadCode("il.Object.setRatingUrl('".
177  $ilCtrl->getLinkTargetByClass(array(get_class($this->container_gui), "ilcommonactiondispatchergui", "ilratinggui"),
178  "saveRating", "", true, false)."');");
179 
180  switch ($ilCtrl->getNextClass())
181  {
182  case "ilcolumngui":
183  $ilCtrl->setReturn($this->container_gui, "");
184  $html = $this->__forwardToColumnGUI();
185  break;
186 
187  default:
188  $ilDB->useSlave(true);
189  $html = $this->getMainContent();
190  $ilDB->useSlave(false);
191  break;
192  }
193 
194  return $html;
195  }
196 
201  abstract function getMainContent();
202 
206  final private function __forwardToColumnGUI()
207  {
208  global $ilCtrl, $ilAccess;
209 
210  include_once("Services/Block/classes/class.ilColumnGUI.php");
211 
212  // this gets us the subitems we need in setColumnSettings()
213  // todo: this should be done in ilCourseGUI->getSubItems
214 
215  $obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
216  $obj_type = ilObject::_lookupType($obj_id);
217 
218  if (!$ilCtrl->isAsynch())
219  {
220  //if ($column_gui->getScreenMode() != IL_SCREEN_SIDE)
222  {
223  // right column wants center
225  {
226  $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
227  $this->getContainerGUI()->setColumnSettings($column_gui);
228  $html = $ilCtrl->forwardCommand($column_gui);
229  }
230  // left column wants center
232  {
233  $column_gui = new ilColumnGUI($obj_type, IL_COL_LEFT);
234  $this->getContainerGUI()->setColumnSettings($column_gui);
235  $html = $ilCtrl->forwardCommand($column_gui);
236  }
237  }
238  else
239  {
240  $html = $this->getMainContent();
241  }
242  }
243 
244  return $html;
245  }
246 
250  protected function clearAdminCommandsDetermination()
251  {
252  $this->adminCommands = false;
253  }
254 
258  protected function determineAdminCommands($a_ref_id, $a_admin_com_included_in_list = false)
259  {
260  global $rbacsystem;
261 
262 //echo "-".$a_admin_com_included_in_list."-";
263 
264  if (!$this->adminCommands)
265  {
266  if (!$this->getContainerGUI()->isActiveAdministrationPanel())
267  {
268  if ($rbacsystem->checkAccess("delete", $a_ref_id))
269  {
270  $this->adminCommands = true;
271  }
272  }
273  else
274  {
275  $this->adminCommands = $a_admin_com_included_in_list;
276  }
277  }
278  }
279 
283  protected function getItemGUI($item_data,$a_show_path = false)
284  {
285  include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
286 
287  // get item list gui object
288  if (!is_object ($this->list_gui[$item_data["type"]]))
289  {
290  $item_list_gui =& ilObjectListGUIFactory::_getListGUIByType($item_data["type"]);
291  $item_list_gui->setContainerObject($this->getContainerGUI());
292  $this->list_gui[$item_data["type"]] =& $item_list_gui;
293  }
294  else
295  {
296  $item_list_gui =& $this->list_gui[$item_data["type"]];
297 
298  }
299 
300  // unique js-ids
301  $item_list_gui->setParentRefId($item_data["parent"]);
302 
303  // show administration command buttons (or not)
304  if (!$this->getContainerGUI()->isActiveAdministrationPanel())
305  {
306 // $item_list_gui->enableDelete(false);
307 // $item_list_gui->enableLink(false);
308 // $item_list_gui->enableCut(false);
309  }
310 
311  // activate common social commands
312  $item_list_gui->enableComments(true);
313  $item_list_gui->enableNotes(true);
314  $item_list_gui->enableTags(true);
315  $item_list_gui->enableRating(true);
316 
317  // container specific modifications
318  $this->getContainerGUI()->modifyItemGUI($item_list_gui, $item_data, $a_show_path);
319 
320  return $item_list_gui;
321  }
322 
326  function determinePageEmbeddedBlocks($a_container_page_html)
327  {
328  $type_grps = $this->getGroupedObjTypes();
329 
330  // iterate all types
331  foreach ($type_grps as $type => $v)
332  {
333  // set template (overall or type specific)
334  if (is_int(strpos($a_container_page_html, "[list-".$type."]")))
335  {
336  $this->addEmbeddedBlock("type", $type);
337  }
338  }
339 
340  // determine item groups
341  while (eregi("\[(item-group-([0-9]*))\]", $a_container_page_html, $found))
342  {
343  $this->addEmbeddedBlock("itgr", (int) $found[2]);
344 
345  $a_container_page_html = eregi_replace("\[".$found[1]."\]", $html, $a_container_page_html);
346  }
347  }
348 
354  function addEmbeddedBlock($block_type, $block_parameter)
355  {
356  $this->embedded_block[$block_type][] = $block_parameter;
357  }
358 
362  function getEmbeddedBlocks()
363  {
364  return $this->embedded_block;
365  }
366 
371  {
372  global $lng;
373 
374  // first all type specific blocks
375  if (is_array($this->embedded_block["type"]))
376  {
377  // all embedded typed blocks
378  foreach ($this->embedded_block["type"] as $k => $type)
379  {
380  if ($this->rendered_block["type"][$type] == "")
381  {
382  if (is_array($this->items[$type]))
383  {
384  $tpl = $this->newBlockTemplate();
385 
386  // the header
387  $this->addHeaderRow($tpl, $type);
388 
389  // all rows
390  $item_rendered = false;
391  $position = 1;
392 
393  if($type == 'sess')
394  {
395  $this->items['sess'] = ilUtil::sortArray($this->items['sess'],'start','ASC',true,true);
396  }
397 
398  foreach($this->items[$type] as $k => $item_data)
399  {
400  $html = $this->renderItem($item_data,$position++);
401  if ($html != "")
402  {
403  $this->addStandardRow($tpl, $html, $item_data["child"]);
404  $item_rendered = true;
405  $this->rendered_items[$item_data["child"]] = true;
406  }
407  }
408 
409  // if no item has been rendered, add message
410  if (!$item_rendered)
411  {
412  //$this->addMessageRow($tpl, $lng->txt("msg_no_type_accessible"), $type);
413  $this->rendered_block["type"][$type] = "";
414  }
415  else
416  {
417  $this->rendered_block["type"][$type] = $tpl->get();
418  }
419  }
420  }
421  }
422  }
423 
424  // all item groups
425  if (is_array($this->embedded_block["itgr"]))
426  {
427  $item_groups = array();
428  if (is_array($this->items["itgr"]))
429  {
430 
431  foreach ($this->items["itgr"] as $ig)
432  {
433  $item_groups[$ig["ref_id"]] = $ig;
434  }
435  }
436 
437  // all embedded typed blocks
438  foreach ($this->embedded_block["itgr"] as $ref_id)
439  {
440  // render only item groups of $this->items (valid childs)
441  if ($this->rendered_block["itgr"][$ref_id] == "" && isset($item_groups[$ref_id]))
442  {
443  $tpl = $this->newBlockTemplate();
444  $this->renderItemGroup($tpl, $item_groups[$ref_id]);
445  $this->rendered_block["itgr"][$ref_id] = $tpl->get();
446  }
447  }
448  }
449 
450  }
451 
459  function renderItem($a_item_data,$a_position = 0,$a_force_icon = false, $a_pos_prefix = "")
460  {
461  global $ilSetting,$ilAccess,$ilCtrl;
462 
463  // Pass type, obj_id and tree to checkAccess method to improve performance
464  if(!$ilAccess->checkAccess('visible','',$a_item_data['ref_id'],$a_item_data['type'],$a_item_data['obj_id'],$a_item_data['tree']))
465  {
466  return '';
467  }
468 
469  $item_list_gui = $this->getItemGUI($a_item_data);
470  if ($ilSetting->get("icon_position_in_lists") == "item_rows" ||
471  $a_item_data["type"] == "sess" || $a_force_icon)
472  {
473  $item_list_gui->enableIcon(true);
474  }
475 
476  if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$_SESSION["clipboard"])
477  {
478  $item_list_gui->enableCheckbox(true);
479  }
480  else if ($this->getContainerGUI()->isMultiDownloadEnabled())
481  {
482  // display multi download checkboxes
483  $item_list_gui->enableDownloadCheckbox($a_item_data["ref_id"], true);
484  }
485 
486  if ($this->getContainerGUI()->isActiveOrdering() && ($a_item_data['type'] != 'sess' || get_class($this) != 'ilContainerSessionsContentGUI'))
487  {
488  $item_list_gui->setPositionInputField($a_pos_prefix."[".$a_item_data["ref_id"]."]",
489  sprintf('%d', (int)$a_position*10));
490  }
491 
492  if($a_item_data['type'] == 'sess' and get_class($this) != 'ilContainerObjectiveGUI')
493  {
494  switch($this->getDetailsLevel($a_item_data['obj_id']))
495  {
496  case self::DETAILS_TITLE:
497  $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_MINIMAL);
498  $item_list_gui->enableExpand(true);
499  $item_list_gui->setExpanded(false);
500  $item_list_gui->enableDescription(false);
501  $item_list_gui->enableProperties(true);
502  break;
503 
504  case self::DETAILS_ALL:
505  $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_ALL);
506  $item_list_gui->enableExpand(true);
507  $item_list_gui->setExpanded(true);
508  $item_list_gui->enableDescription(true);
509  $item_list_gui->enableProperties(true);
510  break;
511 
512  default:
513  $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_ALL);
514  $item_list_gui->enableExpand(true);
515  $item_list_gui->enableDescription(true);
516  $item_list_gui->enableProperties(true);
517  break;
518  }
519  }
520 
521  // show subitems
522  if($a_item_data['type'] == 'sess' and (
523  $this->getDetailsLevel($a_item_data['obj_id']) != self::DETAILS_TITLE or
524  $this->getContainerGUI()->isActiveAdministrationPanel() or
525  $this->getContainerGUI()->isActiveOrdering()
526  )
527  )
528  {
529  $pos = 1;
530 
531  include_once('./Services/Container/classes/class.ilContainerSorting.php');
532  include_once('./Services/Object/classes/class.ilObjectActivation.php');
533  $items = ilObjectActivation::getItemsByEvent($a_item_data['obj_id']);
534  $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('sess',$a_item_data['obj_id'],$items);
535  $items = ilContainer::getCompleteDescriptions($items);
536 
537  $item_readable = $ilAccess->checkAccess('read','',$a_item_data['ref_id']);
538 
539  foreach($items as $item)
540  {
541  // TODO: this should be removed and be handled by if(strlen($sub_item_html))
542  // see mantis: 0003944
543  if(!$ilAccess->checkAccess('visible','',$item['ref_id']))
544  {
545  continue;
546  }
547 
548  $item_list_gui2 = $this->getItemGUI($item);
549  $item_list_gui2->enableIcon(true);
550  $item_list_gui2->enableItemDetailLinks(false);
551 
552  // unique js-ids
553  $item_list_gui2->setParentRefId($a_item_data['ref_id']);
554 
555  // @see mantis 10488
556  if(!$item_readable and !$ilAccess->checkAccess('write','',$item['ref_id']))
557  {
558  $item_list_gui2->forceVisibleOnly(true);
559  }
560 
561  if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$_SESSION["clipboard"])
562  {
563  $item_list_gui2->enableCheckbox(true);
564  }
565  else if ($this->getContainerGUI()->isMultiDownloadEnabled())
566  {
567  // display multi download checkbox
568  $item_list_gui2->enableDownloadCheckbox($item['ref_id'], true);
569  }
570 
571  if ($this->getContainerGUI()->isActiveOrdering())
572  {
573  if ($this->getContainerObject()->getOrderType() == ilContainer::SORT_MANUAL)
574  {
575  $item_list_gui2->setPositionInputField("[sess][".$a_item_data['obj_id']."][".$item["ref_id"]."]",
576  sprintf('%d', (int)$pos*10));
577  $pos++;
578  }
579  }
580 
581  // #10611
582  ilObjectActivation::addListGUIActivationProperty($item_list_gui2, $item);
583 
584  $sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'],
585  $item['obj_id'], $item['title'], $item['description']);
586 
587  $this->determineAdminCommands($item["ref_id"],$item_list_gui2->adminCommandsIncluded());
588  if(strlen($sub_item_html))
589  {
590  $item_list_gui->addSubItemHTML($sub_item_html);
591  }
592  }
593  }
594 
595  if ($ilSetting->get("item_cmd_asynch"))
596  {
597  $asynch = true;
598  $ilCtrl->setParameter($this->container_gui, "cmdrefid", $a_item_data['ref_id']);
599  $asynch_url = $ilCtrl->getLinkTarget($this->container_gui,
600  "getAsynchItemList", "", true, false);
601  $ilCtrl->setParameter($this->container_gui, "cmdrefid", "");
602  }
603 
604  include_once "Services/Object/classes/class.ilObjectActivation.php";
605  ilObjectActivation::addListGUIActivationProperty($item_list_gui, $a_item_data);
606 
607  $html = $item_list_gui->getListItemHTML($a_item_data['ref_id'],
608  $a_item_data['obj_id'], $a_item_data['title'], $a_item_data['description'],
609  $asynch, false, $asynch_url);
610  $this->determineAdminCommands($a_item_data["ref_id"],
611  $item_list_gui->adminCommandsIncluded());
612 
613 
614  return $html;
615  }
616 
623  function newBlockTemplate()
624  {
625  $tpl = new ilTemplate("tpl.container_list_block.html", true, true,
626  "Services/Container");
627  $this->cur_row_type = "row_type_1";
628  return $tpl;
629  }
630 
634  function addStandardRow(&$a_tpl, $a_html, $a_ref_id = 0)
635  {
636  global $ilSetting, $lng;
637 
638  $this->cur_row_type = ($this->cur_row_type == "row_type_1")
639  ? "row_type_2"
640  : "row_type_1";
641 
642  if ($a_ref_id > 0)
643  {
644  $a_tpl->setCurrentBlock($this->cur_row_type);
645  $a_tpl->setVariable("ROW_ID", 'id="item_row_'.$a_ref_id.'"');
646  $a_tpl->parseCurrentBlock();
647  }
648  else
649  {
650  $a_tpl->touchBlock($this->cur_row_type);
651  }
652 
653  $a_tpl->setCurrentBlock("container_standard_row");
654  $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
655  $a_tpl->parseCurrentBlock();
656  $a_tpl->touchBlock("container_row");
657  }
658 
662  function addHeaderRow($a_tpl, $a_type = "", $a_text = "")
663  {
664  global $lng, $ilSetting, $objDefinition;
665 
666  $a_tpl->setVariable("CB_ID", ' id="bl_cntr_'.$this->bl_cnt.'"');
667  if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$_SESSION["clipboard"])
668  {
669  $this->renderSelectAllBlock($a_tpl);
670  }
671  else if ($this->getContainerGUI()->isMultiDownloadEnabled())
672  {
673  // only add select all row on types that are supported
674  if (in_array($a_type, $this->getDownloadableTypes()))
675  {
676  $this->renderSelectAllBlock($a_tpl);
677  }
678  else if ($a_type == "")
679  {
680  // container with multiple types
681  // evaluate what items aren't rendered yet
682  foreach($this->items["_all"] as $k => $item_data)
683  {
684  if ($this->rendered_items[$item_data["child"]] !== true)
685  {
686  if (in_array($item_data["type"], $this->getDownloadableTypes()))
687  {
688  $this->renderSelectAllBlock($a_tpl);
689  break;
690  }
691  }
692  }
693  }
694  }
695 
696  if ($a_text == "" && $a_type != "")
697  {
698  if (!$objDefinition->isPlugin($a_type))
699  {
700  $title = $lng->txt("objs_".$a_type);
701  }
702  else
703  {
704  include_once("./Services/Component/classes/class.ilPlugin.php");
705  $title = ilPlugin::lookupTxt("rep_robj", $a_type, "objs_".$a_type);
706  }
707  }
708  else
709  {
710  $title = $a_text;
711  }
712 
713  if ($ilSetting->get("icon_position_in_lists") != "item_rows" &&
714  $a_type != "")
715  {
716  $icon = ilUtil::getImagePath("icon_".$a_type.".png");
717 
718  $a_tpl->setCurrentBlock("container_header_row_image");
719  $a_tpl->setVariable("HEADER_IMG", $icon);
720  $a_tpl->setVariable("HEADER_ALT", $title);
721  }
722  else
723  {
724  $a_tpl->setCurrentBlock("container_header_row");
725  }
726 
727  $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
728  $a_tpl->parseCurrentBlock();
729  $a_tpl->touchBlock("container_row");
730 
731  $this->resetRowType();
732  }
733 
737  private function getDownloadableTypes()
738  {
739  return array("fold", "file");
740  }
741 
745  private function renderSelectAllBlock($a_tpl)
746  {
747  global $lng;
748 
749  $a_tpl->setCurrentBlock("select_all_row");
750  $a_tpl->setVariable("CHECKBOXNAME", "bl_cb_".$this->bl_cnt);
751  $a_tpl->setVariable("SEL_ALL_PARENT", "bl_cntr_".$this->bl_cnt);
752  $a_tpl->setVariable("SEL_ALL_PARENT", "bl_cntr_".$this->bl_cnt);
753  $a_tpl->setVariable("TXT_SELECT_ALL", $lng->txt("select_all"));
754  $a_tpl->parseCurrentBlock();
755  $this->bl_cnt++;
756  }
757 
761  function resetRowType()
762  {
763  $this->cur_row_type = "";
764  }
765 
769  function insertPageEmbeddedBlocks($a_output_html)
770  {
771  $this->determinePageEmbeddedBlocks($a_output_html);
772  $this->renderPageEmbeddedBlocks($this->items);
773 
774  $type_grps = $this->getGroupedObjTypes();
775 
776  // iterate all types
777  foreach ($type_grps as $type => $v)
778  {
779  // set template (overall or type specific)
780  if (is_int(strpos($a_output_html, "[list-".$type."]")))
781  {
782  $a_output_html = eregi_replace("\[list-".$type."\]",
783  $this->rendered_block["type"][$type], $a_output_html);
784  }
785  }
786 
787  // insert all item groups
788  while (eregi("\[(item-group-([0-9]*))\]", $a_output_html, $found))
789  {
790  $itgr_ref_id = (int) $found[2];
791 
792  // check whether this item group is child -> insert editing html
793  $html = "";
794  if (isset($this->rendered_block["itgr"][$itgr_ref_id]))
795  {
796  $html = $this->rendered_block["itgr"][$itgr_ref_id];
797  $this->rendered_items[$itgr_ref_id] = true;
798  }
799  $a_output_html = eregi_replace("\[".$found[1]."\]", $html, $a_output_html);
800  }
801 
802  return $a_output_html;
803  }
804 
808  function addMessageRow(&$a_tpl, $a_message, $a_type)
809  {
810  global $lng, $objDefinition;
811 
812  $this->cur_row_type = ($this->cur_row_type == "row_type_1")
813  ? "row_type_2"
814  : "row_type_1";
815 
816  $a_tpl->touchBlock($this->cur_row_type);
817 
818  if (!$objDefinition->isPlugin($type))
819  {
820  $type = $lng->txt("obj_".$a_type);
821  }
822  else
823  {
824  include_once("./Services/Component/classes/class.ilPlugin.php");
825  $title = ilPlugin::lookupTxt("rep_robj", $a_type, "objs_".$a_type);
826  }
827  $a_message = str_replace("[type]", $type, $a_message);
828 
829  $a_tpl->setVariable("ROW_NBSP", "&nbsp;");
830 
831  $a_tpl->setCurrentBlock("container_standard_row");
832  $a_tpl->setVariable("BLOCK_ROW_CONTENT",
833  $a_message);
834  $a_tpl->parseCurrentBlock();
835  $a_tpl->touchBlock("container_row");
836  }
837 
841  function addSeparatorRow(&$a_tpl)
842  {
843  global $lng;
844 
845  $a_tpl->setCurrentBlock("container_block");
846  $a_tpl->parseCurrentBlock();
847  }
848 
855  {
856  global $objDefinition;
857 
858  if (empty($this->type_grps))
859  {
860  $this->type_grps =
861  $objDefinition->getGroupedRepositoryObjectTypes($this->getContainerObject()->getType());
862  }
863  return $this->type_grps;
864  }
865 
869  function getIntroduction()
870  {
871  global $ilUser, $lng, $ilCtrl;
872 
873  $lng->loadLanguageModule("rep");
874 
875  $tpl = new ilTemplate("tpl.rep_intro.html", true, true, "Services/Repository");
876  $tpl->setVariable("IMG_REP_LARGE", ilUtil::getImagePath("icon_root_xxl.png"));
877  $tpl->setVariable("TXT_WELCOME", $lng->txt("rep_intro"));
878  $tpl->setVariable("TXT_INTRO_1", $lng->txt("rep_intro1"));
879  $tpl->setVariable("TXT_INTRO_2", $lng->txt("rep_intro2"));
880  $tpl->setVariable("TXT_INTRO_3", sprintf($lng->txt("rep_intro3"), $lng->txt("add")));
881  $tpl->setVariable("TXT_INTRO_4", sprintf($lng->txt("rep_intro4"), $lng->txt("cat_add")));
882  $tpl->setVariable("TXT_INTRO_5", $lng->txt("rep_intro5"));
883  $tpl->setVariable("TXT_INTRO_6", $lng->txt("rep_intro6"));
884 
885  return $tpl->get();
886  }
887 
894  function getItemGroupsHTML($a_tpl)
895  {
896  $rendered = false;
897  if (is_array($this->items["itgr"]))
898  {
899  foreach ($this->items["itgr"] as $itgr)
900  {
901  if (!$this->rendered_items[$itgr["child"]])
902  {
903  $this->renderItemGroup($a_tpl, $itgr);
904  $rendered = true;
905  }
906  }
907  }
908  return $rendered;
909  }
910 
917  function renderItemGroup($a_tpl, $a_itgr)
918  {
919  global $ilAccess;
920 
921  // #16493
922  $perm_ok = ($ilAccess->checkAccess("visible", "", $a_itgr['ref_id']) &&
923  $ilAccess->checkAccess("read", "", $a_itgr['ref_id']));
924 
925  include_once('./Services/Container/classes/class.ilContainerSorting.php');
926  include_once('./Services/Object/classes/class.ilObjectActivation.php');
927  $items = ilObjectActivation::getItemsByItemGroup($a_itgr['ref_id']);
929  $this->getContainerObject()->getId())->sortSubItems('itgr', $a_itgr['obj_id'],$items);
930 
931  // if no permissoin is given, set the items to "rendered" but
932  // do not display the whole block
933  if (!$perm_ok)
934  {
935  foreach($items as $item)
936  {
937  $this->rendered_items[$item["child"]] = true;
938  }
939  return;
940  }
941 
942  $item_list_gui = $this->getItemGUI($a_itgr);
943  $item_list_gui->enableNotes(false);
944  $item_list_gui->enableTags(false);
945  $item_list_gui->enableComments(false);
946  $item_list_gui->enableTimings(false);
947  $item_list_gui->getListItemHTML($a_itgr["ref_id"], $a_itgr["obj_id"],
948  $a_itgr["title"], $a_itgr["description"]);
949  $commands_html = $item_list_gui->getCommandsHTML();
950 
951  $this->addSeparatorRow($a_tpl);
952 
953  $a_tpl->setVariable("CB_ID", ' id="bl_cntr_'.$this->bl_cnt.'"');
954  if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$_SESSION["clipboard"])
955  {
956  $this->renderSelectAllBlock($a_tpl);
957  }
958  else if ($this->getContainerGUI()->isMultiDownloadEnabled())
959  {
960  // contains file or folder?
961  foreach ($items as $item)
962  {
963  if (in_array($item["type"], $this->getDownloadableTypes()))
964  {
965  $this->renderSelectAllBlock($a_tpl);
966  break;
967  }
968  }
969  }
970 
971  $a_tpl->setCurrentBlock("container_header_row");
972  $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $a_itgr["title"]);
973  $a_tpl->setVariable("CHR_COMMANDS", $commands_html);
974  $a_tpl->parseCurrentBlock();
975 
976  $a_tpl->touchBlock("container_row");
977  $this->resetRowType();
978 
979  // render item group sub items
980 
981  $position = 1;
982  foreach($items as $item)
983  {
984  $html2 = $this->renderItem($item, $position++, false, "[itgr][".$a_itgr['obj_id']."]");
985  if ($html2 != "")
986  {
987  $this->addStandardRow($a_tpl, $html2, $item["child"]);
988  $this->rendered_items[$item["child"]] = true;
989  }
990  }
991 
992  // finish block
993  $a_tpl->setCurrentBlock("container_block");
994  $a_tpl->parseCurrentBlock();
995  }
996 
997 }
998 ?>