ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilPCFileListTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 
6 include_once("Services/Table/classes/class.ilTable2GUI.php");
7 
17 {
21  protected $ctrl;
22 
23 
24  public function __construct($a_parent_obj, $a_parent_cmd, $a_file_list)
25  {
26  global $DIC;
27 
28  $this->ctrl = $DIC->ctrl();
29  $this->lng = $DIC->language();
30  $ilCtrl = $DIC->ctrl();
31  $lng = $DIC->language();
32 
33  parent::__construct($a_parent_obj, $a_parent_cmd);
34 
35  $this->addColumn("", "", "1");
36  $this->addColumn($lng->txt("cont_position"), "", "1");
37  if ($this->getParentObject()->checkStyleSelection()) {
38  $this->addColumn($lng->txt("cont_file"), "", "50%");
39  $this->addColumn($lng->txt("cont_characteristic"), "", "50%");
40  } else {
41  $this->addColumn($lng->txt("cont_file"), "", "100%");
42  }
43  $this->setEnableHeader(true);
44  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
45  $this->setRowTemplate(
46  "tpl.file_list_row.html",
47  "Services/COPage"
48  );
49 
50  $this->file_list = $a_file_list;
51  $this->setData($this->file_list->getFileList());
52  $this->setLimit(0);
53 
54  $this->addMultiCommand("deleteFileItem", $lng->txt("delete"));
55  if (count($this->getData()) > 0) {
56  if ($this->getParentObject()->checkStyleSelection()) {
57  $this->addCommandButton("savePositionsAndClasses", $lng->txt("cont_save_positions_and_classes"));
58  } else {
59  $this->addCommandButton("savePositions", $lng->txt("cont_save_positions"));
60  }
61  }
62 
63  $this->setTitle($lng->txt("cont_files"));
64  }
65 
70  protected function fillRow($a_set)
71  {
72  $lng = $this->lng;
74 
75  if ($this->getParentObject()->checkStyleSelection()) {
76  $this->tpl->setCurrentBlock("class_sel");
77  $sel = ($a_set["class"] == "")
78  ? "FileListItem"
79  : $a_set["class"];
80  $this->tpl->setVariable("CLASS_SEL", ilUtil::formSelect(
81  $sel,
82  "class[" . $a_set["hier_id"] . ":" . $a_set["pc_id"] . "]",
83  $this->getParentObject()->getCharacteristics(),
84  false,
85  true
86  ));
87  $this->tpl->parseCurrentBlock();
88  }
89 
90  $this->pos += 10;
91  $this->tpl->setVariable("POS", $this->pos);
92  $this->tpl->setVariable("FID", $a_set["hier_id"] . ":" . $a_set["pc_id"]);
93  $this->tpl->setVariable("TXT_FILE", ilObject::_lookupTitle($a_set["id"]));
94  }
95 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
__construct($a_parent_obj, $a_parent_cmd, $a_file_list)
global $DIC
Definition: saml.php:7
static _lookupTitle($a_id)
lookup object title
getParentObject()
Get parent object.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setEnableHeader($a_enableheader)
Set Enable Header.
TableGUI class for file list.
fillRow($a_set)
Standard Version of Fill Row.
setLimit($a_limit=0, $a_default_limit=0)