Class ilUnitConfigurationGUI .
More...
◆ addCategory()
ilUnitConfigurationGUI::addCategory |
( |
| ) |
|
|
protected |
Definition at line 857 of file class.ilUnitConfigurationGUI.php.
References getDefaultCommand(), getUnitCategoryOverviewCommand(), initUnitCategoryForm(), isCRUDContext(), ilUtil\sendFailure(), and ilUtil\sendSuccess().
866 if($this->unit_cat_form->checkInput())
871 $category->setCategory($this->unit_cat_form->getInput(
'category_name'));
872 $this->repository->saveNewUnitCategory($category);
880 $this->unit_cat_form->getItemByPostVar(
'category_name')->setAlert($this->lng->txt($e->getMessage()));
886 $this->unit_cat_form->setValuesByPost();
888 $this->tpl->setContent($this->unit_cat_form->getHtml());
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Base class for ILIAS Exception handling.
getUnitCategoryOverviewCommand()
initUnitCategoryForm(assFormulaQuestionUnitCategory $cat=null)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
◆ addUnit()
ilUnitConfigurationGUI::addUnit |
( |
| ) |
|
|
protected |
Adds a new unit.
Definition at line 416 of file class.ilUnitConfigurationGUI.php.
References $_GET, getCategoryById(), isCRUDContext(), and ilUtil\sendSuccess().
420 $this->showUnitsOfCategory();
426 $this->initUnitForm($category);
427 if($this->unit_form->checkInput())
430 $unit->setUnit($this->unit_form->getInput(
'unit_title'));
431 $unit->setCategory($category->getId());
433 $this->repository->createNewUnit($unit);
435 $unit->setBaseUnit((
int)$this->unit_form->getInput(
'base_unit'));
436 $unit->setFactor((
float)$this->unit_form->getInput(
'factor'));
438 $this->repository->saveUnit($unit);
441 $this->showUnitsOfCategory();
445 $this->unit_form->setValuesByPost();
447 $this->tpl->setContent($this->unit_form->getHtml());
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
getCategoryById($id, $for_CRUD=true)
◆ checkPermissions()
ilUnitConfigurationGUI::checkPermissions |
( |
|
$cmd | ) |
|
|
protected |
◆ confirmDeleteCategories()
ilUnitConfigurationGUI::confirmDeleteCategories |
( |
| ) |
|
|
protected |
Definition at line 653 of file class.ilUnitConfigurationGUI.php.
References $_POST, $errors, array, getDefaultCommand(), getUnitCategoryOverviewCommand(), isCRUDContext(), and ilUtil\sendFailure().
Referenced by confirmDeleteCategory().
661 if(!isset(
$_POST[
'category_ids']) || !is_array(
$_POST[
'category_ids']))
667 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
669 $confirmation->setFormAction($this->ctrl->getFormAction($this,
'deleteCategories'));
670 $confirmation->setConfirm($this->lng->txt(
'confirm'),
'deleteCategories');
675 foreach(
$_POST[
'category_ids'] as $category_id)
679 $category = $this->repository->getUnitCategoryById((
int)$category_id);
686 if(!$this->repository->isCRUDAllowed((
int)$category_id))
688 $errors[] = $category->getDisplayString() .
' - ' . $this->lng->txt(
'change_adm_categories_not_allowed');
692 $possible_error = $this->repository->checkDeleteCategory($category_id);
693 if(strlen($possible_error))
695 $errors[] = $category->getDisplayString() .
' - ' . $possible_error;
699 $confirmation->addItem(
'category_ids[]', $category->getId(), $category->getDisplayString());
707 $error_message = array_map(
function ($message)
709 return '<li>' . $message .
'</li>';
713 ilUtil::sendFailure($this->lng->txt(
'un_cat_deletion_errors_f_s') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
717 ilUtil::sendFailure($this->lng->txt(
'un_cat_deletion_errors_f') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
723 if($num_to_confirm == 1)
725 $confirmation->setHeaderText($this->lng->txt(
'un_sure_delete_categories_s'));
729 $confirmation->setHeaderText($this->lng->txt(
'un_sure_delete_categories'));
732 $this->tpl->setContent($confirmation->getHTML());
Base class for ILIAS Exception handling.
getUnitCategoryOverviewCommand()
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Confirmation screen class.
◆ confirmDeleteCategory()
ilUnitConfigurationGUI::confirmDeleteCategory |
( |
| ) |
|
|
protected |
◆ confirmDeleteUnit()
ilUnitConfigurationGUI::confirmDeleteUnit |
( |
| ) |
|
|
protected |
◆ confirmDeleteUnits()
ilUnitConfigurationGUI::confirmDeleteUnits |
( |
| ) |
|
|
protected |
Definition at line 159 of file class.ilUnitConfigurationGUI.php.
References $_POST, $errors, array, isCRUDContext(), and ilUtil\sendFailure().
Referenced by confirmDeleteUnit().
163 $this->showUnitsOfCategory();
167 if(!isset(
$_POST[
'unit_ids']) || !is_array(
$_POST[
'unit_ids']))
169 $this->showUnitsOfCategory();
173 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
175 $confirmation->setFormAction($this->ctrl->getFormAction($this,
'deleteUnits'));
176 $confirmation->setConfirm($this->lng->txt(
'confirm'),
'deleteUnits');
177 $confirmation->setCancel($this->lng->txt(
'cancel'),
'showUnitsOfCategory');
181 foreach(
$_POST[
'unit_ids'] as $unit_id)
185 $unit = $this->repository->getUnit((
int)$unit_id);
191 if($check_result = $this->repository->checkDeleteUnit($unit->getId()))
193 $errors[] = $unit->getDisplayString() .
' - ' . $check_result;
197 $confirmation->addItem(
'unit_ids[]', $unit->getId(), $unit->getDisplayString());
210 $error_message = array_map(
function ($message)
212 return '<li>' . $message .
'</li>';
216 ilUtil::sendFailure($this->lng->txt(
'un_unit_deletion_errors_f_s') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
220 ilUtil::sendFailure($this->lng->txt(
'un_unit_deletion_errors_f') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
226 if($num_to_confirm == 1)
228 $confirmation->setHeaderText($this->lng->txt(
'un_sure_delete_units_s'));
232 $confirmation->setHeaderText($this->lng->txt(
'un_sure_delete_units'));
235 $this->tpl->setContent($confirmation->getHTML());
239 $this->showUnitsOfCategory();
Base class for ILIAS Exception handling.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Confirmation screen class.
◆ deleteCategories()
ilUnitConfigurationGUI::deleteCategories |
( |
| ) |
|
|
protected |
Definition at line 743 of file class.ilUnitConfigurationGUI.php.
References $_POST, $errors, array, getDefaultCommand(), getUnitCategoryOverviewCommand(), isCRUDContext(), ilUtil\sendFailure(), and ilUtil\sendSuccess().
751 if(!is_array(
$_POST[
'category_ids']) || !
$_POST[
'category_ids'])
759 foreach(
$_POST[
'category_ids'] as $category_id)
763 $category = $this->repository->getUnitCategoryById((
int)$category_id);
770 if(!$this->repository->isCRUDAllowed((
int)$category_id))
772 $errors[] = $category->getDisplayString() .
' - ' . $this->lng->txt(
'change_adm_categories_not_allowed');
776 $possible_error = $this->repository->deleteCategory($category_id);
777 if(strlen($possible_error))
779 $errors[] = $category->getDisplayString() .
' - ' . $possible_error;
790 $error_message = array_map(
function ($message)
792 return '<li>' . $message .
'</li>';
796 ilUtil::sendFailure($this->lng->txt(
'un_cat_deletion_errors_p_s') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
800 ilUtil::sendFailure($this->lng->txt(
'un_cat_deletion_errors_p') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
806 if($num_deleted == 1)
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Base class for ILIAS Exception handling.
getUnitCategoryOverviewCommand()
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
◆ deleteUnits()
ilUnitConfigurationGUI::deleteUnits |
( |
| ) |
|
Definition at line 246 of file class.ilUnitConfigurationGUI.php.
References $_POST, $errors, array, isCRUDContext(), ilUtil\sendFailure(), and ilUtil\sendSuccess().
250 $this->showUnitsOfCategory();
254 if(!is_array(
$_POST[
'unit_ids']) || !
$_POST[
'unit_ids'])
256 $this->showUnitsOfCategory();
262 foreach(
$_POST[
'unit_ids'] as $unit_id)
266 $unit = $this->repository->getUnit((
int)$unit_id);
272 $check_result = $this->repository->deleteUnit($unit->getId());
273 if(!is_null($check_result))
275 $errors[] = $unit->getDisplayString() .
' - ' . $check_result;
291 $error_message = array_map(
function ($message)
293 return '<li>' . $message .
'</li>';
297 ilUtil::sendFailure($this->lng->txt(
'un_unit_deletion_errors_p_s') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
301 ilUtil::sendFailure($this->lng->txt(
'un_unit_deletion_errors_p') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
307 if($num_deleted == 1)
317 $this->showUnitsOfCategory();
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Base class for ILIAS Exception handling.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
◆ executeCommand()
ilUnitConfigurationGUI::executeCommand |
( |
| ) |
|
◆ getCategoryById()
ilUnitConfigurationGUI::getCategoryById |
( |
|
$id, |
|
|
|
$for_CRUD = true |
|
) |
| |
|
protected |
◆ getDefaultCommand()
ilUnitConfigurationGUI::getDefaultCommand |
( |
| ) |
|
|
abstractprotected |
◆ getUniqueId()
ilUnitConfigurationGUI::getUniqueId |
( |
| ) |
|
|
abstract |
◆ getUnitCategoryOverviewCommand()
ilUnitConfigurationGUI::getUnitCategoryOverviewCommand |
( |
| ) |
|
|
abstract |
◆ handleSubtabs()
ilUnitConfigurationGUI::handleSubtabs |
( |
| ) |
|
|
protected |
◆ initUnitCategoryForm()
- Parameters
-
- Returns
- ilPropertyFormGUI
Definition at line 823 of file class.ilUnitConfigurationGUI.php.
References $title, $unit_cat_form, and getUnitCategoryOverviewCommand().
Referenced by addCategory(), saveCategory(), showUnitCategoryCreationForm(), and showUnitCategoryModificationForm().
830 $this->unit_cat_form =
new ilPropertyFormGUI();
833 $title->setRequired(
true);
834 $this->unit_cat_form->addItem(
$title);
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'));
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()));
getUnitCategoryOverviewCommand()
This class represents a text property in a property form.
◆ isCRUDContext()
ilUnitConfigurationGUI::isCRUDContext |
( |
| ) |
|
|
abstract |
- Returns
- boolean
Referenced by addCategory(), addUnit(), confirmDeleteCategories(), confirmDeleteUnits(), deleteCategories(), deleteUnits(), saveCategory(), saveOrder(), saveUnit(), showUnitCategoryCreationForm(), showUnitCategoryModificationForm(), showUnitCreationForm(), and showUnitModificationForm().
◆ saveCategory()
ilUnitConfigurationGUI::saveCategory |
( |
| ) |
|
|
protected |
Definition at line 910 of file class.ilUnitConfigurationGUI.php.
References $_GET, getCategoryById(), getDefaultCommand(), getUnitCategoryOverviewCommand(), initUnitCategoryForm(), isCRUDContext(), ilUtil\sendFailure(), and ilUtil\sendSuccess().
921 if($this->unit_cat_form->checkInput())
925 $category->setCategory($this->unit_cat_form->getInput(
'category_name'));
926 $this->repository->saveCategory($category);
934 $this->unit_cat_form->getItemByPostVar(
'category_name')->setAlert($this->lng->txt($e->getMessage()));
939 $this->unit_cat_form->setValuesByPost();
941 $this->tpl->setContent($this->unit_cat_form->getHtml());
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
getCategoryById($id, $for_CRUD=true)
Base class for ILIAS Exception handling.
getUnitCategoryOverviewCommand()
initUnitCategoryForm(assFormulaQuestionUnitCategory $cat=null)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
◆ saveOrder()
ilUnitConfigurationGUI::saveOrder |
( |
| ) |
|
|
protected |
Definition at line 323 of file class.ilUnitConfigurationGUI.php.
References $_POST, isCRUDContext(), and ilUtil\sendSuccess().
327 $this->showUnitsOfCategory();
331 if(!isset(
$_POST[
'sequence']) || !is_array(
$_POST[
'sequence']))
333 $this->showUnitsOfCategory();
337 foreach(
$_POST[
'sequence'] as $id => $sequence)
339 $sorting_value = str_replace(
',',
'.', $sequence);
340 $sorting_value = (int)$sorting_value * 100;
341 $this->repository->saveUnitOrder((
int)$id, $sorting_value);
345 $this->showUnitsOfCategory();
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
◆ saveUnit()
ilUnitConfigurationGUI::saveUnit |
( |
| ) |
|
|
protected |
Save a unit.
Definition at line 352 of file class.ilUnitConfigurationGUI.php.
References $_GET, getCategoryById(), isCRUDContext(), ilUtil\sendSuccess(), and showUnitModificationForm().
356 $this->showUnitsOfCategory();
361 $unit = $this->repository->getUnit((
int)
$_GET[
'unit_id']);
363 if($this->repository->isUnitInUse($unit->getId()))
369 $this->initUnitForm($category, $unit);
370 if($this->unit_form->checkInput())
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);
378 $this->showUnitsOfCategory();
383 $this->unit_form->setValuesByPost();
386 $this->tpl->setContent($this->unit_form->getHtml());
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
getCategoryById($id, $for_CRUD=true)
showUnitModificationForm()
◆ showUnitCategories()
ilUnitConfigurationGUI::showUnitCategories |
( |
array |
$categories | ) |
|
|
abstractprotected |
◆ showUnitCategoryCreationForm()
ilUnitConfigurationGUI::showUnitCategoryCreationForm |
( |
| ) |
|
|
protected |
◆ showUnitCategoryModificationForm()
ilUnitConfigurationGUI::showUnitCategoryModificationForm |
( |
| ) |
|
|
protected |
◆ showUnitCreationForm()
ilUnitConfigurationGUI::showUnitCreationForm |
( |
| ) |
|
|
protected |
Definition at line 453 of file class.ilUnitConfigurationGUI.php.
References $_GET, $data, $options, $title, $unit_form, array, getCategoryById(), assFormulaQuestionUnit\getId(), getUnitCategoryOverviewCommand(), isCRUDContext(), ilFormPropertyGUI\setRequired(), and showUnitCategories().
457 $this->showUnitsOfCategory();
463 $this->initUnitForm($category);
464 $this->unit_form->setValuesByArray(
array(
466 'unit_title' => $this->lng->txt(
'unit_placeholder')
469 $this->tpl->setContent($this->unit_form->getHtml());
getCategoryById($id, $for_CRUD=true)
Create styles array
The data for the language used.
◆ showUnitModificationForm()
ilUnitConfigurationGUI::showUnitModificationForm |
( |
| ) |
|
|
protected |
Definition at line 392 of file class.ilUnitConfigurationGUI.php.
References $_GET, array, getCategoryById(), and isCRUDContext().
Referenced by saveUnit().
396 $this->showUnitsOfCategory();
401 $unit = $this->repository->getUnit((
int)
$_GET[
'unit_id']);
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)
410 $this->tpl->setContent($this->unit_form->getHtml());
getCategoryById($id, $for_CRUD=true)
Create styles array
The data for the language used.
◆ $ctrl
ilUnitConfigurationGUI::$ctrl |
|
protected |
◆ $lng
ilUnitConfigurationGUI::$lng |
|
protected |
◆ $repository
ilUnitConfigurationGUI::$repository = null |
|
protected |
◆ $tpl
ilUnitConfigurationGUI::$tpl |
|
protected |
◆ $unit_cat_form
ilUnitConfigurationGUI::$unit_cat_form |
|
protected |
◆ $unit_form
ilUnitConfigurationGUI::$unit_form |
|
protected |
The documentation for this class was generated from the following file: