ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 {
17 
21  function __construct($a_parent_obj, $a_parent_cmd, $a_chars, $a_super_type, $a_style)
22  {
23  global $ilCtrl, $lng, $ilAccess, $lng, $rbacsystem;
24 
25  parent::__construct($a_parent_obj, $a_parent_cmd);
26  $this->media_object = $a_media_object;
27  $this->super_type = $a_super_type;
28  $this->style = $a_style;
29  $all_super_types = ilObjStyleSheet::_getStyleSuperTypes();
30  $this->types = $all_super_types[$this->super_type];
31  $this->core_styles = ilObjStyleSheet::_getCoreStyles();
32  $this->setData($a_chars);
33  $this->setTitle($lng->txt("sty_".$a_super_type."_char"));
34  $this->setLimit(9999);
35 
36  // check, whether any of the types is expandable
37  $this->expandable = false;
38  $this->hideable = false;
39  foreach ($this->types as $t)
40  {
42  {
43  $this->expandable = true;
44  }
46  {
47  $this->hideable = true;
48  }
49  }
50 
51 // if ($this->expandable)
52 // {
53  $this->addColumn("", "", "1"); // checkbox
54 // }
55  $this->addColumn($this->lng->txt("sty_name"), "", "1");
56  $this->addColumn($this->lng->txt("sty_type"), "", "");
57  $this->addColumn($this->lng->txt("sty_example"), "", "");
58  if ($this->hideable)
59  {
60  $this->addColumn($this->lng->txt("sty_hide"), "", ""); // hide checkbox
61  }
62  $this->addColumn($this->lng->txt("sty_commands"), "", "1");
63  $this->setEnableHeader(true);
64  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
65  $this->setRowTemplate("tpl.style_row.html", "Services/Style");
66  $this->disable("footer");
67 
68  if ($rbacsystem->checkAccess("write", (int) $_GET["ref_id"]))
69  {
70  // action commands
71  if ($this->hideable)
72  {
73  $this->addCommandButton("saveHideStatus", $lng->txt("sty_save_hide_status"));
74  }
75 
76  $this->addMultiCommand("copyCharacteristics", $lng->txt("copy"));
77 
78  // action commands
79  if ($this->expandable)
80  {
81  $this->addMultiCommand("deleteCharacteristicConfirmation", $lng->txt("delete"));
82  //$this->addCommandButton("addCharacteristicForm", $lng->txt("sty_add_characteristic"));
83  }
84  }
85 
86  $this->setEnableTitle(true);
87  }
88 
93  protected function fillRow($a_set)
94  {
95  global $lng, $ilCtrl, $ilAccess, $rbacsystem;
96 
98  $types = $stypes[$this->super_type];
99 
100  if (!in_array($a_set["type"], $types))
101  {
102  return;
103  }
104 //var_dump($a_set);
105  // checkbox row
106 /* if ($this->expandable)
107  {
108  if (!empty($this->core_styles[$a_set["type"].".".
109  ilObjStyleSheet::_determineTag($a_set["type"]).
110  ".".$a_set["class"]]))
111  {
112  $this->tpl->touchBlock("no_checkbox");
113  }
114  else
115  {*/
116  $this->tpl->setCurrentBlock("checkbox");
117  $this->tpl->setVariable("CHAR", $a_set["type"].".".
118  ilObjStyleSheet::_determineTag($a_set["type"]).
119  ".".$a_set["class"]);
120  $this->tpl->parseCurrentBlock();
121 /* }
122  }*/
123 
124  if ($this->hideable)
125  {
126  if (!ilObjStyleSheet::_isHideable($a_set["type"]) ||
127  (!empty($this->core_styles[$a_set["type"].".".
128  ilObjStyleSheet::_determineTag($a_set["type"]).
129  ".".$a_set["class"]])))
130  {
131  $this->tpl->touchBlock("no_hide_checkbox");
132  }
133  else
134  {
135  $this->tpl->setCurrentBlock("hide_checkbox");
136  $this->tpl->setVariable("CHAR", $a_set["type"].".".
137  ilObjStyleSheet::_determineTag($a_set["type"]).
138  ".".$a_set["class"]);
139  if ($this->style->getHideStatus($a_set["type"], $a_set["class"]))
140  {
141  $this->tpl->setVariable("CHECKED", "checked='checked'");
142  }
143  $this->tpl->parseCurrentBlock();
144  }
145  }
146 
147  // example
148  $this->tpl->setVariable("EXAMPLE",
149  ilObjStyleSheetGUI::getStyleExampleHTML($a_set["type"], $a_set["class"]));
150  $tag_str = ilObjStyleSheet::_determineTag($a_set["type"]).".".$a_set["class"];
151  $this->tpl->setVariable("TXT_TAG", $a_set["class"]);
152  $this->tpl->setVariable("TXT_TYPE", $lng->txt("sty_type_".$a_set["type"]));
153 
154  if ($rbacsystem->checkAccess("write", (int) $_GET["ref_id"]))
155  {
156  $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
157  $ilCtrl->setParameter($this->parent_obj, "tag", $tag_str);
158  $ilCtrl->setParameter($this->parent_obj, "style_type", $a_set["type"]);
159  $this->tpl->setVariable("LINK_EDIT_TAG_STYLE",
160  $ilCtrl->getLinkTarget($this->parent_obj, "editTagStyle"));
161  }
162  }
163 
164 }
165 ?>