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();
97 case "addSystemStyle":
99 case "saveNewSystemStyle":
100 case "saveNewSubStyle":
105 case "confirmDelete":
114 case "moveUserStyles":
115 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());
195 $to = explode(
":",
$_POST[
"to_style"]);
197 if (
$_POST[
"from_style"] ==
"other")
204 foreach($all_user_styles as
$style)
208 $style_arr = explode(
":", $style);
215 $from = explode(
":",
$_POST[
"from_style"]);
220 $this->ctrl->redirect($this ,
"edit");
232 $all_styles = ilStyleDefinition::getAllSkinStyles();
233 foreach ($all_styles as $st)
235 if (!isset(
$_POST[
"st_act"][$st[
"id"]]))
246 if (
$_POST[
"default_skin_style"] !=
"")
248 $sknst = explode(
":",
$_POST[
"default_skin_style"]);
253 $message_stack->sendMessages(
true);
254 $this->ctrl->redirect($this ,
"edit");
265 if (count(
$_POST[
"st_act"]) < 1)
271 if (!isset(
$_POST[
"st_act"][
$_POST[
"default_skin_style"]]))
279 $all_styles = ilStyleDefinition::getAllSkinStyles();
281 foreach ($all_styles as $st)
283 if (!isset($_POST[
"st_act"][$st[
"id"]]))
301 $this->addSystemStyleForms();
308 if ($form->checkInput() )
320 $container->create($message_stack);
321 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'skin_id',$skin->getId());
322 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'style_id',
$style->getId());
323 if($message_stack->hasMessages()){
324 $message_stack->sendMessages(
true);
328 $this->ctrl->redirectByClass(
"ilSystemStyleSettingsGUI");
333 $message_stack->sendMessages();
337 $form->setValuesByPost();
338 $this->tpl->setContent($form->getHTML());
344 protected function addSystemStyleForms()
349 global $ilHelp,
$DIC;
351 $DIC->tabs()->clearTargets();
355 $ilHelp->setScreenIdComponent(
"sty");
362 $this->tpl->setContent($this->getCreationFormsHTML($forms));
370 $form->setFormAction($this->ctrl->getFormAction($this));
371 $form->setTitle($this->lng->txt(
"sty_create_new_system_style"));
374 $ti->
setInfo($this->lng->txt(
"skin_id_description"));
375 $ti->setMaxLength(128);
377 $ti->setRequired(
true);
380 $ti =
new ilTextInputGUI($this->lng->txt(
"skin_name"),
"skin_name");
381 $ti->
setInfo($this->lng->txt(
"skin_name_description"));
382 $ti->setMaxLength(128);
384 $ti->setRequired(
true);
387 $ti =
new ilTextInputGUI($this->lng->txt(
"style_id"),
"style_id");
388 $ti->
setInfo($this->lng->txt(
"style_id_description"));
389 $ti->setMaxLength(128);
391 $ti->setRequired(
true);
394 $ti =
new ilTextInputGUI($this->lng->txt(
"style_name"),
"style_name");
395 $ti->
setInfo($this->lng->txt(
"style_name_description"));
396 $ti->setMaxLength(128);
398 $ti->setRequired(
true);
401 $form->addCommandButton(
"saveNewSystemStyle", $this->lng->txt(
"save"));
402 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
412 $form->setFormAction($this->ctrl->getFormAction($this));
413 $form->setTitle($this->lng->txt(
"sty_import_system_style"));
416 $file_input =
new ilFileInputGUI($this->lng->txt(
"import_file"),
"importfile");
418 $file_input->setSuffixes(
array(
"zip"));
419 $form->addItem($file_input);
421 $form->addCommandButton(
"importStyle", $this->lng->txt(
"import"));
422 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
432 $form->setFormAction($this->ctrl->getFormAction($this));
433 $form->setTitle($this->lng->txt(
"sty_copy_other_system_style"));
438 $styles = ilStyleDefinition::getAllSkinStyles();
442 if(
$style[
"skin_id"]!=$system_style_conf->getDefaultSkinId()){
450 $form->addCommandButton(
"copyStyle", $this->lng->txt(
"copy"));
451 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
460 protected function getCreationFormsHTML(
array $a_forms)
462 include_once(
"./Services/Accordion/classes/class.ilAccordionGUI.php");
467 foreach ($a_forms as $form_type => $cf)
472 $htpl =
new ilTemplate(
"tpl.creation_acc_head.html",
true,
true,
"Services/Object");
476 if(method_exists($this,
"getCreationFormTitle"))
478 $form_title = $this->getCreationFormTitle($form_type);
482 $form_title = $cf->getTitle();
486 $htpl->setVariable(
"TITLE", $this->lng->txt(
"option").
" ".$cnt.
": ".
489 $cf->setTitleIcon(null);
490 $cf->setTableWidth(
"100%");
492 $acc->addItem($htpl->get(), $cf->getHTML());
497 return "<div class='ilCreationFormSection'>".$acc->getHTML().
"</div>";
503 $imploded_skin_style_id = explode(
":",
$_POST[
'source_style']);
504 $skin_id = $imploded_skin_style_id[0];
505 $style_id = $imploded_skin_style_id[1];
509 $new_container = $container->copy();
511 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'skin_id',$new_container->getSkin()->getId());
512 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'style_id',$new_container->getSkin()->getStyle($style_id)->getId());
518 $message_stack->sendMessages(
true);
519 $this->ctrl->redirectByClass(
"ilSystemStyleSettingsGUI");
523 $skin_id =
$_GET[
"skin_id"];
524 $style_id =
$_GET[
"style_id"];
530 $delete_form_table->addStyle($container->getSkin(),$container->getSkin()->getStyle($style_id));
531 $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
534 $message_stack->sendMessages(
true);
544 $all_deletable =
true;
545 foreach(
$_POST[
'id'] as $skin_style_id){
546 $imploded_skin_style_id = explode(
":", $skin_style_id);
547 $skin_id = $imploded_skin_style_id[0];
548 $style_id = $imploded_skin_style_id[1];
550 $all_deletable =
false;
554 foreach(
$_POST[
'id'] as $skin_style_id){
555 $imploded_skin_style_id = explode(
":", $skin_style_id);
556 $skin_id = $imploded_skin_style_id[0];
557 $style_id = $imploded_skin_style_id[1];
559 $delete_form_table->addStyle($container->getSkin(),$container->getSkin()->getStyle($style_id));
561 $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
564 $message_stack->sendMessages(
true);
607 foreach(
$_POST as $key => $skin_style_id){
608 if(is_string($skin_style_id) && strpos($key,
'style') !==
false){
610 $imploded_skin_style_id = explode(
":", $skin_style_id);
612 $syle = $container->getSkin()->getStyle($imploded_skin_style_id[1]);
613 $container->deleteStyle($syle);
614 if(!$container->getSkin()->hasStyles()){
615 $container->delete();
623 $message_stack->sendMessages(
true);
624 $this->ctrl->redirect($this);
633 if ($form->checkInput() )
637 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'skin_id',$imported_container->getSkin()->getId());
638 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'style_id',$imported_container->getSkin()->getDefaultStyle()->getId());
641 $message_stack->sendMessages(
true);
642 $this->ctrl->redirectByClass(
"ilSystemStyleSettingsGUI");
646 $form->setValuesByPost();
647 $this->tpl->setContent($form->getHTML());
650 $skin_id =
$_GET[
"skin_id"];
653 $container->export();
664 protected function addSubStyle()
669 global $ilHelp,
$DIC;
671 $DIC->tabs()->clearTargets();
672 $ilHelp->setScreenIdComponent(
"sty");
677 $this->tpl->setContent($form->getHTML());
687 $form->setFormAction($this->ctrl->getFormAction($this));
688 $form->setTitle($this->lng->txt(
"sty_create_new_system_sub_style"));
691 $ti =
new ilTextInputGUI($this->lng->txt(
"sub_style_id"),
"sub_style_id");
692 $ti->
setInfo($this->lng->txt(
"sub_style_id_description"));
693 $ti->setMaxLength(128);
695 $ti->setRequired(
true);
698 $ti =
new ilTextInputGUI($this->lng->txt(
"sub_style_name"),
"sub_style_name");
699 $ti->
setInfo($this->lng->txt(
"sub_style_name_description"));
700 $ti->setMaxLength(128);
702 $ti->setRequired(
true);
708 $ti->setInfo($this->lng->txt(
"sub_style_parent_style_description"));
709 $styles = ilStyleDefinition::getAllSkinStyles();
713 if(
$style[
"skin_id"]!=$system_style_conf->getDefaultSkinId() && !
$style[
"substyle_of"]){
720 $form->addCommandButton(
"saveNewSubStyle", $this->lng->txt(
"save"));
721 $form->addCommandButton(
"cancel", $this->lng->txt(
"cancel"));
729 if ($form->checkInput() )
732 $imploded_parent_skin_style_id = explode(
":",
$_POST[
'parent_style']);
733 $parent_skin_id = $imploded_parent_skin_style_id[0];
734 $parent_style_id = $imploded_parent_skin_style_id[1];
738 $sub_style_id =
$_POST[
'sub_style_id'];
741 $style->setSubstyleOf($parent_style_id);
742 $container->addStyle(
$style);
744 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'skin_id',$parent_skin_id);
745 $this->ctrl->setParameterByClass(
'ilSystemStyleSettingsGUI',
'style_id',$sub_style_id);
747 $this->ctrl->redirectByClass(
"ilSystemStyleSettingsGUI");
754 $form->setValuesByPost();
755 $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
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.
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(!is_array($argv)) $options
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.
saveStyleSettings()
Save skin and style settings.
Accordion user interface class.
static _getAllUserAssignedStyles()
skins and styles