ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

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

References ILIAS\UICore\GlobalTemplate\setContent().

+ Here is the call graph for this function:

◆ confirmDeletion()

ilExcCriteriaCatalogueGUI::confirmDeletion ( )
protected

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

122 : void
123 {
124 $ilCtrl = $this->ctrl;
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 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstancesByParentId(int $a_parent_id)
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...
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.

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

+ Here is the call graph for this function:

◆ create()

ilExcCriteriaCatalogueGUI::create ( )
protected

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

251 : void
252 {
253 $this->importForm();
254 }
importForm(?ilExcCriteriaCatalogue $a_cat_obj=null)

◆ delete()

ilExcCriteriaCatalogueGUI::delete ( )
protected

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

149 : void
150 {
151 $ilCtrl = $this->ctrl;
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 }

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

+ 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.

274 : void
275 {
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 }
exportForm(ilExcCriteriaCatalogue $a_cat_obj, ilPropertyFormGUI $a_form)

References ILIAS\UICore\GlobalTemplate\setContent().

+ Here is the call graph for this function:

◆ executeCommand()

ilExcCriteriaCatalogueGUI::executeCommand ( )
Exceptions
ilCtrlException

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

55 : void
56 {
57 $ilCtrl = $this->ctrl;
58 $ilTabs = $this->tabs;
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 }
Class ilExcCriteriaGUI.

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

+ 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.

216 : void {
217 $a_form->getItemByPostVar("title")->setValue($a_cat_obj->getTitle());
218 }
getItemByPostVar(string $a_post_var)

◆ getCurrentCatalogue()

ilExcCriteriaCatalogueGUI::getCurrentCatalogue ( )
protected

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

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 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $id.

◆ importForm()

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

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

222 : void {
223 $ilCtrl = $this->ctrl;
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 }

◆ initForm()

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

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

177 $ilCtrl = $this->ctrl;
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 }
This class represents a property form user interface.
This class represents a text property in a property form.

◆ saveOrder()

ilExcCriteriaCatalogueGUI::saveOrder ( )
protected

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

100 : void
101 {
102 $ilCtrl = $this->ctrl;
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 }

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

+ Here is the call graph for this function:

◆ update()

ilExcCriteriaCatalogueGUI::update ( )
protected

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

288 : void
289 {
290 $cat_obj = $this->getCurrentCatalogue();
291 $this->importForm($cat_obj);
292 }

◆ view()

ilExcCriteriaCatalogueGUI::view ( )
protected

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

84 : void
85 {
86 $ilToolbar = $this->toolbar;
87 $ilCtrl = $this->ctrl;
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 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ 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 confirmDeletion(), and view().


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