本文整理汇总了PHP中ilUtil::_sortIds方法的典型用法代码示例。如果您正苦于以下问题:PHP ilUtil::_sortIds方法的具体用法?PHP ilUtil::_sortIds怎么用?PHP ilUtil::_sortIds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilUtil
的用法示例。
在下文中一共展示了ilUtil::_sortIds方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItems
protected function getItems($a_content_obj, $a_group_obj)
{
global $ilUser, $tree;
$counter = 0;
$items = ilUtil::_getObjectsByOperations($this->type, 'write', $ilUser->getId(), -1);
$items_obj_id = array();
$items_ids = array();
foreach ($items as $ref_id) {
$obj_id = ilObject::_lookupObjId($ref_id);
$items_ids[$obj_id] = $ref_id;
$items_obj_id[] = $obj_id;
}
$items_obj_id = ilUtil::_sortIds($items_obj_id, 'object_data', 'title', 'obj_id');
$assigned_ids = array();
$assigned = $a_group_obj->getAssignedItems();
if ($assigned) {
foreach ($assigned as $item) {
$assigned_ids[] = $item['target_ref_id'];
}
}
$data = array();
foreach ($items_obj_id as $obj_id) {
$item_id = $items_ids[$obj_id];
if ($tree->checkForParentType($item_id, 'adm')) {
continue;
}
$obj_id = ilObject::_lookupObjId($item_id);
$data[] = array('id' => $item_id, 'title' => ilObject::_lookupTitle($obj_id), 'description' => ilObject::_lookupDescription($obj_id), 'path' => $this->__formatPath($tree->getPathFull($item_id)), 'assigned' => in_array($item_id, $assigned_ids));
}
$this->setData($data);
}
示例2: prepareRoleSelect
/**
* get global role array
*
* @access protected
*/
private function prepareRoleSelect()
{
global $rbacreview, $ilObjDataCache;
$global_roles = ilUtil::_sortIds($rbacreview->getGlobalRoles(), 'object_data', 'title', 'obj_id');
$select[0] = $this->lng->txt('links_select_one');
foreach ($global_roles as $role_id) {
$select[$role_id] = ilObject::_lookupTitle($role_id);
}
return $select;
}
示例3: getHTML
/**
* render attendance list
*
* @return string
*/
public function getHTML()
{
$tpl = new ilTemplate('tpl.attendance_list_print.html', true, true, 'Services/Membership');
// title
$time = ilFormat::formatUnixTime(time(), true);
$tpl->setVariable('TXT_TITLE', $this->title);
if ($this->description) {
$tpl->setVariable('TXT_DESCRIPTION', $this->description . " (" . $time . ")");
} else {
$tpl->setVariable('TXT_DESCRIPTION', $time);
}
// header
$tpl->setCurrentBlock('head_item');
foreach ($this->presets as $id => $item) {
if ($item[1]) {
$tpl->setVariable('TXT_HEAD', $item[0]);
$tpl->parseCurrentBlock();
}
}
if ($this->blank_columns) {
foreach ($this->blank_columns as $blank) {
$tpl->setVariable('TXT_HEAD', $blank);
$tpl->parseCurrentBlock();
}
}
// handle members
$member_ids = array();
if ($this->show_admins) {
$member_ids = array_merge((array) $member_ids, $this->participants->getAdmins());
}
if ($this->show_tutors) {
$member_ids = array_merge((array) $member_ids, $this->participants->getTutors());
}
if ($this->show_members) {
$member_ids = array_merge((array) $member_ids, $this->participants->getMembers());
}
$member_ids = ilUtil::_sortIds((array) $member_ids, 'usr_data', 'lastname', 'usr_id');
// rows
foreach ($member_ids as $user_id) {
if ($this->callback) {
$user_data = call_user_func_array($this->callback, array($user_id));
$tpl->setCurrentBlock("row_preset");
foreach ($this->presets as $id => $item) {
if ($item[1]) {
switch ($id) {
case "name":
if (!$user_data[$id]) {
$name = ilObjUser::_lookupName($user_id);
$value = $name["lastname"] . ", " . $name["firstname"];
break;
}
case "email":
if (!$user_data[$id]) {
$value = ilObjUser::_lookupEmail($user_id);
break;
}
case "login":
if (!$user_data[$id]) {
$value = ilObjUser::_lookupLogin($user_id);
break;
}
default:
$value = (string) $user_data[$id];
break;
}
$tpl->setVariable("TXT_PRESET", $value);
$tpl->parseCurrentBlock();
}
}
}
if ($this->blank_columns) {
for ($loop = 0; $loop < sizeof($this->blank_columns); $loop++) {
$tpl->touchBlock('row_blank');
}
}
$tpl->touchBlock("member_row");
}
return $tpl->get();
}
示例4: 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();
}
}
}
示例5: prepareRoleSelect
/**
* Used for old style table.
* @deprecated
* @return
* @param object $a_as_select[optional]
*/
private function prepareRoleSelect($a_as_select = true)
{
global $rbacreview, $ilObjDataCache;
include_once './Services/LDAP/classes/class.ilLDAPAttributeMapping.php';
$global_roles = ilUtil::_sortIds($rbacreview->getGlobalRoles(), 'object_data', 'title', 'obj_id');
$select[0] = $this->lng->txt('links_select_one');
foreach ($global_roles as $role_id) {
$select[$role_id] = ilObject::_lookupTitle($role_id);
}
if ($a_as_select) {
return ilUtil::formSelect(ilLDAPAttributeMapping::_lookupGlobalRole($this->server->getServerId()), 'global_role', $select, false, true);
} else {
return $select;
}
}
示例6: exportCSV
/**
* Events List CSV Export
*
* @access public
* @param
*
*/
public function exportCSV()
{
global $tree, $ilAccess;
include_once 'Services/Utilities/classes/class.ilCSVWriter.php';
include_once 'Modules/Session/classes/class.ilEventParticipants.php';
$members = $this->members_obj->getParticipants();
$members = ilUtil::_sortIds($members, 'usr_data', 'lastname', 'usr_id');
$events = array();
foreach ($tree->getSubtree($tree->getNodeData($this->course_ref_id), false, 'sess') as $event_id) {
$tmp_event = ilObjectFactory::getInstanceByRefId($event_id, false);
if (!is_object($tmp_event) or !$ilAccess->checkAccess('write', '', $event_id)) {
continue;
}
$events[] = $tmp_event;
}
$this->csv = new ilCSVWriter();
$this->csv->addColumn($this->lng->txt("lastname"));
$this->csv->addColumn($this->lng->txt("firstname"));
$this->csv->addColumn($this->lng->txt("login"));
foreach ($events as $event_obj) {
// TODO: do not export relative dates
$this->csv->addColumn($event_obj->getTitle() . ' (' . $event_obj->getFirstAppointment()->appointmentToString() . ')');
}
$this->csv->addRow();
foreach ($members as $user_id) {
$name = ilObjUser::_lookupName($user_id);
$this->csv->addColumn($name['lastname']);
$this->csv->addColumn($name['firstname']);
$this->csv->addColumn(ilObjUser::_lookupLogin($user_id));
foreach ($events as $event_obj) {
$event_part = new ilEventParticipants((int) $event_obj->getId());
$this->csv->addColumn($event_part->hasParticipated($user_id) ? $this->lng->txt('event_participated') : $this->lng->txt('event_not_participated'));
}
$this->csv->addRow();
}
$date = new ilDate(time(), IL_CAL_UNIX);
ilUtil::deliverData($this->csv->getCSVString(), $date->get(IL_CAL_FKT_DATE, 'Y-m-d') . "_course_events.csv", "text/csv");
}
示例7: eventsListObject
/**
* list sessions of all user
*
* @access public
* @param
* @return
*/
public function eventsListObject()
{
global $ilErr, $ilAccess, $ilUser, $tree;
if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
$ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
}
$this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_list.html', 'Modules/Session');
$this->__showButton($this->ctrl->getLinkTarget($this, 'exportCSV'), $this->lng->txt('event_csv_export'));
include_once 'Modules/Session/classes/class.ilEventParticipants.php';
$this->tpl->addBlockfile("EVENTS_TABLE", "events_table", "tpl.table.html");
$this->tpl->addBlockfile('TBL_CONTENT', 'tbl_content', 'tpl.sess_list_row.html', 'Modules/Session');
$members_obj = $this->initContainer(true);
$members = $members_obj->getParticipants();
$members = ilUtil::_sortIds($members, 'usr_data', 'lastname', 'usr_id');
// Table
$tbl = new ilTableGUI();
$tbl->setTitle($this->lng->txt("event_overview"), 'icon_usr.png', $this->lng->txt('obj_usr'));
$this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']);
$course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs');
$events = array();
foreach ($tree->getSubtree($tree->getNodeData($course_ref_id), false, 'sess') as $event_id) {
$tmp_event = ilObjectFactory::getInstanceByRefId($event_id, false);
if (!is_object($tmp_event) or $tmp_event->getType() != 'sess') {
continue;
}
$events[] = $tmp_event;
}
$headerNames = array();
$headerVars = array();
$colWidth = array();
$headerNames[] = $this->lng->txt('name');
$headerVars[] = "name";
$colWidth[] = '20%';
for ($i = 1; $i <= count($events); $i++) {
$headerNames[] = $i;
$headerVars[] = "event_" . $i;
$colWidth[] = 80 / count($events) . "%";
}
$this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
$tbl->setHeaderNames($headerNames);
$tbl->setHeaderVars($headerVars, $this->ctrl->getParameterArray($this, 'eventsList'));
$tbl->setColumnWidth($colWidth);
$tbl->setOrderColumn($_GET["sort_by"]);
$tbl->setOrderDirection($_GET["sort_order"]);
$tbl->setOffset($_GET["offset"]);
$tbl->setLimit($ilUser->getPref("hits_per_page"));
$tbl->setMaxCount(count($members));
$tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next"));
$sliced_users = array_slice($members, $_GET['offset'], $_SESSION['tbl_limit']);
$tbl->disable('sort');
$tbl->render();
$counter = 0;
foreach ($sliced_users as $user_id) {
foreach ($events as $event_obj) {
$this->tpl->setCurrentBlock("eventcols");
$event_part = new ilEventParticipants($this->object->getId());
$this->tpl->setVariable("IMAGE_PARTICIPATED", $event_part->hasParticipated($user_id) ? ilUtil::getImagePath('icon_ok.png') : ilUtil::getImagePath('icon_not_ok.png'));
$this->tpl->setVariable("PARTICIPATED", $event_part->hasParticipated($user_id) ? $this->lng->txt('event_participated') : $this->lng->txt('event_not_participated'));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("tbl_content");
$name = ilObjUser::_lookupName($user_id);
$this->tpl->setVariable("CSS_ROW", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2'));
$this->tpl->setVariable("LASTNAME", $name['lastname']);
$this->tpl->setVariable("FIRSTNAME", $name['firstname']);
$this->tpl->setVariable("LOGIN", ilObjUser::_lookupLogin($user_id));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setVariable("HEAD_TXT_LEGEND", $this->lng->txt("legend"));
$this->tpl->setVariable("HEAD_TXT_DIGIT", $this->lng->txt("event_digit"));
$this->tpl->setVariable("HEAD_TXT_EVENT", $this->lng->txt("event"));
$this->tpl->setVariable("HEAD_TXT_LOCATION", $this->lng->txt("event_location"));
$this->tpl->setVariable("HEAD_TXT_DATE_TIME", $this->lng->txt("event_date_time"));
$i = 1;
foreach ($events as $event_obj) {
$this->tpl->setCurrentBlock("legend_loop");
$this->tpl->setVariable("LEGEND_CSS_ROW", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2'));
$this->tpl->setVariable("LEGEND_DIGIT", $i++);
$this->tpl->setVariable("LEGEND_EVENT_TITLE", $event_obj->getTitle());
$this->tpl->setVariable("LEGEND_EVENT_DESCRIPTION", $event_obj->getDescription());
$this->tpl->setVariable("LEGEND_EVENT_LOCATION", $event_obj->getLocation());
$this->tpl->setVariable("LEGEND_EVENT_APPOINTMENT", $event_obj->getFirstAppointment()->appointmentToString());
$this->tpl->parseCurrentBlock();
}
}
示例8: fetchUsers
/**
* Fetch all users that will be exported
*
* @access private
*
*/
private function fetchUsers()
{
$this->readCourseSpecificFieldsData();
if ($this->settings->enabled('admin')) {
$this->user_ids = $tmp_ids = $this->members->getAdmins();
$this->readCourseData($tmp_ids);
}
if ($this->settings->enabled('tutor')) {
$this->user_ids = array_merge($tmp_ids = $this->members->getTutors(), $this->user_ids);
$this->readCourseData($tmp_ids);
}
if ($this->settings->enabled('member')) {
$this->user_ids = array_merge($tmp_ids = $this->members->getMembers(), $this->user_ids);
$this->readCourseData($tmp_ids);
}
if ($this->settings->enabled('subscribers')) {
$this->user_ids = array_merge($tmp_ids = $this->members->getSubscribers(), $this->user_ids);
$this->readCourseData($tmp_ids, 'subscriber');
}
if ($this->settings->enabled('waiting_list')) {
include_once 'Modules/Course/classes/class.ilCourseWaitingList.php';
$waiting_list = new ilCourseWaitingList($this->obj_id);
$this->user_ids = array_merge($waiting_list->getUserIds(), $this->user_ids);
}
// Sort by lastname
$this->user_ids = ilUtil::_sortIds($this->user_ids, 'usr_data', 'lastname', 'usr_id');
// Finally read user profile data
$this->user_profile_data = ilObjUser::_readUsersProfileData($this->user_ids);
}
示例9: adoptPermObject
protected function adoptPermObject()
{
global $rbacreview;
$output = array();
$parent_role_ids = $rbacreview->getParentRoleIds($this->rolf_ref_id, true);
$ids = array();
foreach ($parent_role_ids as $id => $tmp) {
$ids[] = $id;
}
// Sort ids
$sorted_ids = ilUtil::_sortIds($ids, 'object_data', 'type,title', 'obj_id');
$key = 0;
foreach ($sorted_ids as $id) {
$par = $parent_role_ids[$id];
if ($par["obj_id"] != SYSTEM_ROLE_ID && $this->object->getId() != $par["obj_id"]) {
$radio = ilUtil::formRadioButton(0, "adopt", $par["obj_id"]);
$output["adopt"][$key]["css_row_adopt"] = $key % 2 == 0 ? "tblrow1" : "tblrow2";
$output["adopt"][$key]["check_adopt"] = $radio;
$output["adopt"][$key]["role_id"] = $par["obj_id"];
$output["adopt"][$key]["type"] = $par["type"] == 'role' ? $this->lng->txt('obj_role') : $this->lng->txt('obj_rolt');
$output["adopt"][$key]["role_name"] = ilObjRole::_getTranslation($par["title"]);
$output["adopt"][$key]["role_desc"] = $par["desc"];
$key++;
}
}
$output["formaction_adopt"] = $this->ctrl->getFormAction($this);
$output["message_middle"] = $this->lng->txt("adopt_perm_from_template");
$tpl = new ilTemplate("tpl.adm_copy_role.html", true, true, "Services/AccessControl");
$tpl->setCurrentBlock("ADOPT_PERM_ROW");
foreach ($output["adopt"] as $key => $value) {
$tpl->setVariable("CSS_ROW_ADOPT", $value["css_row_adopt"]);
$tpl->setVariable("CHECK_ADOPT", $value["check_adopt"]);
$tpl->setVariable("LABEL_ID", $value["role_id"]);
$tpl->setVariable("TYPE", $value["type"]);
$tpl->setVariable("ROLE_NAME", $value["role_name"]);
if (strlen($value['role_desc'])) {
$tpl->setVariable('ROLE_DESC', $value['role_desc']);
}
$tpl->parseCurrentBlock();
}
$tpl->setVariable("TPLPATH", $this->tpl->tplPath);
$tpl->setVariable("MESSAGE_MIDDLE", $output["message_middle"]);
$tpl->setVariable("FORMACTION_ADOPT", $output["formaction_adopt"]);
$tpl->setVariable("ADOPT", $this->lng->txt('copy'));
$tpl->setVariable("CANCEL", $this->lng->txt('cancel'));
$tpl->setVariable('HEAD_ROLE', $this->lng->txt('title'));
$tpl->setVariable('HEAD_TYPE', $this->lng->txt('type'));
$this->tpl->setContent($tpl->get());
}
示例10: initRoleForm
/**
* Shoew add role
* @global type $rbacreview
* @global type $objDefinition
* @return ilPropertyFormGUI
*/
protected function initRoleForm()
{
global $rbacreview, $objDefinition;
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this));
$form->setTitle($this->lng->txt('role_new'));
$form->addCommandButton('addrole', $this->lng->txt('role_new'));
$form->addCommandButton('perm', $this->lng->txt('cancel'));
$title = new ilTextInputGUI($this->lng->txt('title'), 'title');
$title->setValidationRegexp('/^(?!il_).*$/');
$title->setValidationFailureMessage($this->lng->txt('msg_role_reserved_prefix'));
$title->setSize(40);
$title->setMaxLength(70);
$title->setRequired(true);
$form->addItem($title);
$desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
$desc->setCols(40);
$desc->setRows(3);
$form->addItem($desc);
$pro = new ilCheckboxInputGUI($this->lng->txt('role_protect_permissions'), 'pro');
$pro->setInfo($this->lng->txt('role_protect_permissions_desc'));
$pro->setValue(1);
$form->addItem($pro);
$pd = new ilCheckboxInputGUI($this->lng->txt('rbac_role_add_to_desktop'), 'desktop');
$pd->setInfo($this->lng->txt('rbac_role_add_to_desktop_info'));
$pd->setValue(1);
$form->addItem($pd);
if (!$this->isInAdministration()) {
$rights = new ilRadioGroupInputGUI($this->lng->txt("rbac_role_rights_copy"), 'rights');
$option = new ilRadioOption($this->lng->txt("rbac_role_rights_copy_empty"), 0);
$rights->addOption($option);
$parent_role_ids = $rbacreview->getParentRoleIds($this->gui_obj->object->getRefId(), true);
$ids = array();
foreach ($parent_role_ids as $id => $tmp) {
$ids[] = $id;
}
// Sort ids
$sorted_ids = ilUtil::_sortIds($ids, 'object_data', 'type DESC,title', 'obj_id');
// Sort roles by title
$sorted_roles = ilUtil::sortArray(array_values($parent_role_ids), 'title', ASC);
$key = 0;
foreach ($sorted_ids as $id) {
$par = $parent_role_ids[$id];
if ($par["obj_id"] != SYSTEM_ROLE_ID) {
include_once './Services/AccessControl/classes/class.ilObjRole.php';
$option = new ilRadioOption(($par["type"] == 'role' ? $this->lng->txt('obj_role') : $this->lng->txt('obj_rolt')) . ": " . ilObjRole::_getTranslation($par["title"]), $par["obj_id"]);
$option->setInfo($par["desc"]);
$rights->addOption($option);
}
$key++;
}
$form->addItem($rights);
}
// Local policy only for containers
if ($objDefinition->isContainer($this->getCurrentObject()->getType())) {
$check = new ilCheckboxInputGui($this->lng->txt("rbac_role_rights_copy_change_existing"), 'existing');
$check->setInfo($this->lng->txt('rbac_change_existing_objects_desc_new_role'));
$form->addItem($check);
}
return $form;
}
示例11: getHTML
/**
* render attendance list
*
* @return string
*/
public function getHTML()
{
$tpl = new ilTemplate('tpl.attendance_list_print.html', true, true, 'Services/Membership');
// title
$time = ilFormat::formatUnixTime(time(), true);
$tpl->setVariable('TXT_TITLE', $this->title);
if ($this->description) {
$tpl->setVariable('TXT_DESCRIPTION', $this->description . " (" . $time . ")");
} else {
$tpl->setVariable('TXT_DESCRIPTION', $time);
}
// header
$tpl->setCurrentBlock('head_item');
foreach ($this->presets as $id => $item) {
if ($item[1]) {
$tpl->setVariable('TXT_HEAD', $item[0]);
$tpl->parseCurrentBlock();
}
}
if ($this->blank_columns) {
foreach ($this->blank_columns as $blank) {
$tpl->setVariable('TXT_HEAD', $blank);
$tpl->parseCurrentBlock();
}
}
// handle members
$valid_user_ids = $filters = array();
if ($this->roles) {
if ($this->has_local_role) {
$members = array();
foreach ($this->participants->getMembers() as $member_id) {
foreach ($this->participants->getAssignedRoles($member_id) as $role_id) {
$members[$role_id][] = $member_id;
}
}
} else {
$members = $this->participants->getMembers();
}
foreach ($this->roles as $role_id) {
switch ($this->role_data[$role_id][1]) {
case "admin":
$valid_user_ids = array_merge($valid_user_ids, $this->participants->getAdmins());
break;
case "tutor":
$valid_user_ids = array_merge($valid_user_ids, $this->participants->getTutors());
break;
// member/local
// member/local
default:
if (!$this->has_local_role) {
$valid_user_ids = array_merge($valid_user_ids, (array) $members);
} else {
$valid_user_ids = array_merge($valid_user_ids, (array) $members[$role_id]);
}
break;
}
}
}
if ($this->include_subscribers) {
$valid_user_ids = array_merge($valid_user_ids, $this->participants->getSubscribers());
}
if ($this->include_waiting_list) {
$valid_user_ids = array_merge($valid_user_ids, $this->waiting_list->getUserIds());
}
if ($this->user_filters) {
foreach ($this->user_filters as $sub_id => $sub_item) {
$filters[$sub_id] = (bool) $sub_item[2];
}
}
$valid_user_ids = ilUtil::_sortIds(array_unique($valid_user_ids), 'usr_data', 'lastname', 'usr_id');
// rows
foreach ($valid_user_ids as $user_id) {
if ($this->callback) {
$user_data = call_user_func_array($this->callback, array($user_id, $filters));
if (!$user_data) {
continue;
}
$tpl->setCurrentBlock("row_preset");
foreach ($this->presets as $id => $item) {
if ($item[1]) {
switch ($id) {
case "name":
if (!$user_data[$id]) {
$name = ilObjUser::_lookupName($user_id);
$value = $name["lastname"] . ", " . $name["firstname"];
break;
}
case "email":
if (!$user_data[$id]) {
$value = ilObjUser::_lookupEmail($user_id);
break;
}
case "login":
if (!$user_data[$id]) {
$value = ilObjUser::_lookupLogin($user_id);
//.........这里部分代码省略.........
示例12: adoptPermObject
protected function adoptPermObject()
{
global $rbacreview;
$output = array();
$parent_role_ids = $rbacreview->getParentRoleIds($this->obj_ref_id, true);
$ids = array();
foreach ($parent_role_ids as $id => $tmp) {
$ids[] = $id;
}
// Sort ids
$sorted_ids = ilUtil::_sortIds($ids, 'object_data', 'type,title', 'obj_id');
$key = 0;
foreach ($sorted_ids as $id) {
$par = $parent_role_ids[$id];
if ($par["obj_id"] != SYSTEM_ROLE_ID && $this->object->getId() != $par["obj_id"]) {
$output[$key]["role_id"] = $par["obj_id"];
$output[$key]["type"] = $par["type"] == 'role' ? $this->lng->txt('obj_role') : $this->lng->txt('obj_rolt');
$output[$key]["role_name"] = ilObjRole::_getTranslation($par["title"]);
$output[$key]["role_desc"] = $par["desc"];
$key++;
}
}
include_once './Services/AccessControl/classes/class.ilRoleAdoptPermissionTableGUI.php';
$tbl = new ilRoleAdoptPermissionTableGUI($this, "adoptPerm");
$tbl->setTitle($this->lng->txt("adopt_perm_from_template"));
$tbl->setData($output);
$this->tpl->setContent($tbl->getHTML());
}