ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 43 of file class.ilExcCriteriaCatalogueGUI.php.

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

References $DIC.

Member Function Documentation

◆ add()

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

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

205 {
207
208 if (!$a_form) {
209 $a_form = $this->initForm();
210 }
211
212 $tpl->setContent($a_form->getHTML());
213 }
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 123 of file class.ilExcCriteriaCatalogueGUI.php.

124 {
128
129 $ids = $_POST["id"];
130 if (!sizeof($ids)) {
131 ilUtil::sendInfo($lng->txt("select_one"), true);
132 $ilCtrl->redirect($this, "view");
133 }
134
135 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
136 $confirmation_gui = new ilConfirmationGUI();
137 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this, "delete"));
138 $confirmation_gui->setHeaderText($lng->txt("exc_criteria_catalogue_deletion_confirmation"));
139 $confirmation_gui->setCancel($lng->txt("cancel"), "view");
140 $confirmation_gui->setConfirm($lng->txt("delete"), "delete");
141
142 foreach (ilExcCriteriaCatalogue::getInstancesByParentId($this->exc_obj->getId()) as $item) {
143 if (in_array($item->getId(), $ids)) {
144 $confirmation_gui->addItem("id[]", $item->getId(), $item->getTitle());
145 }
146 }
147
148 $tpl->setContent($confirmation_gui->getHTML());
149 }
$_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 250 of file class.ilExcCriteriaCatalogueGUI.php.

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

References importForm().

+ Here is the call graph for this function:

◆ delete()

ilExcCriteriaCatalogueGUI::delete ( )
protected

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

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

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

272 {
274
275 $cat_obj = $this->getCurrentCatalogue();
276
277 if (!$a_form) {
278 $a_form = $this->initForm($cat_obj);
279 $this->exportForm($cat_obj, $a_form);
280 }
281
282 $tpl->setContent($a_form->getHTML());
283 }
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 55 of file class.ilExcCriteriaCatalogueGUI.php.

56 {
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 include_once "Modules/Exercise/classes/class.ilExcCriteriaGUI.php";
70 $crit_gui = new ilExcCriteriaGUI($_REQUEST["cat_id"]);
71 $ilCtrl->forwardCommand($crit_gui);
72 break;
73
74 default:
75 $this->$cmd();
76 break;
77 }
78 }
Class ilExcCriteriaGUI.

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

◆ exportForm()

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

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

216 {
217 $a_form->getItemByPostVar("title")->setValue($a_cat_obj->getTitle());
218 }
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 255 of file class.ilExcCriteriaCatalogueGUI.php.

256 {
258
259 $id = (int) $_REQUEST["cat_id"];
260 if ($id) {
261 $cat_obj = new ilExcCriteriaCatalogue($id);
262 if ($cat_obj->getParent() == $this->exc_obj->getId()) {
263 $ilCtrl->setParameter($this, "cat_id", $id);
264 return $cat_obj;
265 }
266 }
267
268 $ilCtrl->redirect($this, "view");
269 }
Class ilExcCriteriaCatalogue.
if(!array_key_exists('StateId', $_REQUEST)) $id

References $ctrl, $id, 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 220 of file class.ilExcCriteriaCatalogueGUI.php.

221 {
224
225 $is_edit = ($a_cat_obj !== null);
226
227 $form = $this->initForm($a_cat_obj);
228 if ($form->checkInput()) {
229 if (!$is_edit) {
230 $a_cat_obj = new ilExcCriteriaCatalogue();
231 $a_cat_obj->setParent($this->exc_obj->getId());
232 }
233
234 $a_cat_obj->setTitle($form->getInput("title"));
235
236 if (!$is_edit) {
237 $a_cat_obj->save();
238 } else {
239 $a_cat_obj->update();
240 }
241
242 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
243 $ilCtrl->redirect($this, "view");
244 }
245
246 $form->setValuesByPost();
247 $this->{$is_edit ? "edit" : "add"}($form);
248 }
if(isset($_POST['submit'])) $form

References $ctrl, $form, $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 176 of file class.ilExcCriteriaCatalogueGUI.php.

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

References $ctrl, $form, $ilCtrl, $lng, and $title.

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

+ Here is the caller graph for this function:

◆ saveOrder()

ilExcCriteriaCatalogueGUI::saveOrder ( )
protected

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

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

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

+ Here is the call graph for this function:

◆ update()

ilExcCriteriaCatalogueGUI::update ( )
protected

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

286 {
287 $cat_obj = $this->getCurrentCatalogue();
288 $this->importForm($cat_obj);
289 }

References getCurrentCatalogue(), and importForm().

+ Here is the call graph for this function:

◆ view()

ilExcCriteriaCatalogueGUI::view ( )
protected

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

86 {
87 $ilToolbar = $this->toolbar;
91
92 $ilToolbar->addButton(
93 $lng->txt("exc_add_criteria_catalogue"),
94 $ilCtrl->getLinkTarget($this, "add")
95 );
96
97 include_once "Modules/Exercise/classes/class.ilExcCriteriaCatalogueTableGUI.php";
98 $tbl = new ilExcCriteriaCatalogueTableGUI($this, "view", $this->exc_obj->getId());
99 $tpl->setContent($tbl->getHTML());
100 }
Class ilExcCriteriaCatalogueTableGUI.
$tbl
Definition: example_048.php:81

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

Field Documentation

◆ $ctrl

ilExcCriteriaCatalogueGUI::$ctrl
protected

◆ $exc_obj

ilExcCriteriaCatalogueGUI::$exc_obj
protected

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

◆ $lng

ilExcCriteriaCatalogueGUI::$lng
protected

◆ $tabs

ilExcCriteriaCatalogueGUI::$tabs
protected

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

Referenced by executeCommand().

◆ $toolbar

ilExcCriteriaCatalogueGUI::$toolbar
protected

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

Referenced by view().

◆ $tpl

ilExcCriteriaCatalogueGUI::$tpl
protected

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

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


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