ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilUnitConfigurationGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
5
11{
15 protected $unit_cat_form;
16
20 protected $unit_form;
21
25 protected $repository = null;
26
30 protected $tpl;
31
35 protected $lng;
36
40 protected $ctrl;
41
45 public function __construct(ilUnitConfigurationRepository $repository)
46 {
52 global $lng, $ilCtrl, $tpl;
53
54 $this->repository = $repository;
55 $this->lng = $lng;
56 $this->ctrl = $ilCtrl;
57 $this->tpl = $tpl;
58
59 $this->lng->loadLanguageModule('assessment');
60 }
61
66 abstract protected function getDefaultCommand();
67
72 abstract public function getUnitCategoryOverviewCommand();
73
78 abstract public function isCRUDContext();
79
84 abstract public function getUniqueId();
85
89 abstract protected function showUnitCategories(array $categories);
90
96 protected function getCategoryById($id, $for_CRUD = true)
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 }
106
110 protected function handleSubtabs()
111 {
112 }
113
117 protected function checkPermissions($cmd)
118 {
119 }
120
124 public function executeCommand()
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 }
140
144 protected function confirmDeleteUnit()
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 }
155
159 protected function confirmDeleteUnits()
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 }
242
246 public function deleteUnits()
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 }
319
323 protected function saveOrder()
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 }
348
352 protected function saveUnit()
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 }
388
392 protected function showUnitModificationForm()
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 }
412
416 protected function addUnit()
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 }
449
453 protected function showUnitCreationForm()
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 }
471
477 protected function initUnitForm(assFormulaQuestionUnitCategory $category = null, assFormulaQuestionUnit $unit = null)
478 {
479 if($this->unit_form instanceof ilPropertyFormGUI)
480 {
481 return $this->unit_form;
482 }
483
484 $unit_in_use = false;
485 if($unit instanceof assFormulaQuestionUnit && $this->repository->isUnitInUse($unit->getId()))
486 {
487 $unit_in_use = true;
488 }
489
490 $this->unit_form = new ilPropertyFormGUI();
491
492 $title = new ilTextInputGUI($this->lng->txt('unit'), 'unit_title');
493 $title->setDisabled($unit_in_use);
494 $title->setRequired(true);
495 $this->unit_form->addItem($title);
496
497 $baseunit = new ilSelectInputGUI($this->lng->txt('baseunit'), 'base_unit');
498 $items = $this->repository->getCategorizedUnits();
499 $options = array();
500 $category_name = '';
501 $new_category = false;
502 foreach((array)$items as $item)
503 {
504 if(
505 $unit instanceof assFormulaQuestionUnit &&
506 $unit->getId() == $item->getId()
507 )
508 {
509 continue;
510 }
511
515 if($item instanceof assFormulaQuestionUnitCategory)
516 {
517 if($category_name != $item->getDisplayString())
518 {
519 $new_category = true;
520 $category_name = $item->getDisplayString();
521 }
522 continue;
523 }
524 $options[$item->getId()] = $item->getDisplayString() . ($new_category ? ' (' . $category_name . ')' : '');
525 $new_category = false;
526 }
527 $baseunit->setDisabled($unit_in_use);
528 $baseunit->setOptions(array(0 => $this->lng->txt('no_selection')) + $options);
529 $this->unit_form->addItem($baseunit);
530
531 $factor = new ilNumberInputGUI($this->lng->txt('factor'), 'factor');
532 $factor->setRequired(true);
533 $factor->setSize(3);
534 $factor->setMinValue(0);
535 $factor->allowDecimals(true);
536 $factor->setDisabled($unit_in_use);
537 $this->unit_form->addItem($factor);
538
539 if(null === $unit)
540 {
541 $this->unit_form->setTitle($this->lng->txt('new_unit'));
542 $this->unit_form->setFormAction($this->ctrl->getFormAction($this, 'addUnit'));
543 $this->unit_form->addCommandButton('addUnit', $this->lng->txt('save'));
544 }
545 else
546 {
547 $this->ctrl->setParameter($this, 'unit_id', $unit->getId());
548 if($unit_in_use)
549 {
550 $this->unit_form->setFormAction($this->ctrl->getFormAction($this, 'showUnitsOfCategory'));
551 }
552 else
553 {
554 $this->unit_form->addCommandButton('saveUnit', $this->lng->txt('save'));
555 $this->unit_form->setFormAction($this->ctrl->getFormAction($this, 'saveUnit'));
556 }
557 $this->unit_form->setTitle(sprintf($this->lng->txt('un_sel_cat_sel_unit'), $category->getDisplayString(), $unit->getDisplayString()));
558 }
559
560 $this->unit_form->addCommandButton('showUnitsOfCategory', $this->lng->txt('cancel'));
561 return $this->unit_form;
562 }
563
567 protected function showUnitsOfCategory()
568 {
572 global $ilToolbar;
573
574 $category = $this->getCategoryById((int)$_GET['category_id'], false);
575
576 $this->tpl->addJavaScript("./Services/JavaScript/js/Basic.js");
577 $this->tpl->addJavaScript("./Services/Form/js/Form.js");
578 $this->lng->loadLanguageModule('form');
579
580 require_once 'Modules/TestQuestionPool/classes/tables/class.ilUnitTableGUI.php';
581 $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, $this->getUnitCategoryOverviewCommand()));
582 if($this->isCRUDContext())
583 {
584 $ilToolbar->addButton($this->lng->txt('un_add_unit'), $this->ctrl->getLinkTarget($this, 'showUnitCreationForm'));
585 }
586 $table = new ilUnitTableGUI($this, 'showUnitsOfCategory', $category);
587 $units = $this->repository->loadUnitsForCategory($category->getId());
588 $data = array();
589 foreach($units as $unit)
590 {
594 $data[] = array(
595 'unit_id' => $unit->getId(),
596 'unit' => $unit->getUnit(),
597 'baseunit' => $unit->getBaseunitTitle(),
598 'baseunit_id' => $unit->getBaseUnit(),
599 'factor' => $unit->getFactor(),
600 'sequence' => $unit->getSequence(),
601 );
602 }
603 $table->setData($data);
604
605 $this->tpl->setContent($table->getHTML());
606 }
607
611 protected function showGlobalUnitCategories()
612 {
613 $categories = array_filter(
614 $this->repository->getAllUnitCategories(),
615 function (assFormulaQuestionUnitCategory $category)
616 {
617 return !$category->getQuestionFi() ? true : false;
618 }
619 );
620 $data = array();
621 foreach($categories as $category)
622 {
626 $data[] = array(
627 'category_id' => $category->getId(),
628 'category' => $category->getDisplayString()
629 );
630 }
631
632 $this->showUnitCategories($data);
633 }
634
638 protected function confirmDeleteCategory()
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 }
649
653 protected function confirmDeleteCategories()
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 }
739
743 protected function deleteCategories()
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 }
818
823 protected function initUnitCategoryForm(assFormulaQuestionUnitCategory $cat = null)
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 }
853
857 protected function addCategory()
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 }
890
894 protected function showUnitCategoryCreationForm()
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 }
906
910 protected function saveCategory()
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 }
943
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 }
964}
$_GET["client_id"]
Confirmation screen class.
Base class for ILIAS Exception handling.
This class represents a number property in a property form.
This class represents a property form user interface.
This class represents a selection list property in a property form.
This class represents a text property in a property form.
Class ilUnitConfigurationGUI @abstract.
showUnitCategories(array $categories)
initUnitCategoryForm(assFormulaQuestionUnitCategory $cat=null)
Class ilUnitConfigurationRepository.
Class ilUnitTableGUI.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST['username']
Definition: cron.php:12
$data
global $ilCtrl
Definition: ilias.php:18
$cmd
Definition: sahs_server.php:35
$errors
if(!is_array($argv)) $options