本文整理汇总了PHP中Role::retrieve方法的典型用法代码示例。如果您正苦于以下问题:PHP Role::retrieve方法的具体用法?PHP Role::retrieve怎么用?PHP Role::retrieve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Role
的用法示例。
在下文中一共展示了Role::retrieve方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_roles
public function action_roles($id = false)
{
$toret = new stdClass();
if ($id) {
$toret->role = Role::retrieve($id, 'dbobject');
if ($toret->role) {
$query = new SelectQuery('Permission');
$query->filter('`role` = :role');
$toret->permissions = $query->fetchAll(array(':role' => $toret->role->array['name']));
$query = new SelectQuery('Assignment');
$query->leftJoin('BackendUser', array('`backend_users`.`id` = `assignments`.`access_id`'))->filter("`assignments`.`access_type` = 'users'")->filter('`role_id` = :role OR `role_id` = 0');
$toret->assignments = $query->fetchAll(array(':role' => $toret->role->array['id']));
} else {
$toret->permissions = null;
}
} else {
$toret->roles = Role::retrieve();
}
return $toret;
}
示例2: assign
public static function assign($role_id, $access_type, $access_id)
{
$result = false;
//if (!self::barredRole($role)) {
if (!is_numeric($role_id)) {
$role_id = Role::retrieve($role_id);
$role_id = $role_id['id'];
}
$params = array(':role_id' => $role_id, ':access_type' => $access_type, ':access_id' => $access_id);
$query = new SelectQuery('Assignment');
$query->filter('`role_id`= :role_id')->filter('`access_type` = :access_type')->filter('`access_id` = :access_id');
$id = $query->fetchColumn($params);
if ($id) {
$result = true;
} else {
$keys = array('role_id', 'access_type', 'access_id');
$data = array_combine($keys, array_values($params));
$query = new InsertQuery('Assignment');
$query->data($data);
$result = $query->execute() ? true : false;
}
//}
return $result;
}
示例3: Role
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$focus = new Role();
$focus->retrieve($_REQUEST['record']);
$focus->set_user_relationship($focus->id, $_REQUEST['mass']);
$header_URL = $sugar_config["site_url"] . "/index.php?action=PopupUsers&form=UsersForm&module=Users&record={$_REQUEST['record']}";
$GLOBALS['log']->debug("about to post header URL of: {$header_URL}");
echo "<script language=javascript>\n";
echo "<!-- //\n";
echo " window.opener.location.reload();\n";
echo "\twindow.location=\"{$header_URL}\";\n";
echo "// -->\n";
echo "</script>";
示例4: Role
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
require_once 'modules/Roles/Role.php';
require_once 'include/utils.php';
$focus = new Role();
$tabs_def = urldecode($_REQUEST['display_tabs_def']);
$tabs_hide = urldecode($_REQUEST['hide_tabs_def']);
$allow_modules = explode(':::', $tabs_def);
$disallow_modules = explode(':::', $tabs_hide);
$focus->retrieve($_POST['record']);
print_r($_POST);
unset($_POST['id']);
foreach ($focus->column_fields as $field) {
if (isset($_POST[$field])) {
$value = $_POST[$field];
$focus->{$field} = $value;
}
}
$check_notify = FALSE;
$focus->save($check_notify);
$return_id = $focus->id;
$focus->clear_module_relationship($return_id);
$focus->set_module_relationship($return_id, $allow_modules, 1);
$focus->set_module_relationship($return_id, $disallow_modules, 0);
if (isset($_POST['return_module']) && $_POST['return_module'] != "") {
示例5: html_roles
public function html_roles($userRoles)
{
Backend::add('Sub Title', 'User Roles');
$vars = array('user_id' => Controller::$parameters[0], 'user_roles' => $userRoles, 'system_roles' => Role::retrieve(false, 'list'));
Backend::addContent(Render::file('backend_user.roles.tpl.php', $vars));
}