ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjCourseGroupingGUI Class Reference

Class ilObjCourseGroupingGUI. More...

+ Collaboration diagram for ilObjCourseGroupingGUI:

Public Member Functions

 __construct ($content_obj, $a_obj_id=0)
 Constructor @access public. More...
 
 executeCommand ()
 
 __initGroupingObject ()
 
 getContentType ()
 
 listGroupings ()
 
 askDeleteGrouping ()
 
 deleteGrouping ()
 
 create ($a_form=null)
 
 initForm ($a_create)
 
 add ()
 
 edit ($a_form=null)
 
 update ()
 
 selectCourse ()
 
 assignCourse ()
 

Data Fields

 $content_obj
 
 $tpl
 
 $ctrl
 
 $lng
 

Detailed Description

Class ilObjCourseGroupingGUI.

Author
your name <your email>
Version
$Id$

Definition at line 13 of file class.ilObjCourseGroupingGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjCourseGroupingGUI::__construct (   $content_obj,
  $a_obj_id = 0 
)

Constructor @access public.

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

25 {
26 global $tpl,$ilCtrl,$lng,$ilObjDataCache;
27
28 $this->tpl = $tpl;
29 $this->ctrl = $ilCtrl;
30 $this->lng = $lng;
31
32 $this->type = "crsg";
33 $this->content_obj = $content_obj;
34 $this->content_type = $ilObjDataCache->lookupType($this->content_obj->getId());
35
36 $this->id = $a_obj_id;
37 $this->ctrl->saveParameter($this, 'obj_id');
38
39 $this->__initGroupingObject();
40 }
global $ilCtrl
Definition: ilias.php:18

References $content_obj, $ilCtrl, $lng, $tpl, and __initGroupingObject().

+ Here is the call graph for this function:

Member Function Documentation

◆ __initGroupingObject()

ilObjCourseGroupingGUI::__initGroupingObject ( )

Definition at line 56 of file class.ilObjCourseGroupingGUI.php.

57 {
58 include_once './Modules/Course/classes/class.ilObjCourseGrouping.php';
59
60 $this->grp_obj = new ilObjCourseGrouping($this->id);
61 }
Class ilObj<module_name>

Referenced by __construct().

+ Here is the caller graph for this function:

◆ add()

ilObjCourseGroupingGUI::add ( )

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

210 {
211 $form = $this->initForm(true);
212 if ($form->checkInput()) {
213 $this->grp_obj->setTitle($form->getInput('title'));
214 $this->grp_obj->setDescription($form->getInput('description'));
215 $this->grp_obj->setUniqueField($form->getInput('unique'));
216
217 if ($this->grp_obj->create($this->content_obj->getRefId(), $this->content_obj->getId())) {
218 ilUtil::sendSuccess($this->lng->txt('crs_grp_added_grouping'), true);
219 } else {
220 ilUtil::sendFailure($this->lng->txt('crs_grp_err_adding_grouping'), true);
221 }
222
223 $this->ctrl->redirect($this, 'listGroupings');
224 }
225
226 $form->setValuesByPost();
227 $this->create($form);
228 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
if(isset($_POST['submit'])) $form

References $form, create(), initForm(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ askDeleteGrouping()

ilObjCourseGroupingGUI::askDeleteGrouping ( )

Definition at line 87 of file class.ilObjCourseGroupingGUI.php.

88 {
89 global $ilErr,$ilAccess,$tpl;
90
91 if (!$ilAccess->checkAccess('write', '', $this->content_obj->getRefId())) {
92 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
93 }
94
95 if (!count($_POST['grouping'])) {
96 ilUtil::sendFailure($this->lng->txt('crs_grouping_select_one'));
97 $this->listGroupings();
98
99 return false;
100 }
101
102 // display confirmation message
103 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
104 $cgui = new ilConfirmationGUI();
105 $cgui->setFormAction($this->ctrl->getFormAction($this));
106 $cgui->setHeaderText($this->lng->txt("crs_grouping_delete_sure"));
107 $cgui->setCancel($this->lng->txt("cancel"), "listGroupings");
108 $cgui->setConfirm($this->lng->txt("delete"), "deleteGrouping");
109
110 // list objects that should be deleted
111 foreach ($_POST['grouping'] as $grouping_id) {
112 $tmp_obj = new ilObjCourseGrouping($grouping_id);
113 $cgui->addItem("grouping[]", $grouping_id, $tmp_obj->getTitle());
114 }
115
116 $tpl->setContent($cgui->getHTML());
117 }
$_POST["username"]
Confirmation screen class.
global $ilErr
Definition: raiseError.php:16

References $_POST, $ilErr, $tpl, listGroupings(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ assignCourse()

ilObjCourseGroupingGUI::assignCourse ( )

Definition at line 299 of file class.ilObjCourseGroupingGUI.php.

300 {
301 global $ilErr,$ilAccess,$ilObjDataCache,$tree,$ilUser;
302
303 if (!$ilAccess->checkAccess('write', '', $this->content_obj->getRefId())) {
304 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
305 }
306
307 if (!$_GET['obj_id']) {
308 $this->listGroupings();
309 return false;
310 }
311
312 // delete all existing conditions
313 include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
314 $condh = new ilConditionHandler();
315 $condh->deleteByObjId((int) $_GET['obj_id']);
316
317 $added = 0;
318 $container_ids = is_array($_POST['crs_ids']) ? $_POST['crs_ids'] : array();
319 foreach ($container_ids as $course_ref_id) {
320 $tmp_crs = ilObjectFactory::getInstanceByRefId($course_ref_id);
321 $tmp_condh = new ilConditionHandler();
322 $tmp_condh->enableAutomaticValidation(false);
323
324 $tmp_condh->setTargetRefId($course_ref_id);
325 $tmp_condh->setTargetObjId($tmp_crs->getId());
326 $tmp_condh->setTargetType($this->getContentType());
327 $tmp_condh->setTriggerRefId(0);
328 $tmp_condh->setTriggerObjId($this->id);
329 $tmp_condh->setTriggerType('crsg');
330 $tmp_condh->setOperator('not_member');
331 $tmp_condh->setValue($this->grp_obj->getUniqueField());
332
333 if (!$tmp_condh->checkExists()) {
334 $tmp_condh->storeCondition();
335 ++$added;
336 }
337 }
338
339 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
340 $this->ctrl->redirect($this, 'edit');
341 }
$_GET["client_id"]
Handles conditions for accesses to different ILIAS objects.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$ilUser
Definition: imgupload.php:18

References $_GET, $_POST, $ilErr, $ilUser, getContentType(), ilObjectFactory\getInstanceByRefId(), listGroupings(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ create()

ilObjCourseGroupingGUI::create (   $a_form = null)

Definition at line 136 of file class.ilObjCourseGroupingGUI.php.

137 {
138 global $ilErr,$ilAccess,$tpl;
139
140 if (!$ilAccess->checkAccess('write', '', $this->content_obj->getRefId())) {
141 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
142 }
143
144 if (!$a_form) {
145 $a_form = $this->initForm(true);
146 }
147
148 $tpl->setContent($a_form->getHTML());
149 }

References $ilErr, $tpl, and initForm().

Referenced by add().

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

◆ deleteGrouping()

ilObjCourseGroupingGUI::deleteGrouping ( )

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

120 {
121 global $ilErr,$ilAccess;
122
123 if (!$ilAccess->checkAccess('write', '', $this->content_obj->getRefId())) {
124 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
125 }
126
127 foreach ($_POST['grouping'] as $grouping_id) {
128 $tmp_obj = new ilObjCourseGrouping((int) $grouping_id);
129 $tmp_obj->delete();
130 }
131
132 ilUtil::sendSuccess($this->lng->txt('crs_grouping_deleted'), true);
133 $this->ctrl->redirect($this, 'listGroupings');
134 }

References $_POST, $ilErr, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ edit()

ilObjCourseGroupingGUI::edit (   $a_form = null)

Definition at line 230 of file class.ilObjCourseGroupingGUI.php.

231 {
232 global $ilErr,$ilAccess,$tpl;
233
234 if (!$ilAccess->checkAccess('write', '', $this->content_obj->getRefId())) {
235 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
236 }
237
238 if (!$a_form) {
239 $a_form = $this->initForm(false);
240 }
241
242 $tpl->setContent($a_form->getHTML());
243 }

References $ilErr, $tpl, and initForm().

Referenced by update().

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

◆ executeCommand()

ilObjCourseGroupingGUI::executeCommand ( )

Definition at line 42 of file class.ilObjCourseGroupingGUI.php.

43 {
44 global $ilTabs;
45
46 $ilTabs->setTabActive('crs_groupings');
47
48 $cmd = $this->ctrl->getCmd();
49 if (!$cmd = $this->ctrl->getCmd()) {
50 $cmd = "edit";
51 }
52 $this->$cmd();
53 }

◆ getContentType()

ilObjCourseGroupingGUI::getContentType ( )

Definition at line 63 of file class.ilObjCourseGroupingGUI.php.

64 {
65 return $this->content_type;
66 }

Referenced by assignCourse().

+ Here is the caller graph for this function:

◆ initForm()

ilObjCourseGroupingGUI::initForm (   $a_create)

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

152 {
153 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
154 $form = new ilPropertyFormGUI();
155 $form->setFormAction($this->ctrl->getFormAction($this));
156
157 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
158 $title->setRequired(true);
159 $form->addItem($title);
160
161 $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
162 $form->addItem($desc);
163
164 $options = array('login' => 'login',
165 'email' => 'email',
166 'matriculation' => 'matriculation');
167
168 foreach ($options as $value => $caption) {
169 $options[$value] = $this->lng->txt($caption);
170 }
171 $uniq = new ilSelectInputGUI($this->lng->txt('unambiguousness'), 'unique');
172 $uniq->setRequired(true);
173 $uniq->setOptions($options);
174 $form->addItem($uniq);
175
176 if ($a_create) {
177 $form->setTitle($this->lng->txt('crs_add_grouping'));
178 $form->addCommandButton('add', $this->lng->txt('btn_add'));
179 } else {
180 $grouping = new ilObjCourseGrouping($_REQUEST['obj_id']);
181 $title->setValue($grouping->getTitle());
182 $desc->setValue($grouping->getDescription());
183 $uniq->setValue($grouping->getUniqueField());
184
185 $ass = new ilCustomInputGUI($this->lng->txt('groupings_assigned_obj_' . $this->getContentType()));
186 $form->addItem($ass);
187
188 // assignments
189 $items = array();
190 foreach ($grouping->getAssignedItems() as $cond_data) {
191 $items[] = ilObject::_lookupTitle($cond_data['target_obj_id']);
192 }
193 if (count($items)) {
194 $ass->setHtml(implode("<br />", $items));
195 } else {
196 $ass->setHtml($this->lng->txt('crs_grp_no_courses_assigned'));
197 }
198
199 $form->setTitle($this->lng->txt('edit_grouping'));
200 $form->addCommandButton('update', $this->lng->txt('save'));
201 $form->addCommandButton('selectCourse', $this->lng->txt('grouping_change_assignment'));
202 }
203
204 $form->addCommandButton('listGroupings', $this->lng->txt('cancel'));
205
206 return $form;
207 }
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
This class represents a custom property in a property form.
static _lookupTitle($a_id)
lookup object title
This class represents a property form user interface.
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.

References $form, $options, $title, and ilObject\_lookupTitle().

Referenced by add(), create(), edit(), and update().

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

◆ listGroupings()

ilObjCourseGroupingGUI::listGroupings ( )

Definition at line 68 of file class.ilObjCourseGroupingGUI.php.

69 {
70 global $ilErr, $ilAccess, $ilToolbar, $tpl;
71
72 if (!$ilAccess->checkAccess('write', '', $this->content_obj->getRefId())) {
73 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
74 }
75
76 $ilToolbar->addButton(
77 $this->lng->txt('crs_add_grouping'),
78 $this->ctrl->getLinkTarget($this, 'create')
79 );
80
81 include_once 'Modules/Course/classes/class.ilCourseGroupingTableGUI.php';
82 $table = new ilCourseGroupingTableGUI($this, 'listGroupings', $this->content_obj);
83
84 $tpl->setContent($table->getHTML());
85 }
if(empty($password)) $table
Definition: pwgen.php:24

References $ilErr, $table, and $tpl.

Referenced by askDeleteGrouping(), assignCourse(), and selectCourse().

+ Here is the caller graph for this function:

◆ selectCourse()

ilObjCourseGroupingGUI::selectCourse ( )

Definition at line 269 of file class.ilObjCourseGroupingGUI.php.

270 {
271 global $ilErr,$ilAccess,$tpl,$ilTabs;
272
273 if (!$ilAccess->checkAccess('write', '', $this->content_obj->getRefId())) {
274 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
275 }
276
277 if (!$_GET['obj_id']) {
278 ilUtil::sendFailure($this->lng->txt('crs_grp_no_grouping_id_given'));
279 $this->listGroupings();
280 return false;
281 }
282
283 $ilTabs->clearTargets();
284 $ilTabs->setBackTarget(
285 $this->lng->txt('back'),
286 $this->ctrl->getLinkTarget($this, 'edit')
287 );
288
289 $tmp_grouping = new ilObjCourseGrouping((int) $_GET['obj_id']);
290
291 include_once 'Modules/Course/classes/class.ilCourseGroupingAssignmentTableGUI.php';
292 $table = new ilCourseGroupingAssignmentTableGUI($this, 'selectCourse', $this->content_obj, $tmp_grouping);
293
294 $tpl->setContent($table->getHTML());
295
296 return true;
297 }

References $_GET, $ilErr, $table, $tpl, listGroupings(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ update()

ilObjCourseGroupingGUI::update ( )

Definition at line 245 of file class.ilObjCourseGroupingGUI.php.

246 {
247 global $ilErr,$ilAccess,$ilObjDataCache;
248
249 if (!$ilAccess->checkAccess('write', '', $this->content_obj->getRefId())) {
250 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
251 }
252
253 $form = $this->initForm(false);
254 if ($form->checkInput()) {
255 $tmp_grouping = new ilObjCourseGrouping($_REQUEST['obj_id']);
256 $tmp_grouping->setTitle($form->getInput('title'));
257 $tmp_grouping->setDescription($form->getInput('description'));
258 $tmp_grouping->setUniqueField($form->getInput('unique'));
259 $tmp_grouping->update();
260
261 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
262 $this->ctrl->redirect($this, 'listGroupings');
263 }
264
265 $form->setValuesByPost();
266 $this->edit($form);
267 }

References $form, $ilErr, edit(), initForm(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

Field Documentation

◆ $content_obj

ilObjCourseGroupingGUI::$content_obj

Definition at line 15 of file class.ilObjCourseGroupingGUI.php.

Referenced by __construct().

◆ $ctrl

ilObjCourseGroupingGUI::$ctrl

Definition at line 17 of file class.ilObjCourseGroupingGUI.php.

◆ $lng

ilObjCourseGroupingGUI::$lng

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

Referenced by __construct().

◆ $tpl

ilObjCourseGroupingGUI::$tpl

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