ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilSystemStyleOverviewGUI.php
Go to the documentation of this file.
1 <?php
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");
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  public 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  case "addSystemStyle":
97  case "addSubStyle":
98  case "saveNewSystemStyle":
99  case "saveNewSubStyle":
100  case "copyStyle":
101  case "importStyle":
102  case "deleteStyles":
103  case "deleteStyle":
104  case "confirmDelete":
105  if (!$this->isManagementEnabled()) {
106  throw new ilObjectException($this->lng->txt("permission_denied"));
107  }
108  $this->$cmd();
109  return;
110  case "cancel":
111  case "edit":
112  case "export":
113  case "moveUserStyles":
114  case "saveStyleSettings":
115  if ($this->isReadOnly()) {
116  throw new ilObjectException($this->lng->txt("permission_denied"));
117  }
118  $this->$cmd();
119  return;
120  case "view":
121  $this->$cmd();
122  return;
123 
124  }
125  }
126 
127  protected function view()
128  {
129  $table = new ilSystemStylesTableGUI($this, "edit", true);
130  $this->tpl->setContent($table->getHTML());
131  }
132 
133  protected function cancel()
134  {
135  $this->edit();
136  }
140  public function edit()
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 
192  public function moveUserStyles()
193  {
194  $to = explode(":", $_POST["to_style"]);
195 
196  if ($_POST["from_style"] == "other") {
197  // get all user assigned styles
198  $all_user_styles = ilObjUser::_getAllUserAssignedStyles();
199 
200  // move users that are not assigned to
201  // currently existing style
202  foreach ($all_user_styles as $style) {
203  if (!ilStyleDefinition::styleExists($style)) {
204  $style_arr = explode(":", $style);
205  ilObjUser::_moveUsersToStyle($style_arr[0], $style_arr[1], $to[0], $to[1]);
206  }
207  }
208  } else {
209  $from = explode(":", $_POST["from_style"]);
210  ilObjUser::_moveUsersToStyle($from[0], $from[1], $to[0], $to[1]);
211  }
212 
213  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
214  $this->ctrl->redirect($this, "edit");
215  }
216 
217 
221  public function saveStyleSettings()
222  {
223  $message_stack = new ilSystemStyleMessageStack();
224 
225  if ($this->checkStyleSettings($message_stack)) {
226  $all_styles = ilStyleDefinition::getAllSkinStyles();
227  foreach ($all_styles as $st) {
228  if (!isset($_POST["st_act"][$st["id"]])) {
229  ilSystemStyleSettings::_deactivateStyle($st["template_id"], $st["style_id"]);
230  } else {
231  ilSystemStyleSettings::_activateStyle($st["template_id"], $st["style_id"]);
232  }
233  }
234 
235  //set default skin and style
236  if ($_POST["default_skin_style"] != "") {
237  $sknst = explode(":", $_POST["default_skin_style"]);
238  ilSystemStyleSettings::setCurrentDefaultStyle($sknst[0], $sknst[1]);
239  }
240  $message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt("msg_obj_modified"), ilSystemStyleMessage::TYPE_SUCCESS));
241  }
242  $message_stack->sendMessages(true);
243  $this->ctrl->redirect($this, "edit");
244  }
245 
250  protected function checkStyleSettings(ilSystemStyleMessageStack $message_stack)
251  {
252  $passed = true;
253 
254  if (count($_POST["st_act"]) < 1) {
255  $passed = false;
256  $message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt("at_least_one_style"), ilSystemStyleMessage::TYPE_ERROR));
257  }
258 
259  if (!isset($_POST["st_act"][$_POST["default_skin_style"]])) {
260  $passed = false;
261  $message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt("cant_deactivate_default_style"), ilSystemStyleMessage::TYPE_ERROR));
262  }
263 
264  // check if a style should be deactivated, that still has
265  // a user assigned to
266  $all_styles = ilStyleDefinition::getAllSkinStyles();
267 
268  foreach ($all_styles as $st) {
269  if (!isset($_POST["st_act"][$st["id"]])) {
270  if (ilObjUser::_getNumberOfUsersForStyle($st["template_id"], $st["style_id"]) > 0) {
271  $passed = false;
272  $message_stack->addMessage(new ilSystemStyleMessage($st["style_name"] . ": " . $this->lng->txt("cant_deactivate_if_users_assigned"), ilSystemStyleMessage::TYPE_ERROR));
273  }
274  }
275  }
276  return $passed;
277  }
278 
279 
283  protected function addSystemStyle()
284  {
285  $this->addSystemStyleForms();
286  }
287 
288 
289  protected function saveNewSystemStyle()
290  {
291  $form = $this->createSystemStyleForm();
292 
293  if ($form->checkInput()) {
294  $message_stack = new ilSystemStyleMessageStack();
295  if (ilStyleDefinition::skinExists($_POST["skin_id"])) {
296  ilUtil::sendFailure($this->lng->txt("skin_id_exists"));
297  } else {
298  try {
299  $skin = new ilSkinXML($_POST["skin_id"], $_POST["skin_name"]);
300  $style = new ilSkinStyleXML($_POST["style_id"], $_POST["style_name"]);
301  $skin->addStyle($style);
303  $container->create($message_stack);
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);
308  } else {
309  ilUtil::sendSuccess($this->lng->txt("msg_sys_style_created"), true);
310  }
311  $this->ctrl->redirectByClass("ilSystemStyleSettingsGUI");
312  } catch (ilSystemStyleException $e) {
313  $message_stack->addMessage(new ilSystemStyleMessage($e->getMessage(), ilSystemStyleMessage::TYPE_ERROR));
314  }
315  }
316  $message_stack->sendMessages();
317  }
318 
319  // display only this form to correct input
320  $form->setValuesByPost();
321  $this->tpl->setContent($form->getHTML());
322  }
323 
327  protected function addSystemStyleForms()
328  {
332  global $ilHelp, $DIC;
333 
334  $DIC->tabs()->clearTargets();
338  $ilHelp->setScreenIdComponent("sty");
339  $ilHelp->setScreenId("system_styles");
340  $ilHelp->setSubScreenId("create");
341 
342  $forms = array();
343 
344  $forms[] = $this->createSystemStyleForm();
345  $forms[] = $this->importSystemStyleForm();
346  $forms[] = $this->cloneSystemStyleForm();
347 
348  $this->tpl->setContent($this->getCreationFormsHTML($forms));
349  }
350 
354  protected function createSystemStyleForm()
355  {
356  $form = new ilPropertyFormGUI();
357  $form->setFormAction($this->ctrl->getFormAction($this));
358  $form->setTitle($this->lng->txt("sty_create_new_system_style"));
359 
360  $ti = new ilTextInputGUI($this->lng->txt("skin_id"), "skin_id");
361  $ti->setInfo($this->lng->txt("skin_id_description"));
362  $ti->setMaxLength(128);
363  $ti->setSize(40);
364  $ti->setRequired(true);
365  $form->addItem($ti);
366 
367  $ti = new ilTextInputGUI($this->lng->txt("skin_name"), "skin_name");
368  $ti->setInfo($this->lng->txt("skin_name_description"));
369  $ti->setMaxLength(128);
370  $ti->setSize(40);
371  $ti->setRequired(true);
372  $form->addItem($ti);
373 
374  $ti = new ilTextInputGUI($this->lng->txt("style_id"), "style_id");
375  $ti->setInfo($this->lng->txt("style_id_description"));
376  $ti->setMaxLength(128);
377  $ti->setSize(40);
378  $ti->setRequired(true);
379  $form->addItem($ti);
380 
381  $ti = new ilTextInputGUI($this->lng->txt("style_name"), "style_name");
382  $ti->setInfo($this->lng->txt("style_name_description"));
383  $ti->setMaxLength(128);
384  $ti->setSize(40);
385  $ti->setRequired(true);
386  $form->addItem($ti);
387 
388  $form->addCommandButton("saveNewSystemStyle", $this->lng->txt("save"));
389  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
390 
391  return $form;
392  }
393 
397  protected function importSystemStyleForm()
398  {
399  $form = new ilPropertyFormGUI();
400  $form->setFormAction($this->ctrl->getFormAction($this));
401  $form->setTitle($this->lng->txt("sty_import_system_style"));
402 
403  // title
404  $file_input = new ilFileInputGUI($this->lng->txt("import_file"), "importfile");
405  $file_input->setRequired(true);
406  $file_input->setSuffixes(array("zip"));
407  $form->addItem($file_input);
408 
409  $form->addCommandButton("importStyle", $this->lng->txt("import"));
410  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
411 
412  return $form;
413  }
414 
418  protected function cloneSystemStyleForm()
419  {
420  $form = new ilPropertyFormGUI();
421  $form->setFormAction($this->ctrl->getFormAction($this));
422  $form->setTitle($this->lng->txt("sty_copy_other_system_style"));
423 
424  // source
425  $ti = new ilSelectInputGUI($this->lng->txt("sty_source"), "source_style");
426  $ti->setRequired(true);
427  $styles = ilStyleDefinition::getAllSkinStyles();
428  $options = array();
429  foreach ($styles as $id => $style) {
430  $system_style_conf = new ilSystemStyleConfig();
431  if ($style["skin_id"]!=$system_style_conf->getDefaultSkinId()) {
432  $options[$id] = $style['title'];
433  }
434  }
435  $ti->setOptions($options);
436 
437  $form->addItem($ti);
438 
439  $form->addCommandButton("copyStyle", $this->lng->txt("copy"));
440  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
441 
442  return $form;
443  }
444 
449  protected function getCreationFormsHTML(array $a_forms)
450  {
451  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
452 
453  $acc = new ilAccordionGUI();
454  $acc->setBehaviour(ilAccordionGUI::FIRST_OPEN);
455  $cnt = 1;
456  foreach ($a_forms as $form_type => $cf) {
460  $htpl = new ilTemplate("tpl.creation_acc_head.html", true, true, "Services/Object");
461 
462  // using custom form titles (used for repository plugins)
463  $form_title = "";
464  if (method_exists($this, "getCreationFormTitle")) {
465  $form_title = $this->getCreationFormTitle($form_type);
466  }
467  if (!$form_title) {
468  $form_title = $cf->getTitle();
469  }
470 
471  // move title from form to accordion
472  $htpl->setVariable("TITLE", $this->lng->txt("option") . " " . $cnt . ": " .
473  $form_title);
474  $cf->setTitle(null);
475  $cf->setTitleIcon(null);
476  $cf->setTableWidth("100%");
477 
478  $acc->addItem($htpl->get(), $cf->getHTML());
479 
480  $cnt++;
481  }
482 
483  return "<div class='ilCreationFormSection'>" . $acc->getHTML() . "</div>";
484  }
485 
486  protected function copyStyle()
487  {
488  $message_stack = new ilSystemStyleMessageStack();
489 
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];
493 
494  try {
495  $container = ilSystemStyleSkinContainer::generateFromId($skin_id, $message_stack);
496  $new_container = $container->copy();
497  $message_stack->prependMessage(new ilSystemStyleMessage($this->lng->txt("style_copied"), ilSystemStyleMessage::TYPE_SUCCESS));
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());
500  } catch (Exception $e) {
501  $message_stack->addMessage(new ilSystemStyleMessage($e->getMessage(), ilSystemStyleMessage::TYPE_ERROR));
502  }
503 
504 
505  $message_stack->sendMessages(true);
506  $this->ctrl->redirectByClass("ilSystemStyleSettingsGUI");
507  }
508 
509  protected function deleteStyle()
510  {
511  $skin_id = $_GET["skin_id"];
512  $style_id = $_GET["style_id"];
513  $message_stack = new ilSystemStyleMessageStack();
514 
515  if ($this->checkDeletable($skin_id, $style_id, $message_stack)) {
516  $delete_form_table = new ilSystemStyleDeleteGUI();
518  $delete_form_table->addStyle($container->getSkin(), $container->getSkin()->getStyle($style_id));
519  $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
520  } else {
521  $message_stack->prependMessage(new ilSystemStyleMessage($this->lng->txt("style_not_deleted"), ilSystemStyleMessage::TYPE_ERROR));
522  $message_stack->sendMessages(true);
523  $this->edit();
524  }
525  }
526  protected function deleteStyles()
527  {
528  $delete_form_table = new ilSystemStyleDeleteGUI();
529  $message_stack = new ilSystemStyleMessageStack();
530 
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;
538  }
539  }
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));
547  }
548  $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
549  } else {
550  $message_stack->prependMessage(new ilSystemStyleMessage($this->lng->txt("styles_not_deleted"), ilSystemStyleMessage::TYPE_ERROR));
551  $message_stack->sendMessages(true);
552  $this->edit();
553  }
554  }
555 
563  protected function checkDeletable($skin_id, $style_id, ilSystemStyleMessageStack $message_stack)
564  {
565  $passed = true;
566  if (ilObjUser::_getNumberOfUsersForStyle($skin_id, $style_id) > 0) {
567  $message_stack->addMessage(new ilSystemStyleMessage($style_id . ": " . $this->lng->txt("cant_delete_if_users_assigned"), ilSystemStyleMessage::TYPE_ERROR));
568  $passed = false;
569  }
570  if (ilSystemStyleSettings::_lookupActivatedStyle($skin_id, $style_id) > 0) {
571  $message_stack->addMessage(new ilSystemStyleMessage($style_id . ": " . $this->lng->txt("cant_delete_activated_style"), ilSystemStyleMessage::TYPE_ERROR));
572  $passed = false;
573  }
575  $message_stack->addMessage(new ilSystemStyleMessage($style_id . ": " . $this->lng->txt("cant_delete_default_style"), ilSystemStyleMessage::TYPE_ERROR));
576  $passed = false;
577  }
578 
579  if (ilSystemStyleSkinContainer::generateFromId($skin_id)->getSkin()->getSubstylesOfStyle($style_id)) {
580  $message_stack->addMessage(new ilSystemStyleMessage($style_id . ": " . $this->lng->txt("cant_delete_style_with_substyles"), ilSystemStyleMessage::TYPE_ERROR));
581  $passed = false;
582  }
583  return $passed;
584  }
585 
586  protected function confirmDelete()
587  {
588  $message_stack = new ilSystemStyleMessageStack();
589 
590  foreach ($_POST as $key => $skin_style_id) {
591  if (is_string($skin_style_id) && strpos($key, 'style') !== false) {
592  try {
593  $imploded_skin_style_id = explode(":", $skin_style_id);
594  $container = ilSystemStyleSkinContainer::generateFromId($imploded_skin_style_id[0], $message_stack);
595  $syle = $container->getSkin()->getStyle($imploded_skin_style_id[1]);
596  $container->deleteStyle($syle);
597  if (!$container->getSkin()->hasStyles()) {
598  $container->delete();
599  }
600  } catch (Exception $e) {
601  $message_stack->addMessage(new ilSystemStyleMessage($e->getMessage(), ilSystemStyleMessage::TYPE_ERROR));
602  }
603  }
604  }
605  $message_stack->sendMessages(true);
606  $this->ctrl->redirect($this);
607  }
608 
612  protected function importStyle()
613  {
614  $form = $this->importSystemStyleForm();
615 
616  if ($form->checkInput()) {
617  $message_stack = new ilSystemStyleMessageStack();
618  $imported_container = ilSystemStyleSkinContainer::import($_POST['importfile']['tmp_name'], $_POST['importfile']['name'], $message_stack);
619  $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'skin_id', $imported_container->getSkin()->getId());
620  $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'style_id', $imported_container->getSkin()->getDefaultStyle()->getId());
621  $message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt("style_imported") . " " . $imported_container->getSkinDirectory(), ilSystemStyleMessage::TYPE_SUCCESS));
622 
623  $message_stack->sendMessages(true);
624  $this->ctrl->redirectByClass("ilSystemStyleSettingsGUI");
625  }
626 
627  // display only this form to correct input
628  $form->setValuesByPost();
629  $this->tpl->setContent($form->getHTML());
630  }
631  protected function export()
632  {
633  $skin_id = $_GET["skin_id"];
635  try {
636  $container->export();
637  } catch (Exception $e) {
638  ilUtil::sendFailure($this->lng->txt("zip_export_failed") . " " . $e->getMessage());
639  }
640  }
641 
642 
646  protected function addSubStyle()
647  {
651  global $ilHelp, $DIC;
652 
653  $DIC->tabs()->clearTargets();
657  $ilHelp->setScreenIdComponent("sty");
658  $ilHelp->setScreenId("system_styles");
659  $ilHelp->setSubScreenId("create_sub");
660 
661  $form = $this->addSubStyleForms();
662 
663  $this->tpl->setContent($form->getHTML());
664  }
665 
669  protected function addSubStyleForms()
670  {
671  $form = new ilPropertyFormGUI();
672  $form->setFormAction($this->ctrl->getFormAction($this));
673  $form->setTitle($this->lng->txt("sty_create_new_system_sub_style"));
674 
675 
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);
679  $ti->setSize(40);
680  $ti->setRequired(true);
681  $form->addItem($ti);
682 
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);
686  $ti->setSize(40);
687  $ti->setRequired(true);
688  $form->addItem($ti);
689 
690  // source
691  $ti = new ilSelectInputGUI($this->lng->txt("parent"), "parent_style");
692  $ti->setRequired(true);
693  $ti->setInfo($this->lng->txt("sub_style_parent_style_description"));
694  $styles = ilStyleDefinition::getAllSkinStyles();
695  $options = array();
696  foreach ($styles as $id => $style) {
697  $system_style_conf = new ilSystemStyleConfig();
698  if ($style["skin_id"]!=$system_style_conf->getDefaultSkinId() && !$style["substyle_of"]) {
699  $options[$id] = $style['title'];
700  }
701  }
702  $ti->setOptions($options);
703 
704  $form->addItem($ti);
705  $form->addCommandButton("saveNewSubStyle", $this->lng->txt("save"));
706  $form->addCommandButton("cancel", $this->lng->txt("cancel"));
707 
708  return $form;
709  }
710 
711  protected function saveNewSubStyle()
712  {
713  $form = $this->addSubStyleForms();
714 
715  if ($form->checkInput()) {
716  try {
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];
720 
722 
723  if (array_key_exists($_POST['sub_style_id'], $container->getSkin()->getSubstylesOfStyle($parent_style_id))) {
725  }
726 
727  $sub_style_id = $_POST['sub_style_id'];
728 
729  $style = new ilSkinStyleXML($_POST['sub_style_id'], $_POST['sub_style_name']);
730  $style->setSubstyleOf($parent_style_id);
731  $container->addStyle($style);
732 
733  $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'skin_id', $parent_skin_id);
734  $this->ctrl->setParameterByClass('ilSystemStyleSettingsGUI', 'style_id', $sub_style_id);
735  ilUtil::sendSuccess($this->lng->txt("msg_sub_style_created"), true);
736  $this->ctrl->redirectByClass("ilSystemStyleSettingsGUI");
737  } catch (ilSystemStyleException $e) {
738  ilUtil::sendFailure($e->getMessage(), true);
739  }
740  }
741 
742  // display only this form to correct input
743  $form->setValuesByPost();
744  $this->tpl->setContent($form->getHTML());
745  }
746 
750  public function isReadOnly()
751  {
752  return $this->read_only;
753  }
754 
758  public function setReadOnly($read_only)
759  {
760  $this->read_only = $read_only;
761  }
762 
766  public function isManagementEnabled()
767  {
769  }
770 
775  {
776  $this->management_enabled = $management_enabled;
777  }
778 }
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.
$style
Definition: example_012.php:70
static _getNumberOfUsersForStyle($a_skin, $a_style)
skins and styles
This class represents a selection list property in a property form.
This class represents a property form user interface.
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)
$_GET["client_id"]
This class represents a file property in a property form.
static setCurrentDefaultStyle($skin_id, $style_id)
Sets the default style of the system.
Base exception class for object service.
if(!array_key_exists('StateId', $_REQUEST)) $id
$from
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...
$container
Definition: wac.php:13
setInfo($a_info)
Set Information Text.
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 &#39;constants&#39; to ensure the testability of all classes using those &#39;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
Definition: pwgen.php:24
saveStyleSettings()
Save skin and style settings.
Accordion user interface class.
$key
Definition: croninfo.php:18
$_POST["username"]
setRequired($a_required)
Set Required.
static _getAllUserAssignedStyles()
skins and styles
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20