ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLocalUnitConfigurationGUI Class Reference

Class ilLocalUnitConfigurationGUI. More...

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

Public Member Functions

 getUnitCategoryOverviewCommand ()
 
 isCRUDContext ()
 
 getUniqueId ()
 
 executeCommand ()
 
- 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 170 of file class.ilLocalUnitConfigurationGUI.php.

References $_POST, and importGlobalCategories().

Referenced by confirmImportGlobalCategory().

171  {
172  if(!isset($_POST['category_ids']) || !is_array($_POST['category_ids']))
173  {
174  $this->showGlobalUnitCategories();
175  return;
176  }
177 
178  // @todo: Confirmation Currently not implemented, so forward to import
179  $this->importGlobalCategories();
180  }
$_POST['username']
Definition: cron.php:12
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmImportGlobalCategory()

ilLocalUnitConfigurationGUI::confirmImportGlobalCategory ( )
protected

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

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

156  {
157  if(!isset($_GET['category_id']))
158  {
159  $this->showGlobalUnitCategories();
160  return;
161  }
162  $_POST['category_ids'] = array($_GET['category_id']);
163 
165  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
+ Here is the call graph for this function:

◆ executeCommand()

ilLocalUnitConfigurationGUI::executeCommand ( )

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

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

74  {
75  $this->ctrl->saveParameter($this, self::REQUEST_PARAM_SUB_CONTEXT_ID);
76 
77  parent::executeCommand();
78  }
+ 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 isCRUDContext().

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 185 of file class.ilLocalUnitConfigurationGUI.php.

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

Referenced by confirmImportGlobalCategories().

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

References getUnitCategoryOverviewCommand().

Referenced by executeCommand().

144  {
145  require_once 'Modules/TestQuestionPool/classes/tables/class.ilLocalUnitCategoryTableGUI.php';
146  $table = new ilLocalUnitCategoryTableGUI($this, $this->getUnitCategoryOverviewCommand());
147  $table->setData($categories);
148 
149  $this->tpl->setContent($table->getHTML());
150  }
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: