ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
4include_once("./Services/Table/classes/class.ilTable2GUI.php");
5include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
6
16{
20 function __construct(ilContentStyleSettingsGUI $a_parent_obj, $a_parent_cmd, $a_data, $a_style_settings)
21 {
22 global $ilCtrl, $lng, $ilSetting;
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/Content");
44 if ($this->parent_obj->checkPermission("sty_write_content", false))
45 {
46 $this->addMultiCommand("deleteStyle", $lng->txt("delete"));
47 $this->addCommandButton("saveActiveStyles", $lng->txt("sty_save_active_styles"));
48 }
49 }
50
54 protected function fillRow($a_set)
55 {
56 global $lng, $ilCtrl, $rbacsystem;
57
58 if ($a_set["id"] > 0)
59 {
60 $this->tpl->setCurrentBlock("cb");
61 $this->tpl->setVariable("ID", $a_set["id"]);
62 $this->tpl->parseCurrentBlock();
63
64 $this->tpl->setCurrentBlock("cb_act");
65 if ($a_set["active"])
66 {
67 $this->tpl->setVariable("ACT_CHECKED", "checked='checked'");
68 }
69 $this->tpl->setVariable("ID", $a_set["id"]);
70 $this->tpl->parseCurrentBlock();
71
72 $this->tpl->setCurrentBlock("edit_link");
73 $ilCtrl->setParameterByClass("ilobjstylesheetgui", "obj_id", $a_set["id"]);
74 $this->tpl->setVariable("EDIT_LINK", $ilCtrl->getLinkTargetByClass("ilobjstylesheetgui", ""));
75 $ilCtrl->setParameterByClass("ilobjstylesheetgui", "obj_id", "");
76 $this->tpl->setVariable("EDIT_TITLE", $a_set["title"]);
77 $this->tpl->parseCurrentBlock();
78 }
79 else
80 {
81 $this->tpl->setVariable("TITLE", $a_set["title"]);
82 }
83
84 $ilCtrl->setParameter($this->parent_obj, "id", $a_set["id"]);
85 if ($a_set["id"] > 0 && $this->parent_obj->checkPermission("sty_write_content", false))
86 {
87 $list = new ilAdvancedSelectionListGUI();
88 $list->setListTitle($lng->txt("actions"));
89 $list->setId("sty_act_".$a_set["id"]);
90
91 // default style
92 if ($this->default_style == $a_set["id"])
93 {
94 $list->addItem($lng->txt("sty_remove_global_default_state"), "",
95 $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalDefault"));
96 }
97 else if ($a_set["active"])
98 {
99 $list->addItem($lng->txt("sty_make_global_default"), "",
100 $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalDefault"));
101 }
102
103 // fixed style
104 if ($this->fixed_style == $a_set["id"])
105 {
106 $list->addItem($lng->txt("sty_remove_global_fixed_state"), "",
107 $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalFixed"));
108 }
109 else if ($a_set["active"])
110 {
111 $list->addItem($lng->txt("sty_make_global_fixed"), "",
112 $ilCtrl->getLinkTarget($this->parent_obj, "toggleGlobalFixed"));
113 }
114 $list->addItem($lng->txt("sty_set_scope"), "",
115 $ilCtrl->getLinkTarget($this->parent_obj, "setScope"));
116
117 $this->tpl->setVariable("ACTIONS", $list->getHTML());
118
119 if ($a_set["id"] == $this->fixed_style)
120 {
121 $this->tpl->setVariable("PURPOSE", $lng->txt("global_fixed"));
122 }
123 if ($a_set["id"] == $this->default_style)
124 {
125 $this->tpl->setVariable("PURPOSE", $lng->txt("global_default"));
126 }
127
128 }
129 $ilCtrl->setParameter($this->parent_obj, "id", "");
130
131 $this->tpl->setVariable("NR_LM", $a_set["lm_nr"]);
132
133 if ($a_set["category"] > 0)
134 {
135 $this->tpl->setVariable("SCOPE",
137 ilObject::_lookupObjId($a_set["category"])
138 ));
139 }
140 }
141
142}
143?>
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
Settings UI class for system styles.
__construct(ilContentStyleSettingsGUI $a_parent_obj, $a_parent_cmd, $a_data, $a_style_settings)
Constructor.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
Class ilTable2GUI.
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.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
global $ilSetting
Definition: privfeed.php:17