ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjCourseGroupingGUI Class Reference

Class ilObjCourseGroupingGUI. More...

+ Collaboration diagram for ilObjCourseGroupingGUI:

Public Member Functions

 ilObjCourseGroupingGUI (&$content_obj, $a_obj_id=0)
 Constructor public.
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.

Member Function Documentation

ilObjCourseGroupingGUI::__initGroupingObject ( )

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

Referenced by ilObjCourseGroupingGUI().

{
include_once './Modules/Course/classes/class.ilObjCourseGrouping.php';
$this->grp_obj =& new ilObjCourseGrouping($this->id);
}

+ Here is the caller graph for this function:

ilObjCourseGroupingGUI::add ( )

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

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

{
$form = $this->initForm(true);
if($form->checkInput())
{
$this->grp_obj->setTitle($form->getInput('title'));
$this->grp_obj->setDescription($form->getInput('description'));
$this->grp_obj->setUniqueField($form->getInput('unique'));
if($this->grp_obj->create($this->content_obj->getRefId(),$this->content_obj->getId()))
{
ilUtil::sendSuccess($this->lng->txt('crs_grp_added_grouping'), true);
}
else
{
ilUtil::sendFailure($this->lng->txt('crs_grp_err_adding_grouping'), true);
}
$this->ctrl->redirect($this, 'listGroupings');
}
$form->setValuesByPost();
$this->create($form);
}

+ Here is the call graph for this function:

ilObjCourseGroupingGUI::askDeleteGrouping ( )

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

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

{
global $ilErr,$ilAccess,$tpl;
if(!$ilAccess->checkAccess('write','',$this->content_obj->getRefId()))
{
$ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
}
if(!count($_POST['grouping']))
{
ilUtil::sendFailure($this->lng->txt('crs_grouping_select_one'));
$this->listGroupings();
return false;
}
// display confirmation message
include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
$cgui = new ilConfirmationGUI();
$cgui->setFormAction($this->ctrl->getFormAction($this));
$cgui->setHeaderText($this->lng->txt("crs_grouping_delete_sure"));
$cgui->setCancel($this->lng->txt("cancel"), "listGroupings");
$cgui->setConfirm($this->lng->txt("delete"), "deleteGrouping");
// list objects that should be deleted
foreach($_POST['grouping'] as $grouping_id)
{
$tmp_obj = new ilObjCourseGrouping($grouping_id);
$cgui->addItem("grouping[]", $grouping_id, $tmp_obj->getTitle());
}
$tpl->setContent($cgui->getHTML());
}

+ Here is the call graph for this function:

ilObjCourseGroupingGUI::assignCourse ( )

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

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

{
global $ilErr,$ilAccess,$ilObjDataCache,$tree,$ilUser;
if(!$ilAccess->checkAccess('write','',$this->content_obj->getRefId()))
{
$ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
}
if(!$_GET['obj_id'])
{
$this->listGroupings();
return false;
}
// delete all existing conditions
include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
$condh = new ilConditionHandler();
$condh->deleteByObjId((int)$_GET['obj_id']);
$added = 0;
$container_ids = is_array($_POST['crs_ids']) ? $_POST['crs_ids'] : array();
foreach($container_ids as $course_ref_id)
{
$tmp_crs = ilObjectFactory::getInstanceByRefId($course_ref_id);
$tmp_condh = new ilConditionHandler();
$tmp_condh->enableAutomaticValidation(false);
$tmp_condh->setTargetRefId($course_ref_id);
$tmp_condh->setTargetObjId($tmp_crs->getId());
$tmp_condh->setTargetType($this->getContentType());
$tmp_condh->setTriggerRefId(0);
$tmp_condh->setTriggerObjId($this->id);
$tmp_condh->setTriggerType('crsg');
$tmp_condh->setOperator('not_member');
$tmp_condh->setValue($this->grp_obj->getUniqueField());
if(!$tmp_condh->checkExists())
{
$tmp_condh->storeCondition();
++$added;
}
}
ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
$this->ctrl->redirect($this, 'edit');
}

+ Here is the call graph for this function:

ilObjCourseGroupingGUI::create (   $a_form = null)

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

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

Referenced by add().

{
global $ilErr,$ilAccess,$tpl;
if(!$ilAccess->checkAccess('write','',$this->content_obj->getRefId()))
{
$ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
}
if(!$a_form)
{
$a_form = $this->initForm(true);
}
$tpl->setContent($a_form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjCourseGroupingGUI::deleteGrouping ( )

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

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

{
global $ilErr,$ilAccess;
if(!$ilAccess->checkAccess('write','',$this->content_obj->getRefId()))
{
$ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
}
foreach($_POST['grouping'] as $grouping_id)
{
$tmp_obj = new ilObjCourseGrouping((int)$grouping_id);
$tmp_obj->delete();
}
ilUtil::sendSuccess($this->lng->txt('crs_grouping_deleted'), true);
$this->ctrl->redirect($this, 'listGroupings');
}

+ Here is the call graph for this function:

ilObjCourseGroupingGUI::edit (   $a_form = null)

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

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

Referenced by update().

{
global $ilErr,$ilAccess,$tpl;
if(!$ilAccess->checkAccess('write','',$this->content_obj->getRefId()))
{
$ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
}
if(!$a_form)
{
$a_form = $this->initForm(false);
}
$tpl->setContent($a_form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilObjCourseGroupingGUI::executeCommand ( )

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

References $cmd.

{
global $ilTabs;
$ilTabs->setTabActive('crs_groupings');
$cmd = $this->ctrl->getCmd();
if (!$cmd = $this->ctrl->getCmd())
{
$cmd = "edit";
}
$this->$cmd();
}
ilObjCourseGroupingGUI::getContentType ( )

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

Referenced by assignCourse().

{
return $this->content_type;
}

+ Here is the caller graph for this function:

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

Constructor public.

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

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

{
global $tpl,$ilCtrl,$lng,$ilObjDataCache;
$this->tpl =& $tpl;
$this->ctrl =& $ilCtrl;
$this->lng =& $lng;
$this->type = "crsg";
$this->content_obj =& $content_obj;
$this->content_type = $ilObjDataCache->lookupType($this->content_obj->getId());
$this->id = $a_obj_id;
$this->ctrl->saveParameter($this,'obj_id');
}

+ Here is the call graph for this function:

ilObjCourseGroupingGUI::initForm (   $a_create)

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

References $_REQUEST, $title, ilObject\_lookupTitle(), and ilFormPropertyGUI\setRequired().

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

{
include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$title = new ilTextInputGUI($this->lng->txt('title'), 'title');
$title->setRequired(true);
$form->addItem($title);
$desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
$form->addItem($desc);
$options = array('login' => 'login',
'email' => 'email',
'matriculation' => 'matriculation');
foreach($options as $value => $caption)
{
$options[$value] = $this->lng->txt($caption);
}
$uniq = new ilSelectInputGUI($this->lng->txt('unambiguousness'), 'unique');
$uniq->setRequired(true);
$uniq->setOptions($options);
$form->addItem($uniq);
if($a_create)
{
$form->setTitle($this->lng->txt('crs_add_grouping'));
$form->addCommandButton('add', $this->lng->txt('btn_add'));
}
else
{
$grouping = new ilObjCourseGrouping($_REQUEST['obj_id']);
$title->setValue($grouping->getTitle());
$desc->setValue($grouping->getDescription());
$uniq->setValue($grouping->getUniqueField());
$ass = new ilCustomInputGUI($this->lng->txt('groupings_assigned_obj_'.$this->getContentType()));
$form->addItem($ass);
// assignments
$items = array();
foreach($grouping->getAssignedItems() as $cond_data)
{
$items[] = ilObject::_lookupTitle($cond_data['target_obj_id']);
}
if(count($items))
{
$ass->setHtml(implode("<br />", $items));
}
else
{
$ass->setHtml($this->lng->txt('crs_grp_no_courses_assigned'));
}
$form->setTitle($this->lng->txt('edit_grouping'));
$form->addCommandButton('update', $this->lng->txt('save'));
$form->addCommandButton('selectCourse', $this->lng->txt('grouping_change_assignment'));
}
$form->addCommandButton('listGroupings', $this->lng->txt('cancel'));
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjCourseGroupingGUI::listGroupings ( )

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

References $ilErr, and $tpl.

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

{
global $ilErr, $ilAccess, $ilToolbar, $tpl;
if(!$ilAccess->checkAccess('write','',$this->content_obj->getRefId()))
{
$ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
}
$ilToolbar->addButton($this->lng->txt('crs_add_grouping'),
$this->ctrl->getLinkTarget($this, 'create'));
include_once 'Modules/Course/classes/class.ilCourseGroupingTableGUI.php';
$table = new ilCourseGroupingTableGUI($this, 'listGroupings', $this->content_obj);
$tpl->setContent($table->getHTML());
}

+ Here is the caller graph for this function:

ilObjCourseGroupingGUI::selectCourse ( )

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

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

{
global $ilErr,$ilAccess,$tpl,$ilTabs;
if(!$ilAccess->checkAccess('write','',$this->content_obj->getRefId()))
{
$ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
}
if(!$_GET['obj_id'])
{
ilUtil::sendFailure($this->lng->txt('crs_grp_no_grouping_id_given'));
$this->listGroupings();
return false;
}
$ilTabs->clearTargets();
$ilTabs->setBackTarget($this->lng->txt('back'),
$this->ctrl->getLinkTarget($this, 'edit'));
$tmp_grouping = new ilObjCourseGrouping((int) $_GET['obj_id']);
include_once 'Modules/Course/classes/class.ilCourseGroupingAssignmentTableGUI.php';
$table = new ilCourseGroupingAssignmentTableGUI($this, 'selectCourse', $this->content_obj, $tmp_grouping);
$tpl->setContent($table->getHTML());
return true;
}

+ Here is the call graph for this function:

ilObjCourseGroupingGUI::update ( )

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

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

{
global $ilErr,$ilAccess,$ilObjDataCache;
if(!$ilAccess->checkAccess('write','',$this->content_obj->getRefId()))
{
$ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
}
$form = $this->initForm(false);
if($form->checkInput())
{
$tmp_grouping = new ilObjCourseGrouping($_REQUEST['obj_id']);
$tmp_grouping->setTitle($form->getInput('title'));
$tmp_grouping->setDescription($form->getInput('description'));
$tmp_grouping->setUniqueField($form->getInput('unique'));
$tmp_grouping->update();
ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
$this->ctrl->redirect($this, 'listGroupings');
}
$form->setValuesByPost();
$this->edit($form);
}

+ Here is the call graph for this function:

Field Documentation

ilObjCourseGroupingGUI::$content_obj

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

Referenced by ilObjCourseGroupingGUI().

ilObjCourseGroupingGUI::$ctrl

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

ilObjCourseGroupingGUI::$lng

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

Referenced by ilObjCourseGroupingGUI().

ilObjCourseGroupingGUI::$tpl

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