ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilUnitConfigurationGUI Class Reference

Class ilUnitConfigurationGUI @abstract. More...

+ Inheritance diagram for ilUnitConfigurationGUI:
+ Collaboration diagram for ilUnitConfigurationGUI:

Public Member Functions

 getUnitCategoryOverviewCommand ()
 
 isCRUDContext ()
 
 getUniqueId ()
 
 executeCommand ()
 
 deleteUnits ()
 

Protected Member Functions

 getDefaultCommand ()
 
 showUnitCategories (array $categories)
 
 getCategoryById ($id, $for_CRUD=true)
 
 handleSubtabs ()
 
 checkPermissions ($cmd)
 
 confirmDeleteUnit ()
 
 confirmDeleteUnits ()
 
 saveOrder ()
 
 saveUnit ()
 Save a unit. More...
 
 showUnitModificationForm ()
 
 addUnit ()
 Adds a new unit. More...
 
 showUnitCreationForm ()
 
 confirmDeleteCategory ()
 
 confirmDeleteCategories ()
 
 deleteCategories ()
 
 initUnitCategoryForm (assFormulaQuestionUnitCategory $cat=null)
 
 addCategory ()
 
 showUnitCategoryCreationForm ()
 
 saveCategory ()
 
 showUnitCategoryModificationForm ()
 

Protected Attributes

 $unit_cat_form
 
 $unit_form
 
 $repository = null
 
 $tpl
 
 $lng
 
 $ctrl
 

Detailed Description

Class ilUnitConfigurationGUI @abstract.

Definition at line 10 of file class.ilUnitConfigurationGUI.php.

Member Function Documentation

◆ addCategory()

ilUnitConfigurationGUI::addCategory ( )
protected

Definition at line 857 of file class.ilUnitConfigurationGUI.php.

858 {
859 if(!$this->isCRUDContext())
860 {
861 $this->{$this->getDefaultCommand()}();
862 return;
863 }
864
865 $this->initUnitCategoryForm();
866 if($this->unit_cat_form->checkInput())
867 {
868 try
869 {
870 $category = new assFormulaQuestionUnitCategory();
871 $category->setCategory($this->unit_cat_form->getInput('category_name'));
872 $this->repository->saveNewUnitCategory($category);
873 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
874
875 $this->{$this->getUnitCategoryOverviewCommand()}();
876 return;
877 }
878 catch(ilException $e)
879 {
880 $this->unit_cat_form->getItemByPostVar('category_name')->setAlert($this->lng->txt($e->getMessage()));
881 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
882 }
883
884 }
885
886 $this->unit_cat_form->setValuesByPost();
887
888 $this->tpl->setContent($this->unit_cat_form->getHtml());
889 }
Base class for ILIAS Exception handling.
initUnitCategoryForm(assFormulaQuestionUnitCategory $cat=null)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References getDefaultCommand(), getUnitCategoryOverviewCommand(), initUnitCategoryForm(), isCRUDContext(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and assFormulaQuestionUnitCategory\setCategory().

+ Here is the call graph for this function:

◆ addUnit()

ilUnitConfigurationGUI::addUnit ( )
protected

Adds a new unit.

Definition at line 416 of file class.ilUnitConfigurationGUI.php.

417 {
418 if(!$this->isCRUDContext())
419 {
420 $this->showUnitsOfCategory();
421 return;
422 }
423
424 $category = $this->getCategoryById((int)$_GET['category_id']);
425
426 $this->initUnitForm($category);
427 if($this->unit_form->checkInput())
428 {
429 $unit = new assFormulaQuestionUnit();
430 $unit->setUnit($this->unit_form->getInput('unit_title'));
431 $unit->setCategory($category->getId());
432
433 $this->repository->createNewUnit($unit);
434
435 $unit->setBaseUnit((int)$this->unit_form->getInput('base_unit'));
436 $unit->setFactor((float)$this->unit_form->getInput('factor'));
437
438 $this->repository->saveUnit($unit);
439
440 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
441 $this->showUnitsOfCategory();
442 return;
443 }
444
445 $this->unit_form->setValuesByPost();
446
447 $this->tpl->setContent($this->unit_form->getHtml());
448 }
$_GET["client_id"]

References $_GET, getCategoryById(), isCRUDContext(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ checkPermissions()

ilUnitConfigurationGUI::checkPermissions (   $cmd)
protected
Parameters
string$cmd

Definition at line 117 of file class.ilUnitConfigurationGUI.php.

118 {
119 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ confirmDeleteCategories()

ilUnitConfigurationGUI::confirmDeleteCategories ( )
protected

Definition at line 653 of file class.ilUnitConfigurationGUI.php.

654 {
655 if(!$this->isCRUDContext())
656 {
657 $this->{$this->getDefaultCommand()}();
658 return;
659 }
660
661 if(!isset($_POST['category_ids']) || !is_array($_POST['category_ids']))
662 {
663 $this->{$this->getUnitCategoryOverviewCommand()}();
664 return;
665 }
666
667 require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
668 $confirmation = new ilConfirmationGUI();
669 $confirmation->setFormAction($this->ctrl->getFormAction($this, 'deleteCategories'));
670 $confirmation->setConfirm($this->lng->txt('confirm'), 'deleteCategories');
671 $confirmation->setCancel($this->lng->txt('cancel'), $this->getUnitCategoryOverviewCommand());
672
673 $errors = array();
674 $num_to_confirm = 0;
675 foreach($_POST['category_ids'] as $category_id)
676 {
677 try
678 {
679 $category = $this->repository->getUnitCategoryById((int)$category_id);
680 }
681 catch(ilException $e)
682 {
683 continue;
684 }
685
686 if(!$this->repository->isCRUDAllowed((int)$category_id))
687 {
688 $errors[] = $category->getDisplayString() . ' - ' . $this->lng->txt('change_adm_categories_not_allowed');
689 continue;
690 }
691
692 $possible_error = $this->repository->checkDeleteCategory($category_id);
693 if(strlen($possible_error))
694 {
695 $errors[] = $category->getDisplayString() . ' - ' . $possible_error;
696 continue;
697 }
698
699 $confirmation->addItem('category_ids[]', $category->getId(), $category->getDisplayString());
700 ++$num_to_confirm;
701 }
702
703 if($errors)
704 {
705 $num_errors = count($errors);
706
707 $error_message = array_map(function ($message)
708 {
709 return '<li>' . $message . '</li>';
710 }, $errors);
711 if($num_errors == 1)
712 {
713 ilUtil::sendFailure($this->lng->txt('un_cat_deletion_errors_f_s') . '<ul>' . implode('', $error_message) . '<ul>');
714 }
715 else
716 {
717 ilUtil::sendFailure($this->lng->txt('un_cat_deletion_errors_f') . '<ul>' . implode('', $error_message) . '<ul>');
718 }
719 }
720
721 if($num_to_confirm)
722 {
723 if($num_to_confirm == 1)
724 {
725 $confirmation->setHeaderText($this->lng->txt('un_sure_delete_categories_s'));
726 }
727 else
728 {
729 $confirmation->setHeaderText($this->lng->txt('un_sure_delete_categories'));
730 }
731
732 $this->tpl->setContent($confirmation->getHTML());
733 }
734 else
735 {
736 $this->{$this->getUnitCategoryOverviewCommand()}();
737 }
738 }
Confirmation screen class.
$_POST['username']
Definition: cron.php:12
$errors

References $_POST, $errors, getDefaultCommand(), assFormulaQuestionUnitCategory\getId(), getUnitCategoryOverviewCommand(), isCRUDContext(), and ilUtil\sendFailure().

Referenced by confirmDeleteCategory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteCategory()

ilUnitConfigurationGUI::confirmDeleteCategory ( )
protected

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

639 {
640 if(!isset($_GET['category_id']))
641 {
642 $this->{$this->getUnitCategoryOverviewCommand()}();
643 return;
644 }
645 $_POST['category_ids'] = array($_GET['category_id']);
646
648 }

References $_GET, $_POST, confirmDeleteCategories(), and getUnitCategoryOverviewCommand().

+ Here is the call graph for this function:

◆ confirmDeleteUnit()

ilUnitConfigurationGUI::confirmDeleteUnit ( )
protected

Definition at line 144 of file class.ilUnitConfigurationGUI.php.

145 {
146 if(!isset($_GET['unit_id']))
147 {
148 $this->showUnitsOfCategory();
149 return;
150 }
151
152 $_POST['unit_ids'] = array($_GET['unit_id']);
153 $this->confirmDeleteUnits();
154 }

References $_GET, $_POST, and confirmDeleteUnits().

+ Here is the call graph for this function:

◆ confirmDeleteUnits()

ilUnitConfigurationGUI::confirmDeleteUnits ( )
protected

Definition at line 159 of file class.ilUnitConfigurationGUI.php.

160 {
161 if(!$this->isCRUDContext())
162 {
163 $this->showUnitsOfCategory();
164 return;
165 }
166
167 if(!isset($_POST['unit_ids']) || !is_array($_POST['unit_ids']))
168 {
169 $this->showUnitsOfCategory();
170 return;
171 }
172
173 require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
174 $confirmation = new ilConfirmationGUI();
175 $confirmation->setFormAction($this->ctrl->getFormAction($this, 'deleteUnits'));
176 $confirmation->setConfirm($this->lng->txt('confirm'), 'deleteUnits');
177 $confirmation->setCancel($this->lng->txt('cancel'), 'showUnitsOfCategory');
178
179 $errors = array();
180 $num_to_confirm = 0;
181 foreach($_POST['unit_ids'] as $unit_id)
182 {
183 try
184 {
185 $unit = $this->repository->getUnit((int)$unit_id);
186 if(!$unit)
187 {
188 continue;
189 }
190
191 if($check_result = $this->repository->checkDeleteUnit($unit->getId()))
192 {
193 $errors[] = $unit->getDisplayString() . ' - ' . $check_result;
194 continue;
195 }
196
197 $confirmation->addItem('unit_ids[]', $unit->getId(), $unit->getDisplayString());
198 ++$num_to_confirm;
199 }
200 catch(ilException $e)
201 {
202 continue;
203 }
204 }
205
206 if($errors)
207 {
208 $num_errors = count($errors);
209
210 $error_message = array_map(function ($message)
211 {
212 return '<li>' . $message . '</li>';
213 }, $errors);
214 if($num_errors == 1)
215 {
216 ilUtil::sendFailure($this->lng->txt('un_unit_deletion_errors_f_s') . '<ul>' . implode('', $error_message) . '<ul>');
217 }
218 else
219 {
220 ilUtil::sendFailure($this->lng->txt('un_unit_deletion_errors_f') . '<ul>' . implode('', $error_message) . '<ul>');
221 }
222 }
223
224 if($num_to_confirm)
225 {
226 if($num_to_confirm == 1)
227 {
228 $confirmation->setHeaderText($this->lng->txt('un_sure_delete_units_s'));
229 }
230 else
231 {
232 $confirmation->setHeaderText($this->lng->txt('un_sure_delete_units'));
233 }
234
235 $this->tpl->setContent($confirmation->getHTML());
236 }
237 else
238 {
239 $this->showUnitsOfCategory();
240 }
241 }

References $_POST, $errors, isCRUDContext(), and ilUtil\sendFailure().

Referenced by confirmDeleteUnit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteCategories()

ilUnitConfigurationGUI::deleteCategories ( )
protected

Definition at line 743 of file class.ilUnitConfigurationGUI.php.

744 {
745 if(!$this->isCRUDContext())
746 {
747 $this->{$this->getDefaultCommand()}();
748 return;
749 }
750
751 if(!is_array($_POST['category_ids']) || !$_POST['category_ids'])
752 {
753 $this->{$this->getUnitCategoryOverviewCommand()}();
754 return;
755 }
756
757 $errors = array();
758 $num_deleted = 0;
759 foreach($_POST['category_ids'] as $category_id)
760 {
761 try
762 {
763 $category = $this->repository->getUnitCategoryById((int)$category_id);
764 }
765 catch(ilException $e)
766 {
767 continue;
768 }
769
770 if(!$this->repository->isCRUDAllowed((int)$category_id))
771 {
772 $errors[] = $category->getDisplayString() . ' - ' . $this->lng->txt('change_adm_categories_not_allowed');
773 continue;
774 }
775
776 $possible_error = $this->repository->deleteCategory($category_id);
777 if(strlen($possible_error))
778 {
779 $errors[] = $category->getDisplayString() . ' - ' . $possible_error;
780 continue;
781 }
782
783 ++$num_deleted;
784 }
785
786 if($errors)
787 {
788 $num_errors = count($errors);
789
790 $error_message = array_map(function ($message)
791 {
792 return '<li>' . $message . '</li>';
793 }, $errors);
794 if($num_errors == 1)
795 {
796 ilUtil::sendFailure($this->lng->txt('un_cat_deletion_errors_p_s') . '<ul>' . implode('', $error_message) . '<ul>');
797 }
798 else
799 {
800 ilUtil::sendFailure($this->lng->txt('un_cat_deletion_errors_p') . '<ul>' . implode('', $error_message) . '<ul>');
801 }
802 }
803
804 if($num_deleted)
805 {
806 if($num_deleted == 1)
807 {
808 ilUtil::sendSuccess($this->lng->txt('un_deleted_categories_s'));
809 }
810 else
811 {
812 ilUtil::sendSuccess($this->lng->txt('un_deleted_categories'));
813 }
814 }
815
816 $this->{$this->getUnitCategoryOverviewCommand()}();
817 }

References $_POST, $errors, getDefaultCommand(), getUnitCategoryOverviewCommand(), isCRUDContext(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ deleteUnits()

ilUnitConfigurationGUI::deleteUnits ( )

Definition at line 246 of file class.ilUnitConfigurationGUI.php.

247 {
248 if(!$this->isCRUDContext())
249 {
250 $this->showUnitsOfCategory();
251 return;
252 }
253
254 if(!is_array($_POST['unit_ids']) || !$_POST['unit_ids'])
255 {
256 $this->showUnitsOfCategory();
257 return;
258 }
259
260 $errors = array();
261 $num_deleted = 0;
262 foreach($_POST['unit_ids'] as $unit_id)
263 {
264 try
265 {
266 $unit = $this->repository->getUnit((int)$unit_id);
267 if(!$unit)
268 {
269 continue;
270 }
271
272 $check_result = $this->repository->deleteUnit($unit->getId());
273 if(!is_null($check_result))
274 {
275 $errors[] = $unit->getDisplayString() . ' - ' . $check_result;
276 continue;
277 }
278
279 ++$num_deleted;
280 }
281 catch(ilException $e)
282 {
283 continue;
284 }
285 }
286
287 if($errors)
288 {
289 $num_errors = count($errors);
290
291 $error_message = array_map(function ($message)
292 {
293 return '<li>' . $message . '</li>';
294 }, $errors);
295 if($num_errors == 1)
296 {
297 ilUtil::sendFailure($this->lng->txt('un_unit_deletion_errors_p_s') . '<ul>' . implode('', $error_message) . '<ul>');
298 }
299 else
300 {
301 ilUtil::sendFailure($this->lng->txt('un_unit_deletion_errors_p') . '<ul>' . implode('', $error_message) . '<ul>');
302 }
303 }
304
305 if($num_deleted)
306 {
307 if($num_deleted == 1)
308 {
309 ilUtil::sendSuccess($this->lng->txt('un_deleted_units_s'));
310 }
311 else
312 {
313 ilUtil::sendSuccess($this->lng->txt('un_deleted_units'));
314 }
315 }
316
317 $this->showUnitsOfCategory();
318 }

References $_POST, $errors, isCRUDContext(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ executeCommand()

ilUnitConfigurationGUI::executeCommand ( )

Reimplemented in ilLocalUnitConfigurationGUI.

Definition at line 124 of file class.ilUnitConfigurationGUI.php.

125 {
126 $this->ctrl->saveParameter($this, 'category_id');
127
128 $cmd = $this->ctrl->getCmd($this->getDefaultCommand());
129 $nextClass = $this->ctrl->getNextClass($this);
130 switch($nextClass)
131 {
132 default:
133 $this->checkPermissions($cmd);
134 $this->$cmd();
135 break;
136 }
137
138 $this->handleSubtabs();
139 }
$cmd
Definition: sahs_server.php:35

References $cmd, checkPermissions(), getDefaultCommand(), and handleSubtabs().

+ Here is the call graph for this function:

◆ getCategoryById()

ilUnitConfigurationGUI::getCategoryById (   $id,
  $for_CRUD = true 
)
protected
Parameters
int$id
bool$for_CRUD
Returns
assFormulaQuestionUnitCategory

Definition at line 96 of file class.ilUnitConfigurationGUI.php.

97 {
98 $category = $this->repository->getUnitCategoryById($id);
99 if($for_CRUD && $category->getQuestionFi() != $this->repository->getConsumerId())
100 {
101 ilUtil::sendFailure($this->lng->txt('change_adm_categories_not_allowed'), true);
102 $this->ctrl->redirect($this, $this->getDefaultCommand());
103 }
104 return $category;
105 }

References getDefaultCommand(), and ilUtil\sendFailure().

Referenced by addUnit(), saveCategory(), saveUnit(), showUnitCategoryModificationForm(), showUnitCreationForm(), and showUnitModificationForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultCommand()

ilUnitConfigurationGUI::getDefaultCommand ( )
abstractprotected

◆ getUniqueId()

ilUnitConfigurationGUI::getUniqueId ( )
abstract
Returns
string @abstract

Reimplemented in ilGlobalUnitConfigurationGUI, and ilLocalUnitConfigurationGUI.

◆ getUnitCategoryOverviewCommand()

ilUnitConfigurationGUI::getUnitCategoryOverviewCommand ( )
abstract
Returns
string @abstract

Reimplemented in ilGlobalUnitConfigurationGUI, and ilLocalUnitConfigurationGUI.

Referenced by addCategory(), confirmDeleteCategories(), confirmDeleteCategory(), deleteCategories(), initUnitCategoryForm(), and saveCategory().

+ Here is the caller graph for this function:

◆ handleSubtabs()

ilUnitConfigurationGUI::handleSubtabs ( )
protected

Definition at line 110 of file class.ilUnitConfigurationGUI.php.

111 {
112 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ initUnitCategoryForm()

ilUnitConfigurationGUI::initUnitCategoryForm ( assFormulaQuestionUnitCategory  $cat = null)
protected
Parameters
assFormulaQuestionUnitCategory$cat
Returns
ilPropertyFormGUI

Definition at line 823 of file class.ilUnitConfigurationGUI.php.

824 {
825 if($this->unit_cat_form instanceof ilPropertyFormGUI)
826 {
828 }
829
830 $this->unit_cat_form = new ilPropertyFormGUI();
831
832 $title = new ilTextInputGUI($this->lng->txt('title'), 'category_name');
833 $title->setRequired(true);
834 $this->unit_cat_form->addItem($title);
835
836 if(null === $cat)
837 {
838 $this->unit_cat_form->setTitle($this->lng->txt('new_category'));
839 $this->unit_cat_form->setFormAction($this->ctrl->getFormAction($this, 'addCategory'));
840 $this->unit_cat_form->addCommandButton('addCategory', $this->lng->txt('save'));
841 }
842 else
843 {
844 $this->ctrl->setParameter($this, 'category_id', $cat->getId());
845 $this->unit_cat_form->addCommandButton('saveCategory', $this->lng->txt('save'));
846 $this->unit_cat_form->setFormAction($this->ctrl->getFormAction($this, 'saveCategory'));
847 $this->unit_cat_form->setTitle(sprintf($this->lng->txt('selected_category'), $cat->getDisplayString()));
848 }
849
850 $this->unit_cat_form->addCommandButton($this->getUnitCategoryOverviewCommand(), $this->lng->txt('cancel'));
852 }
This class represents a property form user interface.
This class represents a text property in a property form.

References $unit_cat_form, and getUnitCategoryOverviewCommand().

Referenced by addCategory(), saveCategory(), showUnitCategoryCreationForm(), and showUnitCategoryModificationForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isCRUDContext()

◆ saveCategory()

ilUnitConfigurationGUI::saveCategory ( )
protected

Definition at line 910 of file class.ilUnitConfigurationGUI.php.

911 {
912 if(!$this->isCRUDContext())
913 {
914 $this->{$this->getDefaultCommand()}();
915 return;
916 }
917
918 $category = $this->getCategoryById((int)$_GET['category_id']);
919
920 $this->initUnitCategoryForm($category);
921 if($this->unit_cat_form->checkInput())
922 {
923 try
924 {
925 $category->setCategory($this->unit_cat_form->getInput('category_name'));
926 $this->repository->saveCategory($category);
927 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
928
929 $this->{$this->getUnitCategoryOverviewCommand()}();
930 return;
931 }
932 catch(ilException $e)
933 {
934 $this->unit_cat_form->getItemByPostVar('category_name')->setAlert($this->lng->txt($e->getMessage()));
935 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
936 }
937 }
938
939 $this->unit_cat_form->setValuesByPost();
940
941 $this->tpl->setContent($this->unit_cat_form->getHtml());
942 }

References $_GET, getCategoryById(), getDefaultCommand(), getUnitCategoryOverviewCommand(), initUnitCategoryForm(), isCRUDContext(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and assFormulaQuestionUnitCategory\setCategory().

+ Here is the call graph for this function:

◆ saveOrder()

ilUnitConfigurationGUI::saveOrder ( )
protected

Definition at line 323 of file class.ilUnitConfigurationGUI.php.

324 {
325 if(!$this->isCRUDContext())
326 {
327 $this->showUnitsOfCategory();
328 return;
329 }
330
331 if(!isset($_POST['sequence']) || !is_array($_POST['sequence']))
332 {
333 $this->showUnitsOfCategory();
334 return;
335 }
336
337 foreach($_POST['sequence'] as $id => $sequence)
338 {
339 $sorting_value = str_replace(',', '.', $sequence);
340 $sorting_value = (int)$sorting_value * 100;
341 $this->repository->saveUnitOrder((int)$id, $sorting_value);
342 }
343
344 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
345 $this->showUnitsOfCategory();
346 return;
347 }

References $_POST, isCRUDContext(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ saveUnit()

ilUnitConfigurationGUI::saveUnit ( )
protected

Save a unit.

Definition at line 352 of file class.ilUnitConfigurationGUI.php.

353 {
354 if(!$this->isCRUDContext())
355 {
356 $this->showUnitsOfCategory();
357 return;
358 }
359
360 $category = $this->getCategoryById((int)$_GET['category_id']);
361 $unit = $this->repository->getUnit((int)$_GET['unit_id']);
362
363 if($this->repository->isUnitInUse($unit->getId()))
364 {
366 return;
367 }
368
369 $this->initUnitForm($category, $unit);
370 if($this->unit_form->checkInput())
371 {
372 $unit->setUnit($this->unit_form->getInput('unit_title'));
373 $unit->setFactor((float)$this->unit_form->getInput('factor'));
374 $unit->setBaseUnit((int)$this->unit_form->getInput('base_unit') != $unit->getId() ? (int)$this->unit_form->getInput('base_unit') : 0);
375 $unit->setCategory($category->getId());
376 $this->repository->saveUnit($unit);
377 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
378 $this->showUnitsOfCategory();
379 return;
380 }
381 else
382 {
383 $this->unit_form->setValuesByPost();
384 }
385
386 $this->tpl->setContent($this->unit_form->getHtml());
387 }

References $_GET, getCategoryById(), isCRUDContext(), ilUtil\sendSuccess(), and showUnitModificationForm().

+ Here is the call graph for this function:

◆ showUnitCategories()

ilUnitConfigurationGUI::showUnitCategories ( array  $categories)
abstractprotected
Parameters
array$categories

Reimplemented in ilGlobalUnitConfigurationGUI, and ilLocalUnitConfigurationGUI.

◆ showUnitCategoryCreationForm()

ilUnitConfigurationGUI::showUnitCategoryCreationForm ( )
protected

Definition at line 894 of file class.ilUnitConfigurationGUI.php.

895 {
896 if(!$this->isCRUDContext())
897 {
898 $this->{$this->getDefaultCommand()}();
899 return;
900 }
901
902 $this->initUnitCategoryForm();
903
904 $this->tpl->setContent($this->unit_cat_form->getHtml());
905 }

References getDefaultCommand(), initUnitCategoryForm(), and isCRUDContext().

+ Here is the call graph for this function:

◆ showUnitCategoryModificationForm()

ilUnitConfigurationGUI::showUnitCategoryModificationForm ( )
protected

Definition at line 947 of file class.ilUnitConfigurationGUI.php.

948 {
949 if(!$this->isCRUDContext())
950 {
951 $this->{$this->getDefaultCommand()}();
952 return;
953 }
954
955 $category = $this->getCategoryById((int)$_GET['category_id']);
956
957 $this->initUnitCategoryForm($category);
958 $this->unit_cat_form->setValuesByArray(array(
959 'category_name' => $category->getCategory()
960 ));
961
962 $this->tpl->setContent($this->unit_cat_form->getHtml());
963 }

References $_GET, assFormulaQuestionUnitCategory\getCategory(), getCategoryById(), getDefaultCommand(), initUnitCategoryForm(), and isCRUDContext().

+ Here is the call graph for this function:

◆ showUnitCreationForm()

ilUnitConfigurationGUI::showUnitCreationForm ( )
protected

Definition at line 453 of file class.ilUnitConfigurationGUI.php.

454 {
455 if(!$this->isCRUDContext())
456 {
457 $this->showUnitsOfCategory();
458 return;
459 }
460
461 $category = $this->getCategoryById((int)$_GET['category_id']);
462
463 $this->initUnitForm($category);
464 $this->unit_form->setValuesByArray(array(
465 'factor' => 1,
466 'unit_title' => $this->lng->txt('unit_placeholder')
467 ));
468
469 $this->tpl->setContent($this->unit_form->getHtml());
470 }

References $_GET, getCategoryById(), and isCRUDContext().

+ Here is the call graph for this function:

◆ showUnitModificationForm()

ilUnitConfigurationGUI::showUnitModificationForm ( )
protected

Definition at line 392 of file class.ilUnitConfigurationGUI.php.

393 {
394 if(!$this->isCRUDContext())
395 {
396 $this->showUnitsOfCategory();
397 return;
398 }
399
400 $category = $this->getCategoryById((int)$_GET['category_id']);
401 $unit = $this->repository->getUnit((int)$_GET['unit_id']);
402
403 $this->initUnitForm($category, $unit);
404 $this->unit_form->setValuesByArray(array(
405 'factor' => $unit->getFactor(),
406 'unit_title' => $unit->getUnit(),
407 'base_unit' => ($unit->getBaseUnit() != $unit->getId() ? $unit->getBaseUnit() : 0)
408 ));
409
410 $this->tpl->setContent($this->unit_form->getHtml());
411 }

References $_GET, getCategoryById(), and isCRUDContext().

Referenced by saveUnit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilUnitConfigurationGUI::$ctrl
protected

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

◆ $lng

ilUnitConfigurationGUI::$lng
protected

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

◆ $repository

ilUnitConfigurationGUI::$repository = null
protected

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

◆ $tpl

ilUnitConfigurationGUI::$tpl
protected

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

◆ $unit_cat_form

ilUnitConfigurationGUI::$unit_cat_form
protected

Definition at line 15 of file class.ilUnitConfigurationGUI.php.

Referenced by initUnitCategoryForm().

◆ $unit_form

ilUnitConfigurationGUI::$unit_form
protected

Definition at line 20 of file class.ilUnitConfigurationGUI.php.


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