ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilContentStylesTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
6 
16 {
20  function __construct($a_parent_obj, $a_parent_cmd, $a_data, $a_style_settings)
21  {
22  global $ilCtrl, $lng, $ilAccess, $lng, $ilSetting, $rbacsystem;
23 
24  $this->fixed_style = $ilSetting->get("fixed_content_style_id");
25  $this->default_style = $ilSetting->get("default_content_style_id");
26 
27  $this->setId("sty_cs");
28  $this->sty_settings = $a_style_settings;
29 
30  parent::__construct($a_parent_obj, $a_parent_cmd);
31  $this->setData($a_data);
32  $this->setTitle($lng->txt("content_styles"));
33 
34  $this->addColumn("", "", "1", true);
35  $this->addColumn($this->lng->txt("title"));
36  $this->addColumn($this->lng->txt("sty_nr_learning_modules"));
37  $this->addColumn($this->lng->txt("purpose"));
38  $this->addColumn($this->lng->txt("sty_scope"));
39  $this->addColumn($this->lng->txt("active"));
40  $this->addColumn($this->lng->txt("actions"));
41 
42  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
43  $this->setRowTemplate("tpl.content_style_row.html", "Services/Style");
44 
45  if ($rbacsystem->checkAccess("write",$this->parent_obj->object->getRefId()))
46  {
47  $this->addMultiCommand("deleteStyle", $lng->txt("delete"));
48  $this->addCommandButton("saveActiveStyles", $lng->txt("sty_save_active_styles"));
49  }
50  }
51 
55  protected function fillRow($a_set)
56  {
57  global $lng, $ilCtrl, $rbacsystem;
58 
59  if ($a_set["id"] > 0)
60  {
61  $this->tpl->setCurrentBlock("cb");
62  $this->tpl->setVariable("ID", $a_set["id"]);
63  $this->tpl->parseCurrentBlock();
64 
65  $this->tpl->setCurrentBlock("cb_act");
66  if ($a_set["active"])
67  {
68  $this->tpl->setVariable("ACT_CHECKED", "checked='checked'");
69  }
70  $this->tpl->setVariable("ID", $a_set["id"]);
71  $this->tpl->parseCurrentBlock();
72 
73  $this->tpl->setCurrentBlock("edit_link");
74  $ilCtrl->setParameterByClass("ilobjstylesheetgui", "obj_id", $a_set["id"]);
75  $this->tpl->setVariable("EDIT_LINK", $ilCtrl->getLinkTargetByClass("ilobjstylesheetgui", ""));
76  $ilCtrl->setParameterByClass("ilobjstylesheetgui", "obj_id", "");
77  $this->tpl->setVariable("EDIT_TITLE", $a_set["title"]);
78  $this->tpl->parseCurrentBlock();
79  }
80  else
81  {
82  $this->tpl->setVariable("TITLE", $a_set["title"]);
83  }
84 
85  $ilCtrl->setParameter($this->parent_obj, "id", $a_set["id"]);
86  if ($a_set["id"] > 0 && $rbacsystem->checkAccess("write",$this->parent_obj->object->getRefId()))
87  {
88  $list = new ilAdvancedSelectionListGUI();
89  $list->setListTitle($lng->txt("actions"));
90  $list->setId("sty_act_".$a_set["id"]);
91 
92  // default style
93  if ($this->default_style == $a_set["id"])
94  {
95  $list->addItem($lng->txt("sty_remove_global_default_state"), "",
96  $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalDefault"));
97  }
98  else if ($a_set["active"])
99  {
100  $list->addItem($lng->txt("sty_make_global_default"), "",
101  $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalDefault"));
102  }
103 
104  // fixed style
105  if ($this->fixed_style == $a_set["id"])
106  {
107  $list->addItem($lng->txt("sty_remove_global_fixed_state"), "",
108  $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalFixed"));
109  }
110  else if ($a_set["active"])
111  {
112  $list->addItem($lng->txt("sty_make_global_fixed"), "",
113  $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalFixed"));
114  }
115  $list->addItem($lng->txt("sty_set_scope"), "",
116  $ilCtrl->getLinkTarget($this->parent_obj, "setScope"));
117 
118  $this->tpl->setVariable("ACTIONS", $list->getHTML());
119 
120  if ($a_set["id"] == $this->fixed_style)
121  {
122  $this->tpl->setVariable("PURPOSE", $lng->txt("global_fixed"));
123  }
124  if ($a_set["id"] == $this->default_style)
125  {
126  $this->tpl->setVariable("PURPOSE", $lng->txt("global_default"));
127  }
128 
129  }
130  $ilCtrl->setParameter($this->parent_obj, "id", "");
131 
132  $this->tpl->setVariable("NR_LM", $a_set["lm_nr"]);
133 
134  if ($a_set["category"] > 0)
135  {
136  $this->tpl->setVariable("SCOPE",
138  ilObject::_lookupObjId($a_set["category"])
139  ));
140  }
141  }
142 
143 }
144 ?>