ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  protected $ctrl;
21 
25  protected $settings;
26 
30  protected $rbacsystem;
31 
35  public function __construct(ilContentStyleSettingsGUI $a_parent_obj, $a_parent_cmd, $a_data, $a_style_settings)
36  {
37  global $DIC;
38 
39  $this->ctrl = $DIC->ctrl();
40  $this->lng = $DIC->language();
41  $this->settings = $DIC->settings();
42  $this->rbacsystem = $DIC->rbac()->system();
43  $ilCtrl = $DIC->ctrl();
44  $lng = $DIC->language();
45  $ilSetting = $DIC->settings();
46 
47  $this->fixed_style = $ilSetting->get("fixed_content_style_id");
48  $this->default_style = $ilSetting->get("default_content_style_id");
49 
50  $this->setId("sty_cs");
51  $this->sty_settings = $a_style_settings;
52 
53  parent::__construct($a_parent_obj, $a_parent_cmd);
54  $this->setData($a_data);
55  $this->setTitle($lng->txt("content_styles"));
56 
57  $this->addColumn("", "", "1", true);
58  $this->addColumn($this->lng->txt("title"));
59  $this->addColumn($this->lng->txt("sty_nr_learning_modules"));
60  $this->addColumn($this->lng->txt("purpose"));
61  $this->addColumn($this->lng->txt("sty_scope"));
62  $this->addColumn($this->lng->txt("active"));
63  $this->addColumn($this->lng->txt("actions"));
64 
65  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
66  $this->setRowTemplate("tpl.content_style_row.html", "Services/Style/Content");
67  if ($this->parent_obj->checkPermission("sty_write_content", false)) {
68  $this->addMultiCommand("deleteStyle", $lng->txt("delete"));
69  $this->addCommandButton("saveActiveStyles", $lng->txt("sty_save_active_styles"));
70  }
71  }
72 
76  protected function fillRow($a_set)
77  {
78  $lng = $this->lng;
81 
82  if ($a_set["id"] > 0) {
83  $this->tpl->setCurrentBlock("cb");
84  $this->tpl->setVariable("ID", $a_set["id"]);
85  $this->tpl->parseCurrentBlock();
86 
87  $this->tpl->setCurrentBlock("cb_act");
88  if ($a_set["active"]) {
89  $this->tpl->setVariable("ACT_CHECKED", "checked='checked'");
90  }
91  $this->tpl->setVariable("ID", $a_set["id"]);
92  $this->tpl->parseCurrentBlock();
93 
94  $this->tpl->setCurrentBlock("edit_link");
95  $ilCtrl->setParameterByClass("ilobjstylesheetgui", "obj_id", $a_set["id"]);
96  $this->tpl->setVariable("EDIT_LINK", $ilCtrl->getLinkTargetByClass("ilobjstylesheetgui", ""));
97  $ilCtrl->setParameterByClass("ilobjstylesheetgui", "obj_id", "");
98  $this->tpl->setVariable("EDIT_TITLE", $a_set["title"]);
99  $this->tpl->parseCurrentBlock();
100  } else {
101  $this->tpl->setVariable("TITLE", $a_set["title"]);
102  }
103 
104  $ilCtrl->setParameter($this->parent_obj, "id", $a_set["id"]);
105  if ($a_set["id"] > 0 && $this->parent_obj->checkPermission("sty_write_content", false)) {
107  $list->setListTitle($lng->txt("actions"));
108  $list->setId("sty_act_" . $a_set["id"]);
109 
110  // default style
111  if ($this->default_style == $a_set["id"]) {
112  $list->addItem(
113  $lng->txt("sty_remove_global_default_state"),
114  "",
115  $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalDefault")
116  );
117  } elseif ($a_set["active"]) {
118  $list->addItem(
119  $lng->txt("sty_make_global_default"),
120  "",
121  $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalDefault")
122  );
123  }
124 
125  // fixed style
126  if ($this->fixed_style == $a_set["id"]) {
127  $list->addItem(
128  $lng->txt("sty_remove_global_fixed_state"),
129  "",
130  $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalFixed")
131  );
132  } elseif ($a_set["active"]) {
133  $list->addItem(
134  $lng->txt("sty_make_global_fixed"),
135  "",
136  $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalFixed")
137  );
138  }
139  $list->addItem(
140  $lng->txt("sty_set_scope"),
141  "",
142  $ilCtrl->getLinkTarget($this->parent_obj, "setScope")
143  );
144 
145  $this->tpl->setVariable("ACTIONS", $list->getHTML());
146 
147  if ($a_set["id"] == $this->fixed_style) {
148  $this->tpl->setVariable("PURPOSE", $lng->txt("global_fixed"));
149  }
150  if ($a_set["id"] == $this->default_style) {
151  $this->tpl->setVariable("PURPOSE", $lng->txt("global_default"));
152  }
153  }
154  $ilCtrl->setParameter($this->parent_obj, "id", "");
155 
156  $this->tpl->setVariable("NR_LM", $a_set["lm_nr"]);
157 
158  if ($a_set["category"] > 0) {
159  $this->tpl->setVariable(
160  "SCOPE",
162  ilObject::_lookupObjId($a_set["category"])
163  )
164  );
165  }
166  }
167 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
global $DIC
Definition: saml.php:7
static _lookupTitle($a_id)
lookup object title
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
__construct(ilContentStyleSettingsGUI $a_parent_obj, $a_parent_cmd, $a_data, $a_style_settings)
Constructor.
static _lookupObjId($a_id)
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
User interface class for advanced drop-down selection lists.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
settings()
Definition: settings.php:2
global $ilSetting
Definition: privfeed.php:17
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.
Settings UI class for system styles.