4 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
31 $ilObjDataCache = $DIC[
'ilObjDataCache'];
39 $this->content_type = $ilObjDataCache->lookupType($this->content_obj->getId());
41 $this->
id = $a_obj_id;
42 $this->ctrl->saveParameter($this,
'obj_id');
51 $ilTabs = $DIC[
'ilTabs'];
53 $ilTabs->setTabActive(
'crs_groupings');
55 $cmd = $this->ctrl->getCmd();
56 if (!$cmd = $this->ctrl->getCmd()) {
65 include_once
'./Modules/Course/classes/class.ilObjCourseGrouping.php';
72 return $this->content_type;
80 $ilAccess = $DIC[
'ilAccess'];
81 $ilToolbar = $DIC[
'ilToolbar'];
84 if (!$ilAccess->checkAccess(
'write',
'', $this->content_obj->getRefId())) {
85 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
88 $ilToolbar->addButton(
89 $this->lng->txt(
'crs_add_grouping'),
90 $this->ctrl->getLinkTarget($this,
'create')
93 include_once
'Modules/Course/classes/class.ilCourseGroupingTableGUI.php';
104 $ilAccess = $DIC[
'ilAccess'];
107 if (!$ilAccess->checkAccess(
'write',
'', $this->content_obj->getRefId())) {
108 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
111 if (empty(
$_POST[
'grouping'])) {
119 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
121 $cgui->setFormAction($this->ctrl->getFormAction($this));
122 $cgui->setHeaderText($this->lng->txt(
"crs_grouping_delete_sure"));
123 $cgui->setCancel($this->lng->txt(
"cancel"),
"listGroupings");
124 $cgui->setConfirm($this->lng->txt(
"delete"),
"deleteGrouping");
127 foreach (
$_POST[
'grouping'] as $grouping_id) {
129 $cgui->addItem(
"grouping[]", $grouping_id, $tmp_obj->getTitle());
132 $tpl->setContent($cgui->getHTML());
140 $ilAccess = $DIC[
'ilAccess'];
142 if (!$ilAccess->checkAccess(
'write',
'', $this->content_obj->getRefId())) {
143 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
146 foreach (
$_POST[
'grouping'] as $grouping_id) {
151 ilUtil::sendSuccess($this->lng->txt(
'crs_grouping_deleted'),
true);
152 $this->ctrl->redirect($this,
'listGroupings');
160 $ilAccess = $DIC[
'ilAccess'];
163 if (!$ilAccess->checkAccess(
'write',
'', $this->content_obj->getRefId())) {
164 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
171 $tpl->setContent($a_form->getHTML());
176 include_once
"Services/Form/classes/class.ilPropertyFormGUI.php";
178 $form->setFormAction($this->ctrl->getFormAction($this));
181 $title->setRequired(
true);
185 $form->addItem($desc);
187 $options = array(
'login' =>
'login',
189 'matriculation' =>
'matriculation');
191 foreach (
$options as $value => $caption) {
192 $options[$value] = $this->lng->txt($caption);
197 $form->addItem($uniq);
200 $form->setTitle($this->lng->txt(
'crs_add_grouping'));
201 $form->addCommandButton(
'add', $this->lng->txt(
'btn_add'));
204 $title->setValue($grouping->getTitle());
205 $desc->setValue($grouping->getDescription());
206 $uniq->setValue($grouping->getUniqueField());
208 $ass =
new ilCustomInputGUI($this->lng->txt(
'groupings_assigned_obj_' . $this->getContentType()));
209 $form->addItem($ass);
213 foreach ($grouping->getAssignedItems() as $cond_data) {
217 $ass->setHtml(implode(
"<br />", $items));
219 $ass->setHtml($this->lng->txt(
'crs_grp_no_courses_assigned'));
222 $form->setTitle($this->lng->txt(
'edit_grouping'));
223 $form->addCommandButton(
'update', $this->lng->txt(
'save'));
224 $form->addCommandButton(
'selectCourse', $this->lng->txt(
'grouping_change_assignment'));
227 $form->addCommandButton(
'listGroupings', $this->lng->txt(
'cancel'));
235 if (
$form->checkInput()) {
236 $this->grp_obj->setTitle(
$form->getInput(
'title'));
237 $this->grp_obj->setDescription(
$form->getInput(
'description'));
238 $this->grp_obj->setUniqueField(
$form->getInput(
'unique'));
240 if ($this->grp_obj->create($this->content_obj->getRefId(), $this->content_obj->getId())) {
241 ilUtil::sendSuccess($this->lng->txt(
'crs_grp_added_grouping'),
true);
246 $this->ctrl->redirect($this,
'listGroupings');
249 $form->setValuesByPost();
253 public function edit($a_form = null)
258 $ilAccess = $DIC[
'ilAccess'];
261 if (!$ilAccess->checkAccess(
'write',
'', $this->content_obj->getRefId())) {
262 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
269 $tpl->setContent($a_form->getHTML());
277 $ilAccess = $DIC[
'ilAccess'];
278 $ilObjDataCache = $DIC[
'ilObjDataCache'];
280 if (!$ilAccess->checkAccess(
'write',
'', $this->content_obj->getRefId())) {
281 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
285 if (
$form->checkInput()) {
287 $tmp_grouping->setTitle(
$form->getInput(
'title'));
288 $tmp_grouping->setDescription(
$form->getInput(
'description'));
289 $tmp_grouping->setUniqueField(
$form->getInput(
'unique'));
290 $tmp_grouping->update();
292 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
293 $this->ctrl->redirect($this,
'listGroupings');
296 $form->setValuesByPost();
305 $ilAccess = $DIC[
'ilAccess'];
307 $ilTabs = $DIC[
'ilTabs'];
309 if (!$ilAccess->checkAccess(
'write',
'', $this->content_obj->getRefId())) {
310 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
313 if (!
$_GET[
'obj_id']) {
319 $ilTabs->clearTargets();
320 $ilTabs->setBackTarget(
321 $this->lng->txt(
'back'),
322 $this->ctrl->getLinkTarget($this,
'edit')
327 include_once
'Modules/Course/classes/class.ilCourseGroupingAssignmentTableGUI.php';
340 $ilAccess = $DIC[
'ilAccess'];
341 $ilObjDataCache = $DIC[
'ilObjDataCache'];
342 $tree = $DIC[
'tree'];
345 if (!$ilAccess->checkAccess(
'write',
'', $this->content_obj->getRefId())) {
346 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->MESSAGE);
349 if (!
$_GET[
'obj_id']) {
355 include_once
'./Services/Conditions/classes/class.ilConditionHandler.php';
357 $condh->deleteByObjId((
int)
$_GET[
'obj_id']);
360 $container_ids = is_array(
$_POST[
'crs_ids']) ?
$_POST[
'crs_ids'] : array();
361 foreach ($container_ids as $course_ref_id) {
364 $tmp_condh->enableAutomaticValidation(
false);
366 $tmp_condh->setTargetRefId($course_ref_id);
367 $tmp_condh->setTargetObjId($tmp_crs->getId());
369 $tmp_condh->setTriggerRefId(0);
370 $tmp_condh->setTriggerObjId($this->
id);
371 $tmp_condh->setTriggerType(
'crsg');
372 $tmp_condh->setOperator(
'not_member');
373 $tmp_condh->setValue($this->grp_obj->getUniqueField());
375 if (!$tmp_condh->checkExists()) {
376 $tmp_condh->storeCondition();
381 ilUtil::sendSuccess($this->lng->txt(
'settings_saved'),
true);
382 $this->ctrl->redirect($this,
'edit');
static _lookupTitle($a_id)
lookup object title
__construct($content_obj, $a_obj_id=0)
Constructor public.
if(isset($_POST['submit'])) $form
This class represents a text property in a property form.
Class ilObjCourseGroupingGUI.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
INTERNAL CLASS: Please do not use in consumer code.
This class represents a text area property in a property form.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
if(empty($password)) $table
Confirmation screen class.