ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilExcCriteriaCatalogueGUI Class Reference

Class ilExcCriteriaCatalogueGUI. More...

+ Collaboration diagram for ilExcCriteriaCatalogueGUI:

Public Member Functions

 executeCommand ()
 

Protected Member Functions

 view ()
 
 saveOrder ()
 
 confirmDeletion ()
 
 delete ()
 
 initForm (?ilExcCriteriaCatalogue $a_cat_obj=null)
 
 add (?ilPropertyFormGUI $a_form=null)
 
 exportForm (ilExcCriteriaCatalogue $a_cat_obj, ilPropertyFormGUI $a_form)
 
 importForm (?ilExcCriteriaCatalogue $a_cat_obj=null)
 
 create ()
 
 getCurrentCatalogue ()
 
 edit (?ilPropertyFormGUI $a_form=null)
 
 update ()
 

Protected Attributes

ilCtrl $ctrl
 
ilTabsGUI $tabs
 
ilLanguage $lng
 
ilToolbarGUI $toolbar
 
ilGlobalTemplateInterface $tpl
 
ilObjExercise $exc_obj
 
GUIRequest $request
 

Detailed Description

Member Function Documentation

◆ add()

ilExcCriteriaCatalogueGUI::add ( ?ilPropertyFormGUI  $a_form = null)
protected

Definition at line 202 of file class.ilExcCriteriaCatalogueGUI.php.

References $tpl, initForm(), and ILIAS\UICore\GlobalTemplate\setContent().

202  : void
203  {
204  $tpl = $this->tpl;
205 
206  if (!$a_form) {
207  $a_form = $this->initForm();
208  }
209 
210  $tpl->setContent($a_form->getHTML());
211  }
setContent(string $a_html)
Sets content for standard template.
initForm(?ilExcCriteriaCatalogue $a_cat_obj=null)
+ Here is the call graph for this function:

◆ confirmDeletion()

ilExcCriteriaCatalogueGUI::confirmDeletion ( )
protected

Definition at line 122 of file class.ilExcCriteriaCatalogueGUI.php.

References $ctrl, $lng, $tpl, ilExcCriteriaCatalogue\getInstancesByParentId(), ILIAS\UICore\GlobalTemplate\setContent(), ILIAS\UICore\GlobalTemplate\setOnScreenMessage(), and ilLanguage\txt().

122  : void
123  {
124  $ilCtrl = $this->ctrl;
125  $lng = $this->lng;
126  $tpl = $this->tpl;
127 
128  $ids = $this->request->getCatalogueIds();
129  if (count($ids) == 0) {
130  $this->tpl->setOnScreenMessage('info', $lng->txt("select_one"), true);
131  $ilCtrl->redirect($this, "view");
132  }
133 
134  $confirmation_gui = new ilConfirmationGUI();
135  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this, "delete"));
136  $confirmation_gui->setHeaderText($lng->txt("exc_criteria_catalogue_deletion_confirmation"));
137  $confirmation_gui->setCancel($lng->txt("cancel"), "view");
138  $confirmation_gui->setConfirm($lng->txt("delete"), "delete");
139 
140  foreach (ilExcCriteriaCatalogue::getInstancesByParentId($this->exc_obj->getId()) as $item) {
141  if (in_array($item->getId(), $ids)) {
142  $confirmation_gui->addItem("id[]", $item->getId(), $item->getTitle());
143  }
144  }
145 
146  $tpl->setContent($confirmation_gui->getHTML());
147  }
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setContent(string $a_html)
Sets content for standard template.
static getInstancesByParentId(int $a_parent_id)
+ Here is the call graph for this function:

◆ create()

ilExcCriteriaCatalogueGUI::create ( )
protected

Definition at line 251 of file class.ilExcCriteriaCatalogueGUI.php.

References importForm().

251  : void
252  {
253  $this->importForm();
254  }
importForm(?ilExcCriteriaCatalogue $a_cat_obj=null)
+ Here is the call graph for this function:

◆ delete()

ilExcCriteriaCatalogueGUI::delete ( )
protected

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

References $ctrl, $lng, ilExcCriteriaCatalogue\getInstancesByParentId(), and ilLanguage\txt().

149  : void
150  {
151  $ilCtrl = $this->ctrl;
152  $lng = $this->lng;
153 
154  $ids = $this->request->getCatalogueIds();
155  if (count($ids) == 0) {
156  $ilCtrl->redirect($this, "view");
157  }
158 
159  foreach (ilExcCriteriaCatalogue::getInstancesByParentId($this->exc_obj->getId()) as $item) {
160  if (in_array($item->getId(), $ids)) {
161  $item->delete();
162  }
163  }
164 
165  $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
166  $ilCtrl->redirect($this, "view");
167  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getInstancesByParentId(int $a_parent_id)
+ Here is the call graph for this function:

◆ edit()

ilExcCriteriaCatalogueGUI::edit ( ?ilPropertyFormGUI  $a_form = null)
protected

Definition at line 274 of file class.ilExcCriteriaCatalogueGUI.php.

References $tpl, exportForm(), getCurrentCatalogue(), initForm(), and ILIAS\UICore\GlobalTemplate\setContent().

274  : void
275  {
276  $tpl = $this->tpl;
277 
278  $cat_obj = $this->getCurrentCatalogue();
279 
280  if (!$a_form) {
281  $a_form = $this->initForm($cat_obj);
282  $this->exportForm($cat_obj, $a_form);
283  }
284 
285  $tpl->setContent($a_form->getHTML());
286  }
setContent(string $a_html)
Sets content for standard template.
initForm(?ilExcCriteriaCatalogue $a_cat_obj=null)
exportForm(ilExcCriteriaCatalogue $a_cat_obj, ilPropertyFormGUI $a_form)
+ Here is the call graph for this function:

◆ executeCommand()

ilExcCriteriaCatalogueGUI::executeCommand ( )
Exceptions
ilCtrlException

Definition at line 55 of file class.ilExcCriteriaCatalogueGUI.php.

References $ctrl, $lng, $tabs, and ilLanguage\txt().

55  : void
56  {
57  $ilCtrl = $this->ctrl;
58  $ilTabs = $this->tabs;
59  $lng = $this->lng;
60 
61  $next_class = $ilCtrl->getNextClass($this);
62  $cmd = $ilCtrl->getCmd("view");
63 
64  switch ($next_class) {
65  case "ilexccriteriagui":
66  $ilTabs->clearTargets();
67  $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, ""));
68  $ilCtrl->saveParameter($this, "cat_id");
69  $crit_gui = new ilExcCriteriaGUI($this->request->getCatalogueId());
70  $ilCtrl->forwardCommand($crit_gui);
71  break;
72 
73  default:
74  $this->$cmd();
75  break;
76  }
77  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
Class ilExcCriteriaGUI.
+ Here is the call graph for this function:

◆ exportForm()

ilExcCriteriaCatalogueGUI::exportForm ( ilExcCriteriaCatalogue  $a_cat_obj,
ilPropertyFormGUI  $a_form 
)
protected

Definition at line 213 of file class.ilExcCriteriaCatalogueGUI.php.

References ilPropertyFormGUI\getItemByPostVar(), and ilExcCriteriaCatalogue\getTitle().

Referenced by edit().

216  : void {
217  $a_form->getItemByPostVar("title")->setValue($a_cat_obj->getTitle());
218  }
getItemByPostVar(string $a_post_var)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentCatalogue()

ilExcCriteriaCatalogueGUI::getCurrentCatalogue ( )
protected

Definition at line 256 of file class.ilExcCriteriaCatalogueGUI.php.

References $ctrl, $id, and null.

Referenced by edit(), and update().

257  {
258  $ilCtrl = $this->ctrl;
259 
260  $id = $this->request->getCatalogueId();
261  if ($id > 0) {
262  $cat_obj = new ilExcCriteriaCatalogue($id);
263  if ($cat_obj->getParent() == $this->exc_obj->getId()) {
264  $ilCtrl->setParameter($this, "cat_id", $id);
265  return $cat_obj;
266  }
267  }
268 
269  $ilCtrl->redirect($this, "view");
270 
271  return null;
272  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ importForm()

ilExcCriteriaCatalogueGUI::importForm ( ?ilExcCriteriaCatalogue  $a_cat_obj = null)
protected

Definition at line 220 of file class.ilExcCriteriaCatalogueGUI.php.

References $ctrl, $lng, initForm(), null, and ilLanguage\txt().

Referenced by create(), and update().

222  : void {
223  $ilCtrl = $this->ctrl;
224  $lng = $this->lng;
225 
226  $is_edit = ($a_cat_obj !== null);
227 
228  $form = $this->initForm($a_cat_obj);
229  if ($form->checkInput()) {
230  if (!$is_edit) {
231  $a_cat_obj = new ilExcCriteriaCatalogue();
232  $a_cat_obj->setParent($this->exc_obj->getId());
233  }
234 
235  $a_cat_obj->setTitle($form->getInput("title"));
236 
237  if (!$is_edit) {
238  $a_cat_obj->save();
239  } else {
240  $a_cat_obj->update();
241  }
242 
243  $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
244  $ilCtrl->redirect($this, "view");
245  }
246 
247  $form->setValuesByPost();
248  $this->{$is_edit ? "edit" : "add"}($form);
249  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
initForm(?ilExcCriteriaCatalogue $a_cat_obj=null)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilExcCriteriaCatalogueGUI::initForm ( ?ilExcCriteriaCatalogue  $a_cat_obj = null)
protected

Definition at line 174 of file class.ilExcCriteriaCatalogueGUI.php.

References $ctrl, $lng, null, and ilLanguage\txt().

Referenced by add(), edit(), and importForm().

177  $ilCtrl = $this->ctrl;
178  $lng = $this->lng;
179 
180  $form = new ilPropertyFormGUI();
181 
182  $is_edit = ($a_cat_obj !== null);
183  if (!$is_edit) {
184  $form->setFormAction($ilCtrl->getFormAction($this, "create"));
185  $form->setTitle($lng->txt("exc_criteria_catalogue_create_form"));
186  $form->addCommandButton("create", $lng->txt("create"));
187  } else {
188  $form->setFormAction($ilCtrl->getFormAction($this, "update"));
189  $form->setTitle($lng->txt("exc_criteria_catalogue_update_form"));
190  $form->addCommandButton("update", $lng->txt("save"));
191  }
192 
193  $form->addCommandButton("view", $lng->txt("cancel"));
194 
195  $title = new ilTextInputGUI($lng->txt("title"), "title");
196  $title->setRequired(true);
197  $form->addItem($title);
198 
199  return $form;
200  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveOrder()

ilExcCriteriaCatalogueGUI::saveOrder ( )
protected

Definition at line 100 of file class.ilExcCriteriaCatalogueGUI.php.

References $ctrl, $id, $lng, ilExcCriteriaCatalogue\getInstancesByParentId(), and ilLanguage\txt().

100  : void
101  {
102  $ilCtrl = $this->ctrl;
103  $lng = $this->lng;
104 
105  $all_cat = ilExcCriteriaCatalogue::getInstancesByParentId($this->exc_obj->getId());
106 
107  $pos = 0;
108  $req_positions = $this->request->getPositions();
109  asort($req_positions);
110  foreach (array_keys($req_positions) as $id) {
111  if (array_key_exists($id, $all_cat)) {
112  $pos += 10;
113  $all_cat[$id]->setPosition($pos);
114  $all_cat[$id]->update();
115  }
116  }
117 
118  $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
119  $ilCtrl->redirect($this, "view");
120  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getInstancesByParentId(int $a_parent_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ update()

ilExcCriteriaCatalogueGUI::update ( )
protected

Definition at line 288 of file class.ilExcCriteriaCatalogueGUI.php.

References getCurrentCatalogue(), and importForm().

288  : void
289  {
290  $cat_obj = $this->getCurrentCatalogue();
291  $this->importForm($cat_obj);
292  }
importForm(?ilExcCriteriaCatalogue $a_cat_obj=null)
+ Here is the call graph for this function:

◆ view()

ilExcCriteriaCatalogueGUI::view ( )
protected

Definition at line 84 of file class.ilExcCriteriaCatalogueGUI.php.

References $ctrl, $lng, $toolbar, $tpl, ILIAS\UICore\GlobalTemplate\setContent(), and ilLanguage\txt().

84  : void
85  {
86  $ilToolbar = $this->toolbar;
87  $ilCtrl = $this->ctrl;
88  $lng = $this->lng;
89  $tpl = $this->tpl;
90 
91  $ilToolbar->addButton(
92  $lng->txt("exc_add_criteria_catalogue"),
93  $ilCtrl->getLinkTarget($this, "add")
94  );
95 
96  $tbl = new ilExcCriteriaCatalogueTableGUI($this, "view", $this->exc_obj->getId());
97  $tpl->setContent($tbl->getHTML());
98  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setContent(string $a_html)
Sets content for standard template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilExcCriteriaCatalogueGUI::$ctrl
protected

◆ $exc_obj

ilObjExercise ilExcCriteriaCatalogueGUI::$exc_obj
protected

Definition at line 34 of file class.ilExcCriteriaCatalogueGUI.php.

◆ $lng

ilLanguage ilExcCriteriaCatalogueGUI::$lng
protected

◆ $request

GUIRequest ilExcCriteriaCatalogueGUI::$request
protected

Definition at line 35 of file class.ilExcCriteriaCatalogueGUI.php.

◆ $tabs

ilTabsGUI ilExcCriteriaCatalogueGUI::$tabs
protected

Definition at line 30 of file class.ilExcCriteriaCatalogueGUI.php.

Referenced by executeCommand().

◆ $toolbar

ilToolbarGUI ilExcCriteriaCatalogueGUI::$toolbar
protected

Definition at line 32 of file class.ilExcCriteriaCatalogueGUI.php.

Referenced by view().

◆ $tpl

ilGlobalTemplateInterface ilExcCriteriaCatalogueGUI::$tpl
protected

Definition at line 33 of file class.ilExcCriteriaCatalogueGUI.php.

Referenced by add(), confirmDeletion(), edit(), and view().


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