ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 176 of file class.ilLocalUnitConfigurationGUI.php.

References $_POST, and importGlobalCategories().

Referenced by confirmImportGlobalCategory().

177  {
178  if(!isset($_POST['category_ids']) || !is_array($_POST['category_ids']))
179  {
180  $this->showGlobalUnitCategories();
181  return;
182  }
183 
184  // @todo: Confirmation Currently not implemented, so forward to import
185  $this->importGlobalCategories();
186  }
$_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 161 of file class.ilLocalUnitConfigurationGUI.php.

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

162  {
163  if(!isset($_GET['category_id']))
164  {
165  $this->showGlobalUnitCategories();
166  return;
167  }
168  $_POST['category_ids'] = array($_GET['category_id']);
169 
171  }
$_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 54 of file class.ilLocalUnitConfigurationGUI.php.

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

55  {
56  $id = $this->repository->getConsumerId();
57  if($this->isCRUDContext())
58  {
59  $id .= '_local';
60  }
61  else
62  {
63  $id .= '_global';
64  }
65 
66  return $id;
67  }
+ 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  {
28  return 'showLocalUnitCategories';
29  }
30  else
31  {
32  return 'showGlobalUnitCategories';
33  }
34  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importGlobalCategories()

ilLocalUnitConfigurationGUI::importGlobalCategories ( )
protected

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

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

Referenced by confirmImportGlobalCategories().

192  {
193  if($this->isCRUDContext())
194  {
195  $this->{$this->getDefaultCommand()}();
196  return;
197  }
198 
199  if(!isset($_POST['category_ids']) || !is_array($_POST['category_ids']))
200  {
201  $this->showGlobalUnitCategories();
202  return;
203  }
204 
205  $i = 0;
206  foreach($_POST['category_ids'] as $category_id)
207  {
208  try
209  {
210  $category = $this->repository->getUnitCategoryById((int)$category_id);
211  }
212  catch(ilException $e)
213  {
214  continue;
215  }
216 
217  // Copy admin-category to custom-category (with question_fi)
218  $new_cat_id = $this->repository->copyCategory($category->getId(), $this->repository->getConsumerId());
219 
220  // Copy units to custom_category
221  $this->repository->copyUnitsByCategories($category->getId(), $new_cat_id, $this->repository->getConsumerId());
222  ++$i;
223  }
224 
225  if($i)
226  {
227  ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
228  }
229 
230  $this->ctrl->setParameter($this, 'question_fi', 0);
231  $this->ctrl->redirect($this, 'showLocalUnitCategories');
232  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Base class for ILIAS Exception handling.
$_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 39 of file class.ilLocalUnitConfigurationGUI.php.

References $_GET.

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

40  {
41  if(!isset($_GET[self::REQUEST_PARAM_SUB_CONTEXT_ID]) || $_GET[self::REQUEST_PARAM_SUB_CONTEXT_ID] == $this->repository->getConsumerId())
42  {
43  return true;
44  }
45  else
46  {
47  return false;
48  }
49  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ showUnitCategories()

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

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

References getUnitCategoryOverviewCommand().

Referenced by getUniqueId().

150  {
151  require_once 'Modules/TestQuestionPool/classes/tables/class.ilLocalUnitCategoryTableGUI.php';
152  $table = new ilLocalUnitCategoryTableGUI($this, $this->getUnitCategoryOverviewCommand());
153  $table->setData($categories);
154 
155  $this->tpl->setContent($table->getHTML());
156  }
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: