ILIAS  Release_4_0_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  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2008 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once("Services/Table/classes/class.ilTable2GUI.php");
25 
35 {
36 
40  function __construct($a_parent_obj, $a_parent_cmd, $a_chars, $a_super_type, $a_style)
41  {
42  global $ilCtrl, $lng, $ilAccess, $lng;
43 
44  parent::__construct($a_parent_obj, $a_parent_cmd);
45  $this->media_object = $a_media_object;
46  $this->super_type = $a_super_type;
47  $this->style = $a_style;
48  $all_super_types = ilObjStyleSheet::_getStyleSuperTypes();
49  $this->types = $all_super_types[$this->super_type];
50  $this->core_styles = ilObjStyleSheet::_getCoreStyles();
51  $this->setData($a_chars);
52  $this->setTitle($lng->txt("sty_".$a_super_type."_char"));
53  $this->setLimit(9999);
54 
55  // check, whether any of the types is expandable
56  $this->expandable = false;
57  $this->hideable = false;
58  foreach ($this->types as $t)
59  {
61  {
62  $this->expandable = true;
63  }
65  {
66  $this->hideable = true;
67  }
68  }
69 
70  if ($this->expandable)
71  {
72  $this->addColumn("", "", "1"); // checkbox
73  }
74  $this->addColumn($this->lng->txt("sty_name"), "", "1");
75  $this->addColumn($this->lng->txt("sty_type"), "", "");
76  $this->addColumn($this->lng->txt("sty_example"), "", "");
77  if ($this->hideable)
78  {
79  $this->addColumn($this->lng->txt("sty_hide"), "", ""); // hide checkbox
80  }
81  $this->addColumn($this->lng->txt("sty_commands"), "", "1");
82  $this->setEnableHeader(true);
83  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
84  $this->setRowTemplate("tpl.style_row.html", "Services/Style");
85  $this->disable("footer");
86 
87  // action commands
88  if ($this->hideable)
89  {
90  $this->addCommandButton("saveHideStatus", $lng->txt("sty_save_hide_status"));
91  }
92 
93  // action commands
94  if ($this->expandable)
95  {
96  $this->addMultiCommand("deleteCharacteristicConfirmation", $lng->txt("delete"));
97  $this->addCommandButton("addCharacteristicForm", $lng->txt("sty_add_characteristic"));
98  }
99 
100  $this->setEnableTitle(true);
101  }
102 
107  protected function fillRow($a_set)
108  {
109  global $lng, $ilCtrl, $ilAccess;
110 
112  $types = $stypes[$this->super_type];
113 
114  if (!in_array($a_set["type"], $types))
115  {
116  return;
117  }
118 //var_dump($a_set);
119  // checkbox row
120  if ($this->expandable)
121  {
122  if (!empty($this->core_styles[$a_set["type"].".".
123  ilObjStyleSheet::_determineTag($a_set["type"]).
124  ".".$a_set["class"]]))
125  {
126  $this->tpl->touchBlock("no_checkbox");
127  }
128  else
129  {
130  $this->tpl->setCurrentBlock("checkbox");
131  $this->tpl->setVariable("CHAR", $a_set["type"].".".
132  ilObjStyleSheet::_determineTag($a_set["type"]).
133  ".".$a_set["class"]);
134  $this->tpl->parseCurrentBlock();
135  }
136  }
137 
138  if ($this->hideable)
139  {
140  if (!ilObjStyleSheet::_isHideable($a_set["type"]) ||
141  (!empty($this->core_styles[$a_set["type"].".".
142  ilObjStyleSheet::_determineTag($a_set["type"]).
143  ".".$a_set["class"]])))
144  {
145  $this->tpl->touchBlock("no_hide_checkbox");
146  }
147  else
148  {
149  $this->tpl->setCurrentBlock("hide_checkbox");
150  $this->tpl->setVariable("CHAR", $a_set["type"].".".
151  ilObjStyleSheet::_determineTag($a_set["type"]).
152  ".".$a_set["class"]);
153  if ($this->style->getHideStatus($a_set["type"], $a_set["class"]))
154  {
155  $this->tpl->setVariable("CHECKED", "checked='checked'");
156  }
157  $this->tpl->parseCurrentBlock();
158  }
159  }
160 
161  // example
162  $this->tpl->setVariable("EXAMPLE",
163  ilObjStyleSheetGUI::getStyleExampleHTML($a_set["type"], $a_set["class"]));
164 
165  $tag_str = ilObjStyleSheet::_determineTag($a_set["type"]).".".$a_set["class"];
166  $this->tpl->setVariable("TXT_TAG", $a_set["class"]);
167  $this->tpl->setVariable("TXT_TYPE", $lng->txt("sty_type_".$a_set["type"]));
168  $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
169  $ilCtrl->setParameter($this->parent_obj, "tag", $tag_str);
170  $ilCtrl->setParameter($this->parent_obj, "style_type", $a_set["type"]);
171  $this->tpl->setVariable("LINK_EDIT_TAG_STYLE",
172  $ilCtrl->getLinkTarget($this->parent_obj, "editTagStyle"));
173 
174  }
175 
176 }
177 ?>