ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilOrgUnitTypeFormGUI Class Reference

Class ilOrgUnitTypeFormGUI. More...

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

Public Member Functions

 __construct ($parent_gui, ilOrgUnitType $type)
 
 saveObject ()
 Save object (create or update) More...
 
- Public Member Functions inherited from ilPropertyFormGUI
 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 setTableWidth ($a_width)
 Set table width. More...
 
 getTableWidth ()
 get table width More...
 
 setMode ($a_mode)
 Set Mode ('std', 'subform'). More...
 
 getMode ()
 Get Mode ('std', 'subform'). More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setTitleIcon ($a_titleicon)
 Set TitleIcon. More...
 
 getTitleIcon ()
 Get TitleIcon. More...
 
 setDescription ($a_val)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setTopAnchor ($a_val)
 Set top anchor. More...
 
 getTopAnchor ()
 Get top anchor. More...
 
 setShowTopButtons ($a_val)
 Get show top buttons. More...
 
 getShowTopButtons ()
 Set show top buttons. More...
 
 setForceTopButtons ($a_val)
 Set force top buttons. More...
 
 getForceTopButtons ()
 Get force top buttons. More...
 
 addItem ($a_item)
 Add Item (Property, SectionHeader). More...
 
 removeItemByPostVar ($a_post_var, $a_remove_unused_headers=false)
 Remove Item. More...
 
 getItemByPostVar ($a_post_var)
 Get Item by POST variable. More...
 
 setItems ($a_items)
 Set Items. More...
 
 getItems ()
 Get Items. More...
 
 getInputItemsRecursive ()
 returns a flat array of all input items including the possibly existing subitems recursively More...
 
 setDisableStandardMessage ($a_val)
 Set disable standard message. More...
 
 getDisableStandardMessage ()
 Get disable standard message. More...
 
 getHideLabels ()
 Get a value indicating whether the labels should be hidden or not. More...
 
 setHideLabels ($a_value=true)
 Set a value indicating whether the labels should be hidden or not. More...
 
 setValuesByArray ($a_values, $a_restrict_to_value_keys=false)
 Set form values from an array. More...
 
 setValuesByPost ()
 Set form values from POST values. More...
 
 checkInput ()
 Check Post Input. More...
 
 getInput ($a_post_var, $ensureValidation=true)
 Returns the value of a HTTP-POST variable, identified by the passed id. More...
 
 addCustomProperty ( $a_title, $a_html, $a_info="", $a_alert="", $a_required=false)
 Add a custom property. More...
 
 addCommandButton ($a_cmd, $a_text, $a_id="")
 Add Command button. More...
 
 getCommandButtons ()
 Return all Command buttons. More...
 
 clearCommandButtons ()
 Remove all command buttons. More...
 
 getContent ()
 Get Content. More...
 
 insertItem ($item, $a_sub_item=false)
 
 getHTML ()
 
 getFileUpload ($a_field, $a_index=null, $a_sub_index=null)
 Get file upload data. More...
 
 hasFileUpload ($a_field, $a_index=null, $a_sub_index=null)
 Was any file uploaded? More...
 
 moveFileUpload ($a_target_directory, $a_field, $a_target_name=null, $a_index=null, $a_sub_index=null)
 Move upload to target directory. More...
 
- Public Member Functions inherited from ilFormGUI
 setFormAction ($a_formaction)
 Set FormAction. More...
 
 getFormAction ()
 Get FormAction. More...
 
 setTarget ($a_target)
 Set Target. More...
 
 getTarget ()
 Get Target. More...
 
 setMultipart ($a_multipart)
 Set Enctype Multipart/Formdata true/false. More...
 
 getMultipart ()
 Get Enctype Multipart/Formdata true/false. More...
 
 setId ($a_id)
 Set Id. More...
 
 getId ()
 Get Id. More...
 
 setName ($a_name)
 Set Name. More...
 
 getName ()
 Get Name. More...
 
 setKeepOpen ($a_keepopen)
 Set Keep Form Tag Open. More...
 
 getKeepOpen ()
 Get Keep Form Tag Open. More...
 
 setOpenTag ($a_open)
 Enable/Disable Open Form Tag. More...
 
 getOpenTag ()
 Get Open Form Tag Enabled. More...
 
 setCloseTag ($a_val)
 Set close tag. More...
 
 getCloseTag ()
 Get close tag. More...
 
 setPreventDoubleSubmission ($a_val)
 Set prevent double submission. More...
 
 getPreventDoubleSubmission ()
 Get prevent double submission. More...
 
 getHTML ()
 Get HTML. More...
 
 getContent ()
 Get Content. More...
 

Protected Member Functions

 initForm ()
 Add all fields to the form. More...
 
 fillObject ()
 Check validity of form and pass values from form to object. More...
 
 addTranslationInputs ($a_lang_code)
 Add a text and textarea input per language. More...
 
- Protected Member Functions inherited from ilPropertyFormGUI
 hideRequired ($a_type)
 
 rebuildUploadedFiles ()
 try to rebuild files More...
 

Protected Attributes

 $type
 
 $tpl
 
 $lng
 
 $ctrl
 
 $parent_gui
 
- Protected Attributes inherited from ilPropertyFormGUI
 $lng
 
 $ctrl
 
 $tpl
 
 $user
 
 $settings
 
 $mode = "std"
 
 $check_input_called = false
 
 $disable_standard_message = false
 
 $top_anchor = "il_form_top"
 
 $titleicon = false
 
 $description = ""
 
 $tbl_width = false
 
 $show_top_buttons = true
 
 $hide_labels = false
 
 $force_top_buttons = false
 
- Protected Attributes inherited from ilFormGUI
 $formaction
 
 $multipart = false
 
 $keepopen = false
 
 $opentag = true
 
 $id
 
 $name
 
 $prevent_double_submission = false
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, $ilCtrl, $lng, $parent_gui, $tpl, $type, and initForm().

34  {
35  global $DIC;
36  $tpl = $DIC['tpl'];
37  $ilCtrl = $DIC['ilCtrl'];
38  $lng = $DIC['lng'];
39  $this->parent_gui = $parent_gui;
40  $this->type = $type;
41  $this->tpl = $tpl;
42  $this->ctrl = $ilCtrl;
43  $this->lng = $lng;
44  $this->lng->loadLanguageModule('meta');
45  $this->initForm();
46  }
initForm()
Add all fields to the form.
global $ilCtrl
Definition: ilias.php:18
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ addTranslationInputs()

ilOrgUnitTypeFormGUI::addTranslationInputs (   $a_lang_code)
protected

Add a text and textarea input per language.

Parameters
$a_lang_code

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

References $section, ilPropertyFormGUI\addItem(), and ilTextAreaInputGUI\setValue().

Referenced by initForm().

138  {
140  $section->setTitle($this->lng->txt("meta_l_{$a_lang_code}"));
141  $this->addItem($section);
142  $item = new ilTextInputGUI($this->lng->txt('title'), "title_{$a_lang_code}");
143  $item->setValue($this->type->getTitle($a_lang_code));
144  $this->addItem($item);
145  $item = new ilTextAreaInputGUI($this->lng->txt('description'), "description_{$a_lang_code}");
146  $item->setValue($this->type->getDescription($a_lang_code));
147  $this->addItem($item);
148  }
This class represents a section header in a property form.
setValue($a_value)
Set Value.
addItem($a_item)
Add Item (Property, SectionHeader).
$section
Definition: Utf8Test.php:83
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 ( )
protected

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

Returns
bool

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

References ilPropertyFormGUI\$description, Vendor\Package\$e, $success, ilPropertyFormGUI\checkInput(), ilPropertyFormGUI\getInput(), ilUtil\sendFailure(), and ilPropertyFormGUI\setValuesByPost().

Referenced by saveObject().

108  {
109  $this->setValuesByPost();
110  if (!$this->checkInput()) {
111  return false;
112  }
113 
114  $success = true;
115  try {
116  $this->type->setDefaultLang($this->getInput('default_lang'));
117  foreach ($this->lng->getInstalledLanguages() as $lang_code) {
118  $title = $this->getInput("title_{$lang_code}");
119  $description = $this->getInput("description_{$lang_code}");
120  $this->type->setTitle($title, $lang_code);
121  $this->type->setDescription($description, $lang_code);
122  }
123  } catch (ilOrgUnitTypePluginException $e) {
124  ilUtil::sendFailure($e->getMessage());
125  $success = false;
126  }
127 
128  return $success;
129  }
$success
Definition: Utf8Test.php:86
checkInput()
Check Post Input.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
setValuesByPost()
Set form values from POST values.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
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 ( )
protected

Add all fields to the form.

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

References ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), addTranslationInputs(), ilFormGUI\setFormAction(), and ilPropertyFormGUI\setTitle().

Referenced by __construct().

75  {
76  $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
77  $title = $this->type->getId() ? $this->lng->txt('orgu_type_edit') : $this->lng->txt('orgu_type_add');
78  $this->setTitle($title);
79  $item = new ilSelectInputGUI($this->lng->txt('default_language'), 'default_lang');
80  $item->setValue($this->type->getDefaultLang());
81  $languages = $this->lng->getInstalledLanguages();
82  $options = array();
83  foreach ($languages as $lang_code) {
84  $options[$lang_code] = $this->lng->txt("meta_l_{$lang_code}");
85  }
86  $item->setOptions($options);
87  $item->setRequired(true);
88  $this->addItem($item);
89 
90  foreach ($languages as $lang_code) {
91  $this->addTranslationInputs($lang_code);
92  }
93 
94  if ($this->type->getId()) {
95  $this->addCommandButton('update', $this->lng->txt('save'));
96  } else {
97  $this->addCommandButton('create', $this->lng->txt('create'));
98  }
99  }
addTranslationInputs($a_lang_code)
Add a text and textarea input per language.
setFormAction($a_formaction)
Set FormAction.
addItem($a_item)
Add Item (Property, SectionHeader).
setTitle($a_title)
Set Title.
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveObject()

ilOrgUnitTypeFormGUI::saveObject ( )

Save object (create or update)

Returns
bool

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

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

55  {
56  if (!$this->fillObject()) {
57  return false;
58  }
59  try {
60  $this->type->save();
61 
62  return true;
63  } catch (ilException $e) {
64  ilUtil::sendFailure($e->getMessage());
65 
66  return false;
67  }
68  }
fillObject()
Check validity of form and pass values from form to object.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilOrgUnitTypeFormGUI::$ctrl
protected

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

◆ $lng

ilOrgUnitTypeFormGUI::$lng
protected

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

Referenced by __construct().

◆ $parent_gui

ilOrgUnitTypeFormGUI::$parent_gui
protected

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

Referenced by __construct().

◆ $tpl

ilOrgUnitTypeFormGUI::$tpl
protected

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

Referenced by __construct().

◆ $type

ilOrgUnitTypeFormGUI::$type
protected

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

Referenced by __construct().


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