ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
4 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
5 
10 abstract class ilUnitConfigurationGUI
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  ilUtil::sendFailure($this->lng->txt('change_adm_categories_not_allowed'), true);
101  $this->ctrl->redirect($this, $this->getDefaultCommand());
102  }
103  return $category;
104  }
105 
109  protected function handleSubtabs()
110  {
111  }
112 
116  protected function checkPermissions($cmd)
117  {
118  }
119 
123  public function executeCommand()
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  }
138 
142  protected function confirmDeleteUnit()
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  }
152 
156  protected function confirmDeleteUnits()
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  }
220 
224  public function deleteUnits()
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  }
280 
284  protected function saveOrder()
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  }
306 
310  protected function saveUnit()
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())) {
321  $this->showUnitModificationForm();
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  }
341 
345  protected function showUnitModificationForm()
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  }
364 
368  protected function addUnit()
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  }
399 
403  protected function showUnitCreationForm()
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  }
420 
426  protected function initUnitForm(assFormulaQuestionUnitCategory $category = null, assFormulaQuestionUnit $unit = null)
427  {
428  if ($this->unit_form instanceof ilPropertyFormGUI) {
429  return $this->unit_form;
430  }
431 
432  $unit_in_use = false;
433  if ($unit instanceof assFormulaQuestionUnit && $this->repository->isUnitInUse($unit->getId())) {
434  $unit_in_use = true;
435  }
436 
437  $this->unit_form = new ilPropertyFormGUI();
438 
439  $title = new ilTextInputGUI($this->lng->txt('unit'), 'unit_title');
440  $title->setDisabled($unit_in_use);
441  $title->setRequired(true);
442  $this->unit_form->addItem($title);
443 
444  $baseunit = new ilSelectInputGUI($this->lng->txt('baseunit'), 'base_unit');
445  $items = $this->repository->getCategorizedUnits();
446  $options = array();
447  $category_name = '';
448  $new_category = false;
449  foreach ((array) $items as $item) {
450  if (
451  $unit instanceof assFormulaQuestionUnit &&
452  $unit->getId() == $item->getId()
453  ) {
454  continue;
455  }
456 
460  if ($item instanceof assFormulaQuestionUnitCategory) {
461  if ($category_name != $item->getDisplayString()) {
462  $new_category = true;
463  $category_name = $item->getDisplayString();
464  }
465  continue;
466  }
467  $options[$item->getId()] = $item->getDisplayString() . ($new_category ? ' (' . $category_name . ')' : '');
468  $new_category = false;
469  }
470  $baseunit->setDisabled($unit_in_use);
471  $baseunit->setOptions(array(0 => $this->lng->txt('no_selection')) + $options);
472  $this->unit_form->addItem($baseunit);
473 
474  $factor = new ilNumberInputGUI($this->lng->txt('factor'), 'factor');
475  $factor->setRequired(true);
476  $factor->setSize(3);
477  $factor->setMinValue(0);
478  $factor->allowDecimals(true);
479  $factor->setDisabled($unit_in_use);
480  $this->unit_form->addItem($factor);
481 
482  if (null === $unit) {
483  $this->unit_form->setTitle($this->lng->txt('new_unit'));
484  $this->unit_form->setFormAction($this->ctrl->getFormAction($this, 'addUnit'));
485  $this->unit_form->addCommandButton('addUnit', $this->lng->txt('save'));
486  } else {
487  $this->ctrl->setParameter($this, 'unit_id', $unit->getId());
488  if ($unit_in_use) {
489  $this->unit_form->setFormAction($this->ctrl->getFormAction($this, 'showUnitsOfCategory'));
490  } else {
491  $this->unit_form->addCommandButton('saveUnit', $this->lng->txt('save'));
492  $this->unit_form->setFormAction($this->ctrl->getFormAction($this, 'saveUnit'));
493  }
494  $this->unit_form->setTitle(sprintf($this->lng->txt('un_sel_cat_sel_unit'), $category->getDisplayString(), $unit->getDisplayString()));
495  }
496 
497  $this->unit_form->addCommandButton('showUnitsOfCategory', $this->lng->txt('cancel'));
498  return $this->unit_form;
499  }
500 
504  protected function showUnitsOfCategory()
505  {
509  global $ilToolbar;
510 
511  $category = $this->getCategoryById((int) $_GET['category_id'], false);
512 
513  $this->tpl->addJavaScript("./Services/JavaScript/js/Basic.js");
514  $this->tpl->addJavaScript("./Services/Form/js/Form.js");
515  $this->lng->loadLanguageModule('form');
516 
517  require_once 'Modules/TestQuestionPool/classes/tables/class.ilUnitTableGUI.php';
518  $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, $this->getUnitCategoryOverviewCommand()));
519  if ($this->isCRUDContext()) {
520  $ilToolbar->addButton($this->lng->txt('un_add_unit'), $this->ctrl->getLinkTarget($this, 'showUnitCreationForm'));
521  }
522  $table = new ilUnitTableGUI($this, 'showUnitsOfCategory', $category);
523  $units = $this->repository->loadUnitsForCategory($category->getId());
524  $data = array();
525  foreach ($units as $unit) {
529  $data[] = array(
530  'unit_id' => $unit->getId(),
531  'unit' => $unit->getUnit(),
532  'baseunit' => $unit->getBaseunitTitle(),
533  'baseunit_id' => $unit->getBaseUnit(),
534  'factor' => $unit->getFactor(),
535  'sequence' => $unit->getSequence(),
536  );
537  }
538  $table->setData($data);
539 
540  $this->tpl->setContent($table->getHTML());
541  }
542 
546  protected function showGlobalUnitCategories()
547  {
548  $categories = array_filter(
549  $this->repository->getAllUnitCategories(),
550  function (assFormulaQuestionUnitCategory $category) {
551  return !$category->getQuestionFi() ? true : false;
552  }
553  );
554  $data = array();
555  foreach ($categories as $category) {
559  $data[] = array(
560  'category_id' => $category->getId(),
561  'category' => $category->getDisplayString()
562  );
563  }
564 
565  $this->showUnitCategories($data);
566  }
567 
571  protected function confirmDeleteCategory()
572  {
573  if (!isset($_GET['category_id'])) {
574  $this->{$this->getUnitCategoryOverviewCommand()}();
575  return;
576  }
577  $_POST['category_ids'] = array($_GET['category_id']);
578 
579  $this->confirmDeleteCategories();
580  }
581 
585  protected function confirmDeleteCategories()
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  }
652 
656  protected function deleteCategories()
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  }
714 
719  protected function initUnitCategoryForm(assFormulaQuestionUnitCategory $cat = null)
720  {
721  if ($this->unit_cat_form instanceof ilPropertyFormGUI) {
722  return $this->unit_cat_form;
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'));
743  return $this->unit_cat_form;
744  }
745 
749  protected function addCategory()
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  }
776 
780  protected function showUnitCategoryCreationForm()
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  }
791 
795  protected function saveCategory()
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  }
823 
827  protected function showUnitCategoryModificationForm()
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  }
843 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
This class represents a selection list property in a property form.
This class represents a property form user interface.
$_GET["client_id"]
initUnitCategoryForm(assFormulaQuestionUnitCategory $cat=null)
if(!array_key_exists('StateId', $_REQUEST)) $id
Class ilUnitConfigurationRepository.
Class ilUnitConfigurationGUI .
showUnitCategories(array $categories)
global $ilCtrl
Definition: ilias.php:18
catch(Exception $e) $message
This class represents a number property in a property form.
This class represents a text property in a property form.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$errors
Definition: index.php:6
Class ilUnitTableGUI.
if(empty($password)) $table
Definition: pwgen.php:24
$_POST["username"]
setRequired($a_required)
Set Required.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
Confirmation screen class.