本文整理汇总了PHP中ilCourseParticipants::_getinstanceByObjId方法的典型用法代码示例。如果您正苦于以下问题:PHP ilCourseParticipants::_getinstanceByObjId方法的具体用法?PHP ilCourseParticipants::_getinstanceByObjId怎么用?PHP ilCourseParticipants::_getinstanceByObjId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilCourseParticipants
的用法示例。
在下文中一共展示了ilCourseParticipants::_getinstanceByObjId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showMembers
/**
* Show course members
*/
public function showMembers()
{
global $lng, $ilUser, $ilObjDataCache;
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
if ($_GET["search_crs"] != "") {
$_POST["search_crs"] = explode(",", $_GET["search_crs"]);
$_GET["search_crs"] = "";
} else {
if ($_SESSION["search_crs"] != "") {
$_POST["search_crs"] = explode(",", $_SESSION["search_crs"]);
$_SESSION["search_crs"] = "";
}
}
if (!is_array($_POST["search_crs"]) || count($_POST["search_crs"]) == 0) {
ilUtil::sendInfo($lng->txt("mail_select_course"));
$this->showMyCourses();
} else {
foreach ($_POST['search_crs'] as $crs_id) {
$oTmpCrs = ilObjectFactory::getInstanceByObjId($crs_id);
if ($oTmpCrs->getShowMembers() == $oTmpCrs->SHOW_MEMBERS_DISABLED) {
unset($_POST['search_crs']);
ilUtil::sendInfo($lng->txt('mail_crs_list_members_not_available_for_at_least_one_crs'));
return $this->showMyCourses();
}
unset($oTmpCrs);
}
$this->tpl->setTitle($this->lng->txt("mail_addressbook"));
$this->ctrl->setParameter($this, "view", "crs_members");
if ($_GET["ref"] != "") {
$this->ctrl->setParameter($this, "ref", $_GET["ref"]);
}
if (is_array($_POST["search_crs"])) {
$this->ctrl->setParameter($this, "search_crs", implode(",", $_POST["search_crs"]));
}
$this->tpl->setVariable("ACTION", $this->ctrl->getFormAction($this));
$this->ctrl->clearParameters($this);
$lng->loadLanguageModule('crs');
include_once 'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
$context = $_GET["ref"] ? $_GET["ref"] : "mail";
$table = new ilMailSearchCoursesMembersTableGUI($this, 'crs', $context);
$table->setId('show_crs_mmbrs_tbl');
$tableData = array();
$searchTpl = new ilTemplate('tpl.mail_search_template.html', true, true, 'Services/Contact');
foreach ($_POST["search_crs"] as $crs_id) {
$members_obj = ilCourseParticipants::_getinstanceByObjId($crs_id);
$tmp_members = $members_obj->getParticipants();
$course_members = ilUtil::_sortIds($tmp_members, 'usr_data', 'lastname', 'usr_id');
foreach ($course_members as $member) {
$tmp_usr = new ilObjUser($member);
if ($tmp_usr->checkTimeLimit() == false || $tmp_usr->getActive() == false) {
unset($tmp_usr);
continue;
}
unset($tmp_usr);
$name = ilObjUser::_lookupName($member);
$login = ilObjUser::_lookupLogin($member);
$fullname = "";
if (in_array(ilObjUser::_lookupPref($member, 'public_profile'), array("g", 'y'))) {
$fullname = $name['lastname'] . ', ' . $name['firstname'];
}
$rowData = array('members_id' => $member, 'members_login' => $login, 'members_name' => $fullname, 'members_crs_grp' => $ilObjDataCache->lookupTitle($crs_id), 'members_in_addressbook' => $this->abook->checkEntryByLogin($login) ? $lng->txt("yes") : $lng->txt("no"), 'search_crs' => $crs_id);
$tableData[] = $rowData;
}
}
$table->setData($tableData);
if (count($tableData)) {
$searchTpl->setVariable("TXT_MARKED_ENTRIES", $lng->txt("marked_entries"));
}
$searchTpl->setVariable('TABLE', $table->getHtml());
$this->tpl->setContent($searchTpl->get());
if ($_GET["ref"] != "wsp") {
$this->tpl->show();
}
}
}