ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilStyleTableGUI.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 include_once("Services/Table/classes/class.ilTable2GUI.php");
6 
16 {
20  protected $ctrl;
21 
25  protected $access;
26 
30  protected $rbacsystem;
31 
32 
36  public function __construct($a_parent_obj, $a_parent_cmd, $a_chars, $a_super_type, $a_style)
37  {
38  global $DIC;
39 
40  $this->ctrl = $DIC->ctrl();
41  $this->lng = $DIC->language();
42  $this->access = $DIC->access();
43  $this->rbacsystem = $DIC->rbac()->system();
44  $ilCtrl = $DIC->ctrl();
45  $lng = $DIC->language();
46  $ilAccess = $DIC->access();
47  $lng = $DIC->language();
48  $rbacsystem = $DIC->rbac()->system();
49 
50  parent::__construct($a_parent_obj, $a_parent_cmd);
51  $this->media_object = $a_media_object;
52  $this->super_type = $a_super_type;
53  $this->style = $a_style;
54  $all_super_types = ilObjStyleSheet::_getStyleSuperTypes();
55  $this->types = $all_super_types[$this->super_type];
56  $this->core_styles = ilObjStyleSheet::_getCoreStyles();
57  $this->setData($a_chars);
58  $this->setTitle($lng->txt("sty_" . $a_super_type . "_char"));
59  $this->setLimit(9999);
60 
61  // check, whether any of the types is expandable
62  $this->expandable = false;
63  $this->hideable = false;
64  foreach ($this->types as $t) {
66  $this->expandable = true;
67  }
69  $this->hideable = true;
70  }
71  }
72 
73  // if ($this->expandable)
74 // {
75  $this->addColumn("", "", "1"); // checkbox
76 // }
77  $this->addColumn($this->lng->txt("sty_name"), "", "1");
78  $this->addColumn($this->lng->txt("sty_type"), "", "");
79  $this->addColumn($this->lng->txt("sty_example"), "", "");
80  if ($this->hideable) {
81  $this->addColumn($this->lng->txt("sty_hide"), "", ""); // hide checkbox
82  }
83  $this->addColumn($this->lng->txt("sty_commands"), "", "1");
84  $this->setEnableHeader(true);
85  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
86  $this->setRowTemplate("tpl.style_row.html", "Services/Style/Content");
87  $this->disable("footer");
88 
89  if ($this->parent_obj->checkWrite()) {
90  // action commands
91  if ($this->hideable) {
92  $this->addCommandButton("saveHideStatus", $lng->txt("sty_save_hide_status"));
93  }
94 
95  $this->addMultiCommand("copyCharacteristics", $lng->txt("copy"));
96 
97  // action commands
98  if ($this->expandable) {
99  $this->addMultiCommand("deleteCharacteristicConfirmation", $lng->txt("delete"));
100  //$this->addCommandButton("addCharacteristicForm", $lng->txt("sty_add_characteristic"));
101  }
102  }
103 
104  $this->setEnableTitle(true);
105  }
106 
111  protected function fillRow($a_set)
112  {
113  $lng = $this->lng;
115  $ilAccess = $this->access;
117 
119  $types = $stypes[$this->super_type];
120 
121  if (!in_array($a_set["type"], $types)) {
122  return;
123  }
124  //var_dump($a_set);
125  // checkbox row
126  /* if ($this->expandable)
127  {
128  if (!empty($this->core_styles[$a_set["type"].".".
129  ilObjStyleSheet::_determineTag($a_set["type"]).
130  ".".$a_set["class"]]))
131  {
132  $this->tpl->touchBlock("no_checkbox");
133  }
134  else
135  {*/
136  $this->tpl->setCurrentBlock("checkbox");
137  $this->tpl->setVariable("CHAR", $a_set["type"] . "." .
138  ilObjStyleSheet::_determineTag($a_set["type"]) .
139  "." . $a_set["class"]);
140  $this->tpl->parseCurrentBlock();
141  /* }
142  }*/
143 
144  if ($this->hideable) {
145  if (!ilObjStyleSheet::_isHideable($a_set["type"]) ||
146  (!empty($this->core_styles[$a_set["type"] . "." .
147  ilObjStyleSheet::_determineTag($a_set["type"]) .
148  "." . $a_set["class"]]))) {
149  $this->tpl->touchBlock("no_hide_checkbox");
150  } else {
151  $this->tpl->setCurrentBlock("hide_checkbox");
152  $this->tpl->setVariable("CHAR", $a_set["type"] . "." .
153  ilObjStyleSheet::_determineTag($a_set["type"]) .
154  "." . $a_set["class"]);
155  if ($this->style->getHideStatus($a_set["type"], $a_set["class"])) {
156  $this->tpl->setVariable("CHECKED", "checked='checked'");
157  }
158  $this->tpl->parseCurrentBlock();
159  }
160  }
161 
162  // example
163  $this->tpl->setVariable(
164  "EXAMPLE",
165  ilObjStyleSheetGUI::getStyleExampleHTML($a_set["type"], $a_set["class"])
166  );
167  $tag_str = ilObjStyleSheet::_determineTag($a_set["type"]) . "." . $a_set["class"];
168  $this->tpl->setVariable("TXT_TAG", $a_set["class"]);
169  $this->tpl->setVariable("TXT_TYPE", $lng->txt("sty_type_" . $a_set["type"]));
170 
171  if ($this->parent_obj->checkWrite()) {
172  $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
173  $ilCtrl->setParameter($this->parent_obj, "tag", $tag_str);
174  $ilCtrl->setParameter($this->parent_obj, "style_type", $a_set["type"]);
175  $this->tpl->setVariable(
176  "LINK_EDIT_TAG_STYLE",
177  $ilCtrl->getLinkTarget($this->parent_obj, "editTagStyle")
178  );
179  }
180  }
181 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
global $DIC
Definition: saml.php:7
static _determineTag($a_type)
"color:#CC0000 style
Definition: example_001.php:92
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
static _isExpandable($a_type)
static _getCoreStyles()
Get core styles.
addMultiCommand($a_cmd, $a_text)
Add Command button.
TableGUI class for style editor.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
__construct($a_parent_obj, $a_parent_cmd, $a_chars, $a_super_type, $a_style)
Constructor.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
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.
static _isHideable($a_type)
setEnableHeader($a_enableheader)
Set Enable Header.
fillRow($a_set)
Standard Version of Fill Row.
setEnableTitle($a_enabletitle)
Set Enable Title.
static getStyleExampleHTML($a_type, $a_class)
Get style example HTML.
setLimit($a_limit=0, $a_default_limit=0)