ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilContentStyleSettingsGUI Class Reference

Settings UI class for system styles. More...

+ Collaboration diagram for ilContentStyleSettingsGUI:

Public Member Functions

 __construct (ilObjStyleSettingsGUI $a_parent_gui)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 checkPermission ($a_perm, $a_throw_exc=true)
 Check permission. More...
 
 createStyle ()
 Create new style. More...
 
 edit ()
 Show styles. More...
 
 moveLMStyles ()
 move learning modules from one style to another More...
 
 moveIndividualStyles ()
 move all learning modules with individual styles to new style More...
 
 confirmDeleteIndividualStyles ()
 
 deleteStyle ()
 display deletion confirmation screen More...
 
 confirmedDelete ()
 delete selected style objects More...
 
 toggleGlobalDefault ()
 Toggle global default style. More...
 
 toggleGlobalFixed ()
 Toggle global fixed style. More...
 
 saveActiveStyles ()
 Save active styles. More...
 
 showActions ($with_subobjects=false)
 show possible action (form buttons) More...
 
 cancelDelete ()
 cancel deletion of object More...
 
 setScope ()
 Set scope. More...
 
 saveScope ()
 Save scope for style. More...
 

Protected Attributes

 $settings
 
 $tree
 
 $ctrl
 
 $rbacsystem
 
 $toolbar
 
 $lng
 
 $tpl
 
 $DIC
 
 $ref_id
 

Detailed Description

Settings UI class for system styles.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$ @ilCtrl_Calls ilContentStyleSettingsGUI: ilObjStyleSheetGUI

Definition at line 13 of file class.ilContentStyleSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilContentStyleSettingsGUI::__construct ( ilObjStyleSettingsGUI  $a_parent_gui)

Constructor.

Definition at line 63 of file class.ilContentStyleSettingsGUI.php.

64 {
65 global $DIC;
66
67 $this->tree = $DIC->repositoryTree();
68 $this->settings = $DIC->settings();
69
70 $this->parent_gui = $a_parent_gui;
71 $this->dic = $DIC;
72 $this->ctrl = $DIC->ctrl();
73 $this->rbacsystem = $DIC->rbac()->system();
74 $this->toolbar = $DIC->toolbar();
75 $this->lng = $DIC->language();
76 $this->tpl = $DIC["tpl"];
77 $this->ref_id = (int) $_GET["ref_id"];
78 $this->obj_id = (int) $_GET["obj_id"]; // note that reference ID is the id of the style settings node and object ID may be a style sheet object ID
79
80
81 include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
82 $this->cs_settings = new ilContentStyleSettings();
83 }
$_GET["client_id"]
settings()
Definition: settings.php:2

References $_GET, $DIC, and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ cancelDelete()

ilContentStyleSettingsGUI::cancelDelete ( )

cancel deletion of object

@access public

Definition at line 437 of file class.ilContentStyleSettingsGUI.php.

438 {
439 ilUtil::sendInfo($this->lng->txt("msg_cancel"), true);
440 $this->ctrl->redirect($this, "edit");
441 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ checkPermission()

ilContentStyleSettingsGUI::checkPermission (   $a_perm,
  $a_throw_exc = true 
)

Check permission.

Parameters
string$a_permpermission(s)
Returns
bool
Exceptions
ilObjectException

Definition at line 119 of file class.ilContentStyleSettingsGUI.php.

120 {
121 if (!$this->rbacsystem->checkAccess($a_perm, $this->ref_id)) {
122 if ($a_throw_exc) {
123 include_once "Services/Object/exceptions/class.ilObjectException.php";
124 throw new ilObjectException($this->lng->txt("permission_denied"));
125 }
126 return false;
127 }
128 return true;
129 }
Base exception class for object service.

Referenced by confirmDeleteIndividualStyles(), confirmedDelete(), deleteStyle(), edit(), moveIndividualStyles(), moveLMStyles(), saveScope(), setScope(), toggleGlobalDefault(), and toggleGlobalFixed().

+ Here is the caller graph for this function:

◆ confirmDeleteIndividualStyles()

ilContentStyleSettingsGUI::confirmDeleteIndividualStyles ( )

Definition at line 245 of file class.ilContentStyleSettingsGUI.php.

246 {
247 $this->checkPermission("sty_write_content");
248
249 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
250
251 $this->ctrl->setParameter($this, "to_style", $_POST["to_style"]);
252
253 $cgui = new ilConfirmationGUI();
254 $cgui->setFormAction($this->ctrl->getFormAction($this));
255 $cgui->setHeaderText($this->lng->txt("sty_confirm_del_ind_styles") . ": " .
256 sprintf(
257 $this->lng->txt("sty_confirm_del_ind_styles_desc"),
258 ilObject::_lookupTitle($_POST["to_style"])
259 ));
260 $cgui->setCancel($this->lng->txt("cancel"), "edit");
261 $cgui->setConfirm($this->lng->txt("ok"), "moveIndividualStyles");
262 $this->tpl->setContent($cgui->getHTML());
263 }
$_POST["username"]
Confirmation screen class.
checkPermission($a_perm, $a_throw_exc=true)
Check permission.
static _lookupTitle($a_id)
lookup object title

References $_POST, ilObject\_lookupTitle(), and checkPermission().

Referenced by moveLMStyles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmedDelete()

ilContentStyleSettingsGUI::confirmedDelete ( )

delete selected style objects

Definition at line 301 of file class.ilContentStyleSettingsGUI.php.

302 {
303 $this->checkPermission("sty_write_content");
304
305 foreach ($_POST["id"] as $id) {
306 include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
307 $set = new ilContentStyleSettings();
308 $set->removeStyle($id);
309 $set->update();
310
312 $style_obj->delete();
313 }
314
315 $this->ctrl->redirect($this, "edit");
316 }
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
if(!array_key_exists('StateId', $_REQUEST)) $id

References $_POST, $id, checkPermission(), and ilObjectFactory\getInstanceByObjId().

+ Here is the call graph for this function:

◆ createStyle()

ilContentStyleSettingsGUI::createStyle ( )

Create new style.

Definition at line 134 of file class.ilContentStyleSettingsGUI.php.

135 {
137
138 // $ilCtrl->setParameterByClass("ilobjstylesheetgui", "new_type", "sty");
139 $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
140 }
global $ilCtrl
Definition: ilias.php:18

References $ctrl, and $ilCtrl.

◆ deleteStyle()

ilContentStyleSettingsGUI::deleteStyle ( )

display deletion confirmation screen

Definition at line 270 of file class.ilContentStyleSettingsGUI.php.

271 {
272 $this->checkPermission("sty_write_content");
273
274 if (!isset($_POST["id"])) {
275 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
276 $this->ctrl->redirect($this, "edit");
277 }
278
279 // display confirmation message
280 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
281 $cgui = new ilConfirmationGUI();
282 $cgui->setFormAction($this->ctrl->getFormAction($this));
283 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
284 $cgui->setCancel($this->lng->txt("cancel"), "cancelDelete");
285 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDelete");
286
287 foreach ($_POST["id"] as $id) {
288 $caption = ilUtil::getImageTagByType("sty", $this->tpl->tplPath) .
290
291 $cgui->addItem("id[]", $id, $caption);
292 }
293
294 $this->tpl->setContent($cgui->getHTML());
295 }
static getImageTagByType($a_type, $a_path, $a_big=false)
Builds an html image tag TODO: function still in use, but in future use getImagePath and move HTML-Co...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $_POST, $id, ilObject\_lookupTitle(), checkPermission(), ilUtil\getImageTagByType(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ edit()

ilContentStyleSettingsGUI::edit ( )

Show styles.

Definition at line 145 of file class.ilContentStyleSettingsGUI.php.

146 {
147 $this->checkPermission("visible,read");
148
149 // this may not be cool, if styles are organised as (independent) Service
150 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
151 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
152
153 $from_styles = $to_styles = $data = array();
154 $styles = $this->cs_settings->getStyles();
155 foreach ($styles as $style) {
158 $data[$style["title"] . ":" . $style["id"]]
159 = $style;
160 if ($style["lm_nr"] > 0) {
161 $from_styles[$style["id"]] = $style["title"];
162 }
163 if ($style["active"] > 0) {
164 $to_styles[$style["id"]] = $style["title"];
165 }
166 }
167
168 // number of individual styles
169 if ($fixed_style <= 0) {
170 $data[-1] =
171 array("title" => $this->lng->txt("sty_individual_styles"),
172 "id" => 0, "lm_nr" => ilObjContentObject::_getNrLMsIndividualStyles());
173 $from_styles[-1] = $this->lng->txt("sty_individual_styles");
174 }
175
176 // number of default style (fallback default style)
177 if ($default_style <= 0 && $fixed_style <= 0) {
178 $data[0] =
179 array("title" => $this->lng->txt("sty_default_style"),
180 "id" => 0, "lm_nr" => ilObjContentObject::_getNrLMsNoStyle());
181 $from_styles[0] = $this->lng->txt("sty_default_style");
182 $to_styles[0] = $this->lng->txt("sty_default_style");
183 }
184
185 if ($this->checkPermission("sty_write_content", false)) {
186 $this->toolbar->addButton(
187 $this->lng->txt("sty_add_content_style"),
188 $this->ctrl->getLinkTarget($this, "createStyle")
189 );
190 $this->toolbar->addSeparator();
191 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
192
193 // from styles selector
194 $si = new ilSelectInputGUI($this->lng->txt("sty_move_lm_styles") . ": " . $this->lng->txt("sty_from"), "from_style");
195 $si->setOptions($from_styles);
196 $this->toolbar->addInputItem($si, true);
197
198 // from styles selector
199 $si = new ilSelectInputGUI($this->lng->txt("sty_to"), "to_style");
200 $si->setOptions($to_styles);
201 $this->toolbar->addInputItem($si, true);
202 $this->toolbar->addFormButton($this->lng->txt("sty_move_style"), "moveLMStyles");
203
204 $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
205 }
206
207 include_once("./Services/Style/Content/classes/class.ilContentStylesTableGUI.php");
208 $table = new ilContentStylesTableGUI($this, "edit", $data, $this->cs_settings);
209 $this->tpl->setContent($table->getHTML());
210 }
static _getNrLMsIndividualStyles()
get number of learning modules with individual styles
static _getNrLMsNoStyle()
get number of learning modules assigned no style
static _getNrOfAssignedLMs($a_style_id)
gets the number of learning modules assigned to a content style
static _lookupActive($a_id)
Lookup active flag.
This class represents a selection list property in a property form.
$style
Definition: example_012.php:70
if(empty($password)) $table
Definition: pwgen.php:24
$data
Definition: bench.php:6

References $data, $si, $style, $table, ilObjContentObject\_getNrLMsIndividualStyles(), ilObjContentObject\_getNrLMsNoStyle(), ilObjContentObject\_getNrOfAssignedLMs(), ilObjStyleSheet\_lookupActive(), and checkPermission().

+ Here is the call graph for this function:

◆ executeCommand()

ilContentStyleSettingsGUI::executeCommand ( )

Execute command.

Definition at line 88 of file class.ilContentStyleSettingsGUI.php.

89 {
90 $next_class = $this->ctrl->getNextClass($this);
91 $cmd = $this->ctrl->getCmd("edit");
92
93 switch ($next_class) {
94 case "ilobjstylesheetgui":
95 $this->ctrl->setReturn($this, "edit");
96 include_once("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
97 $style_gui = new ilObjStyleSheetGUI("", $this->obj_id, false, false);
98 $this->ctrl->forwardCommand($style_gui);
99 break;
100
101 default:
102 $this->parent_gui->prepareOutput();
103 if (in_array($cmd, array("edit", "delete", "toggleGlobalDefault", "toggleGlobalFixed", "setScope", "saveScope", "saveActiveStyles",
104 "createStyle", "moveLMStyles", "moveIndividualStyles", "deleteStyle", "cancelDelete", "confirmedDelete"))) {
105 $this->$cmd();
106 } else {
107 die("Unknown command " . $cmd);
108 }
109 }
110 }
Class ilObjStyleSheetGUI.

◆ moveIndividualStyles()

ilContentStyleSettingsGUI::moveIndividualStyles ( )

move all learning modules with individual styles to new style

Definition at line 233 of file class.ilContentStyleSettingsGUI.php.

234 {
235 $this->checkPermission("sty_write_content");
236
237 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
239 $this->ctrl->redirect($this, "edit");
240 }
static _moveLMStyles($a_from_style, $a_to_style)
move learning modules from one style to another

References $_GET, ilObjContentObject\_moveLMStyles(), and checkPermission().

+ Here is the call graph for this function:

◆ moveLMStyles()

ilContentStyleSettingsGUI::moveLMStyles ( )

move learning modules from one style to another

Definition at line 215 of file class.ilContentStyleSettingsGUI.php.

216 {
217 $this->checkPermission("sty_write_content");
218
219 if ($_POST["from_style"] == -1) {
221 return;
222 }
223
224 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
225 ilObjContentObject::_moveLMStyles($_POST["from_style"], $_POST["to_style"]);
226 $this->ctrl->redirect($this, "edit");
227 }

References $_POST, ilObjContentObject\_moveLMStyles(), checkPermission(), and confirmDeleteIndividualStyles().

+ Here is the call graph for this function:

◆ saveActiveStyles()

ilContentStyleSettingsGUI::saveActiveStyles ( )

Save active styles.

Definition at line 370 of file class.ilContentStyleSettingsGUI.php.

371 {
372 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
373 $styles = $this->cs_settings->getStyles();
374 foreach ($styles as $style) {
375 if ($_POST["std_" . $style["id"]] == 1) {
377 } else {
379 }
380 }
381 ilUtil::redirect($this->ctrl->getLinkTarget($this, "edit", "", false, false));
382 }
static _writeActive($a_id, $a_active)
Write active flag.
static redirect($a_script)

References $_POST, $style, ilObjStyleSheet\_writeActive(), and ilUtil\redirect().

+ Here is the call graph for this function:

◆ saveScope()

ilContentStyleSettingsGUI::saveScope ( )

Save scope for style.

Definition at line 471 of file class.ilContentStyleSettingsGUI.php.

472 {
474
475 $this->checkPermission("sty_write_content");
476
477 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
478 if ($_GET["cat"] == $tree->readRootId()) {
479 $_GET["cat"] = "";
480 }
482
483 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
484
485 ilUtil::redirect($this->ctrl->getLinkTarget($this, "edit", "", false, false));
486 }
static _writeScope($a_id, $a_scope)
Write scope.

References $_GET, $tree, ilObjStyleSheet\_writeScope(), checkPermission(), and ilUtil\redirect().

+ Here is the call graph for this function:

◆ setScope()

ilContentStyleSettingsGUI::setScope ( )

Set scope.

Definition at line 446 of file class.ilContentStyleSettingsGUI.php.

447 {
450
451 $this->checkPermission("sty_write_content");
452
453 $ilCtrl->saveParameter($this, "id");
454 include_once("./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
456 $this,
457 "setScope",
458 $this,
459 "saveScope",
460 "cat"
461 );
462 $exp->setTypeWhiteList(array("root", "cat"));
463 if (!$exp->handleCommand()) {
464 $tpl->setContent($exp->getHTML());
465 }
466 }
Explorer for selecting repository items.

References $ctrl, $ilCtrl, $tpl, and checkPermission().

+ Here is the call graph for this function:

◆ showActions()

ilContentStyleSettingsGUI::showActions (   $with_subobjects = false)

show possible action (form buttons)

Parameters
boolean@access public

Definition at line 390 of file class.ilContentStyleSettingsGUI.php.

391 {
392
393 // delete
394 $this->tpl->setCurrentBlock("tbl_action_btn");
395 $this->tpl->setVariable("BTN_NAME", "deleteStyle");
396 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
397 $this->tpl->parseCurrentBlock();
398
399 // set global default
400 $this->tpl->setCurrentBlock("tbl_action_btn");
401 $this->tpl->setVariable("BTN_NAME", "toggleGlobalDefault");
402 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("toggleGlobalDefault"));
403 $this->tpl->parseCurrentBlock();
404
405 // set global default
406 $this->tpl->setCurrentBlock("tbl_action_btn");
407 $this->tpl->setVariable("BTN_NAME", "toggleGlobalFixed");
408 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("toggleGlobalFixed"));
409 $this->tpl->parseCurrentBlock();
410
411 // set global default
412 $this->tpl->setCurrentBlock("tbl_action_btn");
413 $this->tpl->setVariable("BTN_NAME", "setScope");
414 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("sty_set_scope"));
415 $this->tpl->parseCurrentBlock();
416
417 // save active styles
418 $this->tpl->setCurrentBlock("tbl_action_btn");
419 $this->tpl->setVariable("BTN_NAME", "saveActiveStyles");
420 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("sty_save_active_styles"));
421 $this->tpl->parseCurrentBlock();
422
423 if ($with_subobjects === true) {
424 $this->showPossibleSubObjects();
425 }
426
427 $this->tpl->setCurrentBlock("tbl_action_row");
428 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
429 $this->tpl->parseCurrentBlock();
430 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References ilUtil\getImagePath().

+ Here is the call graph for this function:

◆ toggleGlobalDefault()

ilContentStyleSettingsGUI::toggleGlobalDefault ( )

Toggle global default style.

Definition at line 322 of file class.ilContentStyleSettingsGUI.php.

323 {
326
327 $this->checkPermission("sty_write_content");
328
329 if ($_GET["id"] > 0) {
330 $ilSetting->delete("fixed_content_style_id");
331 $def_style = $ilSetting->get("default_content_style_id");
332
333 if ($def_style != $_GET["id"]) {
334 $ilSetting->set("default_content_style_id", (int) $_GET["id"]);
335 } else {
336 $ilSetting->delete("default_content_style_id");
337 }
338 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
339 }
340 ilUtil::redirect($this->ctrl->getLinkTarget($this, "edit", "", false, false));
341 }
global $ilSetting
Definition: privfeed.php:17

References $_GET, $ilSetting, $lng, $settings, checkPermission(), and ilUtil\redirect().

+ Here is the call graph for this function:

◆ toggleGlobalFixed()

ilContentStyleSettingsGUI::toggleGlobalFixed ( )

Toggle global fixed style.

Definition at line 346 of file class.ilContentStyleSettingsGUI.php.

347 {
350
351 $this->checkPermission("sty_write_content");
352
353 if ($_GET["id"] > 0) {
354 $ilSetting->delete("default_content_style_id");
355 $fixed_style = $ilSetting->get("fixed_content_style_id");
356 if ($fixed_style == (int) $_GET["id"]) {
357 $ilSetting->delete("fixed_content_style_id");
358 } else {
359 $ilSetting->set("fixed_content_style_id", (int) $_GET["id"]);
360 }
361 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
362 }
363 ilUtil::redirect($this->ctrl->getLinkTarget($this, "edit", "", false, false));
364 }

References $_GET, $ilSetting, $lng, $settings, checkPermission(), and ilUtil\redirect().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilContentStyleSettingsGUI::$ctrl
protected

Definition at line 28 of file class.ilContentStyleSettingsGUI.php.

Referenced by createStyle(), and setScope().

◆ $DIC

ilContentStyleSettingsGUI::$DIC
protected

Definition at line 53 of file class.ilContentStyleSettingsGUI.php.

Referenced by __construct().

◆ $lng

ilContentStyleSettingsGUI::$lng
protected

Definition at line 43 of file class.ilContentStyleSettingsGUI.php.

Referenced by toggleGlobalDefault(), and toggleGlobalFixed().

◆ $rbacsystem

ilContentStyleSettingsGUI::$rbacsystem
protected

Definition at line 33 of file class.ilContentStyleSettingsGUI.php.

◆ $ref_id

ilContentStyleSettingsGUI::$ref_id
protected

Definition at line 58 of file class.ilContentStyleSettingsGUI.php.

◆ $settings

ilContentStyleSettingsGUI::$settings
protected

Definition at line 18 of file class.ilContentStyleSettingsGUI.php.

Referenced by toggleGlobalDefault(), and toggleGlobalFixed().

◆ $toolbar

ilContentStyleSettingsGUI::$toolbar
protected

Definition at line 38 of file class.ilContentStyleSettingsGUI.php.

◆ $tpl

ilContentStyleSettingsGUI::$tpl
protected

Definition at line 48 of file class.ilContentStyleSettingsGUI.php.

Referenced by setScope().

◆ $tree

ilContentStyleSettingsGUI::$tree
protected

Definition at line 23 of file class.ilContentStyleSettingsGUI.php.

Referenced by saveScope().


The documentation for this class was generated from the following file: