4 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
33 $this->content_type = $ilObjDataCache->lookupType($this->content_obj->getId());
35 $this->
id = $a_obj_id;
36 $this->ctrl->saveParameter($this,
'obj_id');
46 $ilTabs->setTabActive(
'crs_groupings');
48 $cmd = $this->ctrl->getCmd();
49 if (!
$cmd = $this->ctrl->getCmd())
59 include_once
'./Modules/Course/classes/class.ilObjCourseGrouping.php';
66 return $this->content_type;
73 if(!$ilAccess->checkAccess(
'write',
'',$this->content_obj->getRefId()))
75 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->MESSAGE);
78 $ilToolbar->addButton($this->lng->txt(
'crs_add_grouping'),
79 $this->ctrl->getLinkTarget($this,
'create'));
81 include_once
'Modules/Course/classes/class.ilCourseGroupingTableGUI.php';
84 $tpl->setContent($table->getHTML());
91 if(!$ilAccess->checkAccess(
'write',
'',$this->content_obj->getRefId()))
93 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->MESSAGE);
96 if(!count(
$_POST[
'grouping']))
105 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
107 $cgui->setFormAction($this->ctrl->getFormAction($this));
108 $cgui->setHeaderText($this->lng->txt(
"crs_grouping_delete_sure"));
109 $cgui->setCancel($this->lng->txt(
"cancel"),
"listGroupings");
110 $cgui->setConfirm($this->lng->txt(
"delete"),
"deleteGrouping");
113 foreach(
$_POST[
'grouping'] as $grouping_id)
116 $cgui->addItem(
"grouping[]", $grouping_id, $tmp_obj->getTitle());
119 $tpl->setContent($cgui->getHTML());
126 if(!$ilAccess->checkAccess(
'write',
'',$this->content_obj->getRefId()))
128 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->MESSAGE);
131 foreach(
$_POST[
'grouping'] as $grouping_id)
138 $this->ctrl->redirect($this,
'listGroupings');
145 if(!$ilAccess->checkAccess(
'write',
'',$this->content_obj->getRefId()))
147 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->MESSAGE);
155 $tpl->setContent($a_form->getHTML());
160 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
162 $form->setFormAction($this->ctrl->getFormAction($this));
166 $form->addItem($title);
169 $form->addItem($desc);
171 $options = array(
'login' =>
'login',
173 'matriculation' =>
'matriculation');
175 foreach(
$options as $value => $caption)
177 $options[$value] = $this->lng->txt($caption);
182 $form->addItem($uniq);
186 $form->setTitle($this->lng->txt(
'crs_add_grouping'));
187 $form->addCommandButton(
'add', $this->lng->txt(
'btn_add'));
192 $title->setValue($grouping->getTitle());
193 $desc->setValue($grouping->getDescription());
194 $uniq->setValue($grouping->getUniqueField());
196 $ass =
new ilCustomInputGUI($this->lng->txt(
'groupings_assigned_obj_'.$this->getContentType()));
197 $form->addItem($ass);
201 foreach($grouping->getAssignedItems() as $cond_data)
207 $ass->setHtml(implode(
"<br />", $items));
211 $ass->setHtml($this->lng->txt(
'crs_grp_no_courses_assigned'));
214 $form->setTitle($this->lng->txt(
'edit_grouping'));
215 $form->addCommandButton(
'update', $this->lng->txt(
'save'));
216 $form->addCommandButton(
'selectCourse', $this->lng->txt(
'grouping_change_assignment'));
219 $form->addCommandButton(
'listGroupings', $this->lng->txt(
'cancel'));
227 if($form->checkInput())
229 $this->grp_obj->setTitle($form->getInput(
'title'));
230 $this->grp_obj->setDescription($form->getInput(
'description'));
231 $this->grp_obj->setUniqueField($form->getInput(
'unique'));
233 if($this->grp_obj->create($this->content_obj->getRefId(),$this->content_obj->getId()))
242 $this->ctrl->redirect($this,
'listGroupings');
245 $form->setValuesByPost();
253 if(!$ilAccess->checkAccess(
'write',
'',$this->content_obj->getRefId()))
255 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->MESSAGE);
263 $tpl->setContent($a_form->getHTML());
268 global
$ilErr,$ilAccess,$ilObjDataCache;
270 if(!$ilAccess->checkAccess(
'write',
'',$this->content_obj->getRefId()))
272 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->MESSAGE);
276 if($form->checkInput())
279 $tmp_grouping->setTitle($form->getInput(
'title'));
280 $tmp_grouping->setDescription($form->getInput(
'description'));
281 $tmp_grouping->setUniqueField($form->getInput(
'unique'));
282 $tmp_grouping->update();
285 $this->ctrl->redirect($this,
'listGroupings');
288 $form->setValuesByPost();
296 if(!$ilAccess->checkAccess(
'write',
'',$this->content_obj->getRefId()))
298 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->MESSAGE);
308 $ilTabs->clearTargets();
309 $ilTabs->setBackTarget($this->lng->txt(
'back'),
310 $this->ctrl->getLinkTarget($this,
'edit'));
314 include_once
'Modules/Course/classes/class.ilCourseGroupingAssignmentTableGUI.php';
317 $tpl->setContent($table->getHTML());
326 if(!$ilAccess->checkAccess(
'write',
'',$this->content_obj->getRefId()))
328 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->MESSAGE);
338 include_once
'./Services/AccessControl/classes/class.ilConditionHandler.php';
340 $condh->deleteByObjId((
int)
$_GET[
'obj_id']);
343 $container_ids = is_array(
$_POST[
'crs_ids']) ?
$_POST[
'crs_ids'] : array();
344 foreach($container_ids as $course_ref_id)
348 $tmp_condh->enableAutomaticValidation(
false);
350 $tmp_condh->setTargetRefId($course_ref_id);
351 $tmp_condh->setTargetObjId($tmp_crs->getId());
353 $tmp_condh->setTriggerRefId(0);
354 $tmp_condh->setTriggerObjId($this->
id);
355 $tmp_condh->setTriggerType(
'crsg');
356 $tmp_condh->setOperator(
'not_member');
357 $tmp_condh->setValue($this->grp_obj->getUniqueField());
359 if(!$tmp_condh->checkExists())
361 $tmp_condh->storeCondition();
367 $this->ctrl->redirect($this,
'edit');