本文整理汇总了PHP中ilObjRole::_getTranslation方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjRole::_getTranslation方法的具体用法?PHP ilObjRole::_getTranslation怎么用?PHP ilObjRole::_getTranslation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjRole
的用法示例。
在下文中一共展示了ilObjRole::_getTranslation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
/**
* Parse Search entries
*
* @access public
* @param array array of search entries
*
*/
public function parse($entries)
{
global $rbacreview;
include_once './Services/AccessControl/classes/class.ilObjRole.php';
foreach ($entries as $entry) {
$tmp_arr['id'] = $entry['obj_id'];
$tmp_arr['title'] = ilObjRole::_getTranslation(ilObject::_lookupTitle($entry['obj_id']));
$tmp_arr['description'] = ilObject::_lookupDescription($entry['obj_id']);
$tmp_arr['context'] = ilObject::_lookupTitle($rbacreview->getObjectOfRole($entry['obj_id']));
$records_arr[] = $tmp_arr;
}
$this->setData($records_arr ? $records_arr : array());
}
示例2: start
function start()
{
global $rbacreview;
if (!is_array($this->roles)) {
return false;
}
$this->__buildHeader();
include_once './Services/AccessControl/classes/class.ilObjRole.php';
include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
foreach ($this->roles as $role) {
// if role type is not empty and does not match, then continue;
if (!empty($this->role_type) && strcasecmp($this->role_type, $role["role_type"]) != 0) {
continue;
}
if ($rbacreview->isRoleDeleted($role["obj_id"])) {
continue;
}
$attrs = array('role_type' => ucwords($role["role_type"]), 'id' => "il_" . IL_INST_ID . "_role_" . $role["obj_id"]);
// open tag
$this->xmlStartTag("Role", $attrs);
$this->xmlElement('Title', null, $role["title"]);
$this->xmlElement('Description', null, $role["description"]);
$this->xmlElement('Translation', null, ilObjRole::_getTranslation($role["title"]));
if ($ref_id = ilUtil::__extractRefId($role["title"])) {
$ownerObj = IlObjectFactory::getInstanceByRefId($ref_id, false);
if (is_object($ownerObj)) {
$attrs = array("obj_id" => "il_" . IL_INST_ID . "_" . $ownerObj->getType() . "_" . $ownerObj->getId(), "ref_id" => $ownerObj->getRefId(), "type" => $ownerObj->getType());
$this->xmlStartTag('AssignedObject', $attrs);
$this->xmlElement('Title', null, $ownerObj->getTitle());
$this->xmlElement('Description', null, $ownerObj->getDescription());
ilObjectXMLWriter::appendPathToObject($this, $ref_id);
$this->xmlEndTag('AssignedObject', $attrs);
}
}
$this->xmlEndTag("Role");
}
$this->__buildFooter();
return true;
}
示例3: __construct
/**
* Constructor
*
* @access public
* @param object parent gui object
* @return void
*/
public function __construct($a_parent_obj)
{
global $lng, $ilCtrl;
$this->lng = $lng;
$this->lng->loadLanguageModule('crs');
$this->ctrl = $ilCtrl;
$this->container = $a_parent_obj;
include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
$this->privacy = ilPrivacySettings::_getInstance();
$this->participants = ilCourseParticipants::_getInstanceByObjId($a_parent_obj->object->getId());
parent::__construct($a_parent_obj, 'editMembers');
$this->setFormName('participants');
$this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
$this->addColumn($this->lng->txt('lastname'), 'lastname', '20%');
$this->addColumn($this->lng->txt('login'), 'login', '25%');
if ($this->privacy->enabledCourseAccessTimes()) {
$this->addColumn($this->lng->txt('last_access'), 'access_time');
}
$this->addColumn($this->lng->txt('crs_passed'), 'passed');
$this->addColumn($this->lng->txt('crs_blocked'), 'blocked');
$this->addColumn($this->lng->txt('crs_notification'), 'notification');
$this->addColumn($this->lng->txt('objs_role'), 'roles');
$this->addCommandButton('updateMembers', $this->lng->txt('save'));
$this->addCommandButton('members', $this->lng->txt('cancel'));
$this->setRowTemplate("tpl.edit_participants_row.html", "Modules/Course");
$this->disable('sort');
$this->enable('header');
$this->enable('numinfo');
$this->disable('select_all');
// Performance improvement: We read the local course roles
// only once, instead of reading them for each row in method fillRow().
$this->localCourseRoles = array();
foreach ($this->container->object->getLocalCourseRoles(false) as $title => $role_id) {
$this->localCourseRoles[ilObjRole::_getTranslation($title)] = array('role_id' => $role_id, 'title' => $title);
}
}
示例4: permObject
//.........这里部分代码省略.........
if ($par["obj_id"] != SYSTEM_ROLE_ID) {
$radio = ilUtil::formRadioButton(0, "adopt", $par["obj_id"]);
$output["adopt"][$key]["css_row_adopt"] = ilUtil::switchColor($key, "tblrow1", "tblrow2");
$output["adopt"][$key]["check_adopt"] = $radio;
$output["adopt"][$key]["type"] = $par["type"] == 'role' ? 'Role' : 'Template';
$output["adopt"][$key]["role_name"] = $par["title"];
}
}
$output["formaction_adopt"] = $this->ctrl->getFormAction($this);
// END ADOPT_PERMISSIONS
}
$output["formaction"] = $this->ctrl->getFormAction($this);
$this->data = $output;
/************************************/
/* generate output */
/************************************/
$this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
$this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator");
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.adm_perm_role.html", "Services/AccessControl");
foreach ($rbac_objects as $obj_data) {
// BEGIN object_operations
$this->tpl->setCurrentBlock("object_operations");
foreach ($obj_data["ops"] as $operation) {
$ops_ids[] = $operation["ops_id"];
$css_row = ilUtil::switchColor($key, "tblrow1", "tblrow2");
$this->tpl->setVariable("CSS_ROW", $css_row);
$this->tpl->setVariable("PERMISSION", $operation["name"]);
$this->tpl->setVariable("CHECK_PERMISSION", $this->data["perm"][$obj_data["obj_id"]][$operation["ops_id"]]);
$this->tpl->parseCurrentBlock();
}
// END object_operations
// BEGIN object_type
$this->tpl->setCurrentBlock("object_type");
$this->tpl->setVariable("TXT_OBJ_TYPE", $obj_data["name"]);
// TODO: move this if in a function and query all objects that may be disabled or inactive
if ($this->objDefinition->getDevMode($obj_data["type"])) {
$this->tpl->setVariable("TXT_NOT_IMPL", "(" . $this->lng->txt("not_implemented_yet") . ")");
} else {
if ($obj_data["type"] == "icrs" and !$this->ilias->getSetting("ilinc_active")) {
$this->tpl->setVariable("TXT_NOT_IMPL", "(" . $this->lng->txt("not_enabled_or_configured") . ")");
}
}
// js checkbox toggles
$this->tpl->setVariable("JS_VARNAME", "template_perm_" . $obj_data["type"]);
$this->tpl->setVariable("JS_ONCLICK", ilUtil::array_php2js($ops_ids));
$this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
$this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
$this->tpl->parseCurrentBlock();
// END object_type
}
/*
// BEGIN ADOPT PERMISSIONS
foreach ($this->data["adopt"] as $key => $value)
{
$this->tpl->setCurrentBlock("ADOPT_PERM_ROW");
$this->tpl->setVariable("CSS_ROW_ADOPT",$value["css_row_adopt"]);
$this->tpl->setVariable("CHECK_ADOPT",$value["check_adopt"]);
$this->tpl->setVariable("TYPE",$value["type"]);
$this->tpl->setVariable("ROLE_NAME",$value["role_name"]);
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("ADOPT_PERM_FORM");
$this->tpl->setVariable("MESSAGE_MIDDLE",$this->data["message_middle"]);
$this->tpl->setVariable("FORMACTION_ADOPT",$this->data["formaction_adopt"]);
$this->tpl->setVariable("ADOPT",$this->lng->txt('copy'));
$this->tpl->parseCurrentBlock();
// END ADOPT PERMISSIONS
*/
$this->tpl->setCurrentBlock("tblfooter_protected");
$this->tpl->setVariable("COL_ANZ", 3);
$this->tpl->setVariable("CHECK_BOTTOM", $this->data["check_protected"]);
$this->tpl->setVariable("MESSAGE_TABLE", $this->data["text_protected"]);
$this->tpl->parseCurrentBlock();
$this->tpl->setVariable("COL_ANZ_PLUS", 4);
$this->tpl->setVariable("TXT_SAVE", $this->data["txt_save"]);
$this->tpl->setCurrentBlock("adm_content");
$this->tpl->setVariable("TBL_TITLE_IMG", ilUtil::getImagePath("icon_" . $this->object->getType() . ".png"));
$this->tpl->setVariable("TBL_TITLE_IMG_ALT", $this->lng->txt($this->object->getType()));
$this->tpl->setVariable("TBL_HELP_IMG", ilUtil::getImagePath("icon_help.png"));
$this->tpl->setVariable("TBL_HELP_LINK", "tbl_help.php");
$this->tpl->setVariable("TBL_HELP_IMG_ALT", $this->lng->txt("help"));
// compute additional information in title
if (substr($this->object->getTitle(), 0, 3) == "il_") {
$desc = $this->lng->txt("predefined_template");
//$this->lng->txt("obj_".$parent_node['type'])." (".$parent_node['obj_id'].") : ".$parent_node['title'];
}
$description = "<br/> <span class=\"small\">" . $desc . "</span>";
// translation for autogenerated roles
if (substr($this->object->getTitle(), 0, 3) == "il_") {
include_once './Services/AccessControl/classes/class.ilObjRole.php';
$title = ilObjRole::_getTranslation($this->object->getTitle()) . " (" . $this->object->getTitle() . ")";
} else {
$title = $this->object->getTitle();
}
$this->tpl->setVariable("TBL_TITLE", $title . $description);
$this->tpl->setVariable("TXT_PERMISSION", $this->data["txt_permission"]);
$this->tpl->setVariable("FORMACTION", $this->data["formaction"]);
$this->tpl->parseCurrentBlock();
}
示例5: getPresentationTitle
/**
* return translated title for autogenerated roles
* @return
*/
public function getPresentationTitle()
{
return ilObjRole::_getTranslation($this->getTitle());
}
示例6: 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;
}
示例7: getParentRoles
/**
* Get all roles that are available in the pool
*
* @return array Array with the roles and their id's and title's
*/
public function getParentRoles()
{
$roles = $this->rbacreview->getParentRoleIds($_GET['ref_id']);
$global_roles = array();
foreach ($roles as $role) {
$role_id = $role['rol_id'];
$role_type = $role['role_type'];
$role_title = $role['title'];
if ($role_type == "local") {
$transl_role_title = ilObjRole::_getTranslation($role['title']);
$object_id_of_role = $this->rbacreview->getObjectOfRole($role_id);
$object_title_of_role = ilObject::_lookupTitle($object_id_of_role);
$role_and_group_title = $transl_role_title . " von \"" . $object_title_of_role . "\"";
$global_roles[] = array('id' => $role_id, 'title' => $role_and_group_title);
} else {
$global_roles[] = array('id' => $role_id, 'title' => $role_title);
}
}
return $global_roles;
}
示例8: mailMembersObject
public function mailMembersObject()
{
global $rbacreview, $ilObjDataCache;
include_once 'Services/AccessControl/classes/class.ilObjRole.php';
$this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_members.html', 'Services/Contact');
$this->__setSubTabs('members');
include_once "./Services/Link/classes/class.ilLink.php";
$link_to_seminar = ilLink::_getLink($this->object->getRefId());
include_once 'Services/Mail/classes/class.ilMail.php';
require_once 'Services/Mail/classes/class.ilMailFormCall.php';
$this->tpl->setVariable("MAILACTION", ilMailFormCall::getLinkTarget($this, 'mailMembers', array(), array('type' => 'role')));
$this->tpl->setVariable('ADDITIONAL_MESSAGE_TEXT', $link_to_seminar);
$this->tpl->setVariable('IMG_ARROW', ilUtil::getImagePath('arrow_downright.png'));
$this->tpl->setVariable('OK', $this->lng->txt('ok'));
$role_folder = $rbacreview->getRoleFolderOfObject($this->object->getRefId());
$role_ids = $rbacreview->getRolesOfRoleFolder($role_folder['ref_id'], false);
foreach ($role_ids as $role_id) {
$this->tpl->setCurrentBlock('mailbox_row');
$role_addr = $rbacreview->getRoleMailboxAddress($role_id);
$this->tpl->setVariable('CHECK_MAILBOX', ilUtil::formCheckbox(1, 'roles[]', htmlspecialchars($role_addr)));
if (ilMail::_usePearMail()) {
// if pear mail is enabled, mailbox addresses are already localized in the language of the user
$this->tpl->setVariable('MAILBOX', $role_addr);
} else {
// if pear mail is not enabled, we need to localize mailbox addresses in the language of the user
$this->tpl->setVariable('MAILBOX', ilObjRole::_getTranslation($ilObjDataCache->lookupTitle($role_id)) . ' (' . $role_addr . ')');
}
$this->tpl->parseCurrentBlock();
}
}
示例9: getAvailableRolesTableData
/**
* Available Roles Table Data
* @return array
*/
function getAvailableRolesTableData()
{
global $tree;
include_once './Services/AccessControl/classes/class.ilObjRole.php';
$path = array_reverse($tree->getPathId($this->object->getRefId()));
include_once './Services/AccessControl/classes/class.ilObjRole.php';
$counter = 0;
foreach ($this->valid_roles as $role) {
$result_set[$counter]["img"] = in_array($role['obj_id'], $this->user_roles) ? self::IMG_OK : self::IMG_NOT_OK;
$result_set[$counter]["role"] = str_replace(" ", " ", ilObjRole::_getTranslation($role["title"]));
if ($role['role_type'] != "linked") {
$result_set[$counter]["effective_from"] = "";
} else {
$rolfs = $this->rbacreview->getFoldersAssignedToRole($role["obj_id"]);
// ok, try to match the next rolf in path
foreach ($path as $node) {
if ($node == 1) {
break;
}
if (in_array($node, $rolfs)) {
$nodedata = $tree->getNodeData($node);
$result_set[$counter]["effective_from"] = $nodedata["title"];
$result_set[$counter]["effective_from_ref_id"] = $node;
break;
}
}
}
if (in_array($role['obj_id'], $this->global_roles)) {
$result_set[$counter]["original_position"] = $this->lng->txt("global");
$result_set[$counter]["original_position_ref_id"] = false;
} else {
$rolf = $this->rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
$parent_node = $tree->getNodeData($rolf[0]);
$result_set[$counter]["original_position"] = $parent_node["title"];
$result_set[$counter]["original_position_ref_id"] = $parent_node["ref_id"];
}
++$counter;
}
return $result_set;
}
示例10: mailMembersObject
/**
* Form for mail to group members
*/
function mailMembersObject()
{
global $rbacreview, $ilObjDataCache, $ilias;
include_once './Services/AccessControl/classes/class.ilObjRole.php';
$this->lng->loadLanguageModule('mail');
if (!isset($_GET['returned_from_mail'])) {
ilUtil::sendInfo($this->lng->txt('mail_select_recipients'));
}
$this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_members.html', 'Services/Contact');
$this->setSubTabs('members');
$this->tabs_gui->setTabActive('members');
require_once 'Services/Mail/classes/class.ilMailFormCall.php';
$this->tpl->setVariable("MAILACTION", ilMailFormCall::getLinkTarget($this, 'mailMembers', array(), array('type' => 'role', 'sig' => $this->createMailSignature())));
$this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath('arrow_downright.png'));
$this->tpl->setVariable("TXT_MARKED_ENTRIES", $this->lng->txt('marked_entries'));
$this->tpl->setVariable("OK", $this->lng->txt('next'));
// Get role mailbox addresses
$role_folder = $rbacreview->getRoleFolderOfObject($this->object->getRefId());
$role_ids = $rbacreview->getRolesOfRoleFolder($role_folder['ref_id'], false);
$role_addrs = array();
// Sort by relevance
$sorted_role_ids = array();
$counter = 2;
foreach ($role_ids as $role_id) {
switch (substr(ilObject::_lookupTitle($role_id), 0, 8)) {
case 'il_grp_a':
$sorted_role_ids[1] = $role_id;
break;
case 'il_grp_m':
$sorted_role_ids[0] = $role_id;
break;
default:
$sorted_role_ids[$counter++] = $role_id;
break;
}
}
ksort($sorted_role_ids, SORT_NUMERIC);
foreach ((array) $sorted_role_ids as $role_id) {
$this->tpl->setCurrentBlock("mailbox_row");
$role_addr = $rbacreview->getRoleMailboxAddress($role_id);
// check if role title is unique. if not force use pear mail for roles
$ids_for_role_title = ilObject::_getIdsForTitle(ilObject::_lookupTitle($role_id), 'role');
if (count($ids_for_role_title) >= 2) {
$ilias->setSetting('pear_mail_enable', 1);
}
$this->tpl->setVariable("CHECK_MAILBOX", ilUtil::formCheckbox(1, 'roles[]', htmlspecialchars($role_addr)));
if (ilMail::_usePearMail()) {
// if pear mail is enabled, mailbox addresses are already localized in the language of the user
$this->tpl->setVariable("MAILBOX", $role_addr);
} else {
// if pear mail is not enabled, we need to localize mailbox addresses in the language of the user
$this->tpl->setVariable("MAILBOX", ilObjRole::_getTranslation($ilObjDataCache->lookupTitle($role_id)) . " (" . $role_addr . ")");
}
$this->tpl->parseCurrentBlock();
}
}
示例11: mailMembersObject
function mailMembersObject()
{
global $rbacreview, $ilErr, $ilAccess, $ilObjDataCache, $ilias;
include_once './Services/AccessControl/classes/class.ilObjRole.php';
$this->lng->loadLanguageModule('mail');
if (!isset($_GET['returned_from_mail'])) {
ilUtil::sendInfo($this->lng->txt('mail_select_recipients'));
}
$is_admin = (bool) $ilAccess->checkAccess("write", "", $this->object->getRefId());
if (!$is_admin && $this->object->getShowMembers() == $this->object->SHOW_MEMBERS_DISABLED) {
$ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
}
$this->setSubTabs('members');
$this->tabs_gui->setTabActive('members');
$this->tabs_gui->setSubTabActive('mail_members');
$this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_members.html', 'Services/Contact');
require_once 'Services/Mail/classes/class.ilMailFormCall.php';
$this->tpl->setVariable("MAILACTION", ilMailFormCall::getLinkTarget($this, 'mailMembers', array(), array('type' => 'role', 'sig' => $this->createMailSignature())));
$this->tpl->setVariable("SELECT_ACTION", 'ilias.php?baseClass=ilmailgui&view=my_courses&search_crs=' . $this->object->getId());
$this->tpl->setVariable("MAIL_SELECTED", $this->lng->txt('send_mail_selected'));
$this->tpl->setVariable("MAIL_MEMBERS", $this->lng->txt('send_mail_members'));
$this->tpl->setVariable("MAIL_TUTOR", $this->lng->txt('send_mail_tutors'));
$this->tpl->setVariable("MAIL_ADMIN", $this->lng->txt('send_mail_admins'));
$this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath('arrow_downright.png'));
$this->tpl->setVariable("OK", $this->lng->txt('next'));
// Display roles with user friendly mailbox addresses
$role_folder = $rbacreview->getRoleFolderOfObject($this->object->getRefId());
$role_ids = $rbacreview->getRolesOfRoleFolder($role_folder['ref_id'], false);
// Sort by relevance
$sorted_role_ids = array();
$counter = 3;
foreach ($role_ids as $role_id) {
switch (substr(ilObject::_lookupTitle($role_id), 0, 8)) {
case 'il_crs_a':
$sorted_role_ids[2] = $role_id;
break;
case 'il_crs_t':
$sorted_role_ids[1] = $role_id;
break;
case 'il_crs_m':
$sorted_role_ids[0] = $role_id;
break;
default:
$sorted_role_ids[$counter++] = $role_id;
break;
}
}
ksort($sorted_role_ids, SORT_NUMERIC);
foreach ((array) $sorted_role_ids as $role_id) {
$this->tpl->setCurrentBlock("mailbox_row");
$role_addr = $rbacreview->getRoleMailboxAddress($role_id);
// check if role title is unique. if not force use pear mail for roles
$ids_for_role_title = ilObject::_getIdsForTitle(ilObject::_lookupTitle($role_id), 'role');
if (count($ids_for_role_title) >= 2) {
$ilias->setSetting('pear_mail_enable', 1);
}
$this->tpl->setVariable("CHECK_MAILBOX", ilUtil::formCheckbox(1, 'roles[]', htmlspecialchars($role_addr)));
if (ilMail::_usePearMail()) {
// if pear mail is enabled, mailbox addresses are already localized in the language of the user
$this->tpl->setVariable("MAILBOX", $role_addr);
} else {
// if pear mail is not enabled, we need to localize mailbox addresses in the language of the user
$this->tpl->setVariable("MAILBOX", ilObjRole::_getTranslation($ilObjDataCache->lookupTitle($role_id)) . " (" . $role_addr . ")");
}
$this->tpl->parseCurrentBlock();
}
}
示例12: getLocalRoles
/**
* returns all local roles [role_id] => title
* @return array
*/
protected function getLocalRoles()
{
$local_roles = $this->object->getLocalGroupRoles(false);
$grp_member = $this->object->getDefaultMemberRole();
$grp_roles = array();
//put the group member role to the top of the crs_roles array
if (in_array($grp_member, $local_roles)) {
$grp_roles[$grp_member] = ilObjRole::_getTranslation(array_search($grp_member, $local_roles));
unset($local_roles[$grp_roles[$grp_member]]);
}
foreach ($local_roles as $title => $role_id) {
$grp_roles[$role_id] = ilObjRole::_getTranslation($title);
}
return $grp_roles;
}
示例13: roleassignmentObject
/**
* display roleassignment panel
*
* @access public
*/
function roleassignmentObject()
{
global $rbacreview, $rbacsystem, $ilUser, $ilTabs;
$ilTabs->activateTab("role_assignment");
if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id)) {
$this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"), $this->ilias->error_obj->MESSAGE);
}
$_SESSION['filtered_roles'] = isset($_POST['filter']) ? $_POST['filter'] : $_SESSION['filtered_roles'];
if ($_SESSION['filtered_roles'] > 5) {
$_SESSION['filtered_roles'] = 0;
}
$this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'Services/User');
if (false) {
$this->tpl->setCurrentBlock("filter");
$this->tpl->setVariable("FILTER_TXT_FILTER", $this->lng->txt('filter'));
$this->tpl->setVariable("SELECT_FILTER", $this->__buildFilterSelect());
$this->tpl->setVariable("FILTER_ACTION", $this->ctrl->getFormAction($this));
$this->tpl->setVariable("FILTER_NAME", 'roleassignment');
$this->tpl->setVariable("FILTER_VALUE", $this->lng->txt('apply_filter'));
$this->tpl->parseCurrentBlock();
}
// init table
include_once "./Services/User/classes/class.ilRoleAssignmentTableGUI.php";
$tab = new ilRoleAssignmentTableGUI($this, "roleassignment");
// now get roles depending on filter settings
$role_list = $rbacreview->getRolesByFilter($tab->filter["role_filter"], $this->object->getId());
$assigned_roles = $rbacreview->assignedRoles($this->object->getId());
$counter = 0;
include_once './Services/AccessControl/classes/class.ilObjRole.php';
$records = array();
foreach ($role_list as $role) {
// fetch context path of role
$rolf = $rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
// only list roles that are not set to status "deleted"
if ($rbacreview->isDeleted($rolf[0])) {
continue;
}
// build context path
$path = "";
if ($this->tree->isInTree($rolf[0])) {
if ($rolf[0] == ROLE_FOLDER_ID) {
$path = $this->lng->txt("global");
} else {
$tmpPath = $this->tree->getPathFull($rolf[0]);
// count -1, to exclude the role folder itself
/*for ($i = 1; $i < (count($tmpPath)-1); $i++)
{
if ($path != "")
{
$path .= " > ";
}
$path .= $tmpPath[$i]["title"];
}*/
$path = $tmpPath[count($tmpPath) - 1]["title"];
}
} else {
$path = "<b>Rolefolder " . $rolf[0] . " not found in tree! (Role " . $role["obj_id"] . ")</b>";
}
$disabled = false;
// disable checkbox for system role for the system user
if ($this->object->getId() == SYSTEM_USER_ID and $role["obj_id"] == SYSTEM_ROLE_ID or !in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId())) and $role["obj_id"] == SYSTEM_ROLE_ID) {
$disabled = true;
}
// protected admin role
if ($role['obj_id'] == SYSTEM_ROLE_ID && !$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) {
include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
if (ilSecuritySettings::_getInstance()->isAdminRoleProtected()) {
$disabled = true;
}
}
if (substr($role["title"], 0, 3) == "il_") {
if (!$assignable) {
$rolf_arr = $rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
$rolf2 = $rolf_arr[0];
} else {
$rolf2 = $rolf;
}
$parent_node = $this->tree->getNodeData($rolf2);
$role["description"] = $this->lng->txt("obj_" . $parent_node["type"]) . " (#" . $parent_node["obj_id"] . ")";
}
$role_ids[$counter] = $role["obj_id"];
$result_set[$counter][] = $checkbox = ilUtil::formCheckBox(in_array($role["obj_id"], $assigned_roles), "role_id[]", $role["obj_id"], $disabled) . "<input type=\"hidden\" name=\"role_id_ctrl[]\" value=\"" . $role["obj_id"] . "\"/>";
$this->ctrl->setParameterByClass("ilobjrolegui", "ref_id", $rolf[0]);
$this->ctrl->setParameterByClass("ilobjrolegui", "obj_id", $role["obj_id"]);
$result_set[$counter][] = $link = "<a href=\"" . $this->ctrl->getLinkTargetByClass("ilobjrolegui", "perm") . "\">" . ilObjRole::_getTranslation($role["title"]) . "</a>";
$title = ilObjRole::_getTranslation($role["title"]);
$result_set[$counter][] = $role["description"];
// Add link to objector local Rores
if ($role["role_type"] == "local") {
// Get Object to the role
$obj_id = ilRbacReview::getObjectOfRole($role["rol_id"]);
$obj_type = ilObject::_lookupType($obj_id);
$ref_ids = ilObject::_getAllReferences($obj_id);
foreach ($ref_ids as $ref_id) {
//.........这里部分代码省略.........
示例14: 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());
}
示例15: createTitle
/**
* Create (linked) title
* @param array $role
* @return
*/
protected function createTitle($role)
{
global $ilCtrl;
include_once './Services/AccessControl/classes/class.ilObjRole.php';
$role['title'] = ilObjRole::_getTranslation($role['title']);
// No local policies
if ($role['parent'] != $this->getRefId()) {
return $role['title'];
}
$ilCtrl->setParameterByClass('ilobjrolegui', 'obj_id', $role['obj_id']);
return '<a class="tblheader" href="' . $ilCtrl->getLinkTargetByClass('ilobjrolegui', '') . '" >' . $role['title'] . '</a>';
}