ILIAS  eassessment Revision 61809
 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;
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  // action commands
69  if ($this->hideable)
70  {
71  $this->addCommandButton("saveHideStatus", $lng->txt("sty_save_hide_status"));
72  }
73 
74  $this->addMultiCommand("copyCharacteristics", $lng->txt("copy"));
75 
76  // action commands
77  if ($this->expandable)
78  {
79  $this->addMultiCommand("deleteCharacteristicConfirmation", $lng->txt("delete"));
80  //$this->addCommandButton("addCharacteristicForm", $lng->txt("sty_add_characteristic"));
81  }
82 
83  $this->setEnableTitle(true);
84  }
85 
90  protected function fillRow($a_set)
91  {
92  global $lng, $ilCtrl, $ilAccess;
93 
95  $types = $stypes[$this->super_type];
96 
97  if (!in_array($a_set["type"], $types))
98  {
99  return;
100  }
101 //var_dump($a_set);
102  // checkbox row
103 /* if ($this->expandable)
104  {
105  if (!empty($this->core_styles[$a_set["type"].".".
106  ilObjStyleSheet::_determineTag($a_set["type"]).
107  ".".$a_set["class"]]))
108  {
109  $this->tpl->touchBlock("no_checkbox");
110  }
111  else
112  {*/
113  $this->tpl->setCurrentBlock("checkbox");
114  $this->tpl->setVariable("CHAR", $a_set["type"].".".
115  ilObjStyleSheet::_determineTag($a_set["type"]).
116  ".".$a_set["class"]);
117  $this->tpl->parseCurrentBlock();
118 /* }
119  }*/
120 
121  if ($this->hideable)
122  {
123  if (!ilObjStyleSheet::_isHideable($a_set["type"]) ||
124  (!empty($this->core_styles[$a_set["type"].".".
125  ilObjStyleSheet::_determineTag($a_set["type"]).
126  ".".$a_set["class"]])))
127  {
128  $this->tpl->touchBlock("no_hide_checkbox");
129  }
130  else
131  {
132  $this->tpl->setCurrentBlock("hide_checkbox");
133  $this->tpl->setVariable("CHAR", $a_set["type"].".".
134  ilObjStyleSheet::_determineTag($a_set["type"]).
135  ".".$a_set["class"]);
136  if ($this->style->getHideStatus($a_set["type"], $a_set["class"]))
137  {
138  $this->tpl->setVariable("CHECKED", "checked='checked'");
139  }
140  $this->tpl->parseCurrentBlock();
141  }
142  }
143 
144  // example
145  $this->tpl->setVariable("EXAMPLE",
146  ilObjStyleSheetGUI::getStyleExampleHTML($a_set["type"], $a_set["class"]));
147 
148  $tag_str = ilObjStyleSheet::_determineTag($a_set["type"]).".".$a_set["class"];
149  $this->tpl->setVariable("TXT_TAG", $a_set["class"]);
150  $this->tpl->setVariable("TXT_TYPE", $lng->txt("sty_type_".$a_set["type"]));
151  $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit"));
152  $ilCtrl->setParameter($this->parent_obj, "tag", $tag_str);
153  $ilCtrl->setParameter($this->parent_obj, "style_type", $a_set["type"]);
154  $this->tpl->setVariable("LINK_EDIT_TAG_STYLE",
155  $ilCtrl->getLinkTarget($this->parent_obj, "editTagStyle"));
156 
157  }
158 
159 }
160 ?>