4 include_once
"./Services/Object/classes/class.ilObjectGUI.php";
5 include_once(
"./Services/Style/classes/class.ilPageLayout.php");
32 $cmd = $ilCtrl->getCmd();
34 if (
$cmd ==
"editPg") {
35 $this->peditor_active =
true;
38 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
40 $lng->loadLanguageModule(
"style");
48 $next_class = $this->ctrl->getNextClass($this);
49 $cmd = $this->ctrl->getCmd();
51 if ($next_class ==
"ilpagelayoutgui" ||
$cmd ==
"createPg") {
52 $this->peditor_active =
true;
59 case 'ilpermissiongui':
60 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
62 $ret =& $this->ctrl->forwardCommand($perm_gui);
65 case 'ilpagelayoutgui':
66 include_once(
"./Services/Style/classes/class.ilPageLayoutGUI.php");
67 $this->tpl->getStandardTemplate();
68 $this->ctrl->setReturn($this,
"edit");
69 if ($this->pg_id!=null) {
74 $layout_gui->setTabs();
75 $layout_gui->setEditPreview(
true);
76 $this->ctrl->saveParameter($this,
"obj_id");
77 $ret =& $this->ctrl->forwardCommand($layout_gui);
78 $this->tpl->setContent(
$ret);
84 $cmd =
"editSystemStyles";
119 if (!$rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
121 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
125 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
126 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
128 $from_styles = $to_styles =
$data = array();
129 $styles = $this->
object->getStyles();
131 foreach($styles as $style)
135 $data[$style[
"title"].
":".$style[
"id"]]
137 if ($style[
"lm_nr"] > 0)
139 $from_styles[$style[
"id"]] = $style[
"title"];
141 if ($style[
"active"] > 0)
143 $to_styles[$style[
"id"]] = $style[
"title"];
148 if ($fixed_style <= 0)
151 array(
"title" => $this->lng->txt(
"sty_individual_styles"),
153 $from_styles[-1] = $this->lng->txt(
"sty_individual_styles");
157 if ($default_style <= 0 && $fixed_style <= 0)
160 array(
"title" => $this->lng->txt(
"sty_default_style"),
162 $from_styles[0] = $this->lng->txt(
"sty_default_style");
163 $to_styles[0] = $this->lng->txt(
"sty_default_style");
166 if ($rbacsystem->checkAccess(
"write",$this->object->getRefId()))
168 $ilToolbar->addButton($lng->txt(
"sty_add_content_style"),
169 $ilCtrl->getLinkTarget($this,
"createStyle"));
170 $ilToolbar->addSeparator();
171 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
174 $si =
new ilSelectInputGUI($lng->txt(
"sty_move_lm_styles").
": ".$lng->txt(
"sty_from"),
"from_style");
175 $si->setOptions($from_styles);
176 $ilToolbar->addInputItem(
$si,
true);
180 $si->setOptions($to_styles);
181 $ilToolbar->addInputItem(
$si,
true);
182 $ilToolbar->addFormButton($lng->txt(
"sty_move_style"),
"moveLMStyles");
184 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
187 include_once(
"./Services/Style/classes/class.ilContentStylesTableGUI.php");
189 $tpl->setContent($table->getHTML());
198 if (
$_POST[
"from_style"] == -1)
204 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
206 $this->ctrl->redirect($this,
"editContentStyles");
215 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
217 $this->ctrl->redirect($this,
"editContentStyles");
227 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
229 $ilCtrl->setParameter($this,
"to_style",
$_POST[
"to_style"]);
232 $cgui->setFormAction($ilCtrl->getFormAction($this));
233 $cgui->setHeaderText($lng->txt(
"sty_confirm_del_ind_styles").
": ".
234 sprintf($this->lng->txt(
"sty_confirm_del_ind_styles_desc"),
236 $cgui->setCancel($lng->txt(
"cancel"),
"editContentStyles");
237 $cgui->setConfirm($lng->txt(
"ok"),
"moveIndividualStyles");
238 $tpl->setContent($cgui->getHTML());
248 if (!$rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()))
250 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
256 if ($rbacsystem->checkAccess(
"write",$this->object->getRefId()))
258 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
267 $si =
new ilSelectInputGUI($lng->txt(
"sty_move_user_styles").
": ".$lng->txt(
"sty_from"),
"from_style");
268 $si->setOptions(
$options + array(
"other" => $lng->txt(
"other")));
269 $ilToolbar->addInputItem(
$si,
true);
274 $ilToolbar->addInputItem(
$si,
true);
275 $ilToolbar->addFormButton($lng->txt(
"sty_move_style"),
"moveUserStyles");
277 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
280 include_once(
"./Services/Style/classes/class.ilSystemStylesTableGUI.php");
282 $tpl->setContent(
$tab->getHTML());
292 global $styleDefinition,
$ilCtrl;
295 if (count(
$_POST[
"st_act"]) < 1)
297 $this->ilias->raiseError($this->lng->txt(
"at_least_one_style"), $this->ilias->error_obj->MESSAGE);
301 if (
$_POST[
"default_skin_style"] !=
"")
303 $sknst = explode(
":",
$_POST[
"default_skin_style"]);
305 if ($this->ilias->ini->readVariable(
"layout",
"style") != $sknst[1] ||
306 $this->ilias->ini->readVariable(
"layout",
"skin") != $sknst[0])
308 $this->ilias->ini->setVariable(
"layout",
"skin", $sknst[0]);
309 $this->ilias->ini->setVariable(
"layout",
"style",$sknst[1]);
311 $this->ilias->ini->write();
317 foreach ($all_styles as $st)
319 if (!isset(
$_POST[
"st_act"][$st[
"id"]]))
323 $this->ilias->raiseError($this->lng->txt(
"cant_deactivate_if_users_assigned"), $this->ilias->error_obj->MESSAGE);
337 $ilCtrl->redirect($this ,
"editSystemStyles");
350 $to = explode(
":",
$_POST[
"to_style"]);
352 if (
$_POST[
"from_style"] !=
"other")
354 $from = explode(
":",
$_POST[
"from_style"]);
364 foreach($all_user_styles as $style)
366 if (!in_array($style, $all_styles))
368 $style_arr = explode(
":", $style);
375 $ilCtrl->redirect($this ,
"editSystemStyles");
389 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
393 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
395 $cgui->setFormAction($this->ctrl->getFormAction($this));
396 $cgui->setHeaderText($this->lng->txt(
"info_delete_sure"));
397 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDelete");
398 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmedDelete");
400 foreach (
$_POST[
"id"] as $id)
403 " ".ilObject::_lookupTitle($id);
405 $cgui->addItem(
"id[]", $id, $caption);
408 $this->tpl->setContent($cgui->getHTML());
419 foreach(
$_POST[
"id"] as $id)
421 $this->
object->removeStyle($id);
422 $style_obj =& $ilias->obj_factory->getInstanceByObjId($id);
423 $style_obj->delete();
425 $this->
object->update();
428 $this->ctrl->getLinkTarget($this,
"editContentStyles",
"",
false,
false)));
441 $ilSetting->delete(
"fixed_content_style_id");
442 $def_style = $ilSetting->get(
"default_content_style_id");
444 if ($def_style !=
$_GET[
"id"])
446 $ilSetting->set(
"default_content_style_id", (
int)
$_GET[
"id"]);
450 $ilSetting->delete(
"default_content_style_id");
454 ilUtil::redirect($this->ctrl->getLinkTarget($this,
"editContentStyles",
"",
false,
false));
466 $ilSetting->delete(
"default_content_style_id");
467 $fixed_style = $ilSetting->get(
"fixed_content_style_id");
468 if ($fixed_style == (
int)
$_GET[
"id"])
470 $ilSetting->delete(
"fixed_content_style_id");
474 $ilSetting->set(
"fixed_content_style_id", (
int) $_GET[
"id"]);
478 ilUtil::redirect($this->ctrl->getLinkTarget($this,
"editContentStyles",
"",
false,
false));
487 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
488 $styles = $this->
object->getStyles();
489 foreach($styles as $style)
491 if (
$_POST[
"std_".$style[
"id"]] == 1)
500 ilUtil::redirect($this->ctrl->getLinkTarget($this,
"editContentStyles",
"",
false,
false));
513 $this->tpl->setCurrentBlock(
"tbl_action_btn");
514 $this->tpl->setVariable(
"BTN_NAME",
"deleteStyle");
515 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"delete"));
516 $this->tpl->parseCurrentBlock();
519 $this->tpl->setCurrentBlock(
"tbl_action_btn");
520 $this->tpl->setVariable(
"BTN_NAME",
"toggleGlobalDefault");
521 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"toggleGlobalDefault"));
522 $this->tpl->parseCurrentBlock();
525 $this->tpl->setCurrentBlock(
"tbl_action_btn");
526 $this->tpl->setVariable(
"BTN_NAME",
"toggleGlobalFixed");
527 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"toggleGlobalFixed"));
528 $this->tpl->parseCurrentBlock();
531 $this->tpl->setCurrentBlock(
"tbl_action_btn");
532 $this->tpl->setVariable(
"BTN_NAME",
"setScope");
533 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"sty_set_scope"));
534 $this->tpl->parseCurrentBlock();
537 $this->tpl->setCurrentBlock(
"tbl_action_btn");
538 $this->tpl->setVariable(
"BTN_NAME",
"saveActiveStyles");
539 $this->tpl->setVariable(
"BTN_VALUE", $this->lng->txt(
"sty_save_active_styles"));
540 $this->tpl->parseCurrentBlock();
542 if ($with_subobjects ===
true)
547 $this->tpl->setCurrentBlock(
"tbl_action_row");
549 $this->tpl->parseCurrentBlock();
560 $this->ctrl->redirect($this,
"editContentStyles");
568 include_once (
"./Services/Style/classes/class.ilStyleScopeExplorer.php");
570 $exp->setExpandTarget(
"ilias.php?baseClass=ilRepositoryGUI&cmd=showTree");
571 $exp->setTargetGet(
"ref_id");
573 $exp->forceExpandAll(
true,
false);
574 $exp->addFilter(
"root");
575 $exp->addFilter(
"cat");
577 if (
$_GET[
"expand"] ==
"")
579 $expanded = $this->tree->readRootId();
583 $expanded =
$_GET[
"expand"];
586 $exp->setExpand($expanded);
590 $output = $exp->getOutput();
593 $this->tpl->setVariable(
"ADM_CONTENT", $output);
603 include_once(
"./Services/Style/classes/class.ilObjStyleSheet.php");
604 if (
$_GET[
"cat"] == 0)
610 ilUtil::redirect($this->ctrl->getLinkTarget($this,
"editContentStyles",
"",
false,
false));
621 $ilTabs->setTabActive(
'page_layouts');
624 if ($rbacsystem->checkAccess(
"write",$this->object->getRefId()))
626 $ilToolbar->addButton($lng->txt(
"sty_add_pgl"),
627 $ilCtrl->getLinkTarget($this,
"addPageLayout"));
628 $ilToolbar->addButton($lng->txt(
"sty_import_page_layout"),
629 $ilCtrl->getLinkTarget($this,
"importPageLayoutForm"));
632 $oa_tpl =
new ilTemplate(
"tpl.stys_pglayout.html",
true,
true,
"Services/Style");
634 include_once(
"./Services/Style/classes/class.ilPageLayoutTableGUI.php");
636 $oa_tpl->setVariable(
"PGLAYOUT_TABLE", $pglayout_table->getHTML());
637 $tpl->setContent($oa_tpl->get());
643 if (!isset(
$_POST[
"pglayout"]))
648 foreach (
$_POST[
"pglayout"] as $item)
651 $pg_layout->activate($a_activate);
654 $this->ctrl->redirect($this,
"viewPageLayouts");
670 if(!isset(
$_POST[
"pglayout"]))
672 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
675 $ilTabs->setTabActive(
'page_layouts');
679 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
681 $cgui->setFormAction($this->ctrl->getFormAction($this));
682 $cgui->setHeaderText($this->lng->txt(
"info_delete_sure"));
683 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDeletePg");
684 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmedDeletePg");
686 foreach(
$_POST[
"pglayout"] as $id)
689 $pg_obj->readObject();
692 " ".$pg_obj->getTitle();
694 $cgui->addItem(
"pglayout[]", $id, $caption);
697 $this->tpl->setContent($cgui->getHTML());
706 $this->ctrl->redirect($this,
"viewPageLayouts");
714 foreach (
$_POST[
"pglayout"] as $id)
720 $this->ctrl->redirect($this,
"viewPageLayouts");
727 $ilTabs->setTabActive(
'page_layouts');
734 $this->tpl->setContent($a_form->getHTML());
741 $lng->loadLanguageModule(
"content");
743 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
745 $form_gui->setFormAction($ilCtrl->getFormAction($this));
746 $form_gui->setTitle($lng->txt(
"sty_create_pgl"));
748 $title_input =
new ilTextInputGUI($lng->txt(
"title"),
"pgl_title");
750 $title_input->setMaxLength(128);
751 $title_input->setValue($this->layout_object->title);
752 $title_input->setTitle($lng->txt(
"title"));
753 $title_input->setRequired(
true);
756 $desc_input->
setValue($this->layout_object->description);
757 $desc_input->setRows(3);
758 $desc_input->setCols(37);
762 "0" => $lng->txt(
"cont_layout_template"),
763 "1" => $lng->txt(
"cont_special_page"),
774 $mods->addOption($mod);
777 $ttype_input =
new ilSelectInputGUI($lng->txt(
"sty_based_on"),
"pgl_template");
781 foreach ($arr_templates1 as $v)
783 $arr_templates[] = $v;
789 foreach ($arr_templates as $templ) {
790 $templ->readObject();
791 $key = $templ->getId();
792 $value = $templ->getTitle();
797 $ttype_input->setValue(-1);
798 $ttype_input->setRequired(
true);
800 $desc_input->setTitle($lng->txt(
"description"));
801 $desc_input->setRequired(
false);
803 $form_gui->addItem($title_input);
804 $form_gui->addItem($desc_input);
805 $form_gui->addItem($si);
806 $form_gui->addItem($mods);
807 $form_gui->addItem($ttype_input);
810 $form_gui->addCommandButton(
"createPg", $lng->txt(
"save"));
811 $form_gui->addCommandButton(
"cancelCreate", $lng->txt(
"cancel"));
822 if(!$form_gui->checkInput())
824 $form_gui->setValuesByPost();
830 $pg_object->setTitle($form_gui->getInput(
'pgl_title'));
831 $pg_object->setDescription($form_gui->getInput(
'pgl_desc'));
832 $pg_object->setSpecialPage($form_gui->getInput(
'special_page'));
833 $pg_object->setModules($form_gui->getInput(
'module'));
834 $pg_object->update();
836 include_once(
"./Services/Style/classes/class.ilPageLayoutPage.php");
839 if(!is_object($pg_content))
844 $this->pg_content->setId($pg_object->getId());
846 $tmpl = $form_gui->getInput(
'pgl_template');
850 $this->pg_content->setXMLContent($layout_obj->getXMLContent());
851 $this->pg_content->create(
false);
855 $this->pg_content->create(
false);
858 $ilCtrl->setParameterByClass(
"ilpagelayoutgui",
"obj_id", $pg_object->getId());
859 $ilCtrl->redirectByClass(
"ilpagelayoutgui",
"edit");
870 if (!$rbacsystem->checkAccess(
"write",$this->object->getRefId()))
872 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
875 $ilCtrl->setCmdClass(
"ilpagelayoutgui");
876 $ilCtrl->setCmd(
"edit");
883 echo
"settings_setTabs";
898 global $rbacsystem,
$lng, $ilTabs;
900 if ($this->peditor_active) {
901 $tabs_gui->setBackTarget($this->lng->txt(
"page_layouts"),
902 $this->ctrl->getLinkTarget($this,
"viewPageLayouts"));
905 if ($rbacsystem->checkAccess(
"visible,read",$this->object->getRefId()) && !$this->peditor_active)
907 $tabs_gui->addTarget(
"system_styles",
908 $this->ctrl->getLinkTarget($this,
"editSystemStyles"), array(
"editSystemStyles",
"",
"view"),
"",
"");
910 $tabs_gui->addTarget(
"content_styles",
911 $this->ctrl->getLinkTarget($this,
"editContentStyles"),
"editContentStyles",
"",
"");
913 $tabs_gui->addTarget(
"page_layouts",
914 $this->ctrl->getLinkTarget($this,
"viewPageLayouts"),
"viewPageLayouts",
"",
"");
919 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()) && !$this->peditor_active)
921 $tabs_gui->addTarget(
"perm_settings",
922 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
933 $ilCtrl->setParameter($this,
"new_type",
"sty");
934 $ilCtrl->redirect($this,
"create");
944 include_once(
"./Services/Style/classes/class.ilPageLayout.php");
946 if (is_array(
$_POST[
"type"]))
948 foreach(
$_POST[
"type"] as $id =>
$t)
954 $l->setSpecialPage(
$t);
955 if(is_array(
$_POST[
"module"][$id]))
957 $l->setModules(array_keys(
$_POST[
"module"][$id]));
970 $ilCtrl->redirect($this,
"viewPageLayouts");
979 include_once(
"./Services/Export/classes/class.ilExport.php");
985 $succ = $exp->exportEntity(
"pgtp", (
int)
$_GET[
"layout_id"],
"4.2.0",
986 "Services/COPage",
"Title", $tmpdir);
988 if ($succ[
"success"])
991 "",
false,
false,
false);
993 if (is_file($succ[
"directory"].
"/".$succ[
"file"]))
995 unlink($succ[
"directory"].
"/".$succ[
"file"]);
997 if (is_dir($succ[
"directory"]))
999 unlink($succ[
"directory"]);
1008 global
$tpl, $ilTabs;
1010 $ilTabs->setTabActive(
'page_layouts');
1012 $tpl->setContent($form->getHTML());
1022 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1028 $fi->setRequired(
true);
1029 $form->addItem($fi);
1031 $form->addCommandButton(
"importPageLayout", $lng->txt(
"import"));
1032 $form->addCommandButton(
"viewPageLayouts", $lng->txt(
"cancel"));
1034 $form->setTitle($lng->txt(
"sty_import_page_layout"));
1035 $form->setFormAction($ilCtrl->getFormAction($this));
1048 if ($form->checkInput())
1050 include_once(
"./Services/Style/classes/class.ilPageLayout.php");
1056 $ilCtrl->redirect($this,
"viewPageLayouts");
1060 $ilTabs->setTabActive(
'page_layouts');
1061 $form->setValuesByPost();
1062 $tpl->setContent($form->getHtml());
1076 $ilCtrl->setParameter($this,
"style_id", urlencode(
$_GET[
"style_id"]));
1078 if (!$rbacsystem->checkAccess(
"write", $this->object->getRefId()))
1084 $sel_style = $all_styles[
$_GET[
"style_id"]];
1087 if (is_array($sel_style[
"substyle"]))
1089 foreach ($sel_style[
"substyle"] as $subst)
1091 $options[$subst[
"id"]] = $subst[
"name"];
1096 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
1099 $ilToolbar->addInputItem(
$si,
true);
1101 $ilToolbar->addFormButton($lng->txt(
"sty_add_assignment"),
"addStyleCatAssignment");
1102 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1104 include_once(
"./Services/Style/classes/class.ilSysStyleCatAssignmentTableGUI.php");
1107 $tpl->setContent(
$tab->getHTML());
1121 if (!$rbacsystem->checkAccess(
"write", $this->object->getRefId()))
1126 $ilCtrl->setParameter($this,
"style_id", urlencode(
$_GET[
"style_id"]));
1127 $ilCtrl->setParameter($this,
"substyle", urlencode(
$_REQUEST[
"substyle"]));
1129 include_once
'Services/Search/classes/class.ilSearchRootSelector.php';
1131 $ilCtrl->getLinkTarget($this,
'addStyleCatAssignment'));
1132 $exp->
setExpand(
$_GET[
"search_root_expand"] ?
$_GET[
"search_root_expand"] : $tree->readRootId());
1133 $exp->setExpandTarget($ilCtrl->getLinkTarget($this,
'addStyleCatAssignment'));
1134 $exp->setTargetClass(get_class($this));
1135 $exp->setCmd(
'saveStyleCatAssignment');
1136 $exp->setClickableTypes(array(
"cat"));
1140 $tpl->setContent($exp->getOutput());
1154 if (!$rbacsystem->checkAccess(
"write", $this->object->getRefId()))
1159 $ilCtrl->setParameter($this,
"style_id", urlencode(
$_GET[
"style_id"]));
1161 $style_arr = explode(
":",
$_GET[
"style_id"]);
1166 $ilCtrl->redirect($this,
"assignStylesToCats");
1176 if (!$rbacsystem->checkAccess(
"write", $this->object->getRefId()))
1181 $ilCtrl->setParameter($this,
"style_id", urlencode(
$_GET[
"style_id"]));
1182 $style_arr = explode(
":",
$_GET[
"style_id"]);
1183 if (is_array(
$_POST[
"id"]))
1185 foreach (
$_POST[
"id"] as $id)
1187 $id_arr = explode(
":", $id);
1189 $id_arr[0], $id_arr[1]);
1194 $ilCtrl->redirect($this,
"assignStylesToCats");