ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLocalUnitConfigurationGUI Class Reference

Class ilLocalUnitConfigurationGUI. More...

+ Inheritance diagram for ilLocalUnitConfigurationGUI:
+ Collaboration diagram for ilLocalUnitConfigurationGUI:

Public Member Functions

 getUnitCategoryOverviewCommand ()
 
 isCRUDContext ()
 
 getUniqueId ()
 
- Public Member Functions inherited from ilUnitConfigurationGUI
 getUnitCategoryOverviewCommand ()
 
 isCRUDContext ()
 
 getUniqueId ()
 
 executeCommand ()
 
 deleteUnits ()
 

Data Fields

const REQUEST_PARAM_SUB_CONTEXT_ID = 'question_fi'
 

Protected Member Functions

 getDefaultCommand ()
 
 showUnitCategories (array $categories)
 
 confirmImportGlobalCategory ()
 
 confirmImportGlobalCategories ()
 
 importGlobalCategories ()
 
- Protected Member Functions inherited from ilUnitConfigurationGUI
 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 ()
 

Additional Inherited Members

- Protected Attributes inherited from ilUnitConfigurationGUI
 $unit_cat_form
 
 $unit_form
 
 $repository = null
 
 $tpl
 
 $lng
 
 $ctrl
 

Detailed Description

Member Function Documentation

◆ confirmImportGlobalCategories()

ilLocalUnitConfigurationGUI::confirmImportGlobalCategories ( )
protected

Definition at line 165 of file class.ilLocalUnitConfigurationGUI.php.

References $_POST, and importGlobalCategories().

Referenced by confirmImportGlobalCategory().

166  {
167  if (!isset($_POST['category_ids']) || !is_array($_POST['category_ids'])) {
168  $this->showGlobalUnitCategories();
169  return;
170  }
171 
172  // @todo: Confirmation Currently not implemented, so forward to import
173  $this->importGlobalCategories();
174  }
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmImportGlobalCategory()

ilLocalUnitConfigurationGUI::confirmImportGlobalCategory ( )
protected

Definition at line 151 of file class.ilLocalUnitConfigurationGUI.php.

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

152  {
153  if (!isset($_GET['category_id'])) {
154  $this->showGlobalUnitCategories();
155  return;
156  }
157  $_POST['category_ids'] = array($_GET['category_id']);
158 
160  }
$_GET["client_id"]
$_POST["username"]
+ Here is the call graph for this function:

◆ getDefaultCommand()

ilLocalUnitConfigurationGUI::getDefaultCommand ( )
protected
Returns
string

Definition at line 16 of file class.ilLocalUnitConfigurationGUI.php.

Referenced by importGlobalCategories().

17  {
18  return 'showLocalUnitCategories';
19  }
+ Here is the caller graph for this function:

◆ getUniqueId()

ilLocalUnitConfigurationGUI::getUniqueId ( )
Returns
string

Definition at line 48 of file class.ilLocalUnitConfigurationGUI.php.

References $data, $DIC, $id, ilUnitConfigurationGUI\$repository, ilUnitConfigurationGUI\executeCommand(), ilUnitConfigurationGUI\handleSubtabs(), isCRUDContext(), repository(), and showUnitCategories().

49  {
50  $id = $this->repository->getConsumerId();
51  if ($this->isCRUDContext()) {
52  $id .= '_local';
53  } else {
54  $id .= '_global';
55  }
56 
57  return $id;
58  }
if(!array_key_exists('StateId', $_REQUEST)) $id
repository()
Definition: repository.php:5
+ Here is the call graph for this function:

◆ getUnitCategoryOverviewCommand()

ilLocalUnitConfigurationGUI::getUnitCategoryOverviewCommand ( )
Returns
string

Definition at line 24 of file class.ilLocalUnitConfigurationGUI.php.

References isCRUDContext().

Referenced by showUnitCategories().

25  {
26  if ($this->isCRUDContext()) {
27  return 'showLocalUnitCategories';
28  } else {
29  return 'showGlobalUnitCategories';
30  }
31  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importGlobalCategories()

ilLocalUnitConfigurationGUI::importGlobalCategories ( )
protected

Definition at line 179 of file class.ilLocalUnitConfigurationGUI.php.

References $_POST, $i, getDefaultCommand(), isCRUDContext(), and repository().

Referenced by confirmImportGlobalCategories().

180  {
181  if ($this->isCRUDContext()) {
182  $this->{$this->getDefaultCommand()}();
183  return;
184  }
185 
186  if (!isset($_POST['category_ids']) || !is_array($_POST['category_ids'])) {
187  $this->showGlobalUnitCategories();
188  return;
189  }
190 
191  $i = 0;
192  foreach ($_POST['category_ids'] as $category_id) {
193  try {
194  $category = $this->repository->getUnitCategoryById((int) $category_id);
195  } catch (ilException $e) {
196  continue;
197  }
198 
199  // Copy admin-category to custom-category (with question_fi)
200  $new_cat_id = $this->repository->copyCategory($category->getId(), $this->repository->getConsumerId());
201 
202  // Copy units to custom_category
203  $this->repository->copyUnitsByCategories($category->getId(), $new_cat_id, $this->repository->getConsumerId());
204  ++$i;
205  }
206 
207  if ($i) {
208  ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
209  }
210 
211  $this->ctrl->setParameter($this, 'question_fi', 0);
212  $this->ctrl->redirect($this, 'showLocalUnitCategories');
213  }
repository()
Definition: repository.php:5
$i
Definition: disco.tpl.php:19
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isCRUDContext()

ilLocalUnitConfigurationGUI::isCRUDContext ( )
Returns
boolean

Definition at line 36 of file class.ilLocalUnitConfigurationGUI.php.

References $_GET, and repository().

Referenced by getUniqueId(), getUnitCategoryOverviewCommand(), and importGlobalCategories().

37  {
38  if (!isset($_GET[self::REQUEST_PARAM_SUB_CONTEXT_ID]) || $_GET[self::REQUEST_PARAM_SUB_CONTEXT_ID] == $this->repository->getConsumerId()) {
39  return true;
40  } else {
41  return false;
42  }
43  }
$_GET["client_id"]
repository()
Definition: repository.php:5
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showUnitCategories()

ilLocalUnitConfigurationGUI::showUnitCategories ( array  $categories)
protected
Parameters
array$categories

Definition at line 139 of file class.ilLocalUnitConfigurationGUI.php.

References $table, and getUnitCategoryOverviewCommand().

Referenced by getUniqueId().

140  {
141  require_once 'Modules/TestQuestionPool/classes/tables/class.ilLocalUnitCategoryTableGUI.php';
143  $table->setData($categories);
144 
145  $this->tpl->setContent($table->getHTML());
146  }
if(empty($password)) $table
Definition: pwgen.php:24
Class ilLocalUnitCategoryTableGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ REQUEST_PARAM_SUB_CONTEXT_ID

const ilLocalUnitConfigurationGUI::REQUEST_PARAM_SUB_CONTEXT_ID = 'question_fi'

Definition at line 11 of file class.ilLocalUnitConfigurationGUI.php.


The documentation for this class was generated from the following file: