ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilExcCriteriaCatalogueGUI Class Reference

Class ilExcCriteriaCatalogueGUI. More...

+ Collaboration diagram for ilExcCriteriaCatalogueGUI:

Public Member Functions

 __construct (ilObjExercise $a_exc_obj)
 
 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

 $ctrl
 
 $tabs
 
 $lng
 
 $toolbar
 
 $tpl
 
 $exc_obj
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExcCriteriaCatalogueGUI::__construct ( ilObjExercise  $a_exc_obj)

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

42 {
43 global $DIC;
44
45 $this->ctrl = $DIC->ctrl();
46 $this->tabs = $DIC->tabs();
47 $this->lng = $DIC->language();
48 $this->toolbar = $DIC->toolbar();
49 $this->tpl = $DIC["tpl"];
50 $this->exc_obj = $a_exc_obj;
51 }
$DIC
Definition: xapitoken.php:46

References $DIC.

Member Function Documentation

◆ add()

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

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

199 {
201
202 if (!$a_form) {
203 $a_form = $this->initForm();
204 }
205
206 $tpl->setContent($a_form->getHTML());
207 }
initForm(ilExcCriteriaCatalogue $a_cat_obj=null)

References $tpl, and initForm().

+ Here is the call graph for this function:

◆ confirmDeletion()

ilExcCriteriaCatalogueGUI::confirmDeletion ( )
protected

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

120 {
124
125 $ids = $_POST["id"];
126 if (!sizeof($ids)) {
127 ilUtil::sendInfo($lng->txt("select_one"), true);
128 $ilCtrl->redirect($this, "view");
129 }
130
131 $confirmation_gui = new ilConfirmationGUI();
132 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this, "delete"));
133 $confirmation_gui->setHeaderText($lng->txt("exc_criteria_catalogue_deletion_confirmation"));
134 $confirmation_gui->setCancel($lng->txt("cancel"), "view");
135 $confirmation_gui->setConfirm($lng->txt("delete"), "delete");
136
137 foreach (ilExcCriteriaCatalogue::getInstancesByParentId($this->exc_obj->getId()) as $item) {
138 if (in_array($item->getId(), $ids)) {
139 $confirmation_gui->addItem("id[]", $item->getId(), $item->getTitle());
140 }
141 }
142
143 $tpl->setContent($confirmation_gui->getHTML());
144 }
$_POST["username"]
Confirmation screen class.
static getInstancesByParentId($a_parent_id)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $ilCtrl
Definition: ilias.php:18

References $_POST, $ctrl, $ilCtrl, $lng, $tpl, ilExcCriteriaCatalogue\getInstancesByParentId(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ create()

ilExcCriteriaCatalogueGUI::create ( )
protected

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

245 {
246 $this->importForm();
247 }
importForm(ilExcCriteriaCatalogue $a_cat_obj=null)

References importForm().

+ Here is the call graph for this function:

◆ delete()

ilExcCriteriaCatalogueGUI::delete ( )
protected

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

147 {
150
151 $ids = $_POST["id"];
152 if (!sizeof($ids)) {
153 $ilCtrl->redirect($this, "view");
154 }
155
156 foreach (ilExcCriteriaCatalogue::getInstancesByParentId($this->exc_obj->getId()) as $item) {
157 if (in_array($item->getId(), $ids)) {
158 $item->delete();
159 }
160 }
161
162 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
163 $ilCtrl->redirect($this, "view");
164 }

References $_POST, $ctrl, $ilCtrl, $lng, and ilExcCriteriaCatalogue\getInstancesByParentId().

+ Here is the call graph for this function:

◆ edit()

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

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

266 {
268
269 $cat_obj = $this->getCurrentCatalogue();
270
271 if (!$a_form) {
272 $a_form = $this->initForm($cat_obj);
273 $this->exportForm($cat_obj, $a_form);
274 }
275
276 $tpl->setContent($a_form->getHTML());
277 }
exportForm(ilExcCriteriaCatalogue $a_cat_obj, ilPropertyFormGUI $a_form)

References $tpl, exportForm(), getCurrentCatalogue(), and initForm().

+ Here is the call graph for this function:

◆ executeCommand()

ilExcCriteriaCatalogueGUI::executeCommand ( )

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

54 {
56 $ilTabs = $this->tabs;
58
59 $next_class = $ilCtrl->getNextClass($this);
60 $cmd = $ilCtrl->getCmd("view");
61
62 switch ($next_class) {
63 case "ilexccriteriagui":
64 $ilTabs->clearTargets();
65 $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, ""));
66 $ilCtrl->saveParameter($this, "cat_id");
67 $crit_gui = new ilExcCriteriaGUI($_REQUEST["cat_id"]);
68 $ilCtrl->forwardCommand($crit_gui);
69 break;
70
71 default:
72 $this->$cmd();
73 break;
74 }
75 }
Class ilExcCriteriaGUI.

References $ctrl, $ilCtrl, $lng, and $tabs.

◆ exportForm()

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

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

210 {
211 $a_form->getItemByPostVar("title")->setValue($a_cat_obj->getTitle());
212 }
getItemByPostVar($a_post_var)
Get Item by POST variable.

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

Referenced by edit().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentCatalogue()

ilExcCriteriaCatalogueGUI::getCurrentCatalogue ( )
protected

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

250 {
252
253 $id = (int) $_REQUEST["cat_id"];
254 if ($id) {
255 $cat_obj = new ilExcCriteriaCatalogue($id);
256 if ($cat_obj->getParent() == $this->exc_obj->getId()) {
257 $ilCtrl->setParameter($this, "cat_id", $id);
258 return $cat_obj;
259 }
260 }
261
262 $ilCtrl->redirect($this, "view");
263 }
Class ilExcCriteriaCatalogue.

References $ctrl, and $ilCtrl.

Referenced by edit(), and update().

+ Here is the caller graph for this function:

◆ importForm()

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

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

215 {
218
219 $is_edit = ($a_cat_obj !== null);
220
221 $form = $this->initForm($a_cat_obj);
222 if ($form->checkInput()) {
223 if (!$is_edit) {
224 $a_cat_obj = new ilExcCriteriaCatalogue();
225 $a_cat_obj->setParent($this->exc_obj->getId());
226 }
227
228 $a_cat_obj->setTitle($form->getInput("title"));
229
230 if (!$is_edit) {
231 $a_cat_obj->save();
232 } else {
233 $a_cat_obj->update();
234 }
235
236 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
237 $ilCtrl->redirect($this, "view");
238 }
239
240 $form->setValuesByPost();
241 $this->{$is_edit ? "edit" : "add"}($form);
242 }

References $ctrl, $ilCtrl, $lng, and initForm().

Referenced by create(), and update().

+ 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 171 of file class.ilExcCriteriaCatalogueGUI.php.

172 {
175
176 $form = new ilPropertyFormGUI();
177
178 $is_edit = ($a_cat_obj !== null);
179 if (!$is_edit) {
180 $form->setFormAction($ilCtrl->getFormAction($this, "create"));
181 $form->setTitle($lng->txt("exc_criteria_catalogue_create_form"));
182 $form->addCommandButton("create", $lng->txt("create"));
183 } else {
184 $form->setFormAction($ilCtrl->getFormAction($this, "update"));
185 $form->setTitle($lng->txt("exc_criteria_catalogue_update_form"));
186 $form->addCommandButton("update", $lng->txt("save"));
187 }
188
189 $form->addCommandButton("view", $lng->txt("cancel"));
190
191 $title = new ilTextInputGUI($lng->txt("title"), "title");
192 $title->setRequired(true);
193 $form->addItem($title);
194
195 return $form;
196 }
This class represents a property form user interface.
This class represents a text property in a property form.

References $ctrl, $ilCtrl, and $lng.

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

+ Here is the caller graph for this function:

◆ saveOrder()

ilExcCriteriaCatalogueGUI::saveOrder ( )
protected

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

99 {
102
103 $all_cat = ilExcCriteriaCatalogue::getInstancesByParentId($this->exc_obj->getId());
104
105 $pos = 0;
106 asort($_POST["pos"]);
107 foreach (array_keys($_POST["pos"]) as $id) {
108 if (array_key_exists($id, $all_cat)) {
109 $pos += 10;
110 $all_cat[$id]->setPosition($pos);
111 $all_cat[$id]->update();
112 }
113 }
114
115 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
116 $ilCtrl->redirect($this, "view");
117 }

References $_POST, $ctrl, $ilCtrl, $lng, and ilExcCriteriaCatalogue\getInstancesByParentId().

+ Here is the call graph for this function:

◆ update()

ilExcCriteriaCatalogueGUI::update ( )
protected

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

280 {
281 $cat_obj = $this->getCurrentCatalogue();
282 $this->importForm($cat_obj);
283 }

References getCurrentCatalogue(), and importForm().

+ Here is the call graph for this function:

◆ view()

ilExcCriteriaCatalogueGUI::view ( )
protected

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

83 {
84 $ilToolbar = $this->toolbar;
88
89 $ilToolbar->addButton(
90 $lng->txt("exc_add_criteria_catalogue"),
91 $ilCtrl->getLinkTarget($this, "add")
92 );
93
94 $tbl = new ilExcCriteriaCatalogueTableGUI($this, "view", $this->exc_obj->getId());
95 $tpl->setContent($tbl->getHTML());
96 }
Class ilExcCriteriaCatalogueTableGUI.

References $ctrl, $ilCtrl, $lng, $toolbar, and $tpl.

Field Documentation

◆ $ctrl

ilExcCriteriaCatalogueGUI::$ctrl
protected

◆ $exc_obj

ilExcCriteriaCatalogueGUI::$exc_obj
protected

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

◆ $lng

ilExcCriteriaCatalogueGUI::$lng
protected

◆ $tabs

ilExcCriteriaCatalogueGUI::$tabs
protected

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

Referenced by executeCommand().

◆ $toolbar

ilExcCriteriaCatalogueGUI::$toolbar
protected

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

Referenced by view().

◆ $tpl

ilExcCriteriaCatalogueGUI::$tpl
protected

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

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


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