Public Member Functions | |
ilObjCourseGroupingGUI (&$content_obj, $a_obj_id=0) | |
Constructor public. | |
getContentType () | |
listGroupings () | |
askDeleteGrouping () | |
deleteGrouping () | |
create () | |
cancel () | |
add () | |
edit ($a_grouping_id=0) | |
update () | |
selectCourse () | |
assignCourse () | |
& | executeCommand () |
__initGroupingObject () | |
__formatPath ($a_path_arr) | |
Data Fields | |
$content_obj | |
$tpl | |
$ctrl | |
$lng |
Definition at line 36 of file class.ilObjCourseGroupingGUI.php.
ilObjCourseGroupingGUI::__formatPath | ( | $ | a_path_arr | ) |
Definition at line 542 of file class.ilObjCourseGroupingGUI.php.
References $counter, and $data.
Referenced by selectCourse().
{ $counter = 0; foreach($a_path_arr as $data) { if(!$counter++) { continue; } if($counter++ > 2) { $path .= " -> "; } $path .= $data['title']; } return $path; }
ilObjCourseGroupingGUI::__initGroupingObject | ( | ) |
Definition at line 535 of file class.ilObjCourseGroupingGUI.php.
Referenced by ilObjCourseGroupingGUI().
{ include_once './course/classes/class.ilObjCourseGrouping.php'; $this->grp_obj =& new ilObjCourseGrouping($this->id); }
ilObjCourseGroupingGUI::add | ( | ) |
Definition at line 271 of file class.ilObjCourseGroupingGUI.php.
References $_POST, create(), listGroupings(), sendInfo(), and ilUtil::stripSlashes().
{ if(!$_POST['title']) { sendInfo($this->lng->txt('crs_grp_enter_title')); $this->create(); return false; } $this->grp_obj->setTitle(ilUtil::stripSlashes($_POST['title'])); $this->grp_obj->setDescription(ilUtil::stripSlashes($_POST['description'])); $this->grp_obj->setUniqueField($_POST['unique']); if($this->grp_obj->create($this->content_obj->getRefId(),$this->content_obj->getId())) { sendInfo($this->lng->txt('crs_grp_added_grouping')); } else { sendInfo($this->lng->txt('crs_grp_err_adding_grouping')); } $this->listGroupings(); return false; }
ilObjCourseGroupingGUI::askDeleteGrouping | ( | ) |
Definition at line 161 of file class.ilObjCourseGroupingGUI.php.
References $_POST, $_SESSION, $counter, $ilErr, listGroupings(), sendInfo(), and ilUtil::switchColor().
{ global $ilErr,$ilAccess,$ilObjDataCache; if(!$ilAccess->checkAccess('write','',$this->content_obj->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE); } if(!count($_POST['grouping'])) { sendInfo($this->lng->txt('crs_grouping_select_one')); $this->listGroupings(); return false; } sendInfo($this->lng->txt('crs_grouping_delete_sure')); $this->tpl->addBlockFile("ADM_CONTENT","adm_content","tpl.crs_ask_delete_goupings.html","course"); $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this)); $this->tpl->setVariable("HEADER_DESC",$this->lng->txt('description')); $this->tpl->setVariable("BTN_CANCEL",$this->lng->txt('cancel')); $this->tpl->setVariable("BTN_DELETE",$this->lng->txt('delete')); $counter = 0; foreach($_POST['grouping'] as $grouping_id) { $tmp_obj =& new ilObjCourseGrouping($grouping_id); if(strlen($tmp_obj->getDescription())) { $this->tpl->setCurrentBlock("description"); $this->tpl->setVariable("DESCRIPTION_GRP",$tmp_obj->getDescription()); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("grouping_row"); $this->tpl->setVariable("GRP_TITLE",$tmp_obj->getTitle()); $this->tpl->setVariable("ROW_CLASS",ilUtil::switchColor(++$counter,'tblrow1','tblrow2')); $this->tpl->parseCurrentBlock(); } $_SESSION['crs_grouping_del'] = $_POST['grouping']; }
ilObjCourseGroupingGUI::assignCourse | ( | ) |
Definition at line 468 of file class.ilObjCourseGroupingGUI.php.
References $_GET, $_POST, $ilErr, $tree, edit(), getContentType(), ilObjectFactory::getInstanceByRefId(), listGroupings(), and sendInfo().
{ 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']) { sendInfo($this->lng->txt('crs_grp_no_grouping_id_given')); $this->listGroupings(); return false; } $container_ids = is_array($_POST['crs_ids']) ? $_POST['crs_ids'] : array(); $tmp_grouping = new ilObjCourseGrouping((int) $_GET['obj_id']); // delete all existing conditions include_once './classes/class.ilConditionHandler.php'; $condh = new ilConditionHandler(); $condh->deleteByObjId((int) $_GET['obj_id']); $added = 0; 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; } } $this->edit((int) $_GET['obj_id']); }
ilObjCourseGroupingGUI::cancel | ( | ) |
Definition at line 262 of file class.ilObjCourseGroupingGUI.php.
References $_SESSION, and listGroupings().
{ // unset session variables unset($_SESSION['crs_grouping_del']); $this->listGroupings(); return true; }
ilObjCourseGroupingGUI::create | ( | ) |
Definition at line 234 of file class.ilObjCourseGroupingGUI.php.
References $_POST, $title, ilUtil::formSelect(), ilUtil::prepareFormOutput(), and ilUtil::stripSlashes().
Referenced by add().
{ $options = array('login' => 'login', 'email' => 'email', 'matriculation' => 'matriculation'); $title = ilUtil::prepareFormOutput($_POST["title"],true); $desc = ilUtil::stripSlashes($_POST["description"]); $unique = $_POST['unique'] ? $_POST['unique'] : 'login'; $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_grp_add.html","course"); $this->tpl->setVariable("TITLE",$title); $this->tpl->setVariable("DESC",$desc); $this->tpl->setVariable("UNAM_SELECT",ilUtil::formSelect($unique,'unique',$options)); $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this)); $this->tpl->setVariable("TXT_HEADER",$this->lng->txt('crs_add_grouping')); $this->tpl->setVariable("TXT_TITLE",$this->lng->txt('title')); $this->tpl->setVariable("TXT_DESC",$this->lng->txt('description')); $this->tpl->setVariable("TXT_UNAM",$this->lng->txt('unambiguousness')); $this->tpl->setVariable("TXT_REQUIRED_FLD",$this->lng->txt('required_field')); $this->tpl->setVariable("CMD_SUBMIT",'add'); $this->tpl->setVariable("TXT_SUBMIT",$this->lng->txt('btn_add')); $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel')); }
ilObjCourseGroupingGUI::deleteGrouping | ( | ) |
Definition at line 206 of file class.ilObjCourseGroupingGUI.php.
References $_SESSION, $ilErr, listGroupings(), and sendInfo().
{ global $ilErr,$ilAccess,$ilObjDataCache; if(!$ilAccess->checkAccess('write','',$this->content_obj->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE); } if(!count($_SESSION['crs_grouping_del'])) { sendInfo('No grouping selected'); $this->listGroupings(); return false; } foreach($_SESSION['crs_grouping_del'] as $grouping_id) { $tmp_obj =& new ilObjCourseGrouping((int) $grouping_id); $tmp_obj->delete(); } sendInfo($this->lng->txt('crs_grouping_deleted')); $this->listGroupings(); unset($_SESSION['crs_grouping_del']); return true; }
ilObjCourseGroupingGUI::edit | ( | $ | a_grouping_id = 0 |
) |
Definition at line 297 of file class.ilObjCourseGroupingGUI.php.
References $_POST, $ilErr, $title, ilUtil::formSelect(), listGroupings(), sendInfo(), and ilUtil::stripSlashes().
Referenced by assignCourse(), and update().
{ global $ilErr,$ilAccess,$ilObjDataCache; if(!$ilAccess->checkAccess('write','',$this->content_obj->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE); } if($a_grouping_id) { $grouping_id = $a_grouping_id; } elseif(count($_POST['grouping']) != 1) { sendInfo($this->lng->txt('grouping_select_exactly_one')); $this->listGroupings(); return false; } else { $grouping_id = (int) $_POST['grouping'][0]; } $options = array('login' => 'login', 'email' => 'email', 'matriculation' => 'matriculation'); $tmp_grouping = new ilObjCourseGrouping($grouping_id); $title = isset($_POST['title']) ? ilUtil::stripSlashes($_POST['title']) : $tmp_grouping->getTitle(); $description = isset($_POST["description"]) ? ilUtil::stripSlashes($_POST['description']) : $tmp_grouping->getDescription(); $unique = $_POST['unique'] ? $_POST['unique'] : $tmp_grouping->getUniqueField(); $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_grp_edit.html","course"); $this->ctrl->setParameter($this,'obj_id',$grouping_id); $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this)); $this->tpl->setVariable("EDIT_GROUPING",$this->lng->txt('edit_grouping')); $this->tpl->setVariable("BTN_UPDATE",$this->lng->txt('save')); $this->tpl->setVariable("BTN_ADD",$this->lng->txt('grouping_change_assignment')); $this->tpl->setVariable("BTN_CANCEL",$this->lng->txt('cancel')); $this->tpl->setVariable("TXT_TITLE",$this->lng->txt('title')); $this->tpl->setVariable("TXT_DESCRIPTION",$this->lng->txt('description')); $this->tpl->setVariable("TXT_UNAM",$this->lng->txt('unambiguousness')); $this->tpl->setVariable("UNAM_SELECT",ilUtil::formSelect($unique,'unique',$options)); $this->tpl->setVariable("TITLE",$title); $this->tpl->setVariable("DESCRIPTION",$description); $items = $tmp_grouping->getAssignedItems(); foreach($items as $cond_data) { $this->tpl->setCurrentBlock("list_courses"); $this->tpl->setVariable("LIST_CRS_TITLE",$ilObjDataCache->lookupTitle($cond_data['target_obj_id'])); $this->tpl->parseCurrentBlock(); } if(count($items)) { $this->tpl->setCurrentBlock("assigned"); $this->tpl->setVariable("ASS_COURSES",$this->lng->txt('crs_grp_table_assigned_courses')); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("no_assigned"); $this->tpl->setVariable("MESSAGE_NO_COURSES",$this->lng->txt('crs_grp_no_courses_assigned')); $this->tpl->parseCurrentBlock(); } }
& ilObjCourseGroupingGUI::executeCommand | ( | ) |
ilObjCourseGroupingGUI::getContentType | ( | ) |
Definition at line 65 of file class.ilObjCourseGroupingGUI.php.
Referenced by assignCourse(), and selectCourse().
{
return $this->content_type;
}
ilObjCourseGroupingGUI::ilObjCourseGroupingGUI | ( | &$ | content_obj, | |
$ | a_obj_id = 0 | |||
) |
Constructor public.
Definition at line 46 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'); $this->__initGroupingObject(); }
ilObjCourseGroupingGUI::listGroupings | ( | ) |
Definition at line 70 of file class.ilObjCourseGroupingGUI.php.
References $counter, $ilErr, ilObjCourseGrouping::_checkAccess(), ilObjCourseGrouping::_getVisibleGroupings(), ilUtil::formCheckbox(), ilUtil::getImagePath(), and ilUtil::switchColor().
Referenced by add(), askDeleteGrouping(), assignCourse(), cancel(), deleteGrouping(), edit(), selectCourse(), and update().
{ global $ilErr,$ilAccess,$ilObjDataCache; if(!$ilAccess->checkAccess('write','',$this->content_obj->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE); } $this->tpl->addBlockFile("ADM_CONTENT","adm_content","tpl.groupings.html","course"); $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this)); $this->tpl->setVariable("HEADER_DESC",$this->lng->txt('description')); $this->tpl->setVariable("HEADER_UNAMBIGUOUSNESS",$this->lng->txt('unambiguousness')); $this->tpl->setVariable("ASSIGNED_ITEMS",$this->lng->txt('groupings_assigned_obj_'.$this->getContentType())); $items = ilObjCourseGrouping::_getVisibleGroupings($this->content_obj->getId()); // Fill table $counter = 0; $has_access = false; foreach($items as $grouping_id) { $tmp_obj =& new ilObjCourseGrouping($grouping_id); // Description if(strlen($tmp_obj->getDescription())) { $this->tpl->setCurrentBlock("description"); $this->tpl->setVariable("DESCRIPTION_GRP",$tmp_obj->getDescription()); $this->tpl->parseCurrentBlock(); } // Assigned items $assigned_items = $tmp_obj->getAssignedItems(); if($num_items = count($assigned_items)) { $this->tpl->setVariable("ASSIGNED_COURSES",$this->lng->txt('crs_grp_assigned_courses_info')); } else { $this->tpl->setVariable("ASSIGNED_COURSES",$this->lng->txt('crs_grp_no_courses_assigned')); } foreach($assigned_items as $condition) { $this->tpl->setCurrentBlock("item"); $this->tpl->setVariable("ITEM_TITLE",$ilObjDataCache->lookupTitle($condition['target_obj_id'])); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("grouping_row"); $this->tpl->setVariable("GRP_TITLE",$tmp_obj->getTitle()); if(ilObjCourseGrouping::_checkAccess($grouping_id)) { $has_access = true; $this->tpl->setVariable("CHECK_GRP",ilUtil::formCheckbox(0,'grouping[]',$grouping_id)); } $this->tpl->setVariable("AMB_GRP",$this->lng->txt($tmp_obj->getUniqueField())); $this->tpl->setVariable("ROW_CLASS",ilUtil::switchColor(++$counter,'tblrow1','tblrow2')); $this->ctrl->setParameterByClass('ilobjcoursegroupinggui','obj_id',$grouping_id); $this->tpl->setVariable("EDIT_LINK",$this->ctrl->getLinkTargetByClass('ilobjcoursegroupinggui','edit')); $this->tpl->parseCurrentBlock(); } if(count($items) and $has_access) { $this->tpl->setCurrentBlock("has_items"); $this->tpl->setVariable("ARR_DOWNRIGHT",ilUtil::getImagePath('arrow_downright.gif')); $this->tpl->setVariable("EDIT",$this->lng->txt('edit')); $this->tpl->setVariable("DELETE",$this->lng->txt('delete')); $this->tpl->setVariable("ACTIONS",$this->lng->txt('actions')); $this->tpl->parseCurrentBlock(); } elseif(!count($items)) { // no items $this->tpl->setCurrentBlock("no_items"); $this->tpl->setVariable("TXT_NO_ITEMS",$this->lng->txt('no_datasets')); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("ADD",$this->lng->txt('crs_add_grouping')); }
ilObjCourseGroupingGUI::selectCourse | ( | ) |
Definition at line 404 of file class.ilObjCourseGroupingGUI.php.
References $_GET, $counter, $ilErr, $obj_id, $title, $tree, __formatPath(), ilUtil::_getObjectsByOperations(), ilUtil::formCheckbox(), getContentType(), ilUtil::getImagePath(), listGroupings(), sendInfo(), and ilUtil::switchColor().
{ 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']) { sendInfo($this->lng->txt('crs_grp_no_grouping_id_given')); $this->listGroupings(); return false; } $tmp_grouping = new ilObjCourseGrouping((int) $_GET['obj_id']); $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_grp_select_crs.html","course"); $this->ctrl->setParameter($this,'obj_id',(int) $_GET['obj_id']); $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this)); $this->tpl->setVariable("TBL_TITLE",$this->lng->txt('crs_grp_assign_crs').' ('.$this->grp_obj->getTitle().')'); $this->tpl->setVariable("BTN_ASSIGN",$this->lng->txt('grouping_change_assignment')); $this->tpl->setVariable("BTN_CANCEL",$this->lng->txt('cancel')); $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath('arrow_downright.gif')); $this->tpl->setVariable("HEADER_DESC",$this->lng->txt('description')); $counter = 0; $items = ilUtil::_getObjectsByOperations($this->getContentType(), 'write', $ilUser->getId(),-1); foreach($items as $item_id) { if($tree->checkForParentType($course_id,'adm')) { continue; } $obj_id = $ilObjDataCache->lookupObjId($item_id); $title = $ilObjDataCache->lookupTitle($obj_id); $description = $ilObjDataCache->lookupDescription($obj_id); $assigned = $tmp_grouping->isAssigned($obj_id) ? 1 : 0; if(strlen($description)) { $this->tpl->setCurrentBlock("description"); $this->tpl->setVariable("DESCRIPTION_CRS",$description); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("crs_row"); $this->tpl->setVariable("ROW_CLASS",ilUtil::switchColor(++$counter,'tblrow1','tblrow2')); $this->tpl->setVariable("CHECK_CRS",ilUtil::formCheckbox($assigned,'crs_ids[]',$item_id)); $this->tpl->setVariable("CRS_TITLE",$title); $path = $this->__formatPath($tree->getPathFull($item_id)); $this->tpl->setVariable("CRS_PATH",$this->lng->txt('path').": ".$path); $this->tpl->parseCurrentBlock(); } return true; }
ilObjCourseGroupingGUI::update | ( | ) |
Definition at line 370 of file class.ilObjCourseGroupingGUI.php.
References $_GET, $_POST, $ilErr, edit(), listGroupings(), sendInfo(), and ilUtil::stripSlashes().
{ global $ilErr,$ilAccess,$ilObjDataCache; if(!$ilAccess->checkAccess('write','',$this->content_obj->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE); } if(!$_GET['obj_id']) { sendInfo($this->lng->txt('crs_grp_no_grouping_id_given')); $this->listGroupings(); return false; } if(!$_POST['title']) { sendInfo($this->lng->txt('crs_grp_enter_title')); $this->edit((int) $_GET['obj_id']); return false; } $tmp_grouping = new ilObjCourseGrouping($_GET['obj_id']); $tmp_grouping->setTitle(ilUtil::stripSlashes($_POST['title'])); $tmp_grouping->setDescription(ilUtil::stripSlashes($_POST['description'])); $tmp_grouping->setUniqueField($_POST['unique']); $tmp_grouping->update(); sendInfo($this->lng->txt('settings_saved')); $this->listGroupings(); return true; }
ilObjCourseGroupingGUI::$content_obj |
Definition at line 38 of file class.ilObjCourseGroupingGUI.php.
Referenced by ilObjCourseGroupingGUI().
ilObjCourseGroupingGUI::$ctrl |
Definition at line 40 of file class.ilObjCourseGroupingGUI.php.
ilObjCourseGroupingGUI::$lng |
Definition at line 41 of file class.ilObjCourseGroupingGUI.php.
Referenced by ilObjCourseGroupingGUI().
ilObjCourseGroupingGUI::$tpl |
Definition at line 39 of file class.ilObjCourseGroupingGUI.php.
Referenced by ilObjCourseGroupingGUI().