ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilSystemStyleOverviewGUI Class Reference
+ Collaboration diagram for ilSystemStyleOverviewGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilLanguage $lng, ilGlobalTemplateInterface $tpl, Factory $ui_factory, Renderer $renderer, WrapperFactory $request_wrapper, ilToolbarGUI $toolbar, Refinery $refinery, ilSkinFactory $skin_factory, FileUpload $upload, ilTabsGUI $tabs, ilHelpGUI $help, string $skin_id, string $style_id, string $ref_id, bool $read_only, bool $management_enabled)
 
 executeCommand ()
 
 getAssignmentCreationModal (string $style_name="")
 
 edit ()
 
 moveUserStyles ()
 
 saveStyleSettings ()
 
 isReadOnly ()
 
 setReadOnly (bool $read_only)
 
 isManagementEnabled ()
 
 setManagementEnabled (bool $management_enabled)
 

Protected Member Functions

 view ()
 
 cancel ()
 
 checkStyleSettings (ilSystemStyleMessageStack $message_stack, array $active_styles)
 
 addSystemStyle ()
 
 saveNewSystemStyle ()
 
 addSystemStyleForms ()
 
 createSystemStyleForm ()
 
 importSystemStyleForm ()
 
 cloneSystemStyleForm ()
 
 copyStyle ()
 
 deleteStyle ()
 
 deleteStyles ()
 
 checkDeletable (string $skin_id, string $style_id, ilSystemStyleMessageStack $message_stack)
 
 confirmDelete ()
 
 export ()
 
 addSubStyle ()
 
 addSubStyleForms ()
 
 saveNewSubStyle ()
 

Protected Attributes

ilCtrl $ctrl
 
ilToolbarGUI $toolbar
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilSkinFactory $skin_factory
 
ilFileSystemHelper $file_system
 
ilSkinStyleContainer $style_container
 
ilSystemStyleMessageStack $message_stack
 
Factory $ui_factory
 
Renderer $renderer
 
WrapperFactory $request_wrapper
 
Refinery $refinery
 
ilSystemStyleConfig $config
 
ilTabsGUI $tabs
 
ilHelpGUI $help
 
FileUpload $upload
 
string $ref_id
 
bool $read_only = true
 
bool $management_enabled = false
 
string $style_id
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilSystemStyleOverviewGUI::__construct ( ilCtrl  $ctrl,
ilLanguage  $lng,
ilGlobalTemplateInterface  $tpl,
Factory  $ui_factory,
Renderer  $renderer,
WrapperFactory  $request_wrapper,
ilToolbarGUI  $toolbar,
Refinery  $refinery,
ilSkinFactory  $skin_factory,
FileUpload  $upload,
ilTabsGUI  $tabs,
ilHelpGUI  $help,
string  $skin_id,
string  $style_id,
string  $ref_id,
bool  $read_only,
bool  $management_enabled 
)

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

References $ctrl, $help, $lng, $ref_id, $refinery, $renderer, $request_wrapper, $skin_factory, $style_id, $tabs, $toolbar, $tpl, $ui_factory, $upload, ILIAS\Repository\ctrl(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), setManagementEnabled(), setReadOnly(), ilSkinFactory\skinStyleContainerFromId(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\upload().

69  {
70  $this->ctrl = $ctrl;
71  $this->lng = $lng;
72  $this->tpl = $tpl;
73  $this->ui_factory = $ui_factory;
74  $this->renderer = $renderer;
75  $this->request_wrapper = $request_wrapper;
76  $this->toolbar = $toolbar;
77  $this->refinery = $refinery;
78  $this->tabs = $tabs;
79  $this->style_id = $style_id;
80  $this->message_stack = new ilSystemStyleMessageStack($this->tpl);
81  $this->skin_factory = $skin_factory;
82  $this->style_container = $this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack);
83  $this->help = $help;
84  $this->ref_id = $ref_id;
85  $this->file_system = new ilFileSystemHelper($this->lng, $this->message_stack);
86  $this->upload = $upload;
87  $this->config = new ilSystemStyleConfig();
88  $this->setReadOnly($read_only);
90  }
File System Helper, to reduce deps.
skinStyleContainerFromId(string $skin_id, ilSystemStyleMessageStack $message_stack)
Get container class is responsible for all file system related actions related actions of a skin such...
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
Used to stack messages to be shown to the user.
setManagementEnabled(bool $management_enabled)
+ Here is the call graph for this function:

Member Function Documentation

◆ addSubStyle()

ilSystemStyleOverviewGUI::addSubStyle ( )
protected

Since clearTargets also clears the help screen ids

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

References addSubStyleForms(), ILIAS\Repository\help(), and ILIAS\Repository\tabs().

722  : void
723  {
724  $this->tabs->clearTargets();
728  $this->help->setScreenIdComponent('sty');
729  $this->help->setScreenId('system_styles');
730  $this->help->setSubScreenId('create_sub');
731 
732  $form = $this->addSubStyleForms();
733 
734  $this->tpl->setContent($form->getHTML());
735  }
+ Here is the call graph for this function:

◆ addSubStyleForms()

ilSystemStyleOverviewGUI::addSubStyleForms ( )
protected

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

References $id, ILIAS\Repository\ctrl(), ilStyleDefinition\getAllSkinStyles(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setRequired().

Referenced by addSubStyle(), and saveNewSubStyle().

738  {
739  $form = new ilPropertyFormGUI();
740  $form->setFormAction($this->ctrl->getFormAction($this));
741  $form->setTitle($this->lng->txt('sty_create_new_system_sub_style'));
742 
743  $ti = new ilTextInputGUI($this->lng->txt('sub_style_id'), 'sub_style_id');
744  $ti->setInfo($this->lng->txt('sub_style_id_description'));
745  $ti->setMaxLength(128);
746  $ti->setSize(40);
747  $ti->setRequired(true);
748  $form->addItem($ti);
749 
750  $ti = new ilTextInputGUI($this->lng->txt('sub_style_name'), 'sub_style_name');
751  $ti->setInfo($this->lng->txt('sub_style_name_description'));
752  $ti->setMaxLength(128);
753  $ti->setSize(40);
754  $ti->setRequired(true);
755  $form->addItem($ti);
756 
757  // source
758  $ti = new ilSelectInputGUI($this->lng->txt('parent'), 'parent_style');
759  $ti->setRequired(true);
760  $ti->setInfo($this->lng->txt('sub_style_parent_style_description'));
762  $options = [];
763  foreach ($styles as $id => $style) {
764  $system_style_conf = new ilSystemStyleConfig();
765  if ($style['skin_id'] != $system_style_conf->getDefaultSkinId() && !$style['substyle_of']) {
766  $options[$id] = $style['title'];
767  }
768  }
769  $ti->setOptions($options);
770 
771  $form->addItem($ti);
772  $form->addCommandButton('saveNewSubStyle', $this->lng->txt('save'));
773  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
774 
775  return $form;
776  }
This class represents a selection list property in a property form.
static getAllSkinStyles()
Get all skins/styles as array (convenient for tables) Attention: tempalte_name/template_id in this ar...
setRequired(bool $a_required)
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSystemStyle()

ilSystemStyleOverviewGUI::addSystemStyle ( )
protected

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

References addSystemStyleForms().

311  : void
312  {
313  $this->addSystemStyleForms();
314  }
+ Here is the call graph for this function:

◆ addSystemStyleForms()

ilSystemStyleOverviewGUI::addSystemStyleForms ( )
protected

Since clearTargets also clears the help screen ids

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

References cloneSystemStyleForm(), createSystemStyleForm(), ILIAS\Repository\help(), importSystemStyleForm(), and ILIAS\Repository\tabs().

Referenced by addSystemStyle().

358  : void
359  {
360  $this->tabs->clearTargets();
364  $this->help->setScreenIdComponent('sty');
365  $this->help->setScreenId('system_styles');
366  $this->help->setSubScreenId('create');
367 
368  $forms = [];
369 
370  $forms[] = $this->createSystemStyleForm();
371  $forms[] = $this->importSystemStyleForm();
372  $forms[] = $this->cloneSystemStyleForm();
373 
374  $this->tpl->setContent($this->getCreationFormsHTML($forms));
375  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilSystemStyleOverviewGUI::cancel ( )
protected

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

References edit().

175  : void
176  {
177  $this->edit();
178  }
+ Here is the call graph for this function:

◆ checkDeletable()

ilSystemStyleOverviewGUI::checkDeletable ( string  $skin_id,
string  $style_id,
ilSystemStyleMessageStack  $message_stack 
)
protected

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

References $style_id, ilObjUser\_getNumberOfUsersForStyle(), ilSystemStyleSettings\_lookupActivatedStyle(), ilSystemStyleMessageStack\addMessage(), ilSystemStyleSettings\getCurrentDefaultSkin(), ILIAS\Repository\lng(), and ilSystemStyleMessage\TYPE_ERROR.

Referenced by deleteStyle(), and deleteStyles().

604  : bool {
605  $passed = true;
606  if (ilObjUser::_getNumberOfUsersForStyle($skin_id, $style_id) > 0) {
607  $message_stack->addMessage(new ilSystemStyleMessage(
608  $style_id . ': ' . $this->lng->txt('cant_delete_if_users_assigned'),
610  ));
611  $passed = false;
612  }
614  $message_stack->addMessage(new ilSystemStyleMessage(
615  $style_id . ': ' . $this->lng->txt('cant_delete_activated_style'),
617  ));
618  $passed = false;
619  }
621  $message_stack->addMessage(new ilSystemStyleMessage(
622  $style_id . ': ' . $this->lng->txt('cant_delete_default_style'),
624  ));
625  $passed = false;
626  }
627 
628  if ($this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack)->getSkin()->getSubstylesOfStyle($style_id)) {
629  $message_stack->addMessage(new ilSystemStyleMessage(
630  $style_id . ': ' . $this->lng->txt('cant_delete_style_with_substyles'),
632  ));
633  $passed = false;
634  }
635  return $passed;
636  }
static _lookupActivatedStyle(string $a_skin, string $a_style)
lookup if a style is activated
static getCurrentDefaultSkin()
Gets default Skin of the System.
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
static _getNumberOfUsersForStyle(string $a_skin, string $a_style)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkStyleSettings()

ilSystemStyleOverviewGUI::checkStyleSettings ( ilSystemStyleMessageStack  $message_stack,
array  $active_styles 
)
protected

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

References ilObjUser\_getNumberOfUsersForStyle(), ilSystemStyleMessageStack\addMessage(), ilStyleDefinition\getAllSkinStyles(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilSystemStyleMessage\TYPE_ERROR.

Referenced by saveStyleSettings().

268  : bool
269  {
270  $passed = true;
271 
272  if (count($active_styles) < 1) {
273  $passed = false;
274  $message_stack->addMessage(new ilSystemStyleMessage(
275  $this->lng->txt('at_least_one_style'),
277  ));
278  }
279 
280  $default_style = $this->request_wrapper->post()->retrieve(
281  'default_skin_style',
282  $this->refinery->kindlyTo()->string()
283  );
284 
285  if (!isset($active_styles[$default_style])) {
286  $passed = false;
287  $message_stack->addMessage(new ilSystemStyleMessage(
288  $this->lng->txt('cant_deactivate_default_style'),
290  ));
291  }
292 
293  // check if a style should be deactivated, that still has
294  // a user assigned to
295  $all_styles = ilStyleDefinition::getAllSkinStyles();
296 
297  foreach ($all_styles as $style) {
298  if (!isset($active_styles[$style['id']])) {
299  if (ilObjUser::_getNumberOfUsersForStyle($style['template_id'], $style['style_id']) > 0) {
300  $passed = false;
301  $message_stack->addMessage(new ilSystemStyleMessage(
302  $style['style_name'] . ': ' . $this->lng->txt('cant_deactivate_if_users_assigned'),
304  ));
305  }
306  }
307  }
308  return $passed;
309  }
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
static _getNumberOfUsersForStyle(string $a_skin, string $a_style)
static getAllSkinStyles()
Get all skins/styles as array (convenient for tables) Attention: tempalte_name/template_id in this ar...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneSystemStyleForm()

ilSystemStyleOverviewGUI::cloneSystemStyleForm ( )
protected

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

References $id, ILIAS\Repository\ctrl(), ilAccordionGUI\FIRST_OPEN, ilStyleDefinition\getAllSkinStyles(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setRequired().

Referenced by addSystemStyleForms().

436  {
437  $form = new ilPropertyFormGUI();
438  $form->setFormAction($this->ctrl->getFormAction($this));
439  $form->setTitle($this->lng->txt('sty_copy_other_system_style'));
440 
441  // source
442  $ti = new ilSelectInputGUI($this->lng->txt('sty_source'), 'source_style');
443  $ti->setRequired(true);
445  $options = [];
446  foreach ($styles as $id => $style) {
447  $system_style_conf = new ilSystemStyleConfig();
448  if ($style['skin_id'] != $system_style_conf->getDefaultSkinId()) {
449  $options[$id] = $style['title'];
450  }
451  }
452  $ti->setOptions($options);
453 
454  $form->addItem($ti);
455 
456  $form->addCommandButton('copyStyle', $this->lng->txt('copy'));
457  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
458 
459  return $form;
460  }
This class represents a selection list property in a property form.
static getAllSkinStyles()
Get all skins/styles as array (convenient for tables) Attention: tempalte_name/template_id in this ar...
setRequired(bool $a_required)
ilSystemStyleConfig wraps all &#39;constants&#39; to ensure the testability of all classes using those &#39;const...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDelete()

ilSystemStyleOverviewGUI::confirmDelete ( )
protected

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

References $container, Vendor\Package\$e, $message_stack, ILIAS\Repository\ctrl(), importSystemStyleForm(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilSystemStyleMessage\TYPE_ERROR, ilSystemStyleMessage\TYPE_SUCCESS, and ILIAS\Repository\upload().

638  : void
639  {
640  $i = 0;
641  while ($this->request_wrapper->post()->has('style_' . $i)) {
642  try {
643  $skin_style_id = $this->request_wrapper->post()->retrieve(
644  'style_' . $i,
645  $this->refinery->string()->splitString(':')
646  );
647  $container = $this->skin_factory->skinStyleContainerFromId($skin_style_id[0], $this->message_stack);
648  $syle = $container->getSkin()->getStyle($skin_style_id[1]);
649  $container->deleteStyle($syle);
650  if (!$container->getSkin()->hasStyles()) {
651  $container->delete();
652  }
653  } catch (Exception $e) {
654  $this->message_stack->addMessage(new ilSystemStyleMessage(
655  $e->getMessage(),
657  ));
658  }
659  $i++;
660  }
661  $this->message_stack->sendMessages();
662  $this->ctrl->redirect($this);
663  }
$container
Definition: wac.php:14
+ Here is the call graph for this function:

◆ copyStyle()

ilSystemStyleOverviewGUI::copyStyle ( )
protected

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

References $container, Vendor\Package\$e, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilSystemStyleMessage\TYPE_ERROR, and ilSystemStyleMessage\TYPE_SUCCESS.

499  : void
500  {
501  $imploded_skin_style_id = $this->request_wrapper->post()->retrieve(
502  'source_style',
503  $this->refinery->string()->splitString(':')
504  );
505  $skin_id = $imploded_skin_style_id[0];
506  $style_id = $imploded_skin_style_id[1];
507 
508  try {
509  $container = $this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack);
510  $new_container = $this->skin_factory->copyFromSkinStyleContainer(
511  $container,
512  $this->file_system,
513  $this->message_stack,
514  $this->lng->txt('sty_acopy')
515  );
516  $this->message_stack->prependMessage(new ilSystemStyleMessage(
517  $this->lng->txt('style_copied'),
519  ));
520  $this->ctrl->setParameterByClass('ilsystemstyleconfiggui', 'skin_id', $new_container->getSkin()->getId());
521  $this->ctrl->setParameterByClass(
522  'ilsystemstyleconfiggui',
523  'style_id',
524  $new_container->getSkin()->getStyle($style_id)->getId()
525  );
526  $this->message_stack->addMessage(new ilSystemStyleMessage(
527  $this->lng->txt('directory_created') . ' ' . $new_container->getSkinDirectory(),
529  ));
530  } catch (Exception $e) {
531  $this->message_stack->addMessage(new ilSystemStyleMessage(
532  $e->getMessage(),
534  ));
535  }
536  $this->message_stack->sendMessages();
537  $this->ctrl->redirectByClass('ilsystemstyleconfiggui');
538  }
$container
Definition: wac.php:14
+ Here is the call graph for this function:

◆ createSystemStyleForm()

ilSystemStyleOverviewGUI::createSystemStyleForm ( )
protected

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

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by addSystemStyleForms(), and saveNewSystemStyle().

378  {
379  $form = new ilPropertyFormGUI();
380  $form->setFormAction($this->ctrl->getFormAction($this));
381  $form->setTitle($this->lng->txt('sty_create_new_system_style'));
382 
383  $ti = new ilTextInputGUI($this->lng->txt('skin_id'), 'skin_id');
384  $ti->setInfo($this->lng->txt('skin_id_description'));
385  $ti->setMaxLength(128);
386  $ti->setSize(40);
387  $ti->setRequired(true);
388  $form->addItem($ti);
389 
390  $ti = new ilTextInputGUI($this->lng->txt('skin_name'), 'skin_name');
391  $ti->setInfo($this->lng->txt('skin_name_description'));
392  $ti->setMaxLength(128);
393  $ti->setSize(40);
394  $ti->setRequired(true);
395  $form->addItem($ti);
396 
397  $ti = new ilTextInputGUI($this->lng->txt('style_id'), 'style_id');
398  $ti->setInfo($this->lng->txt('style_id_description'));
399  $ti->setMaxLength(128);
400  $ti->setSize(40);
401  $ti->setRequired(true);
402  $form->addItem($ti);
403 
404  $ti = new ilTextInputGUI($this->lng->txt('style_name'), 'style_name');
405  $ti->setInfo($this->lng->txt('style_name_description'));
406  $ti->setMaxLength(128);
407  $ti->setSize(40);
408  $ti->setRequired(true);
409  $form->addItem($ti);
410 
411  $form->addCommandButton('saveNewSystemStyle', $this->lng->txt('save'));
412  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
413 
414  return $form;
415  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteStyle()

ilSystemStyleOverviewGUI::deleteStyle ( )
protected

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

References $container, $style_id, checkDeletable(), ILIAS\Repository\ctrl(), edit(), ILIAS\Repository\lng(), and ilSystemStyleMessage\TYPE_ERROR.

540  : void
541  {
542  $skin_id = $this->style_container->getSkin()->getId();
544 
545  if ($this->checkDeletable($skin_id, $style_id, $this->message_stack)) {
546  $delete_form_table = new ilSystemStyleDeleteGUI($this->lng, $this->ctrl);
547  $container = $this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack);
548  $delete_form_table->addStyle(
549  $container->getSkin(),
550  $container->getSkin()->getStyle($style_id),
551  $container->getImagesStylePath($style_id) . '/standard/icon_stys.svg'
552  );
553  $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
554  } else {
555  $this->message_stack->prependMessage(new ilSystemStyleMessage(
556  $this->lng->txt('style_not_deleted'),
558  ));
559  $this->edit();
560  }
561  }
$container
Definition: wac.php:14
checkDeletable(string $skin_id, string $style_id, ilSystemStyleMessageStack $message_stack)
+ Here is the call graph for this function:

◆ deleteStyles()

ilSystemStyleOverviewGUI::deleteStyles ( )
protected

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

References $container, checkDeletable(), ILIAS\Repository\ctrl(), edit(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilSystemStyleMessage\TYPE_ERROR.

563  : void
564  {
565  $delete_form_table = new ilSystemStyleDeleteGUI($this->lng, $this->ctrl);
566 
567  $all_deletable = true;
568 
569  $skin_ids = $this->request_wrapper->post()->retrieve('id', $this->refinery->identity());
570  foreach ($skin_ids as $skin_style_id) {
571  $imploded_skin_style_id = explode(':', $skin_style_id);
572  $skin_id = $imploded_skin_style_id[0];
573  $style_id = $imploded_skin_style_id[1];
574  if (!$this->checkDeletable($skin_id, $style_id, $this->message_stack)) {
575  $all_deletable = false;
576  }
577  }
578  if ($all_deletable) {
579  foreach ($skin_ids as $skin_style_id) {
580  $imploded_skin_style_id = explode(':', $skin_style_id);
581  $skin_id = $imploded_skin_style_id[0];
582  $style_id = $imploded_skin_style_id[1];
583  $container = $this->skin_factory->skinStyleContainerFromId($skin_id, $this->message_stack);
584  $delete_form_table->addStyle(
585  $container->getSkin(),
586  $container->getSkin()->getStyle($style_id),
587  $container->getImagesStylePath($style_id) . '/standard/icon_stys.svg'
588  );
589  }
590  $this->tpl->setContent($delete_form_table->getDeleteStyleFormHTML());
591  } else {
592  $this->message_stack->prependMessage(new ilSystemStyleMessage(
593  $this->lng->txt('styles_not_deleted'),
595  ));
596  $this->edit();
597  }
598  }
$container
Definition: wac.php:14
checkDeletable(string $skin_id, string $style_id, ilSystemStyleMessageStack $message_stack)
+ Here is the call graph for this function:

◆ edit()

ilSystemStyleOverviewGUI::edit ( )

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

References ILIAS\Repository\ctrl(), isManagementEnabled(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

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

180  : void
181  {
182  if ($this->isManagementEnabled()) {
183  // Add Button for adding skins
184  $this->toolbar->addComponent($this->ui_factory->button()->standard(
185  $this->lng->txt('add_system_style'),
186  $this->ctrl->getLinkTarget($this, 'addSystemStyle')
187  ));
188 
189  // Add Button for adding sub styles
190  $add_sub = $this->ui_factory->button()->standard(
191  $this->lng->txt('add_substyle'),
192  $this->ctrl->getLinkTarget($this, 'addSubStyle')
193  );
194  if (count(ilStyleDefinition::getAllSkins()) == 1) {
195  $add_sub = $add_sub->withUnavailableAction();
196  }
197  $this->toolbar->addComponent($add_sub);
198  }
199 
200  $table = new ilSystemStylesTableGUI($this, 'edit');
201  $table->addActions($this->isManagementEnabled());
202  $this->tpl->setContent($table->getHTML().$table->getModalsHtml());
203  }
TableGUI class for system styles.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilSystemStyleOverviewGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl(), isManagementEnabled(), isReadOnly(), and ILIAS\Repository\lng().

92  : void
93  {
94  $cmd = $this->ctrl->getCmd();
95 
96  if ($cmd == '') {
97  $cmd = $this->isReadOnly() ? 'view' : 'edit';
98  }
99 
100  switch ($cmd) {
101  case 'addSystemStyle':
102  case 'addSubStyle':
103  case 'saveNewSystemStyle':
104  case 'saveNewSubStyle':
105  case 'copyStyle':
106  case 'importStyle':
107  case 'deleteStyles':
108  case 'deleteStyle':
109  case 'confirmDelete':
110  if (!$this->isManagementEnabled()) {
111  throw new ilObjectException($this->lng->txt('permission_denied'));
112  }
113  $this->$cmd();
114  break;
115  case 'cancel':
116  case 'edit':
117  case 'export':
118  case 'moveUserStyles':
119  case 'saveStyleSettings':
120  if ($this->isReadOnly()) {
121  throw new ilObjectException($this->lng->txt('permission_denied'));
122  }
123  $this->$cmd();
124  break;
125  case 'view':
126  $this->$cmd();
127  break;
128  }
129  $this->message_stack->sendMessages();
130  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ export()

ilSystemStyleOverviewGUI::export ( )
protected

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

References Vendor\Package\$e, ILIAS\Repository\lng(), and ilSystemStyleMessage\TYPE_ERROR.

707  : void
708  {
709  try {
710  $this->style_container->export();
711  } catch (Exception $e) {
712  $this->message_stack->addMessage(new ilSystemStyleMessage(
713  $this->lng->txt('zip_export_failed') . ' ' . $e->getMessage(),
715  ));
716  }
717  }
+ Here is the call graph for this function:

◆ getAssignmentCreationModal()

ilSystemStyleOverviewGUI::getAssignmentCreationModal ( string  $style_name = "")

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

References $id, $txt, ILIAS\Repository\ctrl(), ilStyleDefinition\getAllSkinStyles(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

Referenced by moveUserStyles().

139  {
140  $options = [];
141  foreach (ilStyleDefinition::getAllSkinStyles() as $id => $skin_style) {
142  if (!$skin_style['substyle_of'] && $style_name != $skin_style['style_name']) {
143  $options[$id] = $skin_style['title'];
144  }
145  }
146 
147  $default = "default:delos";
148  if($style_name == "Delos") {
149  $default = key($options);
150  }
151 
152  if(count($options) == 0) {
153  return null;
154  }
155 
156  $txt = $this->lng->txt('sty_move_user_styles').' '.$this->lng->txt('sty_to');
157 
158  $byline = $this->lng->txt('sty_move_user_styles') . ' ' .
159  $this->lng->txt('sty_from') . ' ' . $style_name;
160 
161  $select = $this->ui_factory->input()->field()
162  ->select($txt, $options, $byline)
163  ->withValue($default)
164  ->withAdditionalTransformation($this->refinery->string()->splitString(':'))
165  ->withRequired(true);
166 
167  return $this->ui_factory->modal()->roundtrip(
168  $this->lng->txt('change_assignment'),
169  [],
170  ["new_style" => $select],
171  $this->ctrl->getLinkTargetByClass(ilSystemStyleOverviewGUI::class, 'moveUserStyles')
172  );
173  }
static getAllSkinStyles()
Get all skins/styles as array (convenient for tables) Attention: tempalte_name/template_id in this ar...
$txt
Definition: error.php:14
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importSystemStyleForm()

ilSystemStyleOverviewGUI::importSystemStyleForm ( )
protected

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

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setRequired().

Referenced by addSystemStyleForms(), and confirmDelete().

418  {
419  $form = new ilPropertyFormGUI();
420  $form->setFormAction($this->ctrl->getFormAction($this, 'importStyle'));
421  $form->setTitle($this->lng->txt('sty_import_system_style'));
422 
423  // title
424  $file_input = new ilFileInputGUI($this->lng->txt('import_file'), 'importfile');
425  $file_input->setRequired(true);
426  $file_input->setSuffixes(['zip']);
427  $form->addItem($file_input);
428 
429  $form->addCommandButton('importStyle', $this->lng->txt('import'));
430  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
431 
432  return $form;
433  }
This class represents a file property in a property form.
setRequired(bool $a_required)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isManagementEnabled()

ilSystemStyleOverviewGUI::isManagementEnabled ( )

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

References $management_enabled.

Referenced by edit(), and executeCommand().

845  : bool
846  {
848  }
+ Here is the caller graph for this function:

◆ isReadOnly()

ilSystemStyleOverviewGUI::isReadOnly ( )

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

References $read_only.

Referenced by executeCommand().

835  : bool
836  {
837  return $this->read_only;
838  }
+ Here is the caller graph for this function:

◆ moveUserStyles()

ilSystemStyleOverviewGUI::moveUserStyles ( )

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

References $DIC, ilObjUser\_getAllUserAssignedStyles(), ilObjUser\_moveUsersToStyle(), ILIAS\Repository\ctrl(), getAssignmentCreationModal(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilStyleDefinition\styleExists().

205  : void
206  {
207  global $DIC;
208 
209  $request = $DIC->http()->request();
210 
211  $modal = $this->getAssignmentCreationModal()->withRequest($request);
212  [$new_skin, $new_style] = $modal->getData()["new_style"];
213 
214  $old_skin = $this->request_wrapper->query()->retrieve('old_skin_id', $this->refinery->kindlyTo()->string());
215  $old_style = $this->request_wrapper->query()->retrieve('old_style_id', $this->refinery->kindlyTo()->string());
216 
217  if ($old_style == 'other') {
218  // get all user assigned styles
219  $all_user_styles = ilObjUser::_getAllUserAssignedStyles();
220 
221  // move users that are not assigned to
222  // currently existing style
223  foreach ($all_user_styles as $style) {
224  if (!ilStyleDefinition::styleExists($style)) {
225  [$old_skin, $old_style] = explode(':', $style);
226  ilObjUser::_moveUsersToStyle($old_skin, $old_style, $new_skin, $new_style);
227  }
228  }
229  } else {
230  ilObjUser::_moveUsersToStyle($old_skin, $old_style, $new_skin, $new_style);
231  }
232 
233  $this->message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt('msg_obj_modified')));
234  $this->ctrl->redirect($this, 'edit');
235  }
static styleExists(string $style_id)
static _moveUsersToStyle(string $a_from_skin, string $a_from_style, string $a_to_skin, string $a_to_style)
getAssignmentCreationModal(string $style_name="")
global $DIC
Definition: feed.php:28
static _getAllUserAssignedStyles()
+ Here is the call graph for this function:

◆ saveNewSubStyle()

ilSystemStyleOverviewGUI::saveNewSubStyle ( )
protected

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

References $container, Vendor\Package\$e, addSubStyleForms(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilSystemStyleException\SUBSTYLE_ASSIGNMENT_EXISTS, and ilSystemStyleMessage\TYPE_ERROR.

778  : void
779  {
780  $form = $this->addSubStyleForms();
781 
782  if ($form->checkInput()) {
783  try {
784  $skin_style_ids = $this->request_wrapper->post()->retrieve(
785  'parent_style',
786  $this->refinery->string()->splitString(':')
787  );
788 
789  $parent_skin_id = $skin_style_ids[0];
790  $parent_style_id = $skin_style_ids[1];
791 
792  $container = $this->skin_factory->skinStyleContainerFromId($parent_skin_id, $this->message_stack);
793 
794  $sub_style_id = $this->request_wrapper->post()->retrieve(
795  'sub_style_id',
796  $this->refinery->kindlyTo()->string()
797  );
798 
799  if (array_key_exists(
800  $sub_style_id,
801  $container->getSkin()->getSubstylesOfStyle($parent_style_id)
802  )) {
803  throw new ilSystemStyleException(
805  $sub_style_id
806  );
807  }
808 
809  $sub_style_name = $this->request_wrapper->post()->retrieve(
810  'sub_style_name',
811  $this->refinery->kindlyTo()->string()
812  );
813 
814  $style = new ilSkinStyle($sub_style_id, $sub_style_name);
815  $style->setSubstyleOf($parent_style_id);
816  $container->addStyle($style);
817  $this->ctrl->setParameterByClass('ilsystemstyleconfiggui', 'skin_id', $parent_skin_id);
818  $this->ctrl->setParameterByClass('ilsystemstyleconfiggui', 'style_id', $sub_style_id);
819  $this->message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt('msg_sub_style_created')));
820  $this->message_stack->sendMessages();
821  $this->ctrl->redirectByClass('ilsystemstyleconfiggui');
822  } catch (ilSystemStyleException $e) {
823  $this->message_stack->addMessage(new ilSystemStyleMessage(
824  $e->getMessage(),
826  ));
827  }
828  }
829 
830  // display only this form to correct input
831  $form->setValuesByPost();
832  $this->tpl->setContent($form->getHTML());
833  }
$container
Definition: wac.php:14
+ Here is the call graph for this function:

◆ saveNewSystemStyle()

ilSystemStyleOverviewGUI::saveNewSystemStyle ( )
protected

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

References $container, Vendor\Package\$e, createSystemStyleForm(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilStyleDefinition\skinExists(), and ilSystemStyleMessage\TYPE_ERROR.

316  : void
317  {
318  $form = $this->createSystemStyleForm();
319 
320  if ($form->checkInput()) {
321  $skin_id = $this->request_wrapper->post()->retrieve('skin_id', $this->refinery->kindlyTo()->string());
322  $style_id = $this->request_wrapper->post()->retrieve('style_id', $this->refinery->kindlyTo()->string());
323 
324  $skin_name = $this->request_wrapper->post()->retrieve('skin_name', $this->refinery->kindlyTo()->string());
325  $style_name = $this->request_wrapper->post()->retrieve('style_name', $this->refinery->kindlyTo()->string());
326 
327  if (ilStyleDefinition::skinExists($skin_id)) {
328  $this->message_stack->addMessage(new ilSystemStyleMessage(
329  $this->lng->txt('skin_id_exists'),
331  ));
332  } else {
333  try {
334  $skin = new ilSkin($skin_id, $skin_name);
335  $style = new ilSkinStyle($style_id, $style_name);
336  $skin->addStyle($style);
337  $container = new ilSkinStyleContainer($this->lng, $skin, $this->message_stack);
338  $container->create($this->message_stack);
339  $this->ctrl->setParameterByClass(ilSystemStyleConfigGUI::class, 'skin_id', $skin->getId());
340  $this->ctrl->setParameterByClass(ilSystemStyleConfigGUI::class, 'style_id', $style->getId());
341  $this->message_stack->addMessage(new ilSystemStyleMessage($this->lng->txt('msg_sys_style_created')));
342  $this->message_stack->sendMessages();
343  $this->ctrl->redirectByClass(ilSystemStyleConfigGUI::class);
344  } catch (ilSystemStyleException $e) {
345  $this->message_stack->addMessage(new ilSystemStyleMessage(
346  $e->getMessage(),
348  ));
349  }
350  }
351  }
352 
353  // display only this form to correct input
354  $form->setValuesByPost();
355  $this->tpl->setContent($form->getHTML());
356  }
$container
Definition: wac.php:14
This class is responsible for all file system related actions related actions of a skin such as copyi...
static skinExists(string $skin_id, ?ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
ilSkin holds an manages the basic data of a skin as provide by the template of the skin...
+ Here is the call graph for this function:

◆ saveStyleSettings()

ilSystemStyleOverviewGUI::saveStyleSettings ( )

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

References ilSystemStyleSettings\_activateStyle(), ilSystemStyleSettings\_deactivateStyle(), checkStyleSettings(), ILIAS\Repository\ctrl(), ilStyleDefinition\getAllSkinStyles(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilSystemStyleSettings\setCurrentDefaultStyle(), and ilSystemStyleMessage\TYPE_SUCCESS.

237  : void
238  {
239  $active_styles = $this->request_wrapper->post()->retrieve('st_act', $this->refinery->identity());
240 
241  if ($this->checkStyleSettings($this->message_stack, $active_styles)) {
242  $all_styles = ilStyleDefinition::getAllSkinStyles();
243  foreach ($all_styles as $style) {
244  if (!isset($active_styles[$style['id']])) {
245  ilSystemStyleSettings::_deactivateStyle($style['template_id'], $style['style_id']);
246  } else {
247  ilSystemStyleSettings::_activateStyle($style['template_id'], $style['style_id']);
248  }
249  }
250 
251  //set default skin and style
252  if ($this->request_wrapper->post()->has('default_skin_style')) {
253  $sknst = $this->request_wrapper->post()->retrieve(
254  'default_skin_style',
255  $this->refinery->string()->splitString(':')
256  );
257  ilSystemStyleSettings::setCurrentDefaultStyle($sknst[0], $sknst[1]);
258  }
259  $this->message_stack->addMessage(new ilSystemStyleMessage(
260  $this->lng->txt('msg_obj_modified'),
262  ));
263  }
264  $this->message_stack->sendMessages();
265  $this->ctrl->redirect($this, 'edit');
266  }
static _deactivateStyle(string $a_skin, string $a_style)
deactivate system style
static _activateStyle(string $a_skin, string $a_style)
activate system style
static getAllSkinStyles()
Get all skins/styles as array (convenient for tables) Attention: tempalte_name/template_id in this ar...
static setCurrentDefaultStyle(string $skin_id, string $style_id)
Sets the default style of the system.
checkStyleSettings(ilSystemStyleMessageStack $message_stack, array $active_styles)
+ Here is the call graph for this function:

◆ setManagementEnabled()

ilSystemStyleOverviewGUI::setManagementEnabled ( bool  $management_enabled)

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

References $management_enabled.

Referenced by __construct().

850  : void
851  {
852  $this->management_enabled = $management_enabled;
853  }
+ Here is the caller graph for this function:

◆ setReadOnly()

ilSystemStyleOverviewGUI::setReadOnly ( bool  $read_only)

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

References $read_only.

Referenced by __construct().

840  : void
841  {
842  $this->read_only = $read_only;
843  }
+ Here is the caller graph for this function:

◆ view()

ilSystemStyleOverviewGUI::view ( )
protected

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

132  : void
133  {
134  $table = new ilSystemStylesTableGUI($this, 'edit');
135  $this->tpl->setContent($table->getHTML().$table->getModalsHtml());
136  }
TableGUI class for system styles.

Field Documentation

◆ $config

ilSystemStyleConfig ilSystemStyleOverviewGUI::$config
protected

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

◆ $ctrl

ilCtrl ilSystemStyleOverviewGUI::$ctrl
protected

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

Referenced by __construct().

◆ $file_system

ilFileSystemHelper ilSystemStyleOverviewGUI::$file_system
protected

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

◆ $help

ilHelpGUI ilSystemStyleOverviewGUI::$help
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilSystemStyleOverviewGUI::$lng
protected

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

Referenced by __construct().

◆ $management_enabled

bool ilSystemStyleOverviewGUI::$management_enabled = false
protected

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

Referenced by isManagementEnabled(), and setManagementEnabled().

◆ $message_stack

ilSystemStyleMessageStack ilSystemStyleOverviewGUI::$message_stack
protected

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

Referenced by confirmDelete().

◆ $read_only

bool ilSystemStyleOverviewGUI::$read_only = true
protected

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

Referenced by isReadOnly(), and setReadOnly().

◆ $ref_id

string ilSystemStyleOverviewGUI::$ref_id
protected

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

Referenced by __construct().

◆ $refinery

Refinery ilSystemStyleOverviewGUI::$refinery
protected

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

Referenced by __construct().

◆ $renderer

Renderer ilSystemStyleOverviewGUI::$renderer
protected

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

Referenced by __construct().

◆ $request_wrapper

WrapperFactory ilSystemStyleOverviewGUI::$request_wrapper
protected

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

Referenced by __construct().

◆ $skin_factory

ilSkinFactory ilSystemStyleOverviewGUI::$skin_factory
protected

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

Referenced by __construct().

◆ $style_container

ilSkinStyleContainer ilSystemStyleOverviewGUI::$style_container
protected

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

◆ $style_id

string ilSystemStyleOverviewGUI::$style_id
protected

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

Referenced by __construct(), checkDeletable(), and deleteStyle().

◆ $tabs

ilTabsGUI ilSystemStyleOverviewGUI::$tabs
protected

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

Referenced by __construct().

◆ $toolbar

ilToolbarGUI ilSystemStyleOverviewGUI::$toolbar
protected

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

Referenced by __construct().

◆ $tpl

ilGlobalTemplateInterface ilSystemStyleOverviewGUI::$tpl
protected

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

Referenced by __construct().

◆ $ui_factory

Factory ilSystemStyleOverviewGUI::$ui_factory
protected

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

Referenced by __construct().

◆ $upload

FileUpload ilSystemStyleOverviewGUI::$upload
protected

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

Referenced by __construct().


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