3 declare(strict_types=0);
    49         $this->tpl = $DIC->ui()->mainTemplate();
    50         $this->
ctrl = $DIC->ctrl();
    51         $this->
lng = $DIC->language();
    52         $this->
access = $DIC->access();
    53         $this->error = $DIC[
'ilErr'];
    54         $this->
tabs = $DIC->tabs();
    55         $this->
toolbar = $DIC->toolbar();
    56         $this->
http = $DIC->http();
    62         $this->
id = $a_obj_id;
    63         $this->
ctrl->saveParameter($this, 
'obj_id');
    69         $this->
tabs->setTabActive(
'crs_groupings');
    70         $cmd = $this->
ctrl->getCmd();
    71         if (!$cmd = $this->
ctrl->getCmd()) {
    89         if (!$this->
access->checkAccess(
'write', 
'', $this->content_obj->getRefId())) {
    90             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
    94             $this->
lng->txt(
'crs_add_grouping'),
    95             $this->
ctrl->getLinkTarget($this, 
'create')
    99         $this->tpl->setContent($table->getHTML());
   104         if (!$this->
access->checkAccess(
'write', 
'', $this->content_obj->getRefId())) {
   105             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   109         if ($this->
http->wrapper()->post()->has(
'grouping')) {
   110             $grouping = $this->
http->wrapper()->post()->retrieve(
   112                 $this->
refinery->kindlyTo()->listOf(
   118         if (!count($grouping)) {
   119             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'crs_grouping_select_one'));
   126         $cgui->setFormAction($this->
ctrl->getFormAction($this));
   127         $cgui->setHeaderText($this->
lng->txt(
"crs_grouping_delete_sure"));
   128         $cgui->setCancel($this->
lng->txt(
"cancel"), 
"listGroupings");
   129         $cgui->setConfirm($this->
lng->txt(
"delete"), 
"deleteGrouping");
   132         foreach ($grouping as $grouping_id) {
   134             $cgui->addItem(
"grouping[]", $grouping_id, $tmp_obj->getTitle());
   136         $this->tpl->setContent($cgui->getHTML());
   141         if (!$this->
access->checkAccess(
'write', 
'', $this->content_obj->getRefId())) {
   142             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   145         if ($this->
http->wrapper()->post()->has(
'grouping')) {
   146             $grouping = $this->
http->wrapper()->post()->retrieve(
   148                 $this->
refinery->kindlyTo()->listOf(
   154         foreach ($grouping as $grouping_id) {
   159         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'crs_grouping_deleted'), 
true);
   160         $this->
ctrl->redirect($this, 
'listGroupings');
   165         if (!$this->
access->checkAccess(
'write', 
'', $this->content_obj->getRefId())) {
   166             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   173         $this->tpl->setContent($a_form->getHTML());
   179         $form->setFormAction($this->
ctrl->getFormAction($this));
   182         $title->setRequired(
true);
   183         $form->addItem($title);
   186         $form->addItem($desc);
   188         $options = array(
'login' => 
'login',
   190                          'matriculation' => 
'matriculation'   193         foreach ($options as $value => $caption) {
   194             $options[$value] = $this->
lng->txt($caption);
   198         $uniq->setOptions($options);
   199         $form->addItem($uniq);
   202             $form->setTitle($this->
lng->txt(
'crs_add_grouping'));
   203             $form->addCommandButton(
'add', $this->
lng->txt(
'btn_add'));
   206             $title->setValue($grouping->getTitle());
   207             $desc->setValue($grouping->getDescription());
   208             $uniq->setValue($grouping->getUniqueField());
   210             $ass = 
new ilCustomInputGUI($this->
lng->txt(
'groupings_assigned_obj_' . $this->getContentType()));
   211             $form->addItem($ass);
   215             foreach ($grouping->getAssignedItems() as $cond_data) {
   219                 $ass->setHtml(implode(
"<br />", $items));
   221                 $ass->setHtml($this->
lng->txt(
'crs_grp_no_courses_assigned'));
   224             $form->setTitle($this->
lng->txt(
'edit_grouping'));
   225             $form->addCommandButton(
'update', $this->
lng->txt(
'save'));
   226             $form->addCommandButton(
'selectCourse', $this->
lng->txt(
'grouping_change_assignment'));
   228         $form->addCommandButton(
'listGroupings', $this->
lng->txt(
'cancel'));
   232     public function add(): void
   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             $this->grp_obj->create($this->content_obj->getRefId(), $this->content_obj->getId());
   241             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'crs_grp_added_grouping'), 
true);
   242             $this->
ctrl->redirect($this, 
'listGroupings');
   244         $form->setValuesByPost();
   250         if (!$this->
access->checkAccess(
'write', 
'', $this->content_obj->getRefId())) {
   251             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   256         $this->tpl->setContent($a_form->getHTML());
   261         if (!$this->
access->checkAccess(
'write', 
'', $this->content_obj->getRefId())) {
   262             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   266         if ($this->
http->wrapper()->query()->has(
'obj_id')) {
   267             $obj_id = $this->
http->wrapper()->query()->retrieve(
   273         if ($form->checkInput()) {
   275             $tmp_grouping->setTitle($form->getInput(
'title'));
   276             $tmp_grouping->setDescription($form->getInput(
'description'));
   277             $tmp_grouping->setUniqueField($form->getInput(
'unique'));
   278             $tmp_grouping->update();
   280             $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'), 
true);
   281             $this->
ctrl->redirect($this, 
'listGroupings');
   284         $form->setValuesByPost();
   290         if (!$this->
access->checkAccess(
'write', 
'', $this->content_obj->getRefId())) {
   291             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   295             $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'crs_grp_no_grouping_id_given'));
   300         $this->
tabs->clearTargets();
   301         $this->
tabs->setBackTarget(
   302             $this->
lng->txt(
'back'),
   303             $this->
ctrl->getLinkTarget($this, 
'edit')
   307         $this->tpl->setContent($table->getHTML());
   312         if (!$this->
access->checkAccess(
'write', 
'', $this->content_obj->getRefId())) {
   313             $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
   323         $condh->deleteByObjId($this->
id);
   327         if ($this->
http->wrapper()->post()->has(
'crs_ids')) {
   328             $container_ids = $this->
http->wrapper()->post()->retrieve(
   330                 $this->
refinery->kindlyTo()->listOf(
   336         foreach ($container_ids as $course_ref_id) {
   339             $tmp_condh->enableAutomaticValidation(
false);
   341             $tmp_condh->setTargetRefId($course_ref_id);
   342             $tmp_condh->setTargetObjId($tmp_crs->getId());
   344             $tmp_condh->setTriggerRefId(0);
   345             $tmp_condh->setTriggerObjId($this->
id);
   346             $tmp_condh->setTriggerType(
'crsg');
   347             $tmp_condh->setOperator(
'not_member');
   348             $tmp_condh->setValue($this->grp_obj->getUniqueField());
   350             if (!$tmp_condh->checkExists()) {
   351                 $tmp_condh->storeCondition();
   356         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'), 
true);
   357         $this->
ctrl->redirect($this, 
'edit');
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
edit(?ilPropertyFormGUI $a_form=null)
 
create(?ilPropertyFormGUI $a_form=null)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
ilGlobalTemplateInterface $tpl
 
__construct(ilObject $content_obj, int $a_obj_id=0)
 
static http()
Fetches the global http state from ILIAS. 
 
static _lookupTitle(int $obj_id)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id 
 
Class ilObjCourseGroupingGUI. 
 
This class represents a text area property in a property form. 
 
ilObjCourseGrouping $grp_obj
 
static _lookupType(int $id, bool $reference=false)