ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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

 $exc_obj
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExcCriteriaCatalogueGUI::__construct ( ilObjExercise  $a_exc_obj)

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

19 {
20 $this->exc_obj = $a_exc_obj;
21 }

Member Function Documentation

◆ add()

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

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

173 {
174 global $tpl;
175
176 if(!$a_form)
177 {
178 $a_form = $this->initForm();
179 }
180
181 $tpl->setContent($a_form->getHTML());
182 }
global $tpl
Definition: ilias.php:8
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 86 of file class.ilExcCriteriaCatalogueGUI.php.

87 {
88 global $ilCtrl, $lng, $tpl;
89
90 $ids = $_POST["id"];
91 if(!sizeof($ids))
92 {
93 ilUtil::sendInfo($lng->txt("select_one"), true);
94 $ilCtrl->redirect($this, "view");
95 }
96
97 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
98 $confirmation_gui = new ilConfirmationGUI();
99 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this, "delete"));
100 $confirmation_gui->setHeaderText($lng->txt("exc_criteria_catalogue_deletion_confirmation"));
101 $confirmation_gui->setCancel($lng->txt("cancel"), "view");
102 $confirmation_gui->setConfirm($lng->txt("delete"), "delete");
103
104 foreach(ilExcCriteriaCatalogue::getInstancesByParentId($this->exc_obj->getId()) as $item)
105 {
106 if(in_array($item->getId(), $ids))
107 {
108 $confirmation_gui->addItem("id[]", $item->getId(), $item->getTitle());
109 }
110 }
111
112 $tpl->setContent($confirmation_gui->getHTML());
113 }
Confirmation screen class.
static getInstancesByParentId($a_parent_id)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40

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

+ Here is the call graph for this function:

◆ create()

ilExcCriteriaCatalogueGUI::create ( )
protected

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

224 {
225 $this->importForm();
226 }
importForm(ilExcCriteriaCatalogue $a_cat_obj=null)

References importForm().

+ Here is the call graph for this function:

◆ delete()

ilExcCriteriaCatalogueGUI::delete ( )
protected

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

116 {
117 global $ilCtrl, $lng;
118
119 $ids = $_POST["id"];
120 if(!sizeof($ids))
121 {
122 $ilCtrl->redirect($this, "view");
123 }
124
125 foreach(ilExcCriteriaCatalogue::getInstancesByParentId($this->exc_obj->getId()) as $item)
126 {
127 if(in_array($item->getId(), $ids))
128 {
129 $item->delete();
130 }
131 }
132
133 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
134 $ilCtrl->redirect($this, "view");
135 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

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

+ Here is the call graph for this function:

◆ edit()

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

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

247 {
248 global $tpl;
249
250 $cat_obj = $this->getCurrentCatalogue();
251
252 if(!$a_form)
253 {
254 $a_form = $this->initForm($cat_obj);
255 $this->exportForm($cat_obj, $a_form);
256 }
257
258 $tpl->setContent($a_form->getHTML());
259 }
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 23 of file class.ilExcCriteriaCatalogueGUI.php.

24 {
25 global $ilCtrl, $ilTabs, $lng;
26
27 $next_class = $ilCtrl->getNextClass($this);
28 $cmd = $ilCtrl->getCmd("view");
29
30 switch($next_class)
31 {
32 case "ilexccriteriagui":
33 $ilTabs->clearTargets();
34 $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, ""));
35 $ilCtrl->saveParameter($this, "cat_id");
36 include_once "Modules/Exercise/classes/class.ilExcCriteriaGUI.php";
37 $crit_gui = new ilExcCriteriaGUI($_REQUEST["cat_id"]);
38 $ilCtrl->forwardCommand($crit_gui);
39 break;
40
41 default:
42 $this->$cmd();
43 break;
44 }
45 }
Class ilExcCriteriaGUI.
$cmd
Definition: sahs_server.php:35
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

References $_REQUEST, $cmd, $ilCtrl, and $lng.

◆ exportForm()

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

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

185 {
186 $a_form->getItemByPostVar("title")->setValue($a_cat_obj->getTitle());
187 }
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 228 of file class.ilExcCriteriaCatalogueGUI.php.

229 {
230 global $ilCtrl;
231
232 $id = (int)$_REQUEST["cat_id"];
233 if($id)
234 {
235 $cat_obj = new ilExcCriteriaCatalogue($id);
236 if($cat_obj->getParent() == $this->exc_obj->getId())
237 {
238 $ilCtrl->setParameter($this, "cat_id", $id);
239 return $cat_obj;
240 }
241 }
242
243 $ilCtrl->redirect($this, "view");
244 }
Class ilExcCriteriaCatalogue.

References $_REQUEST, 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 189 of file class.ilExcCriteriaCatalogueGUI.php.

190 {
191 global $ilCtrl, $lng;
192
193 $is_edit = ($a_cat_obj !== null);
194
195 $form = $this->initForm($a_cat_obj);
196 if($form->checkInput())
197 {
198 if(!$is_edit)
199 {
200 $a_cat_obj = new ilExcCriteriaCatalogue();
201 $a_cat_obj->setParent($this->exc_obj->getId());
202 }
203
204 $a_cat_obj->setTitle($form->getInput("title"));
205
206 if(!$is_edit)
207 {
208 $a_cat_obj->save();
209 }
210 else
211 {
212 $a_cat_obj->update();
213 }
214
215 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
216 $ilCtrl->redirect($this, "view");
217 }
218
219 $form->setValuesByPost();
220 $this->{$is_edit ? "edit" : "add"}($form);
221 }

References $ilCtrl, $lng, initForm(), and ilUtil\sendSuccess().

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

143 {
144 global $ilCtrl, $lng;
145
146 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
147 $form = new ilPropertyFormGUI();
148
149 $is_edit = ($a_cat_obj !== null);
150 if(!$is_edit)
151 {
152 $form->setFormAction($ilCtrl->getFormAction($this, "create"));
153 $form->setTitle($lng->txt("exc_criteria_catalogue_create_form"));
154 $form->addCommandButton("create", $lng->txt("create"));
155 }
156 else
157 {
158 $form->setFormAction($ilCtrl->getFormAction($this, "update"));
159 $form->setTitle($lng->txt("exc_criteria_catalogue_update_form"));
160 $form->addCommandButton("update", $lng->txt("save"));
161 }
162
163 $form->addCommandButton("view", $lng->txt("cancel"));
164
165 $title = new ilTextInputGUI($lng->txt("title"), "title");
166 $title->setRequired(true);
167 $form->addItem($title);
168
169 return $form;
170 }
This class represents a property form user interface.
This class represents a text property in a property form.

References $ilCtrl, and $lng.

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

+ Here is the caller graph for this function:

◆ saveOrder()

ilExcCriteriaCatalogueGUI::saveOrder ( )
protected

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

65 {
66 global $ilCtrl, $lng;
67
68 $all_cat = ilExcCriteriaCatalogue::getInstancesByParentId($this->exc_obj->getId());
69
70 $pos = 0;
71 asort($_POST["pos"]);
72 foreach(array_keys($_POST["pos"]) as $id)
73 {
74 if(array_key_exists($id, $all_cat))
75 {
76 $pos += 10;
77 $all_cat[$id]->setPosition($pos);
78 $all_cat[$id]->update();
79 }
80 }
81
82 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
83 $ilCtrl->redirect($this, "view");
84 }

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

+ Here is the call graph for this function:

◆ update()

ilExcCriteriaCatalogueGUI::update ( )
protected

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

262 {
263 $cat_obj = $this->getCurrentCatalogue();
264 $this->importForm($cat_obj);
265 }

References getCurrentCatalogue(), and importForm().

+ Here is the call graph for this function:

◆ view()

ilExcCriteriaCatalogueGUI::view ( )
protected

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

53 {
54 global $ilToolbar, $ilCtrl, $lng, $tpl;
55
56 $ilToolbar->addButton($lng->txt("exc_add_criteria_catalogue"),
57 $ilCtrl->getLinkTarget($this, "add"));
58
59 include_once "Modules/Exercise/classes/class.ilExcCriteriaCatalogueTableGUI.php";
60 $tbl = new ilExcCriteriaCatalogueTableGUI($this, "view", $this->exc_obj->getId());
61 $tpl->setContent($tbl->getHTML());
62 }
Class ilExcCriteriaCatalogueTableGUI.
$tbl
Definition: example_048.php:81

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

Field Documentation

◆ $exc_obj

ilExcCriteriaCatalogueGUI::$exc_obj
protected

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


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