ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilOrgUnitTypeFormGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilOrgUnitTypeFormGUI:
+ Collaboration diagram for ilOrgUnitTypeFormGUI:

Public Member Functions

 __construct (ilOrgUnitTypeGUI $parent_gui, ilOrgUnitType $type)
 
 saveObject ()
 Save object (create or update) More...
 
- Public Member Functions inherited from ilPropertyFormGUI
 __construct ()
 
 executeCommand ()
 
 setTableWidth (string $a_width)
 
 getTableWidth ()
 
 setMode (string $a_mode)
 
 getMode ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setTitleIcon (string $a_titleicon)
 
 getTitleIcon ()
 
 setDescription (string $a_val)
 
 getDescription ()
 
 setTopAnchor (string $a_val)
 
 getTopAnchor ()
 
 setShowTopButtons (bool $a_val)
 
 getShowTopButtons ()
 
 setForceTopButtons (bool $a_val)
 
 getForceTopButtons ()
 
 addItem ($a_item)
 
 removeItemByPostVar (string $a_post_var, bool $a_remove_unused_headers=false)
 
 getItemByPostVar (string $a_post_var)
 
 setItems (array $a_items)
 
 getItems ()
 
 getInputItemsRecursive ()
 returns a flat array of all input items including the possibly existing subitems recursively More...
 
 setDisableStandardMessage (bool $a_val)
 
 getDisableStandardMessage ()
 
 getHideLabels ()
 
 setHideLabels (bool $a_value=true)
 
 setValuesByArray (array $a_values, bool $a_restrict_to_value_keys=false)
 
 setValuesByPost ()
 
 checkInput ()
 
 getInput (string $a_post_var, bool $ensureValidation=true)
 Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-POST variable, identified by the passed postvar. More...
 
 addCommandButton (string $a_cmd, string $a_text, string $a_id="")
 
 getCommandButtons ()
 
 clearCommandButtons ()
 
 getContent ()
 
 insertItem ( $item, bool $a_sub_item=false)
 
 addAsyncOnloadCode (string $code)
 
 getHTML ()
 
 getHTMLAsync ()
 
 getFileUpload (string $a_field, ?string $a_index=null, ?string $a_sub_index=null)
 Get file upload data. More...
 
 hasFileUpload (string $a_field, ?string $a_index=null, ?string $a_sub_index=null)
 
 moveFileUpload (string $a_target_directory, string $a_field, ?string $a_target_name=null, ?string $a_index=null, ?string $a_sub_index=null)
 Move upload to target directory. More...
 
- Public Member Functions inherited from ilFormGUI
 setFormAction (string $a_formaction)
 
 getFormAction ()
 
 setTarget (string $a_target)
 
 getTarget ()
 
 setMultipart (bool $a_multipart)
 
 getMultipart ()
 
 setId (string $a_id)
 
 getId ()
 
 setName (string $a_name)
 
 getName ()
 
 setKeepOpen (bool $a_keepopen)
 
 getKeepOpen ()
 
 setOpenTag (bool $a_open)
 
 getOpenTag ()
 
 setCloseTag (bool $a_val)
 
 getCloseTag ()
 
 setPreventDoubleSubmission (bool $a_val)
 
 getPreventDoubleSubmission ()
 
 getHTML ()
 
 getContent ()
 

Protected Attributes

ilOrgUnitType $type
 
ilOrgUnitTypeGUI $parent_gui
 
- Protected Attributes inherited from ilPropertyFormGUI
bool $required_text = false
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilTemplate $tpl
 
ilObjUser $user = null
 
ilSetting $settings = null
 
string $mode = "std"
 
bool $check_input_called = false
 
bool $disable_standard_message = false
 
string $top_anchor = "il_form_top"
 
string $title = ''
 
string $titleicon = ""
 
string $description = ""
 
string $tbl_width = ""
 
bool $show_top_buttons = true
 
bool $hide_labels = false
 
bool $force_top_buttons = false
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
ilGlobalTemplateInterface $global_tpl = null
 
 $onload_code = []
 
- Protected Attributes inherited from ilFormGUI
string $formaction = ""
 
bool $multipart = false
 
bool $keepopen = false
 
bool $opentag = true
 
string $id = ''
 
string $name = ''
 
string $target = ''
 
bool $prevent_double_submission = false
 

Private Member Functions

 initForm ()
 Add all fields to the form. More...
 
 fillObject ()
 Check validity of form and pass values from form to object. More...
 
 addTranslationInputs (string $a_lang_code)
 Add a text and textarea input per language. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ilPropertyFormGUI
 getRequestedPostVar ()
 
 getFileHash ()
 
 hideRequired (string $a_type)
 
 appendOnloadCode (string $html)
 
 rebuildUploadedFiles ()
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilOrgUnitTypeFormGUI

Author
Stefan Wanzenried sw@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 23 of file class.ilOrgUnitTypeFormGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilOrgUnitTypeFormGUI::__construct ( ilOrgUnitTypeGUI  $parent_gui,
ilOrgUnitType  $type 
)

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

References $DIC, $parent_gui, $type, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), initForm(), and ILIAS\Repository\lng().

30  {
31  global $DIC;
32  $this->parent_gui = $parent_gui;
33  $this->type = $type;
34  //$this->tpl = $DIC->ui()->mainTemplate();
35  $this->global_tpl = $DIC->ui()->mainTemplate();
36  $this->ctrl = $DIC->ctrl();
37  $this->lng = $DIC->language();
38  $this->lng->loadLanguageModule('meta');
39  $this->initForm();
40  $this->http = $DIC->http();
41  }
initForm()
Add all fields to the form.
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

Member Function Documentation

◆ addTranslationInputs()

ilOrgUnitTypeFormGUI::addTranslationInputs ( string  $a_lang_code)
private

Add a text and textarea input per language.

Definition at line 122 of file class.ilOrgUnitTypeFormGUI.php.

References ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), and ilTextAreaInputGUI\setValue().

Referenced by initForm().

122  : void
123  {
124  $a_lang_code = $a_lang_code ?? '';
125  $section = new ilFormSectionHeaderGUI();
126  $section->setTitle($this->lng->txt("meta_l_{$a_lang_code}"));
127  $this->addItem($section);
128  $item = new ilTextInputGUI($this->lng->txt('title'), "title_{$a_lang_code}");
129  $item->setValue($this->type->getTitle($a_lang_code));
130  $this->addItem($item);
131  $item = new ilTextAreaInputGUI($this->lng->txt('description'), "description_{$a_lang_code}");
132  $desc = $this->type->getDescription($a_lang_code) ?? '';
133  $item->setValue($desc);
134  $this->addItem($item);
135  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillObject()

ilOrgUnitTypeFormGUI::fillObject ( )
private

Check validity of form and pass values from form to object.

Definition at line 95 of file class.ilOrgUnitTypeFormGUI.php.

References ilPropertyFormGUI\$description, Vendor\Package\$e, ilPropertyFormGUI\$title, ilPropertyFormGUI\checkInput(), ilPropertyFormGUI\getInput(), ILIAS\Repository\lng(), and ilPropertyFormGUI\setValuesByPost().

Referenced by saveObject().

95  : bool
96  {
97  $this->setValuesByPost();
98  if (!$this->checkInput()) {
99  return false;
100  }
101 
102  $success = true;
103  try {
104  $this->type->setDefaultLang($this->getInput('default_lang'));
105  foreach ($this->lng->getInstalledLanguages() as $lang_code) {
106  $title = $this->getInput("title_{$lang_code}");
107  $description = $this->getInput("description_{$lang_code}");
108  $this->type->setTitle($title, $lang_code);
109  $this->type->setDescription($description, $lang_code);
110  }
111  } catch (ilOrgUnitTypePluginException $e) {
112  $this->global_tpl->setOnScreenMessage('failure', $e->getMessage());
113  $success = false;
114  }
115 
116  return $success;
117  }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
Class ilOrgUnitTypePluginException This exception is thrown whenever one or multiple ilOrgUnitTypeHoo...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilOrgUnitTypeFormGUI::initForm ( )
private

Add all fields to the form.

Definition at line 65 of file class.ilOrgUnitTypeFormGUI.php.

References ilPropertyFormGUI\$title, ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), addTranslationInputs(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilFormGUI\setFormAction(), and ilPropertyFormGUI\setTitle().

Referenced by __construct().

65  : void
66  {
67  $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
68  $title = $this->type->getId() ? $this->lng->txt('orgu_type_edit') : $this->lng->txt('orgu_type_add');
69  $this->setTitle($title);
70  $item = new ilSelectInputGUI($this->lng->txt('default_language'), 'default_lang');
71  $item->setValue($this->type->getDefaultLang());
72  $languages = $this->lng->getInstalledLanguages();
73  $options = array();
74  foreach ($languages as $lang_code) {
75  $options[$lang_code] = $this->lng->txt("meta_l_{$lang_code}");
76  }
77  $item->setOptions($options);
78  $item->setRequired(true);
79  $this->addItem($item);
80 
81  foreach ($languages as $lang_code) {
82  $this->addTranslationInputs($lang_code);
83  }
84 
85  if ($this->type->getId()) {
86  $this->addCommandButton('update', $this->lng->txt('save'));
87  } else {
88  $this->addCommandButton('create', $this->lng->txt('create'));
89  }
90  }
addTranslationInputs(string $a_lang_code)
Add a text and textarea input per language.
setFormAction(string $a_formaction)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveObject()

ilOrgUnitTypeFormGUI::saveObject ( )

Save object (create or update)

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

References Vendor\Package\$e, and fillObject().

46  : bool
47  {
48  if (!$this->fillObject()) {
49  return false;
50  }
51  try {
52  $this->type->save();
53 
54  return true;
55  } catch (ilException $e) {
56  $this->global_tpl->setOnScreenMessage('failure', $e->getMessage());
57 
58  return false;
59  }
60  }
fillObject()
Check validity of form and pass values from form to object.
+ Here is the call graph for this function:

Field Documentation

◆ $parent_gui

ilOrgUnitTypeGUI ilOrgUnitTypeFormGUI::$parent_gui
protected

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

Referenced by __construct().

◆ $type

ilOrgUnitType ilOrgUnitTypeFormGUI::$type
protected

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

Referenced by __construct().


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