ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 749 of file class.ilUnitConfigurationGUI.php.

750 {
751 if (!$this->isCRUDContext()) {
752 $this->{$this->getDefaultCommand()}();
753 return;
754 }
755
756 $this->initUnitCategoryForm();
757 if ($this->unit_cat_form->checkInput()) {
758 try {
759 $category = new assFormulaQuestionUnitCategory();
760 $category->setCategory($this->unit_cat_form->getInput('category_name'));
761 $this->repository->saveNewUnitCategory($category);
762 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
763
764 $this->{$this->getUnitCategoryOverviewCommand()}();
765 return;
766 } catch (ilException $e) {
767 $this->unit_cat_form->getItemByPostVar('category_name')->setAlert($this->lng->txt($e->getMessage()));
768 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
769 }
770 }
771
772 $this->unit_cat_form->setValuesByPost();
773
774 $this->tpl->setContent($this->unit_cat_form->getHtml());
775 }
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 368 of file class.ilUnitConfigurationGUI.php.

369 {
370 if (!$this->isCRUDContext()) {
371 $this->showUnitsOfCategory();
372 return;
373 }
374
375 $category = $this->getCategoryById((int) $_GET['category_id']);
376
377 $this->initUnitForm($category);
378 if ($this->unit_form->checkInput()) {
379 $unit = new assFormulaQuestionUnit();
380 $unit->setUnit($this->unit_form->getInput('unit_title'));
381 $unit->setCategory($category->getId());
382
383 $this->repository->createNewUnit($unit);
384
385 $unit->setBaseUnit((int) $this->unit_form->getInput('base_unit'));
386 $unit->setFactor((float) $this->unit_form->getInput('factor'));
387
388 $this->repository->saveUnit($unit);
389
390 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
391 $this->showUnitsOfCategory();
392 return;
393 }
394
395 $this->unit_form->setValuesByPost();
396
397 $this->tpl->setContent($this->unit_form->getHtml());
398 }
$_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 116 of file class.ilUnitConfigurationGUI.php.

117 {
118 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ confirmDeleteCategories()

ilUnitConfigurationGUI::confirmDeleteCategories ( )
protected

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

586 {
587 if (!$this->isCRUDContext()) {
588 $this->{$this->getDefaultCommand()}();
589 return;
590 }
591
592 if (!isset($_POST['category_ids']) || !is_array($_POST['category_ids'])) {
593 $this->{$this->getUnitCategoryOverviewCommand()}();
594 return;
595 }
596
597 require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
598 $confirmation = new ilConfirmationGUI();
599 $confirmation->setFormAction($this->ctrl->getFormAction($this, 'deleteCategories'));
600 $confirmation->setConfirm($this->lng->txt('confirm'), 'deleteCategories');
601 $confirmation->setCancel($this->lng->txt('cancel'), $this->getUnitCategoryOverviewCommand());
602
603 $errors = array();
604 $num_to_confirm = 0;
605 foreach ($_POST['category_ids'] as $category_id) {
606 try {
607 $category = $this->repository->getUnitCategoryById((int) $category_id);
608 } catch (ilException $e) {
609 continue;
610 }
611
612 if (!$this->repository->isCRUDAllowed((int) $category_id)) {
613 $errors[] = $category->getDisplayString() . ' - ' . $this->lng->txt('change_adm_categories_not_allowed');
614 continue;
615 }
616
617 $possible_error = $this->repository->checkDeleteCategory($category_id);
618 if (strlen($possible_error)) {
619 $errors[] = $category->getDisplayString() . ' - ' . $possible_error;
620 continue;
621 }
622
623 $confirmation->addItem('category_ids[]', $category->getId(), $category->getDisplayString());
624 ++$num_to_confirm;
625 }
626
627 if ($errors) {
628 $num_errors = count($errors);
629
630 $error_message = array_map(function ($message) {
631 return '<li>' . $message . '</li>';
632 }, $errors);
633 if ($num_errors == 1) {
634 ilUtil::sendFailure($this->lng->txt('un_cat_deletion_errors_f_s') . '<ul>' . implode('', $error_message) . '<ul>');
635 } else {
636 ilUtil::sendFailure($this->lng->txt('un_cat_deletion_errors_f') . '<ul>' . implode('', $error_message) . '<ul>');
637 }
638 }
639
640 if ($num_to_confirm) {
641 if ($num_to_confirm == 1) {
642 $confirmation->setHeaderText($this->lng->txt('un_sure_delete_categories_s'));
643 } else {
644 $confirmation->setHeaderText($this->lng->txt('un_sure_delete_categories'));
645 }
646
647 $this->tpl->setContent($confirmation->getHTML());
648 } else {
649 $this->{$this->getUnitCategoryOverviewCommand()}();
650 }
651 }
$_POST["username"]
Confirmation screen class.
catch(Exception $e) $message
$errors
Definition: index.php:6

References $_POST, $errors, $message, 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 571 of file class.ilUnitConfigurationGUI.php.

572 {
573 if (!isset($_GET['category_id'])) {
574 $this->{$this->getUnitCategoryOverviewCommand()}();
575 return;
576 }
577 $_POST['category_ids'] = array($_GET['category_id']);
578
580 }

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

+ Here is the call graph for this function:

◆ confirmDeleteUnit()

ilUnitConfigurationGUI::confirmDeleteUnit ( )
protected

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

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

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

+ Here is the call graph for this function:

◆ confirmDeleteUnits()

ilUnitConfigurationGUI::confirmDeleteUnits ( )
protected

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

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

References $_POST, $errors, $message, 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 656 of file class.ilUnitConfigurationGUI.php.

657 {
658 if (!$this->isCRUDContext()) {
659 $this->{$this->getDefaultCommand()}();
660 return;
661 }
662
663 if (!is_array($_POST['category_ids']) || !$_POST['category_ids']) {
664 $this->{$this->getUnitCategoryOverviewCommand()}();
665 return;
666 }
667
668 $errors = array();
669 $num_deleted = 0;
670 foreach ($_POST['category_ids'] as $category_id) {
671 try {
672 $category = $this->repository->getUnitCategoryById((int) $category_id);
673 } catch (ilException $e) {
674 continue;
675 }
676
677 if (!$this->repository->isCRUDAllowed((int) $category_id)) {
678 $errors[] = $category->getDisplayString() . ' - ' . $this->lng->txt('change_adm_categories_not_allowed');
679 continue;
680 }
681
682 $possible_error = $this->repository->deleteCategory($category_id);
683 if (strlen($possible_error)) {
684 $errors[] = $category->getDisplayString() . ' - ' . $possible_error;
685 continue;
686 }
687
688 ++$num_deleted;
689 }
690
691 if ($errors) {
692 $num_errors = count($errors);
693
694 $error_message = array_map(function ($message) {
695 return '<li>' . $message . '</li>';
696 }, $errors);
697 if ($num_errors == 1) {
698 ilUtil::sendFailure($this->lng->txt('un_cat_deletion_errors_p_s') . '<ul>' . implode('', $error_message) . '<ul>');
699 } else {
700 ilUtil::sendFailure($this->lng->txt('un_cat_deletion_errors_p') . '<ul>' . implode('', $error_message) . '<ul>');
701 }
702 }
703
704 if ($num_deleted) {
705 if ($num_deleted == 1) {
706 ilUtil::sendSuccess($this->lng->txt('un_deleted_categories_s'));
707 } else {
708 ilUtil::sendSuccess($this->lng->txt('un_deleted_categories'));
709 }
710 }
711
712 $this->{$this->getUnitCategoryOverviewCommand()}();
713 }

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

+ Here is the call graph for this function:

◆ deleteUnits()

ilUnitConfigurationGUI::deleteUnits ( )

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

225 {
226 if (!$this->isCRUDContext()) {
227 $this->showUnitsOfCategory();
228 return;
229 }
230
231 if (!is_array($_POST['unit_ids']) || !$_POST['unit_ids']) {
232 $this->showUnitsOfCategory();
233 return;
234 }
235
236 $errors = array();
237 $num_deleted = 0;
238 foreach ($_POST['unit_ids'] as $unit_id) {
239 try {
240 $unit = $this->repository->getUnit((int) $unit_id);
241 if (!$unit) {
242 continue;
243 }
244
245 $check_result = $this->repository->deleteUnit($unit->getId());
246 if (!is_null($check_result)) {
247 $errors[] = $unit->getDisplayString() . ' - ' . $check_result;
248 continue;
249 }
250
251 ++$num_deleted;
252 } catch (ilException $e) {
253 continue;
254 }
255 }
256
257 if ($errors) {
258 $num_errors = count($errors);
259
260 $error_message = array_map(function ($message) {
261 return '<li>' . $message . '</li>';
262 }, $errors);
263 if ($num_errors == 1) {
264 ilUtil::sendFailure($this->lng->txt('un_unit_deletion_errors_p_s') . '<ul>' . implode('', $error_message) . '<ul>');
265 } else {
266 ilUtil::sendFailure($this->lng->txt('un_unit_deletion_errors_p') . '<ul>' . implode('', $error_message) . '<ul>');
267 }
268 }
269
270 if ($num_deleted) {
271 if ($num_deleted == 1) {
272 ilUtil::sendSuccess($this->lng->txt('un_deleted_units_s'));
273 } else {
274 ilUtil::sendSuccess($this->lng->txt('un_deleted_units'));
275 }
276 }
277
278 $this->showUnitsOfCategory();
279 }

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

+ Here is the call graph for this function:

◆ executeCommand()

ilUnitConfigurationGUI::executeCommand ( )

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

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

References 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 ilUtil::sendFailure($this->lng->txt('change_adm_categories_not_allowed'), true);
101 $this->ctrl->redirect($this, $this->getDefaultCommand());
102 }
103 return $category;
104 }
if(!array_key_exists('StateId', $_REQUEST)) $id

References $id, 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 109 of file class.ilUnitConfigurationGUI.php.

110 {
111 }

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 719 of file class.ilUnitConfigurationGUI.php.

720 {
721 if ($this->unit_cat_form instanceof ilPropertyFormGUI) {
723 }
724
725 $this->unit_cat_form = new ilPropertyFormGUI();
726
727 $title = new ilTextInputGUI($this->lng->txt('title'), 'category_name');
728 $title->setRequired(true);
729 $this->unit_cat_form->addItem($title);
730
731 if (null === $cat) {
732 $this->unit_cat_form->setTitle($this->lng->txt('new_category'));
733 $this->unit_cat_form->setFormAction($this->ctrl->getFormAction($this, 'addCategory'));
734 $this->unit_cat_form->addCommandButton('addCategory', $this->lng->txt('save'));
735 } else {
736 $this->ctrl->setParameter($this, 'category_id', $cat->getId());
737 $this->unit_cat_form->addCommandButton('saveCategory', $this->lng->txt('save'));
738 $this->unit_cat_form->setFormAction($this->ctrl->getFormAction($this, 'saveCategory'));
739 $this->unit_cat_form->setTitle(sprintf($this->lng->txt('selected_category'), $cat->getDisplayString()));
740 }
741
742 $this->unit_cat_form->addCommandButton($this->getUnitCategoryOverviewCommand(), $this->lng->txt('cancel'));
744 }
sprintf('%.4f', $callTime)
This class represents a property form user interface.
This class represents a text property in a property form.

References $title, $unit_cat_form, getUnitCategoryOverviewCommand(), and sprintf.

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 795 of file class.ilUnitConfigurationGUI.php.

796 {
797 if (!$this->isCRUDContext()) {
798 $this->{$this->getDefaultCommand()}();
799 return;
800 }
801
802 $category = $this->getCategoryById((int) $_GET['category_id']);
803
804 $this->initUnitCategoryForm($category);
805 if ($this->unit_cat_form->checkInput()) {
806 try {
807 $category->setCategory($this->unit_cat_form->getInput('category_name'));
808 $this->repository->saveCategory($category);
809 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
810
811 $this->{$this->getUnitCategoryOverviewCommand()}();
812 return;
813 } catch (ilException $e) {
814 $this->unit_cat_form->getItemByPostVar('category_name')->setAlert($this->lng->txt($e->getMessage()));
815 ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
816 }
817 }
818
819 $this->unit_cat_form->setValuesByPost();
820
821 $this->tpl->setContent($this->unit_cat_form->getHtml());
822 }

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 284 of file class.ilUnitConfigurationGUI.php.

285 {
286 if (!$this->isCRUDContext()) {
287 $this->showUnitsOfCategory();
288 return;
289 }
290
291 if (!isset($_POST['sequence']) || !is_array($_POST['sequence'])) {
292 $this->showUnitsOfCategory();
293 return;
294 }
295
296 foreach ($_POST['sequence'] as $id => $sequence) {
297 $sorting_value = str_replace(',', '.', $sequence);
298 $sorting_value = (int) $sorting_value * 100;
299 $this->repository->saveUnitOrder((int) $id, $sorting_value);
300 }
301
302 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
303 $this->showUnitsOfCategory();
304 return;
305 }

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

+ Here is the call graph for this function:

◆ saveUnit()

ilUnitConfigurationGUI::saveUnit ( )
protected

Save a unit.

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

311 {
312 if (!$this->isCRUDContext()) {
313 $this->showUnitsOfCategory();
314 return;
315 }
316
317 $category = $this->getCategoryById((int) $_GET['category_id']);
318 $unit = $this->repository->getUnit((int) $_GET['unit_id']);
319
320 if ($this->repository->isUnitInUse($unit->getId())) {
322 return;
323 }
324
325 $this->initUnitForm($category, $unit);
326 if ($this->unit_form->checkInput()) {
327 $unit->setUnit($this->unit_form->getInput('unit_title'));
328 $unit->setFactor((float) $this->unit_form->getInput('factor'));
329 $unit->setBaseUnit((int) $this->unit_form->getInput('base_unit') != $unit->getId() ? (int) $this->unit_form->getInput('base_unit') : 0);
330 $unit->setCategory($category->getId());
331 $this->repository->saveUnit($unit);
332 ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
333 $this->showUnitsOfCategory();
334 return;
335 } else {
336 $this->unit_form->setValuesByPost();
337 }
338
339 $this->tpl->setContent($this->unit_form->getHtml());
340 }

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 780 of file class.ilUnitConfigurationGUI.php.

781 {
782 if (!$this->isCRUDContext()) {
783 $this->{$this->getDefaultCommand()}();
784 return;
785 }
786
787 $this->initUnitCategoryForm();
788
789 $this->tpl->setContent($this->unit_cat_form->getHtml());
790 }

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

+ Here is the call graph for this function:

◆ showUnitCategoryModificationForm()

ilUnitConfigurationGUI::showUnitCategoryModificationForm ( )
protected

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

828 {
829 if (!$this->isCRUDContext()) {
830 $this->{$this->getDefaultCommand()}();
831 return;
832 }
833
834 $category = $this->getCategoryById((int) $_GET['category_id']);
835
836 $this->initUnitCategoryForm($category);
837 $this->unit_cat_form->setValuesByArray(array(
838 'category_name' => $category->getCategory()
839 ));
840
841 $this->tpl->setContent($this->unit_cat_form->getHtml());
842 }

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

+ Here is the call graph for this function:

◆ showUnitCreationForm()

ilUnitConfigurationGUI::showUnitCreationForm ( )
protected

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

404 {
405 if (!$this->isCRUDContext()) {
406 $this->showUnitsOfCategory();
407 return;
408 }
409
410 $category = $this->getCategoryById((int) $_GET['category_id']);
411
412 $this->initUnitForm($category);
413 $this->unit_form->setValuesByArray(array(
414 'factor' => 1,
415 'unit_title' => $this->lng->txt('unit_placeholder')
416 ));
417
418 $this->tpl->setContent($this->unit_form->getHtml());
419 }

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

+ Here is the call graph for this function:

◆ showUnitModificationForm()

ilUnitConfigurationGUI::showUnitModificationForm ( )
protected

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

346 {
347 if (!$this->isCRUDContext()) {
348 $this->showUnitsOfCategory();
349 return;
350 }
351
352 $category = $this->getCategoryById((int) $_GET['category_id']);
353 $unit = $this->repository->getUnit((int) $_GET['unit_id']);
354
355 $this->initUnitForm($category, $unit);
356 $this->unit_form->setValuesByArray(array(
357 'factor' => $unit->getFactor(),
358 'unit_title' => $unit->getUnit(),
359 'base_unit' => ($unit->getBaseUnit() != $unit->getId() ? $unit->getBaseUnit() : 0)
360 ));
361
362 $this->tpl->setContent($this->unit_form->getHtml());
363 }

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: