/** * Get all completed tests */ protected function getItems() { global $ilUser; $data = array(); include_once "Modules/Course/classes/class.ilObjCourse.php"; include_once "./Modules/Course/classes/class.ilCourseParticipants.php"; $obj_ids = ilCourseParticipants::_getMembershipByType($ilUser->getId(), "crs"); if ($obj_ids) { include_once "./Services/Certificate/classes/class.ilCertificate.php"; include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php"; ilCourseCertificateAdapter::_preloadListData($ilUser->getId(), $obj_ids); foreach ($obj_ids as $crs_id) { // #11210 - only available certificates! if (ilCourseCertificateAdapter::_hasUserCertificate($ilUser->getId(), $crs_id)) { $crs = new ilObjCourse($crs_id, false); $adapter = new ilCourseCertificateAdapter($crs); if (ilCertificate::_isComplete($adapter)) { $data[] = array("id" => $crs_id, "title" => ilObject::_lookupTitle($crs_id), "passed" => true); } } } } $this->setData($data); }
protected function share() { global $ilToolbar, $tpl, $ilUser, $ilSetting; $options = array(); $options["user"] = $this->lng->txt("wsp_set_permission_single_user"); include_once 'Modules/Group/classes/class.ilGroupParticipants.php'; $grp_ids = ilGroupParticipants::_getMembershipByType($ilUser->getId(), 'grp'); if (sizeof($grp_ids)) { $options["group"] = $this->lng->txt("wsp_set_permission_group"); } include_once 'Modules/Course/classes/class.ilCourseParticipants.php'; $crs_ids = ilCourseParticipants::_getMembershipByType($ilUser->getId(), 'crs'); if (sizeof($crs_ids)) { $options["course"] = $this->lng->txt("wsp_set_permission_course"); } if (!$this->getAccessHandler()->hasRegisteredPermission($this->node_id)) { $options["registered"] = $this->lng->txt("wsp_set_permission_registered"); } if ($ilSetting->get("enable_global_profiles")) { if (!$this->getAccessHandler()->hasGlobalPasswordPermission($this->node_id)) { $options["password"] = $this->lng->txt("wsp_set_permission_all_password"); } if (!$this->getAccessHandler()->hasGlobalPermission($this->node_id)) { $options["all"] = $this->lng->txt("wsp_set_permission_all"); } } include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $actions = new ilSelectInputGUI("", "action"); $actions->setOptions($options); $ilToolbar->addInputItem($actions); $ilToolbar->setFormAction($this->ctrl->getFormAction($this)); $ilToolbar->addFormButton($this->lng->txt("add"), "addpermissionhandler"); include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessTableGUI.php"; $table = new ilWorkspaceAccessTableGUI($this, "share", $this->node_id, $this->getAccessHandler()); $tpl->setContent($table->getHTML() . $this->footer); }
/** * Show user's courses */ public function showMyCourses() { global $lng, $ilUser, $ilObjDataCache, $tree, $tpl, $rbacsystem; include_once 'Modules/Course/classes/class.ilCourseParticipants.php'; $this->tpl->setTitle($this->lng->txt('mail_addressbook')); $searchTpl = new ilTemplate('tpl.mail_search_template.html', true, true, 'Services/Contact'); $_GET['view'] = 'mycourses'; $lng->loadLanguageModule('crs'); include_once 'Services/Contact/classes/class.ilMailSearchCoursesTableGUI.php'; $table = new ilMailSearchCoursesTableGUI($this, "crs", $_GET["ref"]); $table->setId('search_crs_tbl'); include_once 'Modules/Course/classes/class.ilCourseParticipants.php'; $crs_ids = ilCourseParticipants::_getMembershipByType($ilUser->getId(), 'crs'); $counter = 0; $tableData = array(); if (is_array($crs_ids) && count($crs_ids) > 0) { $num_courses_hidden_members = 0; include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; foreach ($crs_ids as $crs_id) { /** * @var $oTmpCrs ilObjCourse */ $oTmpCrs = ilObjectFactory::getInstanceByObjId($crs_id); $isOffline = !$oTmpCrs->isActivated(); $hasUntrashedReferences = ilObject::_hasUntrashedReference($crs_id); $showMemberListEnabled = (bool) $oTmpCrs->getShowMembers(); $ref_ids = array_keys(ilObject::_getAllReferences($crs_id)); $isPrivilegedUser = $rbacsystem->checkAccess('write', $ref_ids[0]); if ($hasUntrashedReferences && (!$isOffline && $showMemberListEnabled || $isPrivilegedUser)) { $oCrsParticipants = ilCourseParticipants::_getInstanceByObjId($crs_id); $crs_members = $oCrsParticipants->getParticipants(); foreach ($crs_members as $key => $member) { $tmp_usr = new ilObjUser($member); if ($tmp_usr->checkTimeLimit() == false || $tmp_usr->getActive() == false) { unset($crs_members[$key]); } } unset($tmp_usr); $hiddenMembers = false; if ((int) $oTmpCrs->getShowMembers() == $oTmpCrs->SHOW_MEMBERS_DISABLED) { ++$num_courses_hidden_members; $hiddenMembers = true; } unset($oTmpCrs); $ref_ids = ilObject::_getAllReferences($crs_id); $ref_id = current($ref_ids); $path_arr = $tree->getPathFull($ref_id, $tree->getRootId()); $path_counter = 0; $path = ''; foreach ($path_arr as $data) { if ($path_counter++) { $path .= " -> "; } $path .= $data['title']; } $path = $this->lng->txt('path') . ': ' . $path; $current_selection_list = new ilAdvancedSelectionListGUI(); $current_selection_list->setListTitle($this->lng->txt("actions")); $current_selection_list->setId("act_" . $counter); $this->ctrl->setParameter($this, 'search_crs', $crs_id); $this->ctrl->setParameter($this, 'view', 'mycourses'); if ($_GET["ref"] == "mail") { if ($this->mailing_allowed) { $current_selection_list->addItem($this->lng->txt("mail_members"), '', $this->ctrl->getLinkTarget($this, "mail")); } } else { if ($_GET["ref"] == "wsp") { $current_selection_list->addItem($this->lng->txt("wsp_share_with_members"), '', $this->ctrl->getLinkTarget($this, "share")); } } $current_selection_list->addItem($this->lng->txt("mail_list_members"), '', $this->ctrl->getLinkTarget($this, "showMembers")); $this->ctrl->clearParameters($this); $rowData = array("CRS_ID" => $crs_id, "CRS_NAME" => $ilObjDataCache->lookupTitle($crs_id), "CRS_NO_MEMBERS" => count($crs_members), "CRS_PATH" => $path, 'COMMAND_SELECTION_LIST' => $current_selection_list->getHTML(), "hidden_members" => $hiddenMembers); $counter++; $tableData[] = $rowData; } } //if((int)$counter) //{ // $table->addCommandButton('mail',$lng->txt('mail_members')); // $table->addCommandButton('showMembers',$lng->txt('mail_list_members')); //} if ($num_courses_hidden_members > 0) { $searchTpl->setCurrentBlock('caption_block'); $searchTpl->setVariable('TXT_LIST_MEMBERS_NOT_AVAILABLE', $this->lng->txt('mail_crs_list_members_not_available')); $searchTpl->parseCurrentBlock(); } } $searchTpl->setVariable('TXT_MARKED_ENTRIES', $lng->txt('marked_entries')); $table->setData($tableData); if ($_GET['ref'] == 'mail') { $this->tpl->setVariable('BUTTON_CANCEL', $lng->txt('cancel')); } $searchTpl->setVariable('TABLE', $table->getHtml()); $tpl->setContent($searchTpl->get()); if ($_GET["ref"] != "wsp") { $tpl->show(); } }