ILIAS  release_4-3 Revision
 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 
22 
24 
27 
32  function __construct(&$container_gui_obj)
33  {
34  $this->container_gui = $container_gui_obj;
35  $this->container_obj = $this->container_gui->object;
36  }
37 
45  protected function getDetailsLevel($a_item_id)
46  {
47  return $this->details_level;
48  }
49 
55  public function getContainerObject()
56  {
57  return $this->container_obj;
58  }
59 
65  public function getContainerGUI()
66  {
67  return $this->container_gui;
68  }
69 
76  public function setOutput()
77  {
78  global $tpl, $ilCtrl;
79 
80  // note: we do not want to get the center html in case of
81  // asynchronous calls to blocks in the right column (e.g. news)
82  // see #13012
83  if ($ilCtrl->getNextClass() == "ilcolumngui" &&
84  $ilCtrl->isAsynch())
85  {
86  $tpl->setRightContent($this->getRightColumnHTML());
87  }
88 
89  // BEGIN ChangeEvent: record read event.
90  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
91  global $ilUser;
92 //global $log;
93 //$log->write("setOutput");
94 
95  $obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
97  $this->getContainerObject()->getType(),
98  $this->getContainerObject()->getRefId(),
99  $obj_id, $ilUser->getId());
100  // END ChangeEvent: record read event.
101 
102 
103  $tpl->setContent($this->getCenterColumnHTML());
104 
105  // see above, all other cases (this was the old position of setRightContent,
106  // maybe the position above is ok and all ifs can be removed)
107  if ($ilCtrl->getNextClass() != "ilcolumngui" ||
108  !$ilCtrl->isAsynch())
109  {
110  $tpl->setRightContent($this->getRightColumnHTML());
111  }
112 
113  }
114 
118  protected function getRightColumnHTML()
119  {
120  global $ilUser, $lng, $ilCtrl, $ilAccess, $ilPluginAdmin;;
121 
122  $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
123 
124  $obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
125  $obj_type = ilObject::_lookupType($obj_id);
126 
127  include_once("Services/Block/classes/class.ilColumnGUI.php");
128  $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
129 
130  if ($column_gui->getScreenMode() == IL_SCREEN_FULL)
131  {
132  return "";
133  }
134 
135  $this->getContainerGUI()->setColumnSettings($column_gui);
136 
137  if ($ilCtrl->getNextClass() == "ilcolumngui" &&
138  $column_gui->getCmdSide() == IL_COL_RIGHT &&
139  $column_gui->getScreenMode() == IL_SCREEN_SIDE)
140  {
141 
142  $html = $ilCtrl->forwardCommand($column_gui);
143  }
144  else
145  {
146  if (!$ilCtrl->isAsynch())
147  {
148  $html = "";
149 
150  // user interface plugin slot + default rendering
151  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
152  $uip = new ilUIHookProcessor("Services/Container", "right_column",
153  array("container_content_gui" => $this));
154  if (!$uip->replaced())
155  {
156  $html = $ilCtrl->getHTML($column_gui);
157  }
158  $html = $uip->getHTML($html);
159  }
160  }
161 
162  return $html;
163  }
164 
168  protected function getCenterColumnHTML()
169  {
170  global $ilCtrl, $tpl;
171 
172  $ilCtrl->saveParameterByClass("ilcolumngui", "col_return");
173 
174  $tpl->addOnLoadCode("il.Object.setRedrawListItemUrl('".
175  $ilCtrl->getLinkTarget($this->container_gui, "redrawListItem", "", true)."');");
176 
177  switch ($ilCtrl->getNextClass())
178  {
179  case "ilcolumngui":
180  $ilCtrl->setReturn($this->container_gui, "");
181  $html = $this->__forwardToColumnGUI();
182  break;
183 
184  default:
185  $html = $this->getMainContent();
186  break;
187  }
188 
189  return $html;
190  }
191 
196  abstract function getMainContent();
197 
201  final private function __forwardToColumnGUI()
202  {
203  global $ilCtrl, $ilAccess;
204 
205  include_once("Services/Block/classes/class.ilColumnGUI.php");
206 
207  // this gets us the subitems we need in setColumnSettings()
208  // todo: this should be done in ilCourseGUI->getSubItems
209 
210  $obj_id = ilObject::_lookupObjId($this->getContainerObject()->getRefId());
211  $obj_type = ilObject::_lookupType($obj_id);
212 
213  if (!$ilCtrl->isAsynch())
214  {
215  //if ($column_gui->getScreenMode() != IL_SCREEN_SIDE)
217  {
218  // right column wants center
220  {
221  $column_gui = new ilColumnGUI($obj_type, IL_COL_RIGHT);
222  $this->getContainerGUI()->setColumnSettings($column_gui);
223  $html = $ilCtrl->forwardCommand($column_gui);
224  }
225  // left column wants center
227  {
228  $column_gui = new ilColumnGUI($obj_type, IL_COL_LEFT);
229  $this->getContainerGUI()->setColumnSettings($column_gui);
230  $html = $ilCtrl->forwardCommand($column_gui);
231  }
232  }
233  else
234  {
235  $html = $this->getMainContent();
236  }
237  }
238 
239  return $html;
240  }
241 
245  protected function clearAdminCommandsDetermination()
246  {
247  $this->adminCommands = false;
248  }
249 
253  protected function determineAdminCommands($a_ref_id, $a_admin_com_included_in_list = false)
254  {
255  global $rbacsystem;
256 
257 //echo "-".$a_admin_com_included_in_list."-";
258 
259  if (!$this->adminCommands)
260  {
261  if (!$this->getContainerGUI()->isActiveAdministrationPanel())
262  {
263  if ($rbacsystem->checkAccess("delete", $a_ref_id))
264  {
265  $this->adminCommands = true;
266  }
267  }
268  else
269  {
270  $this->adminCommands = $a_admin_com_included_in_list;
271  }
272  }
273  }
274 
278  protected function getItemGUI($item_data,$a_show_path = false)
279  {
280  include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
281 
282  // get item list gui object
283  if (!is_object ($this->list_gui[$item_data["type"]]))
284  {
285  $item_list_gui =& ilObjectListGUIFactory::_getListGUIByType($item_data["type"]);
286  $item_list_gui->setContainerObject($this->getContainerGUI());
287  $this->list_gui[$item_data["type"]] =& $item_list_gui;
288  }
289  else
290  {
291  $item_list_gui =& $this->list_gui[$item_data["type"]];
292  }
293 
294  // show administration command buttons (or not)
295  if (!$this->getContainerGUI()->isActiveAdministrationPanel())
296  {
297 // $item_list_gui->enableDelete(false);
298 // $item_list_gui->enableLink(false);
299 // $item_list_gui->enableCut(false);
300  }
301 
302  // activate common social commands
303  $item_list_gui->enableComments(true);
304  $item_list_gui->enableNotes(true);
305  $item_list_gui->enableTags(true);
306 
307  // container specific modifications
308  $this->getContainerGUI()->modifyItemGUI($item_list_gui, $item_data, $a_show_path);
309 
310  return $item_list_gui;
311  }
312 
316  function determinePageEmbeddedBlocks($a_container_page_html)
317  {
318  $type_grps = $this->getGroupedObjTypes();
319 
320  // iterate all types
321  foreach ($type_grps as $type => $v)
322  {
323  // set template (overall or type specific)
324  if (is_int(strpos($a_container_page_html, "[list-".$type."]")))
325  {
326  $this->addEmbeddedBlock("type", $type);
327  }
328  }
329 
330  // determine item groups
331  while (eregi("\[(item-group-([0-9]*))\]", $a_container_page_html, $found))
332  {
333  $this->addEmbeddedBlock("itgr", (int) $found[2]);
334 
335  $a_container_page_html = eregi_replace("\[".$found[1]."\]", $html, $a_container_page_html);
336  }
337  }
338 
344  function addEmbeddedBlock($block_type, $block_parameter)
345  {
346  $this->embedded_block[$block_type][] = $block_parameter;
347  }
348 
352  function getEmbeddedBlocks()
353  {
354  return $this->embedded_block;
355  }
356 
361  {
362  global $lng;
363 
364  // first all type specific blocks
365  if (is_array($this->embedded_block["type"]))
366  {
367  // all embedded typed blocks
368  foreach ($this->embedded_block["type"] as $k => $type)
369  {
370  if ($this->rendered_block["type"][$type] == "")
371  {
372  if (is_array($this->items[$type]))
373  {
374  $tpl = $this->newBlockTemplate();
375 
376  // the header
377  $this->addHeaderRow($tpl, $type);
378 
379  // all rows
380  $item_rendered = false;
381  $position = 1;
382 
383  if($type == 'sess')
384  {
385  $this->items['sess'] = ilUtil::sortArray($this->items['sess'],'start','ASC',true,true);
386  }
387 
388  foreach($this->items[$type] as $k => $item_data)
389  {
390  $html = $this->renderItem($item_data,$position++);
391  if ($html != "")
392  {
393  $this->addStandardRow($tpl, $html, $item_data["child"]);
394  $item_rendered = true;
395  $this->rendered_items[$item_data["child"]] = true;
396  }
397  }
398 
399  // if no item has been rendered, add message
400  if (!$item_rendered)
401  {
402  //$this->addMessageRow($tpl, $lng->txt("msg_no_type_accessible"), $type);
403  $this->rendered_block["type"][$type] = "";
404  }
405  else
406  {
407  $this->rendered_block["type"][$type] = $tpl->get();
408  }
409  }
410  }
411  }
412  }
413 
414  // all item groups
415  if (is_array($this->embedded_block["itgr"]))
416  {
417  $item_groups = array();
418  if (is_array($this->items["itgr"]))
419  {
420 
421  foreach ($this->items["itgr"] as $ig)
422  {
423  $item_groups[$ig["ref_id"]] = $ig;
424  }
425  }
426 
427  // all embedded typed blocks
428  foreach ($this->embedded_block["itgr"] as $ref_id)
429  {
430  // render only item groups of $this->items (valid childs)
431  if ($this->rendered_block["itgr"][$ref_id] == "" && isset($item_groups[$ref_id]))
432  {
433  $tpl = $this->newBlockTemplate();
434  $this->renderItemGroup($tpl, $item_groups[$ref_id]);
435  $this->rendered_block["itgr"][$ref_id] = $tpl->get();
436  }
437  }
438  }
439 
440  }
441 
449  function renderItem($a_item_data,$a_position = 0,$a_force_icon = false, $a_pos_prefix = "")
450  {
451  global $ilSetting,$ilAccess,$ilCtrl;
452 
453  // Pass type, obj_id and tree to checkAccess method to improve performance
454  if(!$ilAccess->checkAccess('visible','',$a_item_data['ref_id'],$a_item_data['type'],$a_item_data['obj_id'],$a_item_data['tree']))
455  {
456  return '';
457  }
458 
459  $item_list_gui = $this->getItemGUI($a_item_data);
460  if ($ilSetting->get("icon_position_in_lists") == "item_rows" ||
461  $a_item_data["type"] == "sess" || $a_force_icon)
462  {
463  $item_list_gui->enableIcon(true);
464  }
465  if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$_SESSION["clipboard"])
466  {
467  $item_list_gui->enableCheckbox(true);
468  }
469  if ($this->getContainerGUI()->isActiveOrdering() && ($a_item_data['type'] != 'sess' || get_class($this) != 'ilContainerSessionsContentGUI'))
470  {
471  $item_list_gui->setPositionInputField($a_pos_prefix."[".$a_item_data["ref_id"]."]",
472  sprintf('%d', (int)$a_position*10));
473  }
474  if($a_item_data['type'] == 'sess' and get_class($this) != 'ilContainerObjectiveGUI')
475  {
476  switch($this->getDetailsLevel($a_item_data['obj_id']))
477  {
478  case self::DETAILS_TITLE:
479  $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_MINIMAL);
480  $item_list_gui->enableExpand(true);
481  $item_list_gui->setExpanded(false);
482  $item_list_gui->enableDescription(false);
483  $item_list_gui->enableProperties(true);
484  break;
485 
486  case self::DETAILS_ALL:
487  $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_ALL);
488  $item_list_gui->enableExpand(true);
489  $item_list_gui->setExpanded(true);
490  $item_list_gui->enableDescription(true);
491  $item_list_gui->enableProperties(true);
492  break;
493 
494  default:
495  $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_ALL);
496  $item_list_gui->enableExpand(true);
497  $item_list_gui->enableDescription(true);
498  $item_list_gui->enableProperties(true);
499  break;
500  }
501  }
502 
503  // show subitems
504  if($a_item_data['type'] == 'sess' and (
505  $this->getDetailsLevel($a_item_data['obj_id']) != self::DETAILS_TITLE or
506  $this->getContainerGUI()->isActiveAdministrationPanel() or
507  $this->getContainerGUI()->isActiveOrdering()
508  )
509  )
510  {
511  $pos = 1;
512 
513  include_once('./Services/Container/classes/class.ilContainerSorting.php');
514  include_once('./Services/Object/classes/class.ilObjectActivation.php');
515  $items = ilObjectActivation::getItemsByEvent($a_item_data['obj_id']);
516  $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('sess',$a_item_data['obj_id'],$items);
517 
518 
519  $item_readable = $ilAccess->checkAccess('read','',$a_item_data['ref_id']);
520 
521  foreach($items as $item)
522  {
523  // TODO: this should be removed and be handled by if(strlen($sub_item_html))
524  // see mantis: 0003944
525  if(!$ilAccess->checkAccess('visible','',$item['ref_id']))
526  {
527  continue;
528  }
529 
530  $item_list_gui2 = $this->getItemGUI($item);
531  $item_list_gui2->enableIcon(true);
532  $item_list_gui2->enableItemDetailLinks(false);
533 
534  // @see mantis 10488
535  if(!$item_readable and !$ilAccess->checkAccess('write','',$item['ref_id']))
536  {
537  $item_list_gui2->forceVisibleOnly(true);
538  }
539 
540  if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$_SESSION["clipboard"])
541  {
542  $item_list_gui2->enableCheckbox(true);
543  }
544  if ($this->getContainerGUI()->isActiveOrdering())
545  {
546  if ($this->getContainerObject()->getOrderType() == ilContainer::SORT_MANUAL)
547  {
548  $item_list_gui2->setPositionInputField("[sess][".$a_item_data['obj_id']."][".$item["ref_id"]."]",
549  sprintf('%d', (int)$pos*10));
550  $pos++;
551  }
552  }
553 
554  // #10611
555  ilObjectActivation::addListGUIActivationProperty($item_list_gui2, $item);
556 
557  $sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'],
558  $item['obj_id'], $item['title'], $item['description']);
559 
560  $this->determineAdminCommands($item["ref_id"],$item_list_gui2->adminCommandsIncluded());
561  if(strlen($sub_item_html))
562  {
563  $item_list_gui->addSubItemHTML($sub_item_html);
564  }
565  }
566  }
567 
568  if ($ilSetting->get("item_cmd_asynch"))
569  {
570  $asynch = true;
571  $ilCtrl->setParameter($this->container_gui, "cmdrefid", $a_item_data['ref_id']);
572  $asynch_url = $ilCtrl->getLinkTarget($this->container_gui,
573  "getAsynchItemList", "", true, false);
574  $ilCtrl->setParameter($this->container_gui, "cmdrefid", "");
575  }
576 
577  include_once "Services/Object/classes/class.ilObjectActivation.php";
578  ilObjectActivation::addListGUIActivationProperty($item_list_gui, $a_item_data);
579 
580  $html = $item_list_gui->getListItemHTML($a_item_data['ref_id'],
581  $a_item_data['obj_id'], $a_item_data['title'], $a_item_data['description'],
582  $asynch, false, $asynch_url);
583  $this->determineAdminCommands($a_item_data["ref_id"],
584  $item_list_gui->adminCommandsIncluded());
585 
586 
587  return $html;
588  }
589 
596  function newBlockTemplate()
597  {
598  $tpl = new ilTemplate("tpl.container_list_block.html", true, true,
599  "Services/Container");
600  $this->cur_row_type = "row_type_1";
601  return $tpl;
602  }
603 
607  function addStandardRow(&$a_tpl, $a_html, $a_ref_id = 0)
608  {
609  global $ilSetting, $lng;
610 
611  $this->cur_row_type = ($this->cur_row_type == "row_type_1")
612  ? "row_type_2"
613  : "row_type_1";
614 
615  if ($a_ref_id > 0)
616  {
617  $a_tpl->setCurrentBlock($this->cur_row_type);
618  $a_tpl->setVariable("ROW_ID", 'id="item_row_'.$a_ref_id.'"');
619  $a_tpl->parseCurrentBlock();
620  }
621  else
622  {
623  $a_tpl->touchBlock($this->cur_row_type);
624  }
625 
626  $a_tpl->setCurrentBlock("container_standard_row");
627  $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
628  $a_tpl->parseCurrentBlock();
629  $a_tpl->touchBlock("container_row");
630  }
631 
635  function addHeaderRow($a_tpl, $a_type = "", $a_text = "")
636  {
637  global $lng, $ilSetting, $objDefinition;
638 
639  $a_tpl->setVariable("CB_ID", ' id="bl_cntr_'.$this->bl_cnt.'"');
640  if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$_SESSION["clipboard"])
641  {
642  $a_tpl->setCurrentBlock("select_all_row");
643  $a_tpl->setVariable("CHECKBOXNAME", "bl_cb_".$this->bl_cnt);
644  $a_tpl->setVariable("SEL_ALL_PARENT", "bl_cntr_".$this->bl_cnt);
645  $a_tpl->setVariable("SEL_ALL_PARENT", "bl_cntr_".$this->bl_cnt);
646  $a_tpl->setVariable("TXT_SELECT_ALL", $lng->txt("select_all"));
647  $a_tpl->parseCurrentBlock();
648  $this->bl_cnt++;
649  }
650 
651  if ($a_text == "" && $a_type != "")
652  {
653  if (!$objDefinition->isPlugin($a_type))
654  {
655  $title = $lng->txt("objs_".$a_type);
656  }
657  else
658  {
659  include_once("./Services/Component/classes/class.ilPlugin.php");
660  $title = ilPlugin::lookupTxt("rep_robj", $a_type, "objs_".$a_type);
661  }
662  }
663  else
664  {
665  $title = $a_text;
666  }
667 
668  if ($ilSetting->get("icon_position_in_lists") != "item_rows" &&
669  $a_type != "")
670  {
671  $icon = ilUtil::getImagePath("icon_".$a_type.".png");
672 
673  $a_tpl->setCurrentBlock("container_header_row_image");
674  $a_tpl->setVariable("HEADER_IMG", $icon);
675  $a_tpl->setVariable("HEADER_ALT", $title);
676  }
677  else
678  {
679  $a_tpl->setCurrentBlock("container_header_row");
680  }
681 
682  $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
683  $a_tpl->parseCurrentBlock();
684  $a_tpl->touchBlock("container_row");
685 
686  $this->resetRowType();
687  }
688 
689 
693  function resetRowType()
694  {
695  $this->cur_row_type = "";
696  }
697 
701  function insertPageEmbeddedBlocks($a_output_html)
702  {
703  $this->determinePageEmbeddedBlocks($a_output_html);
704  $this->renderPageEmbeddedBlocks($this->items);
705 
706  $type_grps = $this->getGroupedObjTypes();
707 
708  // iterate all types
709  foreach ($type_grps as $type => $v)
710  {
711  // set template (overall or type specific)
712  if (is_int(strpos($a_output_html, "[list-".$type."]")))
713  {
714  $a_output_html = eregi_replace("\[list-".$type."\]",
715  $this->rendered_block["type"][$type], $a_output_html);
716  }
717  }
718 
719  // insert all item groups
720  while (eregi("\[(item-group-([0-9]*))\]", $a_output_html, $found))
721  {
722  $itgr_ref_id = (int) $found[2];
723 
724  // check whether this item group is child -> insert editing html
725  $html = "";
726  if (isset($this->rendered_block["itgr"][$itgr_ref_id]))
727  {
728  $html = $this->rendered_block["itgr"][$itgr_ref_id];
729  $this->rendered_items[$itgr_ref_id] = true;
730  }
731  $a_output_html = eregi_replace("\[".$found[1]."\]", $html, $a_output_html);
732  }
733 
734  return $a_output_html;
735  }
736 
740  function addMessageRow(&$a_tpl, $a_message, $a_type)
741  {
742  global $lng, $objDefinition;
743 
744  $this->cur_row_type = ($this->cur_row_type == "row_type_1")
745  ? "row_type_2"
746  : "row_type_1";
747 
748  $a_tpl->touchBlock($this->cur_row_type);
749 
750  if (!$objDefinition->isPlugin($type))
751  {
752  $type = $lng->txt("obj_".$a_type);
753  }
754  else
755  {
756  include_once("./Services/Component/classes/class.ilPlugin.php");
757  $title = ilPlugin::lookupTxt("rep_robj", $a_type, "objs_".$a_type);
758  }
759  $a_message = str_replace("[type]", $type, $a_message);
760 
761  $a_tpl->setVariable("ROW_NBSP", "&nbsp;");
762 
763  $a_tpl->setCurrentBlock("container_standard_row");
764  $a_tpl->setVariable("BLOCK_ROW_CONTENT",
765  $a_message);
766  $a_tpl->parseCurrentBlock();
767  $a_tpl->touchBlock("container_row");
768  }
769 
773  function addSeparatorRow(&$a_tpl)
774  {
775  global $lng;
776 
777  $a_tpl->setCurrentBlock("container_block");
778  $a_tpl->parseCurrentBlock();
779  }
780 
787  {
788  global $objDefinition;
789 
790  if (empty($this->type_grps))
791  {
792  $this->type_grps =
793  $objDefinition->getGroupedRepositoryObjectTypes($this->getContainerObject()->getType());
794  }
795  return $this->type_grps;
796  }
797 
801  function getIntroduction()
802  {
803  global $ilUser, $lng, $ilCtrl;
804 
805  $lng->loadLanguageModule("rep");
806 
807  $tpl = new ilTemplate("tpl.rep_intro.html", true, true, "Services/Repository");
808  $tpl->setVariable("IMG_REP_LARGE", ilUtil::getImagePath("icon_root_xxl.png"));
809  $tpl->setVariable("TXT_WELCOME", $lng->txt("rep_intro"));
810  $tpl->setVariable("TXT_INTRO_1", $lng->txt("rep_intro1"));
811  $tpl->setVariable("TXT_INTRO_2", $lng->txt("rep_intro2"));
812  $tpl->setVariable("TXT_INTRO_3", sprintf($lng->txt("rep_intro3"), $lng->txt("add")));
813  $tpl->setVariable("TXT_INTRO_4", sprintf($lng->txt("rep_intro4"), $lng->txt("cat_add")));
814  $tpl->setVariable("TXT_INTRO_5", $lng->txt("rep_intro5"));
815  $tpl->setVariable("TXT_INTRO_6", $lng->txt("rep_intro6"));
816 
817  return $tpl->get();
818  }
819 
826  function getItemGroupsHTML($a_tpl)
827  {
828  $rendered = false;
829  if (is_array($this->items["itgr"]))
830  {
831  foreach ($this->items["itgr"] as $itgr)
832  {
833  if (!$this->rendered_items[$itgr["child"]])
834  {
835  $this->renderItemGroup($a_tpl, $itgr);
836  $rendered = true;
837  }
838  }
839  }
840  return $rendered;
841  }
842 
849  function renderItemGroup($a_tpl, $a_itgr)
850  {
851  global $ilAccess, $lng;
852 
853  $perm_ok = $ilAccess->checkAccess("read", "", $a_itgr['ref_id']);
854 
855  include_once('./Services/Container/classes/class.ilContainerSorting.php');
856  include_once('./Services/Object/classes/class.ilObjectActivation.php');
857  $items = ilObjectActivation::getItemsByItemGroup($a_itgr['ref_id']);
859  $this->getContainerObject()->getId())->sortSubItems('itgr', $a_itgr['obj_id'],$items);
860 
861  // if no permissoin is given, set the items to "rendered" but
862  // do not display the whole block
863  if (!$perm_ok)
864  {
865  foreach($items as $item)
866  {
867  $this->rendered_items[$item["child"]] = true;
868  }
869  return;
870  }
871 
872  $item_list_gui = $this->getItemGUI($a_itgr);
873  $item_list_gui->enableNotes(false);
874  $item_list_gui->enableTags(false);
875  $item_list_gui->enableComments(false);
876  $item_list_gui->enableTimings(false);
877  $item_list_gui->getListItemHTML($a_itgr["ref_id"], $a_itgr["obj_id"],
878  $a_itgr["title"], $a_itgr["description"]);
879  $commands_html = $item_list_gui->getCommandsHTML();
880 
881  $this->addSeparatorRow($a_tpl);
882 
883  $a_tpl->setVariable("CB_ID", ' id="bl_cntr_'.$this->bl_cnt.'"');
884  if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$_SESSION["clipboard"])
885  {
886  $a_tpl->setCurrentBlock("select_all_row");
887  $a_tpl->setVariable("CHECKBOXNAME", "bl_cb_".$this->bl_cnt);
888  $a_tpl->setVariable("SEL_ALL_PARENT", "bl_cntr_".$this->bl_cnt);
889  $a_tpl->setVariable("SEL_ALL_PARENT", "bl_cntr_".$this->bl_cnt);
890  $a_tpl->setVariable("TXT_SELECT_ALL", $lng->txt("select_all"));
891  $a_tpl->parseCurrentBlock();
892  $this->bl_cnt++;
893  }
894 
895  $a_tpl->setCurrentBlock("container_header_row");
896  $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $a_itgr["title"]);
897  $a_tpl->setVariable("CHR_COMMANDS", $commands_html);
898  $a_tpl->parseCurrentBlock();
899 
900  $a_tpl->touchBlock("container_row");
901  $this->resetRowType();
902 
903  // render item group sub items
904 
905  $position = 1;
906  foreach($items as $item)
907  {
908  $html2 = $this->renderItem($item, $position++, false, "[itgr][".$a_itgr['obj_id']."]");
909  if ($html2 != "")
910  {
911  $this->addStandardRow($a_tpl, $html2, $item["child"]);
912  $this->rendered_items[$item["child"]] = true;
913  }
914  }
915 
916  // finish block
917  $a_tpl->setCurrentBlock("container_block");
918  $a_tpl->parseCurrentBlock();
919  }
920 
921 }
922 ?>