ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilSystemStylesTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("./Services/Table/classes/class.ilTable2GUI.php");
6
16{
20 function __construct($a_parent_obj, $a_parent_cmd)
21 {
22 global $ilCtrl, $lng, $ilAccess, $lng, $rbacsystem;
23
24 parent::__construct($a_parent_obj, $a_parent_cmd);
25 $this->getStyles();
26// $this->setTitle($lng->txt(""));
27
28 $this->setLimit(9999);
29
30 $this->addColumn($this->lng->txt("title"));
31 $this->addColumn($this->lng->txt("default"));
32 $this->addColumn($this->lng->txt("users"));
33 $this->addColumn($this->lng->txt("active"));
34 $this->addColumn($this->lng->txt("sty_substyles"));
35 $this->addColumn($this->lng->txt("actions"));
36
37 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
38 $this->setRowTemplate("tpl.sys_styles_row.html", "Services/Style");
39
40 if ($rbacsystem->checkAccess("write", (int) $_GET["ref_id"]))
41 {
42 $this->addCommandButton("saveStyleSettings", $lng->txt("save"));
43 }
44 }
45
52 function getStyles()
53 {
54 global $styleDefinition;
55
57
58 // get all user assigned styles
59 $all_user_styles = ilObjUser::_getAllUserAssignedStyles();
60
61 // output "other" row for all users, that are not assigned to
62 // any existing style
63 $users_missing_styles = 0;
64 foreach($all_user_styles as $style)
65 {
66 if (!isset($all_styles[$style]))
67 {
68 $style_arr = explode(":", $style);
69 $users_missing_styles += ilObjUser::_getNumberOfUsersForStyle($style_arr[0], $style_arr[1]);
70 }
71 }
72
73 if ($users_missing_styles > 0)
74 {
75 $all_styles["other"] =
76 array (
77 "title" => $this->lng->txt("other"),
78 "id" => "other",
79 "template_id" => "",
80 "style_id" => "",
81 "template_name" => "",
82 "style_name" => "",
83 "users" => $users_missing_styles
84 );
85 }
86
87
88 $this->setData($all_styles);
89 }
90
91
95 protected function fillRow($a_set)
96 {
97 global $lng, $ilClientIniFile, $ilCtrl;
98
99 $cat_ass = ilStyleDefinition::getSystemStyleCategoryAssignments($a_set["template_id"],
100 $a_set["style_id"]);
101
102 if (is_array($a_set["substyle"]))
103 {
104 foreach ($a_set["substyle"] as $substyle)
105 {
106 reset($cat_ass);
107 $cats = false;
108 foreach($cat_ass as $ca)
109 {
110 if ($ca["substyle"] == $substyle["id"])
111 {
112 $this->tpl->setCurrentBlock("cat");
113 $this->tpl->setVariable("CAT", ilObject::_lookupTitle(
114 ilObject::_lookupObjId($ca["ref_id"])));
115 $this->tpl->parseCurrentBlock();
116 $cats = true;
117 }
118 }
119 if ($cats)
120 {
121 $this->tpl->touchBlock("cats");
122 }
123
124 $this->tpl->setCurrentBlock("substyle");
125 $this->tpl->setVariable("SUB_STYLE", $substyle["name"]);
126 $this->tpl->parseCurrentBlock();
127 }
128 $this->tpl->touchBlock("substyles");
129
130 $ilCtrl->setParameter($this->parent_obj, "style_id", urlencode($a_set["id"]));
131 $this->tpl->setCurrentBlock("cmd");
132 $this->tpl->setVariable("HREF_CMD", $ilCtrl->getLinkTarget($this->parent_obj,
133 "assignStylesToCats"));
134 $this->tpl->setVariable("TXT_CMD", $lng->txt("sty_assign_categories"));
135 $this->tpl->parseCurrentBlock();
136 }
137
138 $this->tpl->setVariable("TITLE", $a_set["title"]);
139 $this->tpl->setVariable("ID", $a_set["id"]);
140
141 // number of users
142 $this->tpl->setVariable("USERS", $a_set["users"]);
143
144 // activation
145 if (ilObjStyleSettings::_lookupActivatedStyle($a_set["template_id"], $a_set["style_id"]))
146 {
147 $this->tpl->setVariable("CHECKED", ' checked="checked" ');
148 }
149
150 if ($ilClientIniFile->readVariable("layout","skin") == $a_set["template_id"] &&
151 $ilClientIniFile->readVariable("layout","style") == $a_set["style_id"])
152 {
153 $this->tpl->setVariable("CHECKED_DEFAULT", ' checked="checked" ');
154 }
155
156 }
157
158}
159?>
$_GET["client_id"]
_lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
_getAllUserAssignedStyles()
skins and styles
_getNumberOfUsersForStyle($a_skin, $a_style)
skins and styles
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static getSystemStyleCategoryAssignments($a_skin_id, $a_style_id)
Get all system style category assignments.
static getAllSkinStyles()
Get all skins/styles.
TableGUI class for system styles.
__construct($a_parent_obj, $a_parent_cmd)
Constructor.
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.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
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.
$style
Definition: example_012.php:70
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40