ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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

 $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 53 of file class.ilContentStyleSettingsGUI.php.

54 {
55 global $DIC;
56
57 $this->parent_gui = $a_parent_gui;
58 $this->dic = $DIC;
59 $this->ctrl = $DIC->ctrl();
60 $this->rbacsystem = $DIC->rbac()->system();
61 $this->toolbar = $DIC->toolbar();
62 $this->lng = $DIC->language();
63 $this->tpl = $DIC["tpl"];
64 $this->ref_id = (int) $_GET["ref_id"];
65 $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
66
67
68 include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
69 $this->settings = new ilContentStyleSettings();
70 }
$_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 449 of file class.ilContentStyleSettingsGUI.php.

450 {
451 ilUtil::sendInfo($this->lng->txt("msg_cancel"),true);
452 $this->ctrl->redirect($this, "edit");
453
454 }
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 110 of file class.ilContentStyleSettingsGUI.php.

111 {
112 if (!$this->rbacsystem->checkAccess($a_perm, $this->ref_id))
113 {
114 if ($a_throw_exc)
115 {
116 include_once "Services/Object/exceptions/class.ilObjectException.php";
117 throw new ilObjectException($this->lng->txt("permission_denied"));
118 }
119 return false;
120 }
121 return true;
122 }
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 244 of file class.ilContentStyleSettingsGUI.php.

245 {
246 $this->checkPermission("sty_write_content");
247
248 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
249
250 $this->ctrl->setParameter($this, "to_style", $_POST["to_style"]);
251
252 $cgui = new ilConfirmationGUI();
253 $cgui->setFormAction($this->ctrl->getFormAction($this));
254 $cgui->setHeaderText($this->lng->txt("sty_confirm_del_ind_styles").": ".
255 sprintf($this->lng->txt("sty_confirm_del_ind_styles_desc"),
256 ilObject::_lookupTitle($_POST["to_style"])));
257 $cgui->setCancel($this->lng->txt("cancel"), "edit");
258 $cgui->setConfirm($this->lng->txt("ok"), "moveIndividualStyles");
259 $this->tpl->setContent($cgui->getHTML());
260 }
sprintf('%.4f', $callTime)
$_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(), checkPermission(), and sprintf.

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 300 of file class.ilContentStyleSettingsGUI.php.

301 {
302 global $ilias;
303
304 $this->checkPermission("sty_write_content");
305
306 foreach($_POST["id"] as $id)
307 {
308 include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
309 $set = new ilContentStyleSettings();
310 $set->removeStyle($id);
311 $set->update();
312 $style_obj = $ilias->obj_factory->getInstanceByObjId($id);
313 $style_obj->delete();
314 }
315
316 $this->ctrl->redirect($this, "edit");
317 }

References $_POST, and checkPermission().

+ Here is the call graph for this function:

◆ createStyle()

ilContentStyleSettingsGUI::createStyle ( )

Create new style.

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

128 {
129 global $ilCtrl;
130
131 // $ilCtrl->setParameterByClass("ilobjstylesheetgui", "new_type", "sty");
132 $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
133 }
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl.

◆ deleteStyle()

ilContentStyleSettingsGUI::deleteStyle ( )

display deletion confirmation screen

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

268 {
269 $this->checkPermission("sty_write_content");
270
271 if (!isset($_POST["id"]))
272 {
273 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
274 $this->ctrl->redirect($this, "edit");
275 }
276
277 // display confirmation message
278 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
279 $cgui = new ilConfirmationGUI();
280 $cgui->setFormAction($this->ctrl->getFormAction($this));
281 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
282 $cgui->setCancel($this->lng->txt("cancel"), "cancelDelete");
283 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDelete");
284
285 foreach ($_POST["id"] as $id)
286 {
287 $caption = ilUtil::getImageTagByType("sty", $this->tpl->tplPath).
288 " ".ilObject::_lookupTitle($id);
289
290 $cgui->addItem("id[]", $id, $caption);
291 }
292
293 $this->tpl->setContent($cgui->getHTML());
294 }
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, checkPermission(), ilUtil\getImageTagByType(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ edit()

ilContentStyleSettingsGUI::edit ( )

Show styles.

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

139 {
140 $this->checkPermission("visible,read");
141
142 // this may not be cool, if styles are organised as (independent) Service
143 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
144 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
145
146 $from_styles = $to_styles = $data = array();
147 $styles = $this->settings->getStyles();
148 foreach($styles as $style)
149 {
152 $data[$style["title"].":".$style["id"]]
153 = $style;
154 if ($style["lm_nr"] > 0)
155 {
156 $from_styles[$style["id"]] = $style["title"];
157 }
158 if ($style["active"] > 0)
159 {
160 $to_styles[$style["id"]] = $style["title"];
161 }
162 }
163
164 // number of individual styles
165 if ($fixed_style <= 0)
166 {
167 $data[-1] =
168 array("title" => $this->lng->txt("sty_individual_styles"),
169 "id" => 0, "lm_nr" => ilObjContentObject::_getNrLMsIndividualStyles());
170 $from_styles[-1] = $this->lng->txt("sty_individual_styles");
171 }
172
173 // number of default style (fallback default style)
174 if ($default_style <= 0 && $fixed_style <= 0)
175 {
176 $data[0] =
177 array("title" => $this->lng->txt("sty_default_style"),
178 "id" => 0, "lm_nr" => ilObjContentObject::_getNrLMsNoStyle());
179 $from_styles[0] = $this->lng->txt("sty_default_style");
180 $to_styles[0] = $this->lng->txt("sty_default_style");
181 }
182
183 if ($this->checkPermission("sty_write_content", false))
184 {
185 $this->toolbar->addButton($this->lng->txt("sty_add_content_style"),
186 $this->ctrl->getLinkTarget($this, "createStyle"));
187 $this->toolbar->addSeparator();
188 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
189
190 // from styles selector
191 $si = new ilSelectInputGUI($this->lng->txt("sty_move_lm_styles").": ".$this->lng->txt("sty_from"), "from_style");
192 $si->setOptions($from_styles);
193 $this->toolbar->addInputItem($si, true);
194
195 // from styles selector
196 $si = new ilSelectInputGUI($this->lng->txt("sty_to"), "to_style");
197 $si->setOptions($to_styles);
198 $this->toolbar->addInputItem($si, true);
199 $this->toolbar->addFormButton($this->lng->txt("sty_move_style"), "moveLMStyles");
200
201 $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
202 }
203
204 include_once("./Services/Style/Content/classes/class.ilContentStylesTableGUI.php");
205 $table = new ilContentStylesTableGUI($this, "edit", $data, $this->settings);
206 $this->tpl->setContent($table->getHTML());
207
208 }
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

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

+ Here is the call graph for this function:

◆ executeCommand()

ilContentStyleSettingsGUI::executeCommand ( )

Execute command.

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

76 {
77 $next_class = $this->ctrl->getNextClass($this);
78 $cmd = $this->ctrl->getCmd("edit");
79
80 switch ($next_class)
81 {
82 case "ilobjstylesheetgui":
83 $this->ctrl->setReturn($this, "edit");
84 include_once("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
85 $style_gui = new ilObjStyleSheetGUI("", $this->obj_id, false, false);
86 $this->ctrl->forwardCommand($style_gui);
87 break;
88
89 default:
90 $this->parent_gui->prepareOutput();
91 if (in_array($cmd, array("edit", "delete", "toggleGlobalDefault", "toggleGlobalFixed", "setScope", "saveScope", "saveActiveStyles",
92 "createStyle", "moveLMStyles", "moveIndividualStyles", "deleteStyle", "cancelDelete", "confirmedDelete")))
93 {
94 $this->$cmd();
95 }
96 else
97 {
98 die("Unknown command ".$cmd);
99 }
100 }
101 }
Class ilObjStyleSheetGUI.
$cmd
Definition: sahs_server.php:35

References $cmd.

◆ moveIndividualStyles()

ilContentStyleSettingsGUI::moveIndividualStyles ( )

move all learning modules with individual styles to new style

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

233 {
234 $this->checkPermission("sty_write_content");
235
236 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
238 $this->ctrl->redirect($this, "edit");
239 }
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 213 of file class.ilContentStyleSettingsGUI.php.

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

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

+ Here is the call graph for this function:

◆ saveActiveStyles()

ilContentStyleSettingsGUI::saveActiveStyles ( )

Save active styles.

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

378 {
379 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
380 $styles = $this->settings->getStyles();
381 foreach($styles as $style)
382 {
383 if ($_POST["std_".$style["id"]] == 1)
384 {
386 }
387 else
388 {
390 }
391 }
392 ilUtil::redirect($this->ctrl->getLinkTarget($this, "edit", "", false, false));
393 }
static _writeActive($a_id, $a_active)
Write active flag.
static redirect($a_script)
http redirect to other script

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

+ Here is the call graph for this function:

◆ saveScope()

ilContentStyleSettingsGUI::saveScope ( )

Save scope for style.

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

480 {
481 global $tree;
482
483 $this->checkPermission("sty_write_content");
484
485 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
486 if ($_GET["cat"] == $tree->readRootId())
487 {
488 $_GET["cat"] = "";
489 }
491
492 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
493
494 ilUtil::redirect($this->ctrl->getLinkTarget($this, "edit", "", false, false));
495 }
static _writeScope($a_id, $a_scope)
Write scope.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

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

+ Here is the call graph for this function:

◆ setScope()

ilContentStyleSettingsGUI::setScope ( )

Set scope.

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

460 {
461 global $tpl, $ilCtrl;
462
463 $this->checkPermission("sty_write_content");
464
465 $ilCtrl->saveParameter($this, "id");
466 include_once("./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
467 $exp = new ilRepositorySelectorExplorerGUI($this, "setScope",
468 $this, "saveScope", "cat");
469 $exp->setTypeWhiteList(array("root", "cat"));
470 if (!$exp->handleCommand())
471 {
472 $tpl->setContent($exp->getHTML());
473 }
474 }
Explorer for selecting repository items.

References $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 401 of file class.ilContentStyleSettingsGUI.php.

402 {
403
404 // delete
405 $this->tpl->setCurrentBlock("tbl_action_btn");
406 $this->tpl->setVariable("BTN_NAME", "deleteStyle");
407 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("delete"));
408 $this->tpl->parseCurrentBlock();
409
410 // set global default
411 $this->tpl->setCurrentBlock("tbl_action_btn");
412 $this->tpl->setVariable("BTN_NAME", "toggleGlobalDefault");
413 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("toggleGlobalDefault"));
414 $this->tpl->parseCurrentBlock();
415
416 // set global default
417 $this->tpl->setCurrentBlock("tbl_action_btn");
418 $this->tpl->setVariable("BTN_NAME", "toggleGlobalFixed");
419 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("toggleGlobalFixed"));
420 $this->tpl->parseCurrentBlock();
421
422 // set global default
423 $this->tpl->setCurrentBlock("tbl_action_btn");
424 $this->tpl->setVariable("BTN_NAME", "setScope");
425 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("sty_set_scope"));
426 $this->tpl->parseCurrentBlock();
427
428 // save active styles
429 $this->tpl->setCurrentBlock("tbl_action_btn");
430 $this->tpl->setVariable("BTN_NAME", "saveActiveStyles");
431 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("sty_save_active_styles"));
432 $this->tpl->parseCurrentBlock();
433
434 if ($with_subobjects === true)
435 {
436 $this->showPossibleSubObjects();
437 }
438
439 $this->tpl->setCurrentBlock("tbl_action_row");
440 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
441 $this->tpl->parseCurrentBlock();
442 }
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 323 of file class.ilContentStyleSettingsGUI.php.

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

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

+ Here is the call graph for this function:

◆ toggleGlobalFixed()

ilContentStyleSettingsGUI::toggleGlobalFixed ( )

Toggle global fixed style.

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

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

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

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilContentStyleSettingsGUI::$ctrl
protected

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

◆ $DIC

ilContentStyleSettingsGUI::$DIC
protected

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

Referenced by __construct().

◆ $lng

ilContentStyleSettingsGUI::$lng
protected

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

Referenced by toggleGlobalDefault(), and toggleGlobalFixed().

◆ $rbacsystem

ilContentStyleSettingsGUI::$rbacsystem
protected

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

◆ $ref_id

ilContentStyleSettingsGUI::$ref_id
protected

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

◆ $toolbar

ilContentStyleSettingsGUI::$toolbar
protected

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

◆ $tpl

ilContentStyleSettingsGUI::$tpl
protected

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

Referenced by setScope().


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