Class ilUnitConfigurationGUI .
More...
◆ addCategory()
ilUnitConfigurationGUI::addCategory |
( |
| ) |
|
|
protected |
Definition at line 753 of file class.ilUnitConfigurationGUI.php.
References getDefaultCommand(), getUnitCategoryOverviewCommand(), initUnitCategoryForm(), isCRUDContext(), repository(), and ilUtil\sendFailure().
761 if ($this->unit_cat_form->checkInput()) {
764 $category->setCategory($this->unit_cat_form->getInput(
'category_name'));
765 $this->
repository->saveNewUnitCategory($category);
766 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
771 $this->unit_cat_form->getItemByPostVar(
'category_name')->setAlert($this->lng->txt($e->getMessage()));
776 $this->unit_cat_form->setValuesByPost();
778 $this->tpl->setContent($this->unit_cat_form->getHtml());
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 371 of file class.ilUnitConfigurationGUI.php.
References $_GET, getCategoryById(), isCRUDContext(), and repository().
374 $this->showUnitsOfCategory();
380 $this->initUnitForm($category);
381 if ($this->unit_form->checkInput()) {
383 $unit->setUnit($this->unit_form->getInput(
'unit_title'));
384 $unit->setCategory($category->getId());
388 $unit->setBaseUnit((
int) $this->unit_form->getInput(
'base_unit'));
389 $unit->setFactor((
float) $this->unit_form->getInput(
'factor'));
393 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
394 $this->showUnitsOfCategory();
398 $this->unit_form->setValuesByPost();
400 $this->tpl->setContent($this->unit_form->getHtml());
getCategoryById($id, $for_CRUD=true)
◆ checkPermissions()
ilUnitConfigurationGUI::checkPermissions |
( |
|
$cmd | ) |
|
|
protected |
◆ confirmDeleteCategories()
ilUnitConfigurationGUI::confirmDeleteCategories |
( |
| ) |
|
|
protected |
Definition at line 589 of file class.ilUnitConfigurationGUI.php.
References $_POST, $errors, $message, getDefaultCommand(), getUnitCategoryOverviewCommand(), isCRUDContext(), repository(), and ilUtil\sendFailure().
Referenced by confirmDeleteCategory().
596 if (!isset(
$_POST[
'category_ids']) || !is_array(
$_POST[
'category_ids'])) {
601 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
603 $confirmation->setFormAction($this->ctrl->getFormAction($this,
'deleteCategories'));
604 $confirmation->setConfirm($this->lng->txt(
'confirm'),
'deleteCategories');
609 foreach (
$_POST[
'category_ids'] as $category_id) {
611 $category = $this->
repository->getUnitCategoryById((
int) $category_id);
616 if (!$this->
repository->isCRUDAllowed((
int) $category_id)) {
617 $errors[] = $category->getDisplayString() .
' - ' . $this->lng->txt(
'change_adm_categories_not_allowed');
621 $possible_error = $this->
repository->checkDeleteCategory($category_id);
622 if (strlen($possible_error)) {
623 $errors[] = $category->getDisplayString() .
' - ' . $possible_error;
627 $confirmation->addItem(
'category_ids[]', $category->getId(), $category->getDisplayString());
634 $error_message = array_map(
function (
$message) {
637 if ($num_errors == 1) {
638 ilUtil::sendFailure($this->lng->txt(
'un_cat_deletion_errors_f_s') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
640 ilUtil::sendFailure($this->lng->txt(
'un_cat_deletion_errors_f') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
644 if ($num_to_confirm) {
645 if ($num_to_confirm == 1) {
646 $confirmation->setHeaderText($this->lng->txt(
'un_sure_delete_categories_s'));
648 $confirmation->setHeaderText($this->lng->txt(
'un_sure_delete_categories'));
651 $this->tpl->setContent($confirmation->getHTML());
getUnitCategoryOverviewCommand()
catch(Exception $e) $message
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, $message, isCRUDContext(), repository(), and ilUtil\sendFailure().
Referenced by confirmDeleteUnit().
162 $this->showUnitsOfCategory();
166 if (!isset(
$_POST[
'unit_ids']) || !is_array(
$_POST[
'unit_ids'])) {
167 $this->showUnitsOfCategory();
171 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
173 $confirmation->setFormAction($this->ctrl->getFormAction($this,
'deleteUnits'));
174 $confirmation->setConfirm($this->lng->txt(
'confirm'),
'deleteUnits');
175 $confirmation->setCancel($this->lng->txt(
'cancel'),
'showUnitsOfCategory');
179 foreach (
$_POST[
'unit_ids'] as $unit_id) {
181 $unit = $this->
repository->getUnit((
int) $unit_id);
186 if ($check_result = $this->
repository->checkDeleteUnit($unit->getId())) {
187 $errors[] = $unit->getDisplayString() .
' - ' . $check_result;
191 $confirmation->addItem(
'unit_ids[]', $unit->getId(), $unit->getDisplayString());
201 $error_message = array_map(
function (
$message) {
204 if ($num_errors == 1) {
205 ilUtil::sendFailure($this->lng->txt(
'un_unit_deletion_errors_f_s') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
207 ilUtil::sendFailure($this->lng->txt(
'un_unit_deletion_errors_f') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
211 if ($num_to_confirm) {
212 if ($num_to_confirm == 1) {
213 $confirmation->setHeaderText($this->lng->txt(
'un_sure_delete_units_s'));
215 $confirmation->setHeaderText($this->lng->txt(
'un_sure_delete_units'));
218 $this->tpl->setContent($confirmation->getHTML());
220 $this->showUnitsOfCategory();
catch(Exception $e) $message
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Confirmation screen class.
◆ deleteCategories()
ilUnitConfigurationGUI::deleteCategories |
( |
| ) |
|
|
protected |
Definition at line 660 of file class.ilUnitConfigurationGUI.php.
References $_POST, $errors, $message, getDefaultCommand(), getUnitCategoryOverviewCommand(), isCRUDContext(), repository(), and ilUtil\sendFailure().
667 if (!is_array(
$_POST[
'category_ids']) || !
$_POST[
'category_ids']) {
674 foreach (
$_POST[
'category_ids'] as $category_id) {
676 $category = $this->
repository->getUnitCategoryById((
int) $category_id);
681 if (!$this->
repository->isCRUDAllowed((
int) $category_id)) {
682 $errors[] = $category->getDisplayString() .
' - ' . $this->lng->txt(
'change_adm_categories_not_allowed');
686 $possible_error = $this->
repository->deleteCategory($category_id);
687 if (strlen($possible_error)) {
688 $errors[] = $category->getDisplayString() .
' - ' . $possible_error;
698 $error_message = array_map(
function (
$message) {
701 if ($num_errors == 1) {
702 ilUtil::sendFailure($this->lng->txt(
'un_cat_deletion_errors_p_s') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
704 ilUtil::sendFailure($this->lng->txt(
'un_cat_deletion_errors_p') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
709 if ($num_deleted == 1) {
710 ilUtil::sendSuccess($this->lng->txt(
'un_deleted_categories_s'));
712 ilUtil::sendSuccess($this->lng->txt(
'un_deleted_categories'));
getUnitCategoryOverviewCommand()
catch(Exception $e) $message
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
◆ deleteUnits()
ilUnitConfigurationGUI::deleteUnits |
( |
| ) |
|
Definition at line 227 of file class.ilUnitConfigurationGUI.php.
References $_POST, $errors, $message, isCRUDContext(), repository(), and ilUtil\sendFailure().
230 $this->showUnitsOfCategory();
234 if (!is_array(
$_POST[
'unit_ids']) || !
$_POST[
'unit_ids']) {
235 $this->showUnitsOfCategory();
241 foreach (
$_POST[
'unit_ids'] as $unit_id) {
243 $unit = $this->
repository->getUnit((
int) $unit_id);
248 $check_result = $this->
repository->deleteUnit($unit->getId());
249 if (!is_null($check_result)) {
250 $errors[] = $unit->getDisplayString() .
' - ' . $check_result;
263 $error_message = array_map(
function (
$message) {
266 if ($num_errors == 1) {
267 ilUtil::sendFailure($this->lng->txt(
'un_unit_deletion_errors_p_s') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
269 ilUtil::sendFailure($this->lng->txt(
'un_unit_deletion_errors_p') .
'<ul>' . implode(
'', $error_message) .
'<ul>');
274 if ($num_deleted == 1) {
275 ilUtil::sendSuccess($this->lng->txt(
'un_deleted_units_s'));
277 ilUtil::sendSuccess($this->lng->txt(
'un_deleted_units'));
281 $this->showUnitsOfCategory();
catch(Exception $e) $message
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
◆ executeCommand()
ilUnitConfigurationGUI::executeCommand |
( |
| ) |
|
◆ getCategoryById()
ilUnitConfigurationGUI::getCategoryById |
( |
|
$id, |
|
|
|
$for_CRUD = true |
|
) |
| |
|
protected |
- Parameters
-
- Returns
- assFormulaQuestionUnitCategory
Definition at line 99 of file class.ilUnitConfigurationGUI.php.
References $id, getDefaultCommand(), repository(), and ilUtil\sendFailure().
Referenced by addUnit(), saveCategory(), saveUnit(), showUnitCategoryModificationForm(), showUnitCreationForm(), and showUnitModificationForm().
102 if ($for_CRUD && $category->getQuestionFi() != $this->
repository->getConsumerId()) {
if(!array_key_exists('StateId', $_REQUEST)) $id
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
◆ getDefaultCommand()
ilUnitConfigurationGUI::getDefaultCommand |
( |
| ) |
|
|
abstractprotected |
◆ getUniqueId()
ilUnitConfigurationGUI::getUniqueId |
( |
| ) |
|
|
abstract |
◆ getUnitCategoryOverviewCommand()
ilUnitConfigurationGUI::getUnitCategoryOverviewCommand |
( |
| ) |
|
|
abstract |
◆ handleSubtabs()
ilUnitConfigurationGUI::handleSubtabs |
( |
| ) |
|
|
protected |
◆ initUnitCategoryForm()
- Parameters
-
- Returns
- ilPropertyFormGUI
Definition at line 723 of file class.ilUnitConfigurationGUI.php.
References $title, $unit_cat_form, and getUnitCategoryOverviewCommand().
Referenced by addCategory(), saveCategory(), showUnitCategoryCreationForm(), and showUnitCategoryModificationForm().
729 $this->unit_cat_form =
new ilPropertyFormGUI();
732 $title->setRequired(
true);
733 $this->unit_cat_form->addItem(
$title);
736 $this->unit_cat_form->setTitle($this->lng->txt(
'new_category'));
737 $this->unit_cat_form->setFormAction($this->ctrl->getFormAction($this,
'addCategory'));
738 $this->unit_cat_form->addCommandButton(
'addCategory', $this->lng->txt(
'save'));
740 $this->ctrl->setParameter($this,
'category_id', $cat->
getId());
741 $this->unit_cat_form->addCommandButton(
'saveCategory', $this->lng->txt(
'save'));
742 $this->unit_cat_form->setFormAction($this->ctrl->getFormAction($this,
'saveCategory'));
743 $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 |
◆ saveOrder()
ilUnitConfigurationGUI::saveOrder |
( |
| ) |
|
|
protected |
Definition at line 287 of file class.ilUnitConfigurationGUI.php.
References $_POST, $id, isCRUDContext(), and repository().
290 $this->showUnitsOfCategory();
294 if (!isset(
$_POST[
'sequence']) || !is_array(
$_POST[
'sequence'])) {
295 $this->showUnitsOfCategory();
299 foreach (
$_POST[
'sequence'] as
$id => $sequence) {
300 $sorting_value = str_replace(
',',
'.', $sequence);
301 $sorting_value = (int) $sorting_value * 100;
305 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
306 $this->showUnitsOfCategory();
if(!array_key_exists('StateId', $_REQUEST)) $id
◆ saveUnit()
ilUnitConfigurationGUI::saveUnit |
( |
| ) |
|
|
protected |
Save a unit.
Definition at line 313 of file class.ilUnitConfigurationGUI.php.
References $_GET, getCategoryById(), isCRUDContext(), repository(), and showUnitModificationForm().
316 $this->showUnitsOfCategory();
323 if ($this->
repository->isUnitInUse($unit->getId())) {
328 $this->initUnitForm($category, $unit);
329 if ($this->unit_form->checkInput()) {
330 $unit->setUnit($this->unit_form->getInput(
'unit_title'));
331 $unit->setFactor((
float) $this->unit_form->getInput(
'factor'));
332 $unit->setBaseUnit((
int) $this->unit_form->getInput(
'base_unit') != $unit->getId() ? (int) $this->unit_form->getInput(
'base_unit') : 0);
333 $unit->setCategory($category->getId());
335 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'));
336 $this->showUnitsOfCategory();
339 $this->unit_form->setValuesByPost();
342 $this->tpl->setContent($this->unit_form->getHtml());
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 406 of file class.ilUnitConfigurationGUI.php.
References $_GET, $data, $DIC, PHPMailer\PHPMailer\$options, $table, $title, $unit_form, getCategoryById(), assFormulaQuestionUnit\getId(), getUnitCategoryOverviewCommand(), isCRUDContext(), repository(), ilFormPropertyGUI\setRequired(), and showUnitCategories().
409 $this->showUnitsOfCategory();
415 $this->initUnitForm($category);
416 $this->unit_form->setValuesByArray(array(
418 'unit_title' => $this->lng->txt(
'unit_placeholder')
421 $this->tpl->setContent($this->unit_form->getHtml());
getCategoryById($id, $for_CRUD=true)
◆ showUnitModificationForm()
ilUnitConfigurationGUI::showUnitModificationForm |
( |
| ) |
|
|
protected |
Definition at line 348 of file class.ilUnitConfigurationGUI.php.
References $_GET, getCategoryById(), isCRUDContext(), and repository().
Referenced by saveUnit().
351 $this->showUnitsOfCategory();
358 $this->initUnitForm($category, $unit);
359 $this->unit_form->setValuesByArray(array(
360 'factor' => $unit->getFactor(),
361 'unit_title' => $unit->getUnit(),
362 'base_unit' => ($unit->getBaseUnit() != $unit->getId() ? $unit->getBaseUnit() : 0)
365 $this->tpl->setContent($this->unit_form->getHtml());
getCategoryById($id, $for_CRUD=true)
◆ $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: