ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilSystemStyleOverviewGUI.php
Go to the documentation of this file.
1<?php
2include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
3include_once("Services/Style/System/classes/class.ilSystemStyleSettings.php");
4include_once("Services/Style/System/classes/Overview/class.ilSystemStyleDeleteGUI.php");
5include_once("Services/Style/System/classes/Utilities/class.ilSystemStyleMessageStack.php");
6include_once("Services/Style/System/classes/Utilities/class.ilSystemStyleSkinContainer.php");
7include_once("Services/FileDelivery/classes/class.ilFileDelivery.php");
8include_once("Services/Style/System/classes/Overview/class.ilSystemStylesTableGUI.php");
9include_once("Services/Form/classes/class.ilSelectInputGUI.php");
10include_once("Services/Style/System/classes/class.ilStyleDefinition.php");
11include_once("Services/Style/System/classes/Utilities/class.ilSkinXML.php");
12include_once("Services/Style/System/classes/Utilities/class.ilSystemStyleSkinContainer.php");
13include_once("Services/Object/exceptions/class.ilObjectException.php");
14
21{
25 protected $ctrl;
26
30 protected $toolbar;
31
35 protected $lng;
36
40 protected $tpl;
41
45 protected $DIC;
46
50 protected $ref_id;
51
55 protected $read_only = true;
56
60 protected $management_enabled = false;
61
62
67 {
68 global $DIC;
69
70 $this->ilias = $DIC["ilias"];
71 $this->dic = $DIC;
72 $this->ctrl = $DIC->ctrl();
73 $this->toolbar = $DIC->toolbar();
74 $this->lng = $DIC->language();
75 $this->tpl = $DIC["tpl"];
76
77 $this->ref_id = (int) $_GET["ref_id"];
78
79 $this->setReadOnly($read_only);
81 }
82
86 function executeCommand()
87 {
88 $cmd = $this->ctrl->getCmd();
89
90 if($cmd == ""){
91 $cmd = $this->isReadOnly()?"view":"edit";
92 }
93
94
95 switch ($cmd)
96 {
97 case "addSystemStyle":
98 case "addSubStyle":
99 case "saveNewSystemStyle":
100 case "saveNewSubStyle":
101 case "copyStyle":
102 case "importStyle":
103 case "deleteStyles":
104 case "deleteStyle":
105 case "confirmDelete":
106 if(!$this->isManagementEnabled()){
107 throw new ilObjectException($this->lng->txt("permission_denied"));
108 }
109 $this->$cmd();
110 return;
111 case "cancel":
112 case "edit":
113 case "export":
114 case "moveUserStyles":
115 case "saveStyleSettings":
116 if($this->isReadOnly()){
117 throw new ilObjectException($this->lng->txt("permission_denied"));
118 }
119 $this->$cmd();
120 return;
121 case "view":
122 $this->$cmd();
123 return;
124
125 }
126 }
127
128 protected function view(){
129 $table = new ilSystemStylesTableGUI($this, "edit",true);
130 $this->tpl->setContent($table->getHTML());
131 }
132
133 protected function cancel(){
134 $this->edit();
135 }
139 function edit()
140 {
141
142 if($this->isManagementEnabled()){
143 // Add Button for adding skins
144 $add_skin_btn = ilLinkButton::getInstance();
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);
148
149 // Add Button for adding skins
150 $add_substyle_btn = ilLinkButton::getInstance();
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);
155 }
156 $this->toolbar->addButtonInstance($add_substyle_btn);
157
158 $this->toolbar->addSeparator();
159 }
160
161 // from styles selector
162 $si = new ilSelectInputGUI($this->lng->txt("sty_move_user_styles").": ".$this->lng->txt("sty_from"), "from_style");
163
164 $options = array();
165 foreach(ilStyleDefinition::getAllSkinStyles() as $id => $skin_style) {
166 if(!$skin_style['substyle_of']){
167 $options[$id] = $skin_style['title'];
168 }
169 }
170 $si->setOptions($options + array("other" => $this->lng->txt("other")));
171
172 $this->toolbar->addInputItem($si, true);
173
174 // from styles selector
175 $si = new ilSelectInputGUI($this->lng->txt("sty_to"), "to_style");
176 $si->setOptions($options);
177 $this->toolbar->addInputItem($si, true);
178 // Add Button for adding skins
179 $move_skin_btn = ilSubmitButton::getInstance();
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'));
183
184 $table = new ilSystemStylesTableGUI($this, "edit");
185 $table->addActions($this->isManagementEnabled());
186 $this->tpl->setContent($table->getHTML());
187
188 }
189
193 function moveUserStyles()
194 {
195 $to = explode(":", $_POST["to_style"]);
196
197 if ($_POST["from_style"] == "other")
198 {
199 // get all user assigned styles
200 $all_user_styles = ilObjUser::_getAllUserAssignedStyles();
201
202 // move users that are not assigned to
203 // currently existing style
204 foreach($all_user_styles as $style)
205 {
207 {
208 $style_arr = explode(":", $style);
209 ilObjUser::_moveUsersToStyle($style_arr[0],$style_arr[1],$to[0],$to[1]);
210 }
211 }
212 }
213 else
214 {
215 $from = explode(":", $_POST["from_style"]);
216 ilObjUser::_moveUsersToStyle($from[0],$from[1],$to[0],$to[1]);
217 }
218
219 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
220 $this->ctrl->redirect($this , "edit");
221 }
222
223
228 {
229 $message_stack = new ilSystemStyleMessageStack();
230
231 if($this->checkStyleSettings($message_stack)){
232 $all_styles = ilStyleDefinition::getAllSkinStyles();
233 foreach ($all_styles as $st)
234 {
235 if (!isset($_POST["st_act"][$st["id"]]))
236 {
237 ilSystemStyleSettings::_deactivateStyle($st["template_id"], $st["style_id"]);
238 }
239 else
240 {
241 ilSystemStyleSettings::_activateStyle($st["template_id"], $st["style_id"]);
242 }
243 }
244
245 //set default skin and style
246 if ($_POST["default_skin_style"] != "")
247 {
248 $sknst = explode(":", $_POST["default_skin_style"]);
250 }
251 $message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt("msg_obj_modified"),ilSystemStyleMessage::TYPE_SUCCESS));
252 }
253 $message_stack->sendMessages(true);
254 $this->ctrl->redirect($this , "edit");
255 }
256
261 protected function checkStyleSettings(ilSystemStyleMessageStack $message_stack){
262
263 $passed = true;
264
265 if (count($_POST["st_act"]) < 1)
266 {
267 $passed = false;
268 $message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt("at_least_one_style"),ilSystemStyleMessage::TYPE_ERROR));
269 }
270
271 if (!isset($_POST["st_act"][$_POST["default_skin_style"]]))
272 {
273 $passed = false;
274 $message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt("cant_deactivate_default_style"),ilSystemStyleMessage::TYPE_ERROR));
275 }
276
277 // check if a style should be deactivated, that still has
278 // a user assigned to
279 $all_styles = ilStyleDefinition::getAllSkinStyles();
280
281 foreach ($all_styles as $st)
282 {
283 if (!isset($_POST["st_act"][$st["id"]]))
284 {
285 if (ilObjUser::_getNumberOfUsersForStyle($st["template_id"], $st["style_id"]) > 0)
286 {
287 $passed = false;
288 $message_stack->addMessage(new ilSystemStyleMessage($st["style_name"].": ".$this->lng->txt("cant_deactivate_if_users_assigned"),ilSystemStyleMessage::TYPE_ERROR));
289 }
290 }
291 }
292 return $passed;
293 }
294
295
299 protected function addSystemStyle()
300 {
301 $this->addSystemStyleForms();
302 }
303
304
305 protected function saveNewSystemStyle(){
306 $form = $this->createSystemStyleForm();
307
308 if ($form->checkInput() )
309 {
310 $message_stack = new ilSystemStyleMessageStack();
312 ilUtil::sendFailure($this->lng->txt("skin_id_exists"));
313 }
314 else{
315 try{
316 $skin = new ilSkinXML($_POST["skin_id"],$_POST["skin_name"]);
317 $style = new ilSkinStyleXML($_POST["style_id"],$_POST["style_name"]);
318 $skin->addStyle($style);
319 $container = new ilSystemStyleSkinContainer($skin);
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);
325 }else{
326 ilUtil::sendSuccess($this->lng->txt("msg_sys_style_created"), true);
327 }
328 $this->ctrl->redirectByClass("ilSystemStyleSettingsGUI");
329 }catch(ilSystemStyleException $e){
330 $message_stack->addMessage(new ilSystemStyleMessage($e->getMessage(),ilSystemStyleMessage::TYPE_ERROR));
331 }
332 }
333 $message_stack->sendMessages();
334 }
335
336 // display only this form to correct input
337 $form->setValuesByPost();
338 $this->tpl->setContent($form->getHTML());
339 }
340
344 protected function addSystemStyleForms()
345 {
349 global $ilHelp, $DIC;
350
351 $DIC->tabs()->clearTargets();
352
353 $forms = array();
354
355 $ilHelp->setScreenIdComponent("sty");
356 $ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "system_style_create");
357
358 $forms[] = $this->createSystemStyleForm();
359 $forms[] = $this->importSystemStyleForm();
360 $forms[] = $this->cloneSystemStyleForm();
361
362 $this->tpl->setContent($this->getCreationFormsHTML($forms));
363 }
364
368 protected function createSystemStyleForm(){
369 $form = new ilPropertyFormGUI();
370 $form->setFormAction($this->ctrl->getFormAction($this));
371 $form->setTitle($this->lng->txt("sty_create_new_system_style"));
372
373 $ti = new ilTextInputGUI($this->lng->txt("skin_id"), "skin_id");
374 $ti->setInfo($this->lng->txt("skin_id_description"));
375 $ti->setMaxLength(128);
376 $ti->setSize(40);
377 $ti->setRequired(true);
378 $form->addItem($ti);
379
380 $ti = new ilTextInputGUI($this->lng->txt("skin_name"), "skin_name");
381 $ti->setInfo($this->lng->txt("skin_name_description"));
382 $ti->setMaxLength(128);
383 $ti->setSize(40);
384 $ti->setRequired(true);
385 $form->addItem($ti);
386
387 $ti = new ilTextInputGUI($this->lng->txt("style_id"), "style_id");
388 $ti->setInfo($this->lng->txt("style_id_description"));
389 $ti->setMaxLength(128);
390 $ti->setSize(40);
391 $ti->setRequired(true);
392 $form->addItem($ti);
393
394 $ti = new ilTextInputGUI($this->lng->txt("style_name"), "style_name");
395 $ti->setInfo($this->lng->txt("style_name_description"));
396 $ti->setMaxLength(128);
397 $ti->setSize(40);
398 $ti->setRequired(true);
399 $form->addItem($ti);
400
401 $form->addCommandButton("saveNewSystemStyle", $this->lng->txt("save"));
402 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
403
404 return $form;
405 }
406
410 protected function importSystemStyleForm(){
411 $form = new ilPropertyFormGUI();
412 $form->setFormAction($this->ctrl->getFormAction($this));
413 $form->setTitle($this->lng->txt("sty_import_system_style"));
414
415 // title
416 $file_input = new ilFileInputGUI($this->lng->txt("import_file"), "importfile");
417 $file_input->setRequired(true);
418 $file_input->setSuffixes(array("zip"));
419 $form->addItem($file_input);
420
421 $form->addCommandButton("importStyle", $this->lng->txt("import"));
422 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
423
424 return $form;
425 }
426
430 protected function cloneSystemStyleForm(){
431 $form = new ilPropertyFormGUI();
432 $form->setFormAction($this->ctrl->getFormAction($this));
433 $form->setTitle($this->lng->txt("sty_copy_other_system_style"));
434
435 // source
436 $ti = new ilSelectInputGUI($this->lng->txt("sty_source"), "source_style");
437 $ti->setRequired(true);
438 $styles = ilStyleDefinition::getAllSkinStyles();
439 $options = array();
440 foreach($styles as $id => $style){
441 $system_style_conf = new ilSystemStyleConfig();
442 if($style["skin_id"]!=$system_style_conf->getDefaultSkinId()){
443 $options[$id] = $style['title'];
444 }
445 }
446 $ti->setOptions($options);
447
448 $form->addItem($ti);
449
450 $form->addCommandButton("copyStyle", $this->lng->txt("copy"));
451 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
452
453 return $form;
454 }
455
460 protected function getCreationFormsHTML(array $a_forms)
461 {
462 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
463
464 $acc = new ilAccordionGUI();
465 $acc->setBehaviour(ilAccordionGUI::FIRST_OPEN);
466 $cnt = 1;
467 foreach ($a_forms as $form_type => $cf)
468 {
472 $htpl = new ilTemplate("tpl.creation_acc_head.html", true, true, "Services/Object");
473
474 // using custom form titles (used for repository plugins)
475 $form_title = "";
476 if(method_exists($this, "getCreationFormTitle"))
477 {
478 $form_title = $this->getCreationFormTitle($form_type);
479 }
480 if(!$form_title)
481 {
482 $form_title = $cf->getTitle();
483 }
484
485 // move title from form to accordion
486 $htpl->setVariable("TITLE", $this->lng->txt("option")." ".$cnt.": ".
487 $form_title);
488 $cf->setTitle(null);
489 $cf->setTitleIcon(null);
490 $cf->setTableWidth("100%");
491
492 $acc->addItem($htpl->get(), $cf->getHTML());
493
494 $cnt++;
495 }
496
497 return "<div class='ilCreationFormSection'>".$acc->getHTML()."</div>";
498 }
499
500 protected function copyStyle(){
501 $message_stack = new ilSystemStyleMessageStack();
502
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];
506
507 try{
508 $container = ilSystemStyleSkinContainer::generateFromId($skin_id,$message_stack);
509 $new_container = $container->copy();
510 $message_stack->prependMessage(new ilSystemStyleMessage($this->lng->txt("style_copied"),ilSystemStyleMessage::TYPE_SUCCESS));
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());
513 }catch(Exception $e){
514 $message_stack->addMessage(new ilSystemStyleMessage($e->getMessage(),ilSystemStyleMessage::TYPE_ERROR));
515 }
516
517
518 $message_stack->sendMessages(true);
519 $this->ctrl->redirectByClass("ilSystemStyleSettingsGUI");
520 }
521
522 protected function deleteStyle(){
523 $skin_id = $_GET["skin_id"];
524 $style_id = $_GET["style_id"];
525 $message_stack = new ilSystemStyleMessageStack();
526
527 if($this->checkDeletable($skin_id,$style_id,$message_stack)){
528 $delete_form_table = new ilSystemStyleDeleteGUI();
529 $container = ilSystemStyleSkinContainer::generateFromId($skin_id);
530 $delete_form_table->addStyle($container->getSkin(),$container->getSkin()->getStyle($style_id));
531 $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
532 }else{
533 $message_stack->prependMessage(new ilSystemStyleMessage($this->lng->txt("style_not_deleted"),ilSystemStyleMessage::TYPE_ERROR));
534 $message_stack->sendMessages(true);
535 $this->edit();
536 }
537
538
539 }
540 protected function deleteStyles(){
541 $delete_form_table = new ilSystemStyleDeleteGUI();
542 $message_stack = new ilSystemStyleMessageStack();
543
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];
549 if(!$this->checkDeletable($skin_id,$style_id,$message_stack)){
550 $all_deletable = false;
551 }
552 }
553 if($all_deletable){
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];
558 $container = ilSystemStyleSkinContainer::generateFromId($skin_id);
559 $delete_form_table->addStyle($container->getSkin(),$container->getSkin()->getStyle($style_id));
560 }
561 $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
562 }else{
563 $message_stack->prependMessage(new ilSystemStyleMessage($this->lng->txt("styles_not_deleted"),ilSystemStyleMessage::TYPE_ERROR));
564 $message_stack->sendMessages(true);
565 $this->edit();
566 }
567
568
569 }
570
578 protected function checkDeletable($skin_id,$style_id, ilSystemStyleMessageStack $message_stack){
579 $passed = true;
580 if (ilObjUser::_getNumberOfUsersForStyle($skin_id, $style_id) > 0)
581 {
582 $message_stack->addMessage(new ilSystemStyleMessage($style_id.": ".$this->lng->txt("cant_delete_if_users_assigned"),ilSystemStyleMessage::TYPE_ERROR));
583 $passed = false;
584 }
585 if (ilSystemStyleSettings::_lookupActivatedStyle($skin_id, $style_id) > 0)
586 {
587 $message_stack->addMessage(new ilSystemStyleMessage($style_id.": ".$this->lng->txt("cant_delete_activated_style"),ilSystemStyleMessage::TYPE_ERROR));
588 $passed = false;
589 }
591 {
592 $message_stack->addMessage(new ilSystemStyleMessage($style_id.": ".$this->lng->txt("cant_delete_default_style"),ilSystemStyleMessage::TYPE_ERROR));
593 $passed = false;
594 }
595
596 if (ilSystemStyleSkinContainer::generateFromId($skin_id)->getSkin()->getSubstylesOfStyle($style_id))
597 {
598 $message_stack->addMessage(new ilSystemStyleMessage($style_id.": ".$this->lng->txt("cant_delete_style_with_substyles"),ilSystemStyleMessage::TYPE_ERROR));
599 $passed = false;
600 }
601 return $passed;
602 }
603
604 protected function confirmDelete(){
605 $message_stack = new ilSystemStyleMessageStack();
606
607 foreach($_POST as $key => $skin_style_id){
608 if(is_string($skin_style_id) && strpos($key, 'style') !== false){
609 try{
610 $imploded_skin_style_id = explode(":", $skin_style_id);
611 $container = ilSystemStyleSkinContainer::generateFromId($imploded_skin_style_id[0],$message_stack);
612 $syle = $container->getSkin()->getStyle($imploded_skin_style_id[1]);
613 $container->deleteStyle($syle);
614 if(!$container->getSkin()->hasStyles()){
615 $container->delete();
616 }
617 }catch(Exception $e){
618 $message_stack->addMessage(new ilSystemStyleMessage($e->getMessage(),ilSystemStyleMessage::TYPE_ERROR));
619 }
620
621 }
622 }
623 $message_stack->sendMessages(true);
624 $this->ctrl->redirect($this);
625 }
626
630 protected function importStyle(){
631 $form = $this->importSystemStyleForm();
632
633 if ($form->checkInput() )
634 {
635 $message_stack = new ilSystemStyleMessageStack();
636 $imported_container = ilSystemStyleSkinContainer::import($_POST['importfile']['tmp_name'],$_POST['importfile']['name'],$message_stack);
637 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI','skin_id',$imported_container->getSkin()->getId());
638 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI','style_id',$imported_container->getSkin()->getDefaultStyle()->getId());
639 $message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt("style_imported") . " " . $imported_container->getSkinDirectory(),ilSystemStyleMessage::TYPE_SUCCESS));
640
641 $message_stack->sendMessages(true);
642 $this->ctrl->redirectByClass("ilSystemStyleSettingsGUI");
643 }
644
645 // display only this form to correct input
646 $form->setValuesByPost();
647 $this->tpl->setContent($form->getHTML());
648 }
649 protected function export(){
650 $skin_id = $_GET["skin_id"];
651 $container = ilSystemStyleSkinContainer::generateFromId($skin_id);
652 try{
653 $container->export();
654 }catch(Exception $e){
655 ilUtil::sendFailure($this->lng->txt("zip_export_failed")." ".$e->getMessage());
656 }
657
658 }
659
660
664 protected function addSubStyle()
665 {
669 global $ilHelp, $DIC;
670
671 $DIC->tabs()->clearTargets();
672 $ilHelp->setScreenIdComponent("sty");
673 $ilHelp->setDefaultScreenId(ilHelpGUI::ID_PART_SCREEN, "system_sub_style_create");
674
675 $form = $this->addSubStyleForms();
676
677 $this->tpl->setContent($form->getHTML());
678
679 }
680
684 protected function addSubStyleForms( )
685 {
686 $form = new ilPropertyFormGUI();
687 $form->setFormAction($this->ctrl->getFormAction($this));
688 $form->setTitle($this->lng->txt("sty_create_new_system_sub_style"));
689
690
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);
694 $ti->setSize(40);
695 $ti->setRequired(true);
696 $form->addItem($ti);
697
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);
701 $ti->setSize(40);
702 $ti->setRequired(true);
703 $form->addItem($ti);
704
705 // source
706 $ti = new ilSelectInputGUI($this->lng->txt("parent"), "parent_style");
707 $ti->setRequired(true);
708 $ti->setInfo($this->lng->txt("sub_style_parent_style_description"));
709 $styles = ilStyleDefinition::getAllSkinStyles();
710 $options = array();
711 foreach($styles as $id => $style){
712 $system_style_conf = new ilSystemStyleConfig();
713 if($style["skin_id"]!=$system_style_conf->getDefaultSkinId() && !$style["substyle_of"]){
714 $options[$id] = $style['title'];
715 }
716 }
717 $ti->setOptions($options);
718
719 $form->addItem($ti);
720 $form->addCommandButton("saveNewSubStyle", $this->lng->txt("save"));
721 $form->addCommandButton("cancel", $this->lng->txt("cancel"));
722
723 return $form;
724 }
725
726 protected function saveNewSubStyle(){
727 $form = $this->addSubStyleForms();
728
729 if ($form->checkInput() )
730 {
731 try{
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];
735
736 $container = ilSystemStyleSkinContainer::generateFromId($parent_skin_id);
737
738 $sub_style_id = $_POST['sub_style_id'];
739
740 $style = new ilSkinStyleXML($_POST['sub_style_id'], $_POST['sub_style_name']);
741 $style->setSubstyleOf($parent_style_id);
742 $container->addStyle($style);
743
744 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI','skin_id',$parent_skin_id);
745 $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI','style_id',$sub_style_id);
746 ilUtil::sendSuccess($this->lng->txt("msg_sub_style_created"), true);
747 $this->ctrl->redirectByClass("ilSystemStyleSettingsGUI");
748 }catch(ilSystemStyleException $e){
749 ilUtil::sendFailure($e->getMessage(), true);
750 }
751 }
752
753 // display only this form to correct input
754 $form->setValuesByPost();
755 $this->tpl->setContent($form->getHTML());
756 }
757
761 public function isReadOnly()
762 {
763 return $this->read_only;
764 }
765
769 public function setReadOnly($read_only)
770 {
771 $this->read_only = $read_only;
772 }
773
777 public function isManagementEnabled()
778 {
780 }
781
786 {
787 $this->management_enabled = $management_enabled;
788 }
789}
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
Accordion user interface class.
This class represents a file property in a property form.
const ID_PART_SCREEN
static getInstance()
Factory.
static _getAllUserAssignedStyles()
skins and styles
static _moveUsersToStyle($a_from_skin, $a_from_style, $a_to_skin, $a_to_style)
skins and styles
static _getNumberOfUsersForStyle($a_skin, $a_style)
skins and styles
Base exception class for object service.
This class represents a property form user interface.
This class represents a selection list property in a property form.
ilSkinXml holds an manages the basic data of a skin as provide by the template of the skin.
static skinExists($skin_id, ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
static styleExists($style_id)
static getInstance()
Factory.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
Class for advanced editing exception handling in ILIAS.
Used to stack messages to be shown to the user.
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
checkDeletable($skin_id, $style_id, ilSystemStyleMessageStack $message_stack)
saveStyleSettings()
Save skin and style settings.
__construct($read_only, $management_enabled)
Constructor.
checkStyleSettings(ilSystemStyleMessageStack $message_stack)
static setCurrentDefaultStyle($skin_id, $style_id)
Sets the default style of the system.
static _activateStyle($a_skin, $a_style)
activate system style
static _deactivateStyle($a_skin, $a_style)
deactivate system style
static _lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
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...
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
static import($import_zip_path, $name, ilSystemStyleMessageStack $message_stack=null, $system_styles_conf=null, $uploaded=true)
Imports a skin from zip.
TableGUI class for system styles.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$style
Definition: example_012.php:70
redirection script todo: (a better solution should control the processing via a xml file)
$cmd
Definition: sahs_server.php:35
if(!is_array($argv)) $options