2 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
3 include_once(
"Services/Style/System/classes/class.ilSystemStyleSettings.php");
4 include_once(
"Services/Style/System/classes/Overview/class.ilSystemStyleDeleteGUI.php");
5 include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleMessageStack.php");
6 include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleSkinContainer.php");
7 include_once(
"Services/FileDelivery/classes/class.ilFileDelivery.php");
8 include_once(
"Services/Style/System/classes/Overview/class.ilSystemStylesTableGUI.php");
9 include_once(
"Services/Form/classes/class.ilSelectInputGUI.php");
10 include_once(
"Services/Style/System/classes/class.ilStyleDefinition.php");
11 include_once(
"Services/Style/System/classes/Utilities/class.ilSkinXML.php");
12 include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleSkinContainer.php");
13 include_once(
"Services/Object/exceptions/class.ilObjectException.php");
70 $this->
ilias = $DIC[
"ilias"];
72 $this->ctrl = $DIC->ctrl();
73 $this->toolbar = $DIC->toolbar();
74 $this->lng = $DIC->language();
75 $this->tpl = $DIC[
"tpl"];
77 $this->ref_id = (int)
$_GET[
"ref_id"];
88 $cmd = $this->ctrl->getCmd();
96 case "addSystemStyle":
98 case "saveNewSystemStyle":
99 case "saveNewSubStyle":
104 case "confirmDelete":
113 case "moveUserStyles":
114 case "saveStyleSettings":
130 $this->tpl->setContent(
$table->getHTML());
145 $add_skin_btn->setCaption($this->lng->txt(
"add_system_style"),
false);
146 $add_skin_btn->setUrl($this->ctrl->getLinkTarget($this,
'addSystemStyle'));
147 $this->toolbar->addButtonInstance($add_skin_btn);
151 $add_substyle_btn->setCaption($this->lng->txt(
"add_substyle"),
false);
152 $add_substyle_btn->setUrl($this->ctrl->getLinkTarget($this,
'addSubStyle'));
153 if (count(ilStyleDefinition::getAllSkins()) ==1) {
154 $add_substyle_btn->setDisabled(
true);
156 $this->toolbar->addButtonInstance($add_substyle_btn);
158 $this->toolbar->addSeparator();
162 $si =
new ilSelectInputGUI($this->lng->txt(
"sty_move_user_styles") .
": " . $this->lng->txt(
"sty_from"),
"from_style");
165 foreach (ilStyleDefinition::getAllSkinStyles() as
$id => $skin_style) {
166 if (!$skin_style[
'substyle_of']) {
167 $options[
$id] = $skin_style[
'title'];
170 $si->setOptions($options +
array(
"other" => $this->lng->txt(
"other")));
172 $this->toolbar->addInputItem(
$si,
true);
176 $si->setOptions($options);
177 $this->toolbar->addInputItem(
$si,
true);
180 $move_skin_btn->setCaption($this->lng->txt(
"sty_move_style"),
false);
181 $this->toolbar->addButtonInstance($move_skin_btn);
182 $this->toolbar->setFormAction($this->ctrl->getLinkTarget($this,
'moveUserStyles'));
186 $this->tpl->setContent(
$table->getHTML());
194 $to = explode(
":",
$_POST[
"to_style"]);
196 if (
$_POST[
"from_style"] ==
"other") {
202 foreach ($all_user_styles as
$style) {
204 $style_arr = explode(
":", $style);
214 $this->ctrl->redirect($this,
"edit");
226 $all_styles = ilStyleDefinition::getAllSkinStyles();
227 foreach ($all_styles as $st) {
228 if (!isset(
$_POST[
"st_act"][$st[
"id"]])) {
236 if (
$_POST[
"default_skin_style"] !=
"") {
237 $sknst = explode(
":",
$_POST[
"default_skin_style"]);
242 $message_stack->sendMessages(
true);
243 $this->ctrl->redirect($this,
"edit");
254 if (count(
$_POST[
"st_act"]) < 1) {
259 if (!isset(
$_POST[
"st_act"][
$_POST[
"default_skin_style"]])) {
266 $all_styles = ilStyleDefinition::getAllSkinStyles();
268 foreach ($all_styles as $st) {
269 if (!isset($_POST[
"st_act"][$st[
"id"]])) {
285 $this->addSystemStyleForms();
293 if (
$form->checkInput()) {
304 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'skin_id', $skin->getId());
305 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'style_id',
$style->getId());
306 if ($message_stack->hasMessages()) {
307 $message_stack->sendMessages(
true);
311 $this->ctrl->redirectByClass(
"ilSystemStyleSettingsGUI");
316 $message_stack->sendMessages();
320 $form->setValuesByPost();
321 $this->tpl->setContent(
$form->getHTML());
327 protected function addSystemStyleForms()
332 global $ilHelp,
$DIC;
334 $DIC->tabs()->clearTargets();
338 $ilHelp->setScreenIdComponent(
"sty");
339 $ilHelp->setScreenId(
"system_styles");
340 $ilHelp->setSubScreenId(
"create");
348 $this->tpl->setContent($this->getCreationFormsHTML($forms));
357 $form->setFormAction($this->ctrl->getFormAction($this));
358 $form->setTitle($this->lng->txt(
"sty_create_new_system_style"));
361 $ti->
setInfo($this->lng->txt(
"skin_id_description"));
362 $ti->setMaxLength(128);
364 $ti->setRequired(
true);
367 $ti =
new ilTextInputGUI($this->lng->txt(
"skin_name"),
"skin_name");
368 $ti->
setInfo($this->lng->txt(
"skin_name_description"));
369 $ti->setMaxLength(128);
371 $ti->setRequired(
true);
374 $ti =
new ilTextInputGUI($this->lng->txt(
"style_id"),
"style_id");
375 $ti->
setInfo($this->lng->txt(
"style_id_description"));
376 $ti->setMaxLength(128);
378 $ti->setRequired(
true);
381 $ti =
new ilTextInputGUI($this->lng->txt(
"style_name"),
"style_name");
382 $ti->
setInfo($this->lng->txt(
"style_name_description"));
383 $ti->setMaxLength(128);
385 $ti->setRequired(
true);
388 $form->addCommandButton(
"saveNewSystemStyle", $this->lng->txt(
"save"));
389 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
400 $form->setFormAction($this->ctrl->getFormAction($this));
401 $form->setTitle($this->lng->txt(
"sty_import_system_style"));
404 $file_input =
new ilFileInputGUI($this->lng->txt(
"import_file"),
"importfile");
406 $file_input->setSuffixes(
array(
"zip"));
407 $form->addItem($file_input);
409 $form->addCommandButton(
"importStyle", $this->lng->txt(
"import"));
410 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
421 $form->setFormAction($this->ctrl->getFormAction($this));
422 $form->setTitle($this->lng->txt(
"sty_copy_other_system_style"));
427 $styles = ilStyleDefinition::getAllSkinStyles();
431 if (
$style[
"skin_id"]!=$system_style_conf->getDefaultSkinId()) {
439 $form->addCommandButton(
"copyStyle", $this->lng->txt(
"copy"));
440 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
449 protected function getCreationFormsHTML(
array $a_forms)
451 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
456 foreach ($a_forms as $form_type => $cf) {
460 $htpl =
new ilTemplate(
"tpl.creation_acc_head.html",
true,
true,
"Services/Object");
464 if (method_exists($this,
"getCreationFormTitle")) {
465 $form_title = $this->getCreationFormTitle($form_type);
468 $form_title = $cf->getTitle();
472 $htpl->setVariable(
"TITLE", $this->lng->txt(
"option") .
" " . $cnt .
": " .
475 $cf->setTitleIcon(null);
476 $cf->setTableWidth(
"100%");
478 $acc->addItem($htpl->get(), $cf->getHTML());
483 return "<div class='ilCreationFormSection'>" . $acc->getHTML() .
"</div>";
490 $imploded_skin_style_id = explode(
":",
$_POST[
'source_style']);
491 $skin_id = $imploded_skin_style_id[0];
492 $style_id = $imploded_skin_style_id[1];
498 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'skin_id', $new_container->getSkin()->getId());
499 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'style_id', $new_container->getSkin()->getStyle($style_id)->getId());
505 $message_stack->sendMessages(
true);
506 $this->ctrl->redirectByClass(
"ilSystemStyleSettingsGUI");
511 $skin_id =
$_GET[
"skin_id"];
512 $style_id =
$_GET[
"style_id"];
518 $delete_form_table->addStyle(
$container->getSkin(),
$container->getSkin()->getStyle($style_id));
519 $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
522 $message_stack->sendMessages(
true);
531 $all_deletable =
true;
532 foreach (
$_POST[
'id'] as $skin_style_id) {
533 $imploded_skin_style_id = explode(
":", $skin_style_id);
534 $skin_id = $imploded_skin_style_id[0];
535 $style_id = $imploded_skin_style_id[1];
536 if (!$this->
checkDeletable($skin_id, $style_id, $message_stack)) {
537 $all_deletable =
false;
540 if ($all_deletable) {
541 foreach (
$_POST[
'id'] as $skin_style_id) {
542 $imploded_skin_style_id = explode(
":", $skin_style_id);
543 $skin_id = $imploded_skin_style_id[0];
544 $style_id = $imploded_skin_style_id[1];
546 $delete_form_table->addStyle(
$container->getSkin(),
$container->getSkin()->getStyle($style_id));
548 $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
551 $message_stack->sendMessages(
true);
591 if (is_string($skin_style_id) && strpos(
$key,
'style') !==
false) {
593 $imploded_skin_style_id = explode(
":", $skin_style_id);
595 $syle =
$container->getSkin()->getStyle($imploded_skin_style_id[1]);
605 $message_stack->sendMessages(
true);
606 $this->ctrl->redirect($this);
616 if (
$form->checkInput()) {
619 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'skin_id', $imported_container->getSkin()->getId());
620 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'style_id', $imported_container->getSkin()->getDefaultStyle()->getId());
623 $message_stack->sendMessages(
true);
624 $this->ctrl->redirectByClass(
"ilSystemStyleSettingsGUI");
628 $form->setValuesByPost();
629 $this->tpl->setContent(
$form->getHTML());
633 $skin_id =
$_GET[
"skin_id"];
646 protected function addSubStyle()
651 global $ilHelp,
$DIC;
653 $DIC->tabs()->clearTargets();
657 $ilHelp->setScreenIdComponent(
"sty");
658 $ilHelp->setScreenId(
"system_styles");
659 $ilHelp->setSubScreenId(
"create_sub");
663 $this->tpl->setContent(
$form->getHTML());
672 $form->setFormAction($this->ctrl->getFormAction($this));
673 $form->setTitle($this->lng->txt(
"sty_create_new_system_sub_style"));
676 $ti =
new ilTextInputGUI($this->lng->txt(
"sub_style_id"),
"sub_style_id");
677 $ti->
setInfo($this->lng->txt(
"sub_style_id_description"));
678 $ti->setMaxLength(128);
680 $ti->setRequired(
true);
683 $ti =
new ilTextInputGUI($this->lng->txt(
"sub_style_name"),
"sub_style_name");
684 $ti->
setInfo($this->lng->txt(
"sub_style_name_description"));
685 $ti->setMaxLength(128);
687 $ti->setRequired(
true);
693 $ti->setInfo($this->lng->txt(
"sub_style_parent_style_description"));
694 $styles = ilStyleDefinition::getAllSkinStyles();
698 if (
$style[
"skin_id"]!=$system_style_conf->getDefaultSkinId() && !
$style[
"substyle_of"]) {
705 $form->addCommandButton(
"saveNewSubStyle", $this->lng->txt(
"save"));
706 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
715 if (
$form->checkInput()) {
717 $imploded_parent_skin_style_id = explode(
":",
$_POST[
'parent_style']);
718 $parent_skin_id = $imploded_parent_skin_style_id[0];
719 $parent_style_id = $imploded_parent_skin_style_id[1];
723 if (array_key_exists(
$_POST[
'sub_style_id'],
$container->getSkin()->getSubstylesOfStyle($parent_style_id))) {
727 $sub_style_id =
$_POST[
'sub_style_id'];
730 $style->setSubstyleOf($parent_style_id);
733 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'skin_id', $parent_skin_id);
734 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'style_id', $sub_style_id);
736 $this->ctrl->redirectByClass(
"ilSystemStyleSettingsGUI");
743 $form->setValuesByPost();
744 $this->tpl->setContent(
$form->getHTML());
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _deactivateStyle($a_skin, $a_style)
deactivate system style
static import($import_zip_path, $name, ilSystemStyleMessageStack $message_stack=null, $system_styles_conf=null, $uploaded=true)
Imports a skin from zip.
static _getNumberOfUsersForStyle($a_skin, $a_style)
skins and styles
const SUBSTYLE_ASSIGNMENT_EXISTS
static styleExists($style_id)
static getCurrentDefaultSkin()
Gets default Skin of the System.
This class is responsible for all file system related actions related actions of a skin such as copyi...
checkDeletable($skin_id, $style_id, ilSystemStyleMessageStack $message_stack)
static setCurrentDefaultStyle($skin_id, $style_id)
Sets the default style of the system.
setManagementEnabled($management_enabled)
Base exception class for object service.
if(!array_key_exists('StateId', $_REQUEST)) $id
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
static _lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
ilSkinXml holds an manages the basic data of a skin as provide by the template of the skin...
executeCommand()
Execute command.
moveUserStyles()
Move user styles.
if(isset($_POST['submit'])) $form
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
redirection script todo: (a better solution should control the processing via a xml file) ...
Class for advanced editing exception handling in ILIAS.
static skinExists($skin_id, ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
__construct($read_only, $management_enabled)
Constructor.
Create styles array
The data for the language used.
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
static _activateStyle($a_skin, $a_style)
activate system style
Used to stack messages to be shown to the user.
checkStyleSettings(ilSystemStyleMessageStack $message_stack)
static _moveUsersToStyle($a_from_skin, $a_from_style, $a_to_skin, $a_to_style)
skins and styles
TableGUI class for system styles.
if(empty($password)) $table
saveStyleSettings()
Save skin and style settings.
Accordion user interface class.
static _getAllUserAssignedStyles()
skins and styles
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options