本文整理汇总了PHP中Base_AclCommon::get_admin_level方法的典型用法代码示例。如果您正苦于以下问题:PHP Base_AclCommon::get_admin_level方法的具体用法?PHP Base_AclCommon::get_admin_level怎么用?PHP Base_AclCommon::get_admin_level使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base_AclCommon
的用法示例。
在下文中一共展示了Base_AclCommon::get_admin_level方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submit_contact
public static function submit_contact($values, $mode)
{
switch ($mode) {
case 'cloning':
$values['login'] = '';
return $values;
case 'display':
// display copy company data button and do update if needed
self::copy_company_data_subroutine($values);
$is_employee = false;
if (isset($values['related_companies']) && is_array($values['related_companies']) && in_array(CRM_ContactsCommon::get_main_company(), $values['related_companies'])) {
$is_employee = true;
}
if (isset($values['company_name']) && $values['company_name'] == CRM_ContactsCommon::get_main_company()) {
$is_employee = true;
}
$me = CRM_ContactsCommon::get_my_record();
$emp = array($me['id']);
$cus = array();
if ($is_employee) {
$emp[] = $values['id'];
} else {
$cus[] = 'P:' . $values['id'];
}
$ret = array();
$ret['new'] = array();
$ret['new']['crm_filter'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('Set CRM Filter')) . ' ' . Module::create_href(array('set_crm_filter' => 1)) . '>F</a>';
if (isset($_REQUEST['set_crm_filter'])) {
CRM_FiltersCommon::set_profile('c' . $values['id']);
}
if (ModuleManager::is_installed('CRM/Meeting') !== -1 && Utils_RecordBrowserCommon::get_access('crm_meeting', 'add')) {
$ret['new']['event'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('New Meeting')) . ' ' . Utils_RecordBrowserCommon::create_new_record_href('crm_meeting', array('employees' => $emp, 'customers' => $cus, 'status' => 0, 'priority' => 1, 'permission' => 0)) . '><img border="0" src="' . Base_ThemeCommon::get_template_file('CRM_Calendar', 'icon-small.png') . '"></a>';
}
if (ModuleManager::is_installed('CRM/Tasks') !== -1 && Utils_RecordBrowserCommon::get_access('task', 'add')) {
$ret['new']['task'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('New Task')) . ' ' . Utils_RecordBrowserCommon::create_new_record_href('task', array('employees' => $emp, 'customers' => $cus, 'status' => 0, 'priority' => 1, 'permission' => 0)) . '><img border="0" src="' . Base_ThemeCommon::get_template_file('CRM_Tasks', 'icon-small.png') . '"></a>';
}
if (ModuleManager::is_installed('CRM/PhoneCall') !== -1 && Utils_RecordBrowserCommon::get_access('phonecall', 'add')) {
$ret['new']['phonecall'] = '<a ' . Utils_TooltipCommon::open_tag_attrs(__('New Phonecall')) . ' ' . Utils_RecordBrowserCommon::create_new_record_href('phonecall', array('date_and_time' => date('Y-m-d H:i:s'), 'customer' => 'P:' . $values['id'], 'employees' => $me['id'], 'status' => 0, 'permission' => 0, 'priority' => 1), 'none', false) . '><img border="0" src="' . Base_ThemeCommon::get_template_file('CRM_PhoneCall', 'icon-small.png') . '"></a>';
}
$ret['new']['note'] = Utils_RecordBrowser::$rb_obj->add_note_button('contact/' . $values['id']);
return $ret;
case 'adding':
$values['permission'] = Base_User_SettingsCommon::get('CRM_Common', 'default_record_permission');
break;
case 'add':
if (isset($values['email']) && $values['email'] == '' && $values['login'] != 0 && $mode == 'add') {
$values['email'] = DB::GetOne('SELECT mail FROM user_password WHERE user_login_id=%d', array($values['login']));
}
case 'edit':
if (isset($values['create_company'])) {
$comp_id = Utils_RecordBrowserCommon::new_record('company', array('company_name' => $values['create_company_name'], 'address_1' => $values['address_1'], 'address_2' => $values['address_2'], 'country' => $values['country'], 'city' => $values['city'], 'zone' => isset($values['zone']) ? $values['zone'] : '', 'postal_code' => $values['postal_code'], 'phone' => $values['work_phone'], 'fax' => $values['fax'], 'web_address' => $values['web_address'], 'permission' => $values['permission']));
if (!isset($values['company_name'])) {
$values['company_name'] = null;
}
if (!isset($values['related_companies'])) {
$values['related_companies'] = array();
}
if (!is_array($values['related_companies'])) {
$values['related_companies'] = array($values['related_companies']);
}
if (!$values['company_name']) {
$values['company_name'] = $comp_id;
} else {
$values['related_companies'][] = $comp_id;
}
}
if (Base_AclCommon::i_am_admin()) {
if ($values['login'] == 'new') {
if (!$values['set_password']) {
$values['set_password'] = null;
}
Base_User_LoginCommon::add_user($values['username'], $values['email'], $values['set_password']);
$values['login'] = Base_UserCommon::get_user_id($values['username']);
} else {
if ($values['login']) {
Base_User_LoginCommon::change_user_preferences($values['login'], isset($values['email']) ? $values['email'] : '', isset($values['set_password']) ? $values['set_password'] : null);
if (isset($values['username']) && $values['username']) {
Base_UserCommon::rename_user($values['login'], $values['username']);
}
}
}
if (Base_AclCommon::i_am_sa() && $values['login'] && isset($values['admin']) && $values['admin'] !== '') {
$old_admin = Base_AclCommon::get_admin_level($values['login']);
if ($old_admin != $values['admin']) {
$admin_arr = array(0 => 'No', 1 => 'Administrator', 2 => 'Super Administrator');
if (Base_UserCommon::change_admin($values['login'], $values['admin']) !== true) {
Utils_RecordBrowserCommon::new_record_history('contact', $values['id'], 'Admin set from "' . $admin_arr[$old_admin] . '" to "' . $admin_arr[$values['admin']]);
}
}
}
}
unset($values['admin']);
unset($values['username']);
unset($values['set_password']);
unset($values['confirm_password']);
}
return $values;
}