ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSystemStyleOverviewGUI Class Reference
+ Collaboration diagram for ilSystemStyleOverviewGUI:

Public Member Functions

 __construct ($read_only, $management_enabled)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 edit ()
 Edit. More...
 
 moveUserStyles ()
 Move user styles. More...
 
 saveStyleSettings ()
 Save skin and style settings. More...
 
 isReadOnly ()
 
 setReadOnly ($read_only)
 
 isManagementEnabled ()
 
 setManagementEnabled ($management_enabled)
 

Protected Member Functions

 view ()
 
 cancel ()
 
 checkStyleSettings (ilSystemStyleMessageStack $message_stack)
 
 addSystemStyle ()
 create More...
 
 saveNewSystemStyle ()
 
 createSystemStyleForm ()
 
 importSystemStyleForm ()
 
 cloneSystemStyleForm ()
 
 copyStyle ()
 
 deleteStyle ()
 
 deleteStyles ()
 
 checkDeletable ($skin_id, $style_id, ilSystemStyleMessageStack $message_stack)
 
 confirmDelete ()
 
 importStyle ()
 
 export ()
 
 addSubStyleForms ()
 
 saveNewSubStyle ()
 

Protected Attributes

 $ctrl
 
 $toolbar
 
 $lng
 
 $tpl
 
 $DIC
 
 $ref_id
 
 $read_only = true
 
 $management_enabled = false
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilSystemStyleOverviewGUI::__construct (   $read_only,
  $management_enabled 
)

Constructor.

Definition at line 66 of file class.ilSystemStyleOverviewGUI.php.

References $_GET, $DIC, $management_enabled, $read_only, setManagementEnabled(), and setReadOnly().

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  }
$_GET["client_id"]
redirection script todo: (a better solution should control the processing via a xml file) ...
+ Here is the call graph for this function:

Member Function Documentation

◆ addSubStyleForms()

ilSystemStyleOverviewGUI::addSubStyleForms ( )
protected
Returns
ilPropertyFormGUI

Definition at line 684 of file class.ilSystemStyleOverviewGUI.php.

References $options, $style, $styles, array, ilFormPropertyGUI\setInfo(), and ilFormPropertyGUI\setRequired().

Referenced by export(), and saveNewSubStyle().

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  }
$style
Definition: example_012.php:70
This class represents a selection list property in a property form.
This class represents a property form user interface.
setInfo($a_info)
Set Information Text.
if(!is_array($argv)) $options
This class represents a text property in a property form.
Create styles array
The data for the language used.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSystemStyle()

ilSystemStyleOverviewGUI::addSystemStyle ( )
protected

create

Definition at line 299 of file class.ilSystemStyleOverviewGUI.php.

300  {
301  $this->addSystemStyleForms();
302  }

◆ cancel()

ilSystemStyleOverviewGUI::cancel ( )
protected

Definition at line 133 of file class.ilSystemStyleOverviewGUI.php.

References edit().

133  {
134  $this->edit();
135  }
+ Here is the call graph for this function:

◆ checkDeletable()

ilSystemStyleOverviewGUI::checkDeletable (   $skin_id,
  $style_id,
ilSystemStyleMessageStack  $message_stack 
)
protected
Parameters
$skin_id
$style_id
ilSystemStyleMessageStack$message_stack
Returns
bool
Exceptions
ilSystemStyleException

Definition at line 578 of file class.ilSystemStyleOverviewGUI.php.

References ilObjUser\_getNumberOfUsersForStyle(), ilSystemStyleSettings\_lookupActivatedStyle(), ilSystemStyleMessageStack\addMessage(), ilSystemStyleSkinContainer\generateFromId(), ilSystemStyleSettings\getCurrentDefaultSkin(), and ilSystemStyleMessage\TYPE_ERROR.

Referenced by deleteStyle(), and deleteStyles().

578  {
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  }
static _getNumberOfUsersForStyle($a_skin, $a_style)
skins and styles
static getCurrentDefaultSkin()
Gets default Skin of the System.
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
static _lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkStyleSettings()

ilSystemStyleOverviewGUI::checkStyleSettings ( ilSystemStyleMessageStack  $message_stack)
protected
Parameters
ilSystemStyleMessageStack$message_stack
Returns
bool

Definition at line 261 of file class.ilSystemStyleOverviewGUI.php.

References $_POST, ilObjUser\_getNumberOfUsersForStyle(), ilSystemStyleMessageStack\addMessage(), and ilSystemStyleMessage\TYPE_ERROR.

Referenced by saveStyleSettings().

261  {
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  }
static _getNumberOfUsersForStyle($a_skin, $a_style)
skins and styles
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneSystemStyleForm()

ilSystemStyleOverviewGUI::cloneSystemStyleForm ( )
protected
Returns
ilPropertyFormGUI

Definition at line 430 of file class.ilSystemStyleOverviewGUI.php.

References $options, $style, $styles, array, ilAccordionGUI\FIRST_OPEN, and ilFormPropertyGUI\setRequired().

Referenced by saveNewSystemStyle().

430  {
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  }
$style
Definition: example_012.php:70
This class represents a selection list property in a property form.
This class represents a property form user interface.
if(!is_array($argv)) $options
Create styles array
The data for the language used.
ilSystemStyleConfig wraps all &#39;constants&#39; to ensure the testability of all classes using those &#39;const...
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDelete()

ilSystemStyleOverviewGUI::confirmDelete ( )
protected

Definition at line 604 of file class.ilSystemStyleOverviewGUI.php.

References $_POST, ilSystemStyleSkinContainer\generateFromId(), and ilSystemStyleMessage\TYPE_ERROR.

604  {
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  }
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
Used to stack messages to be shown to the user.
$_POST["username"]
+ Here is the call graph for this function:

◆ copyStyle()

ilSystemStyleOverviewGUI::copyStyle ( )
protected

Definition at line 500 of file class.ilSystemStyleOverviewGUI.php.

References $_POST, ilSystemStyleSkinContainer\generateFromId(), ilSystemStyleMessage\TYPE_ERROR, and ilSystemStyleMessage\TYPE_SUCCESS.

500  {
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  }
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
Used to stack messages to be shown to the user.
$_POST["username"]
+ Here is the call graph for this function:

◆ createSystemStyleForm()

ilSystemStyleOverviewGUI::createSystemStyleForm ( )
protected
Returns
ilPropertyFormGUI

Definition at line 368 of file class.ilSystemStyleOverviewGUI.php.

References ilFormPropertyGUI\setInfo().

Referenced by saveNewSystemStyle().

368  {
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  }
This class represents a property form user interface.
setInfo($a_info)
Set Information Text.
This class represents a text property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteStyle()

ilSystemStyleOverviewGUI::deleteStyle ( )
protected

Definition at line 522 of file class.ilSystemStyleOverviewGUI.php.

References $_GET, checkDeletable(), edit(), ilSystemStyleSkinContainer\generateFromId(), and ilSystemStyleMessage\TYPE_ERROR.

522  {
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  }
checkDeletable($skin_id, $style_id, ilSystemStyleMessageStack $message_stack)
$_GET["client_id"]
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
Used to stack messages to be shown to the user.
+ Here is the call graph for this function:

◆ deleteStyles()

ilSystemStyleOverviewGUI::deleteStyles ( )
protected

Definition at line 540 of file class.ilSystemStyleOverviewGUI.php.

References $_POST, checkDeletable(), edit(), ilSystemStyleSkinContainer\generateFromId(), and ilSystemStyleMessage\TYPE_ERROR.

540  {
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  }
checkDeletable($skin_id, $style_id, ilSystemStyleMessageStack $message_stack)
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
Used to stack messages to be shown to the user.
$_POST["username"]
+ Here is the call graph for this function:

◆ edit()

ilSystemStyleOverviewGUI::edit ( )

Edit.

Definition at line 139 of file class.ilSystemStyleOverviewGUI.php.

References $options, $si, array, ilSubmitButton\getInstance(), ilLinkButton\getInstance(), and isManagementEnabled().

Referenced by cancel(), deleteStyle(), and deleteStyles().

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  }
This class represents a selection list property in a property form.
if(!is_array($argv)) $options
Create styles array
The data for the language used.
TableGUI class for system styles.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilSystemStyleOverviewGUI::executeCommand ( )

Execute command.

Definition at line 86 of file class.ilSystemStyleOverviewGUI.php.

References $cmd, isManagementEnabled(), and isReadOnly().

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  }
$cmd
Definition: sahs_server.php:35
Base exception class for object service.
+ Here is the call graph for this function:

◆ export()

ilSystemStyleOverviewGUI::export ( )
protected

Definition at line 649 of file class.ilSystemStyleOverviewGUI.php.

References $_GET, $DIC, addSubStyleForms(), ilSystemStyleSkinContainer\generateFromId(), ilHelpGUI\ID_PART_SCREEN, and ilUtil\sendFailure().

649  {
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  }
$_GET["client_id"]
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.
+ Here is the call graph for this function:

◆ importStyle()

ilSystemStyleOverviewGUI::importStyle ( )
protected

Definition at line 630 of file class.ilSystemStyleOverviewGUI.php.

References $_POST, ilSystemStyleSkinContainer\import(), importSystemStyleForm(), and ilSystemStyleMessage\TYPE_SUCCESS.

630  {
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  }
static import($import_zip_path, $name, ilSystemStyleMessageStack $message_stack=null, $system_styles_conf=null, $uploaded=true)
Imports a skin from zip.
Used to stack messages to be shown to the user.
$_POST["username"]
+ Here is the call graph for this function:

◆ importSystemStyleForm()

ilSystemStyleOverviewGUI::importSystemStyleForm ( )
protected
Returns
ilPropertyFormGUI

Definition at line 410 of file class.ilSystemStyleOverviewGUI.php.

References array, and ilFormPropertyGUI\setRequired().

Referenced by importStyle(), and saveNewSystemStyle().

410  {
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  }
This class represents a property form user interface.
This class represents a file property in a property form.
Create styles array
The data for the language used.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isManagementEnabled()

ilSystemStyleOverviewGUI::isManagementEnabled ( )
Returns
boolean

Definition at line 777 of file class.ilSystemStyleOverviewGUI.php.

References $management_enabled.

Referenced by edit(), and executeCommand().

+ Here is the caller graph for this function:

◆ isReadOnly()

ilSystemStyleOverviewGUI::isReadOnly ( )
Returns
boolean

Definition at line 761 of file class.ilSystemStyleOverviewGUI.php.

References $read_only.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ moveUserStyles()

ilSystemStyleOverviewGUI::moveUserStyles ( )

Move user styles.

Definition at line 193 of file class.ilSystemStyleOverviewGUI.php.

References $_POST, $style, ilObjUser\_getAllUserAssignedStyles(), ilObjUser\_moveUsersToStyle(), ilUtil\sendSuccess(), and ilStyleDefinition\styleExists().

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  {
206  if (!ilStyleDefinition::styleExists($style))
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  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$style
Definition: example_012.php:70
static styleExists($style_id)
static _moveUsersToStyle($a_from_skin, $a_from_style, $a_to_skin, $a_to_style)
skins and styles
$_POST["username"]
static _getAllUserAssignedStyles()
skins and styles
+ Here is the call graph for this function:

◆ saveNewSubStyle()

ilSystemStyleOverviewGUI::saveNewSubStyle ( )
protected

Definition at line 726 of file class.ilSystemStyleOverviewGUI.php.

References $_POST, $style, addSubStyleForms(), ilSystemStyleSkinContainer\generateFromId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

726  {
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  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$style
Definition: example_012.php:70
Class for advanced editing exception handling in ILIAS.
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.
$_POST["username"]
+ Here is the call graph for this function:

◆ saveNewSystemStyle()

ilSystemStyleOverviewGUI::saveNewSystemStyle ( )
protected

Definition at line 305 of file class.ilSystemStyleOverviewGUI.php.

References $_POST, $DIC, $style, array, cloneSystemStyleForm(), createSystemStyleForm(), ilHelpGUI\ID_PART_SCREEN, importSystemStyleForm(), ilUtil\sendFailure(), ilUtil\sendSuccess(), ilStyleDefinition\skinExists(), and ilSystemStyleMessage\TYPE_ERROR.

305  {
306  $form = $this->createSystemStyleForm();
307 
308  if ($form->checkInput() )
309  {
310  $message_stack = new ilSystemStyleMessageStack();
311  if(ilStyleDefinition::skinExists($_POST["skin_id"])){
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  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$style
Definition: example_012.php:70
This class is responsible for all file system related actions related actions of a skin such as copyi...
ilSkinXml holds an manages the basic data of a skin as provide by the template of the skin...
Class for advanced editing exception handling in ILIAS.
static skinExists($skin_id, ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Used to stack messages to be shown to the user.
$_POST["username"]
+ Here is the call graph for this function:

◆ saveStyleSettings()

ilSystemStyleOverviewGUI::saveStyleSettings ( )

Save skin and style settings.

Definition at line 227 of file class.ilSystemStyleOverviewGUI.php.

References $_POST, ilSystemStyleSettings\_activateStyle(), ilSystemStyleSettings\_deactivateStyle(), checkStyleSettings(), ilSystemStyleSettings\setCurrentDefaultStyle(), and ilSystemStyleMessage\TYPE_SUCCESS.

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  }
static _deactivateStyle($a_skin, $a_style)
deactivate system style
static setCurrentDefaultStyle($skin_id, $style_id)
Sets the default style of the system.
static _activateStyle($a_skin, $a_style)
activate system style
Used to stack messages to be shown to the user.
checkStyleSettings(ilSystemStyleMessageStack $message_stack)
$_POST["username"]
+ Here is the call graph for this function:

◆ setManagementEnabled()

ilSystemStyleOverviewGUI::setManagementEnabled (   $management_enabled)
Parameters
boolean$management_enabled

Definition at line 785 of file class.ilSystemStyleOverviewGUI.php.

References $management_enabled.

Referenced by __construct().

786  {
787  $this->management_enabled = $management_enabled;
788  }
+ Here is the caller graph for this function:

◆ setReadOnly()

ilSystemStyleOverviewGUI::setReadOnly (   $read_only)
Parameters
boolean$read_only

Definition at line 769 of file class.ilSystemStyleOverviewGUI.php.

References $read_only.

Referenced by __construct().

770  {
771  $this->read_only = $read_only;
772  }
+ Here is the caller graph for this function:

◆ view()

ilSystemStyleOverviewGUI::view ( )
protected

Definition at line 128 of file class.ilSystemStyleOverviewGUI.php.

128  {
129  $table = new ilSystemStylesTableGUI($this, "edit",true);
130  $this->tpl->setContent($table->getHTML());
131  }
TableGUI class for system styles.

Field Documentation

◆ $ctrl

ilSystemStyleOverviewGUI::$ctrl
protected

Definition at line 25 of file class.ilSystemStyleOverviewGUI.php.

◆ $DIC

ilSystemStyleOverviewGUI::$DIC
protected

Definition at line 45 of file class.ilSystemStyleOverviewGUI.php.

Referenced by __construct(), export(), and saveNewSystemStyle().

◆ $lng

ilSystemStyleOverviewGUI::$lng
protected

Definition at line 35 of file class.ilSystemStyleOverviewGUI.php.

◆ $management_enabled

ilSystemStyleOverviewGUI::$management_enabled = false
protected

◆ $read_only

ilSystemStyleOverviewGUI::$read_only = true
protected

Definition at line 55 of file class.ilSystemStyleOverviewGUI.php.

Referenced by __construct(), isReadOnly(), and setReadOnly().

◆ $ref_id

ilSystemStyleOverviewGUI::$ref_id
protected

Definition at line 50 of file class.ilSystemStyleOverviewGUI.php.

◆ $toolbar

ilSystemStyleOverviewGUI::$toolbar
protected

Definition at line 30 of file class.ilSystemStyleOverviewGUI.php.

◆ $tpl

ilSystemStyleOverviewGUI::$tpl
protected

Definition at line 40 of file class.ilSystemStyleOverviewGUI.php.


The documentation for this class was generated from the following file: