本文整理汇总了PHP中module_security::get_roles方法的典型用法代码示例。如果您正苦于以下问题:PHP module_security::get_roles方法的具体用法?PHP module_security::get_roles怎么用?PHP module_security::get_roles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module_security
的用法示例。
在下文中一共展示了module_security::get_roles方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
/**
* Copyright: dtbaker 2012
* Licence: Please check CodeCanyon.net for licence details.
* More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/
* Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
* Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
* Package Date: 2015-11-25 02:55:20
* IP Address: 67.79.165.254
*/
$search = isset($_REQUEST['search']) && is_array($_REQUEST['search']) ? $_REQUEST['search'] : array();
$search['customer_id'] = 0;
$users = module_user::get_users($search);
// grab a list of customer sites
$sites = array();
$user_statuses = module_user::get_statuses();
$roles = module_security::get_roles();
$heading = array('title' => _l('User Administration'), 'button' => array(), 'main' => true);
if (module_user::can_i('create', 'Users', 'Config')) {
$heading['button'][] = array('title' => 'Add new user', 'type' => 'add', 'url' => $module->link_open('new'));
}
print_heading($heading);
?>
<form action="" method="post">
<?php
$search_bar = array('elements' => array('name' => array('title' => _l('Users Name:'), 'field' => array('type' => 'text', 'name' => 'search[generic]', 'value' => isset($search['generic']) ? $search['generic'] : ''))));
echo module_form::search_bar($search_bar);
/** START TABLE LAYOUT **/
示例2: _l
<?php
/**
* Copyright: dtbaker 2012
* Licence: Please check CodeCanyon.net for licence details.
* More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/
* Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
* Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
* Package Date: 2015-11-25 02:55:20
* IP Address: 67.79.165.254
*/
$module->page_title = _l('Customer Signup');
print_heading(array('title' => 'Customer Signup Form', 'type' => 'h2', 'main' => true));
$roles = array();
foreach (module_security::get_roles() as $r) {
$roles[$r['security_role_id']] = $r['name'];
}
ob_start();
$invoice_templates = array();
$invoice_templates['customer_signup_thank_you_page'] = 1;
$invoice_templates['customer_signup_email_welcome'] = 1;
$invoice_templates['customer_signup_email_admin'] = 1;
$invoice_templates['customer_signup_form_wrapper'] = 1;
foreach ($invoice_templates as $template_key => $tf) {
module_template::link_open_popup($template_key);
}
$template_html = ob_get_clean();
module_config::print_settings_form(array(array('key' => 'customer_signup_allowed', 'default' => 0, 'type' => 'select', 'options' => array(0 => _l('Not allowed'), 1 => _l('Allowed')), 'description' => 'Enable customer signup form'), array('key' => 'customer_signup_always_new', 'default' => 0, 'type' => 'select', 'options' => array(0 => _l('Allow Update of Existing Customer Entries'), 1 => _l('Always Create New Customer Entries')), 'description' => 'Matching email address action', 'help' => 'If a customer fills in this form and the email address already exists in the system then it can update the existing entry instead of creating a new customer entry. If updating existing entry then the new customer name will be applied, which could differ from existing company name. Set this option to "Always Create New Customer Entry" if you do not want a customer to be able to update their existing details.'), array('key' => 'customer_signup_password', 'default' => 0, 'type' => 'select', 'options' => array(0 => _l('No Password, Admin creates password for each new account (most secure option)'), 1 => _l('Allow Primary User to pick a Password on Signup')), 'description' => 'User Passwords', 'help' => 'If a user has a password they can login to the system and see all their details.'), array('key' => 'customer_signup_role', 'default' => 0, 'type' => 'select', 'options' => $roles, 'description' => 'User Role', 'help' => 'Assign this User Role to all newly created contacts.'), array('key' => 'captcha_on_signup_form', 'default' => 0, 'type' => 'select', 'options' => array(0 => _l('No'), 1 => _l('Yes')), 'description' => 'Use CAPTCHA on signup form'), array('key' => 'customer_signup_redirect', 'default' => '', 'type' => 'text', 'description' => 'Redirect URL', 'help' => 'If no redirect URL is set then the standard thank you message will be displayed. This can be changed in Settings > Templates > customer_signup_thank_you_page'), array('key' => 'customer_signup_admin_email', 'default' => module_config::c('admin_email_address'), 'type' => 'text', 'description' => 'What email address will signup notifications be sent to'), array('key' => 'customer_signup_contact_count', 'default' => 1, 'type' => 'text', 'description' => 'Number of customer contacts'), array('key' => 'customer_signup_password', 'default' => 0, 'type' => 'select', 'options' => array(0 => _l('No'), 1 => _l('Yes')), 'description' => 'Ask for Password'), array('key' => 'customer_signup_on_login', 'default' => 0, 'type' => 'select', 'options' => array(0 => _l('No'), 1 => _l('Yes')), 'description' => 'Show Signup Link on Login Page'), array('key' => 'customer_signup_on_login_url', 'default' => '', 'type' => 'text', 'description' => 'Signup Page URL', 'help' => 'If you have placed the signup form on a page of your website, put that website URL here (e.g. http://www.yourwebsite.com/signup.html)'), array('key' => 'customer_signup_subscription_start', 'default' => '', 'type' => 'text', 'description' => 'Subscription Start Date Modification', 'help' => 'How much to modify the subscription start date by (if they choose a Subscription during signup). Examples are: +5 days or +2 weeks'), array('type' => 'html', 'description' => 'Templates', 'html' => $template_html)));
$form_html = module_customer::get_customer_signup_form_html();
?>
示例3: handle_import
//.........这里部分代码省略.........
if ($user['name'] == $row['primary_user_name']) {
$user_match = $user['user_id'];
break;
}
}
$user_update = array('customer_id' => $customer_id);
if (isset($row['primary_user_name'])) {
$user_update['name'] = $row['primary_user_name'];
}
if (isset($row['primary_user_last_name'])) {
$user_update['last_name'] = $row['primary_user_last_name'];
}
if (isset($row['primary_user_email'])) {
$user_update['email'] = $row['primary_user_email'];
}
if (isset($row['primary_user_phone'])) {
$user_update['phone'] = $row['primary_user_phone'];
}
if (isset($row['primary_user_fax'])) {
$user_update['fax'] = $row['primary_user_fax'];
}
if (isset($row['primary_user_mobile'])) {
$user_update['mobile'] = $row['primary_user_mobile'];
}
if (isset($row['primary_user_language'])) {
$user_update['language'] = $row['primary_user_language'];
}
if (isset($row['password']) && strlen($row['password'])) {
$user_update['password'] = md5(trim($row['password']));
}
$user_match = update_insert("user_id", $user_match, "user", $user_update);
if ($user_match && isset($row['role']) && strlen(trim($row['role']))) {
// find this role name and assign it to this user.
$role = module_security::get_roles(array('name' => $row['role']));
if ($role) {
$user_role = array_shift($role);
$role_id = $user_role['security_role_id'];
module_user::add_user_to_role($user_match, $role_id);
}
}
self::set_primary_user_id($customer_id, $user_match);
// do a hack to save address.
$existing_address = module_address::get_address($customer_id, 'customer', 'physical');
$address_id = $existing_address && isset($existing_address['address_id']) ? (int) $existing_address['address_id'] : 'new';
$address = array_merge($row, array('owner_id' => $customer_id, 'owner_table' => 'customer', 'address_type' => 'physical'));
module_address::save_address($address_id, $address);
foreach ($add_to_group as $group_id => $tf) {
module_group::add_to_group($group_id, $customer_id, 'customer');
}
// handle any extra fields.
$extra = array();
foreach ($row as $key => $val) {
if (!strlen(trim($val))) {
continue;
}
if (strpos($key, 'extra:') !== false) {
$extra_key = str_replace('extra:', '', $key);
if (strlen($extra_key)) {
$extra[$extra_key] = $val;
}
}
}
if ($extra) {
// we handle extra importing for customer extra fields and contact extra fields.
// sort out which are which.
// but they have to be unique names. for now. oh well that'll do.