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

References $_POST, and importGlobalCategories().

Referenced by confirmImportGlobalCategory().

163  {
164  if (!isset($_POST['category_ids']) || !is_array($_POST['category_ids'])) {
165  $this->showGlobalUnitCategories();
166  return;
167  }
168 
169  // @todo: Confirmation Currently not implemented, so forward to import
170  $this->importGlobalCategories();
171  }
$_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 148 of file class.ilLocalUnitConfigurationGUI.php.

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

149  {
150  if (!isset($_GET['category_id'])) {
151  $this->showGlobalUnitCategories();
152  return;
153  }
154  $_POST['category_ids'] = array($_GET['category_id']);
155 
157  }
$_GET["client_id"]
Create styles array
The data for the language used.
$_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, $id, ilUnitConfigurationGUI\$repository, array, ilUnitConfigurationGUI\executeCommand(), ilUnitConfigurationGUI\handleSubtabs(), isCRUDContext(), 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
+ 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 176 of file class.ilLocalUnitConfigurationGUI.php.

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

Referenced by confirmImportGlobalCategories().

177  {
178  if ($this->isCRUDContext()) {
179  $this->{$this->getDefaultCommand()}();
180  return;
181  }
182 
183  if (!isset($_POST['category_ids']) || !is_array($_POST['category_ids'])) {
184  $this->showGlobalUnitCategories();
185  return;
186  }
187 
188  $i = 0;
189  foreach ($_POST['category_ids'] as $category_id) {
190  try {
191  $category = $this->repository->getUnitCategoryById((int) $category_id);
192  } catch (ilException $e) {
193  continue;
194  }
195 
196  // Copy admin-category to custom-category (with question_fi)
197  $new_cat_id = $this->repository->copyCategory($category->getId(), $this->repository->getConsumerId());
198 
199  // Copy units to custom_category
200  $this->repository->copyUnitsByCategories($category->getId(), $new_cat_id, $this->repository->getConsumerId());
201  ++$i;
202  }
203 
204  if ($i) {
205  ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
206  }
207 
208  $this->ctrl->setParameter($this, 'question_fi', 0);
209  $this->ctrl->redirect($this, 'showLocalUnitCategories');
210  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$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.

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"]
+ Here is the caller graph for this function:

◆ showUnitCategories()

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

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

References $table, and getUnitCategoryOverviewCommand().

Referenced by getUniqueId().

137  {
138  require_once 'Modules/TestQuestionPool/classes/tables/class.ilLocalUnitCategoryTableGUI.php';
140  $table->setData($categories);
141 
142  $this->tpl->setContent($table->getHTML());
143  }
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: