67 $this->tree = $DIC->repositoryTree();
70 $this->parent_gui = $a_parent_gui;
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"];
81 include_once(
"./Services/Style/Content/classes/class.ilContentStyleSettings.php");
90 $next_class = $this->ctrl->getNextClass($this);
91 $cmd = $this->ctrl->getCmd(
"edit");
93 switch ($next_class) {
94 case "ilobjstylesheetgui":
95 $this->ctrl->setReturn($this,
"edit");
96 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
98 $this->ctrl->forwardCommand($style_gui);
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"))) {
107 die(
"Unknown command " . $cmd);
121 if (!$this->rbacsystem->checkAccess($a_perm, $this->ref_id)) {
123 include_once
"Services/Object/exceptions/class.ilObjectException.php";
139 $ilCtrl->redirectByClass(
"ilobjstylesheetgui",
"create");
150 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
151 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
153 $from_styles = $to_styles =
$data = array();
154 $styles = $this->cs_settings->getStyles();
155 foreach ($styles as
$style) {
158 $data[$style[
"title"] .
":" . $style[
"id"]]
160 if ($style[
"lm_nr"] > 0) {
161 $from_styles[$style[
"id"]] = $style[
"title"];
163 if ($style[
"active"] > 0) {
164 $to_styles[$style[
"id"]] = $style[
"title"];
169 if ($fixed_style <= 0) {
171 array(
"title" => $this->lng->txt(
"sty_individual_styles"),
173 $from_styles[-1] = $this->lng->txt(
"sty_individual_styles");
177 if ($default_style <= 0 && $fixed_style <= 0) {
179 array(
"title" => $this->lng->txt(
"sty_default_style"),
181 $from_styles[0] = $this->lng->txt(
"sty_default_style");
182 $to_styles[0] = $this->lng->txt(
"sty_default_style");
186 $this->toolbar->addButton(
187 $this->lng->txt(
"sty_add_content_style"),
188 $this->ctrl->getLinkTarget($this,
"createStyle")
190 $this->toolbar->addSeparator();
191 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
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);
200 $si->setOptions($to_styles);
201 $this->toolbar->addInputItem(
$si,
true);
202 $this->toolbar->addFormButton($this->lng->txt(
"sty_move_style"),
"moveLMStyles");
204 $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
207 include_once(
"./Services/Style/Content/classes/class.ilContentStylesTableGUI.php");
209 $this->tpl->setContent(
$table->getHTML());
219 if (
$_POST[
"from_style"] == -1) {
224 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
226 $this->ctrl->redirect($this,
"edit");
237 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
239 $this->ctrl->redirect($this,
"edit");
249 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
251 $this->ctrl->setParameter($this,
"to_style",
$_POST[
"to_style"]);
254 $cgui->setFormAction($this->ctrl->getFormAction($this));
255 $cgui->setHeaderText($this->lng->txt(
"sty_confirm_del_ind_styles") .
": " .
257 $this->lng->txt(
"sty_confirm_del_ind_styles_desc"),
260 $cgui->setCancel($this->lng->txt(
"cancel"),
"edit");
261 $cgui->setConfirm($this->lng->txt(
"ok"),
"moveIndividualStyles");
262 $this->tpl->setContent($cgui->getHTML());
274 if (!isset(
$_POST[
"id"])) {
276 $this->ctrl->redirect($this,
"edit");
280 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
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");
291 $cgui->addItem(
"id[]", $id, $caption);
294 $this->tpl->setContent($cgui->getHTML());
306 include_once(
"./Services/Style/Content/classes/class.ilContentStyleSettings.php");
308 $set->removeStyle($id);
312 $style_obj->delete();
315 $this->ctrl->redirect($this,
"edit");
329 if (
$_GET[
"id"] > 0) {
331 $def_style =
$ilSetting->get(
"default_content_style_id");
333 if ($def_style !=
$_GET[
"id"]) {
336 $ilSetting->delete(
"default_content_style_id");
338 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
340 ilUtil::redirect($this->ctrl->getLinkTarget($this,
"edit",
"",
false,
false));
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"]) {
359 $ilSetting->set(
"fixed_content_style_id", (
int) $_GET[
"id"]);
361 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
363 ilUtil::redirect($this->ctrl->getLinkTarget($this,
"edit",
"",
false,
false));
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) {
381 ilUtil::redirect($this->ctrl->getLinkTarget($this,
"edit",
"",
false,
false));
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();
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();
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();
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();
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();
423 if ($with_subobjects ===
true) {
424 $this->showPossibleSubObjects();
427 $this->tpl->setCurrentBlock(
"tbl_action_row");
429 $this->tpl->parseCurrentBlock();
440 $this->ctrl->redirect($this,
"edit");
453 $ilCtrl->saveParameter($this,
"id");
454 include_once(
"./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
462 $exp->setTypeWhiteList(array(
"root",
"cat"));
463 if (!$exp->handleCommand()) {
464 $tpl->setContent($exp->getHTML());
477 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
483 ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"),
true);
485 ilUtil::redirect($this->ctrl->getLinkTarget($this,
"edit",
"",
false,
false));
static _writeScope($a_id, $a_scope)
Write scope.
static _getNrLMsNoStyle()
get number of learning modules assigned no style
executeCommand()
Execute command.
Explorer for selecting repository items.
toggleGlobalFixed()
Toggle global fixed style.
static _getNrOfAssignedLMs($a_style_id)
gets the number of learning modules assigned to a content style
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...
confirmedDelete()
delete selected style objects
Base exception class for object service.
if(!array_key_exists('StateId', $_REQUEST)) $id
checkPermission($a_perm, $a_throw_exc=true)
Check permission.
moveLMStyles()
move learning modules from one style to another
saveScope()
Save scope for style.
static _lookupTitle($a_id)
lookup object title
toggleGlobalDefault()
Toggle global default style.
cancelDelete()
cancel deletion of object
deleteStyle()
display deletion confirmation screen
confirmDeleteIndividualStyles()
static _moveLMStyles($a_from_style, $a_to_style)
move learning modules from one style to another
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _writeActive($a_id, $a_active)
Write active flag.
Style settings GUI class.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
saveActiveStyles()
Save active styles.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
__construct(ilObjStyleSettingsGUI $a_parent_gui)
Constructor.
Class ilObjStyleSheetGUI.
static _getNrLMsIndividualStyles()
get number of learning modules with individual styles
moveIndividualStyles()
move all learning modules with individual styles to new style
static _lookupActive($a_id)
Lookup active flag.
if(empty($password)) $table
createStyle()
Create new style.
static redirect($a_script)
showActions($with_subobjects=false)
show possible action (form buttons)
Confirmation screen class.
Settings UI class for system styles.