当前位置: 首页>>代码示例>>PHP>>正文


PHP Base_AclCommon::i_am_admin方法代码示例

本文整理汇总了PHP中Base_AclCommon::i_am_admin方法的典型用法代码示例。如果您正苦于以下问题:PHP Base_AclCommon::i_am_admin方法的具体用法?PHP Base_AclCommon::i_am_admin怎么用?PHP Base_AclCommon::i_am_admin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Base_AclCommon的用法示例。


在下文中一共展示了Base_AclCommon::i_am_admin方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: admin_access

 public static function admin_access()
 {
     if (DEMO_MODE) {
         return false;
     }
     if (Variable::get('anonymous_setup')) {
         return true;
     }
     return Base_AclCommon::i_am_admin();
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:10,代码来源:SetupCommon_0.php

示例2: create_admin_modules_instances

 private function create_admin_modules_instances()
 {
     foreach (get_declared_classes() as $class) {
         $rclass = new ReflectionClass($class);
         if ($rclass->isSubclassOf("AdminModule") && !$rclass->isAbstract()) {
             $module = new $class();
             if (Base_AclCommon::i_am_sa() || Base_AclCommon::i_am_admin() && $module->access_admin() || Base_AclCommon::i_am_user() && $module->access_user()) {
                 $this->admin_modules[$class] = $module;
             }
         }
     }
     ksort($this->admin_modules);
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:13,代码来源:AdminIndex.php

示例3: user_admin

 public function user_admin()
 {
     if ($this->is_back()) {
         if ($this->parent->parent->get_type() == 'Base_Admin') {
             $this->parent->parent->reset();
         } else {
             location(array());
         }
         return;
     }
     if (!Base_AclCommon::i_am_admin()) {
         return false;
     }
     Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     $this->rb = $this->init_module('Utils/RecordBrowser', 'contact', 'contact');
     $logins = DB::GetAll('SELECT * FROM user_login');
     $active_logins = array();
     $inactive_logins = array();
     $user_logins = array();
     $admin_logins = array();
     $sa_logins = array();
     foreach ($logins as $i) {
         if ($i['active']) {
             $active_logins[] = $i['id'];
         } else {
             $inactive_logins[] = $i['id'];
         }
         if ($i['admin'] == 0) {
             $user_logins[] = $i['id'];
         } elseif ($i['admin'] == 1) {
             $admin_logins[] = $i['id'];
         } else {
             $sa_logins[] = $i['id'];
         }
     }
     $this->rb->set_custom_filter('username', array('type' => 'select', 'label' => __('Active'), 'args' => array('__NULL__' => '---', 1 => __('Yes'), 2 => __('No')), 'trans' => array('__NULL__' => array(), 1 => array('login' => $active_logins), 2 => array('login' => $inactive_logins))));
     $this->rb->set_custom_filter('admin', array('type' => 'select', 'label' => __('Admin'), 'args' => array('__NULL__' => '---', 0 => __('No'), 1 => __('Administrator'), 2 => __('Super Administrator')), 'trans' => array('__NULL__' => array(), 0 => array('login' => $user_logins), 1 => array('login' => $admin_logins), 2 => array('login' => $sa_logins))));
     $this->rb->set_defaults(array('country' => Base_User_SettingsCommon::get('Base_RegionalSettings', 'default_country'), 'zone' => Base_User_SettingsCommon::get('Base_RegionalSettings', 'default_state'), 'permission' => Base_User_SettingsCommon::get('CRM_Common', 'default_record_permission'), 'home_country' => Base_User_SettingsCommon::get('Base_RegionalSettings', 'default_country'), 'home_zone' => Base_User_SettingsCommon::get('Base_RegionalSettings', 'default_state'), 'login' => 'new'));
     $this->rb->set_default_order(array('last_name' => 'ASC', 'first_name' => 'ASC'));
     $this->rb->set_additional_actions_method(array($this, 'user_actions'));
     $this->rb->set_additional_caption(__('Users'));
     $this->rb->disable_pdf();
     $this->rb->disable_export();
     $this->display_module($this->rb, array(array(), array('!login' => ''), array('work_phone' => false, 'admin' => true, 'mobile_phone' => false, 'city' => false, 'zone' => false, 'login' => true, 'access' => true, 'email' => true), array('username' => true, 'admin' => true, 'access' => true, 'related_companies' => false)));
     Base_ActionBarCommon::add('edit', __('E-mail header'), $this->create_callback_href(array('Base_BoxCommon', 'push_module'), array($this->get_type(), 'change_email_header')), __('Edit the header of the message that is sent to each newly created user'));
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:46,代码来源:Contacts_0.php

示例4: addon

 public function addon($arg, $rb)
 {
     $rs = $rb->tab;
     $id = $arg['id'];
     if ($rs == 'contact' && Base_AclCommon::i_am_admin()) {
         Base_ActionBarCommon::add('reload', __('Reload mails'), $this->create_callback_href(array($this, 'reload_mails'), $arg['id']));
     }
     if (isset($_SESSION['rc_mails_cp']) && is_array($_SESSION['rc_mails_cp']) && !empty($_SESSION['rc_mails_cp'])) {
         $ok = true;
         $mails = Utils_RecordBrowserCommon::get_records('rc_mails', array('id' => $_SESSION['rc_mails_cp']), array('related', 'employee', 'contacts'));
         if (count($mails) != count($_SESSION['rc_mails_cp'])) {
             $ok = false;
         }
         if ($ok) {
             foreach ($mails as $mail) {
                 if (in_array($rs . '/' . $id, $mail['related']) || ($rs == 'contact' || $rs == 'company') && (in_array(($rs == 'contact' ? 'P:' : 'C:') . $id, $mail['contacts']) || $rs == 'contact' && $id == $mail['employee'])) {
                     $ok = false;
                     break;
                 }
             }
         }
         if ($ok) {
             $this->lp = $this->init_module('Utils_LeightboxPrompt');
             $this->lp->add_option('cancel', __('Cancel'), Base_ThemeCommon::get_template_file('Base_ActionBar', 'icons/back.png'), null);
             $this->lp->add_option('paste', __('Paste'), Base_ThemeCommon::get_template_file($this->get_type(), 'copy.png'), null);
             $content = '';
             foreach ($_SESSION['rc_mails_cp'] as $mid) {
                 $mail = Utils_RecordBrowserCommon::get_record('rc_mails', $mid);
                 $content .= '<div style="text-align:left"><b>' . __('From') . ':</b> <i>' . $mail['from'] . '</i><br /><b>' . __('To') . ':</b> <i>' . $mail['to'] . '</i><br /><b>' . __('Subject') . ':</b> <i>' . $mail['subject'] . '</i><br />' . substr(strip_tags($mail['body'], '<br><hr>'), 0, 200) . (strlen($mail['body']) > 200 ? '...' : '') . '</div>';
             }
             $this->display_module($this->lp, array(__('Paste e-mail'), array(), $content, false));
             $vals = $this->lp->export_values();
             if ($vals) {
                 if ($vals['option'] == 'paste') {
                     $this->paste($rs, $id);
                 }
             }
             Base_ActionBarCommon::add(Base_ThemeCommon::get_template_file($this->get_type(), 'copy.png'), __('Paste mail'), $this->lp->get_href());
             //$this->create_confirm_callback_href(__('Paste following email?'),array($this,'paste'),array($rs,$id)));
         }
     }
     $tb = $this->init_module('Utils/TabbedBrowser');
     $tb->set_tab(__('Threaded'), array($this, 'addon_threaded'), array($rs, $id));
     $tb->set_tab(__('Flat'), array($this, 'addon_flat'), array($rs, $id));
     $this->display_module($tb);
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:46,代码来源:Roundcube_0.php

示例5: display_status

 public static function display_status($record, $nolink, $desc)
 {
     $prefix = 'crm_tasks_leightbox';
     $v = $record[$desc['id']];
     if (!$v) {
         $v = 0;
     }
     $status = Utils_CommonDataCommon::get_translated_array('CRM/Status');
     if ($v >= 3 || $nolink) {
         return $status[$v];
     }
     CRM_FollowupCommon::drawLeightbox($prefix);
     if (!Utils_RecordBrowserCommon::get_access('task', 'edit', $record) && !Base_AclCommon::i_am_admin()) {
         return $status[$v];
     }
     if (isset($_REQUEST['form_name']) && $_REQUEST['form_name'] == $prefix . '_follow_up_form' && $_REQUEST['id'] == $record['id']) {
         unset($_REQUEST['form_name']);
         $v = $_REQUEST['closecancel'];
         $action = $_REQUEST['action'];
         $note = $_REQUEST['note'];
         if ($note) {
             if (get_magic_quotes_gpc()) {
                 $note = stripslashes($note);
             }
             $note = str_replace("\n", '<br />', $note);
             Utils_AttachmentCommon::add('task/' . $record['id'], 0, Acl::get_user(), $note);
         }
         if ($action == 'set_in_progress') {
             $v = 1;
         }
         Utils_RecordBrowserCommon::update_record('task', $record['id'], array('status' => $v));
         if ($action == 'set_in_progress') {
             location(array());
         }
         $values = $record;
         $values['date_and_time'] = date('Y-m-d H:i:s');
         $values['title'] = __('Follow-up') . ': ' . $values['title'];
         $values['status'] = 0;
         if ($action != 'none') {
             $x = ModuleManager::get_instance('/Base_Box|0');
             $values['follow_up'] = array('task', $record['id'], $record['title']);
             if ($action == 'new_task') {
                 $x->push_main('Utils/RecordBrowser', 'view_entry', array('add', null, $values), array('task'));
             }
             if ($action == 'new_meeting') {
                 $x->push_main('Utils/RecordBrowser', 'view_entry', array('add', null, array('title' => $values['title'], 'permission' => $values['permission'], 'priority' => $values['priority'], 'description' => $values['description'], 'date' => date('Y-m-d'), 'time' => date('H:i:s'), 'duration' => 3600, 'status' => 0, 'employees' => $values['employees'], 'customers' => $values['customers'], 'follow_up' => $values['follow_up'])), array('crm_meeting'));
             }
             if ($action == 'new_phonecall') {
                 $x->push_main('Utils/RecordBrowser', 'view_entry', array('add', null, array('subject' => $values['title'], 'permission' => $values['permission'], 'priority' => $values['priority'], 'description' => $values['description'], 'date_and_time' => date('Y-m-d H:i:s'), 'employees' => $values['employees'], 'status' => 0, 'customer' => !empty($values['customers']) ? array_pop($values['customers']) : '', 'follow_up' => $values['follow_up'])), array('phonecall'));
             }
             return false;
         }
         location(array());
     }
     if ($v == 0) {
         return '<a href="javascript:void(0)" onclick="' . $prefix . '_set_action(\'set_in_progress\');' . $prefix . '_set_id(\'' . $record['id'] . '\');' . $prefix . '_submit_form();">' . $status[$v] . '</a>';
     }
     return '<a href="javascript:void(0)" class="lbOn" rel="' . $prefix . '_followups_leightbox" onMouseDown="' . $prefix . '_set_id(' . $record['id'] . ');">' . $status[$v] . '</a>';
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:59,代码来源:TasksCommon_0.php

示例6: get_access

 public static function get_access($tab, $action, $record = null, $return_crits = false, $return_in_array = false)
 {
     if (!$return_crits && self::$admin_access && Base_AclCommon::i_am_admin()) {
         $ret = true;
     } elseif (isset($record[':active']) && !$record[':active'] && ($action == 'edit' || $action == 'delete' || $action == 'clone')) {
         return false;
     } else {
         static $cache = array();
         $cache_key = "{$tab}__USER_" . Base_AclCommon::get_user();
         if (!isset($cache[$cache_key])) {
             self::check_table_name($tab);
             $user_clearance = Base_AclCommon::get_clearance();
             $r = DB::Execute('SELECT * FROM ' . $tab . '_access AS acs WHERE NOT EXISTS (SELECT * FROM ' . $tab . '_access_clearance WHERE rule_id=acs.id AND ' . implode(' AND ', array_fill(0, count($user_clearance), 'clearance!=%s')) . ')', array_values($user_clearance));
             $crits = array('view' => null, 'edit' => null, 'delete' => null, 'add' => null, 'print' => null, 'export' => null, 'selection' => null);
             $crits_raw = array('view' => array(), 'edit' => array(), 'delete' => array(), 'add' => array(), 'print' => array(), 'export' => array(), 'selection' => array());
             $fields = array();
             while ($row = $r->FetchRow()) {
                 $fields[$row['id']] = array();
                 $new = self::parse_access_crits($row['crits']);
                 $crits_raw[$row['action']][$row['id']] = $new;
                 // if new or existing crit is empty, then we have access to all records
                 if ($new->is_empty()) {
                     $crits[$row['action']] = $new;
                 }
                 if ($crits[$row['action']] instanceof Utils_RecordBrowser_Crits && $crits[$row['action']]->is_empty()) {
                     continue;
                 }
                 $crits[$row['action']] = self::merge_crits($crits[$row['action']], $new, true);
             }
             $r = DB::Execute('SELECT * FROM ' . $tab . '_access_fields');
             while ($row = $r->FetchRow()) {
                 $fields[$row['rule_id']][$row['block_field']] = $row['block_field'];
             }
             $cache[$cache_key]['crits'] = $crits;
             $cache[$cache_key]['crits_raw'] = $crits_raw;
             $cache[$cache_key]['fields'] = $fields;
         } else {
             $crits = $cache[$cache_key]['crits'];
             $crits_raw = $cache[$cache_key]['crits_raw'];
             $fields = $cache[$cache_key]['fields'];
         }
         if ($return_crits) {
             if ($action == 'browse') {
                 $action = 'view';
             }
             if ($return_in_array) {
                 return $crits_raw[$action];
             }
             return $crits[$action];
         }
         if ($action == 'browse') {
             return $crits['view'] !== null ? true : false;
         }
         $ret = false;
         $blocked_fields = array();
         if ($action != 'browse' && $action != 'clone') {
             foreach ($crits_raw[$action] as $rule_id => $c) {
                 if ($record != null && !self::check_record_against_crits($tab, $record, $c)) {
                     continue;
                 }
                 if (!$ret) {
                     $ret = true;
                     $blocked_fields = $fields[$rule_id];
                 } else {
                     foreach ($blocked_fields as $f => $v) {
                         if (!isset($fields[$rule_id][$f])) {
                             unset($blocked_fields[$f]);
                         }
                     }
                 }
             }
         }
     }
     if ($action !== 'browse' && $action !== 'delete') {
         self::init($tab);
         if ($ret === false) {
             return false;
         }
         if ($ret === true) {
             $ret = array();
         }
         foreach (self::$table_rows as $field => $args) {
             if (!isset($ret[$args['id']])) {
                 if (isset($blocked_fields[$args['id']])) {
                     $ret[$args['id']] = false;
                 } else {
                     $ret[$args['id']] = true;
                 }
             }
         }
     }
     return $ret;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:93,代码来源:RecordBrowserCommon_0.php

示例7: require_once

require_once('../../../include.php');

if (!isset($_SESSION['client']['utils_recordbrowser'][$key])) {
    die('Invalid request');
}

$crits = $_SESSION['client']['utils_recordbrowser'][$key]['crits'];
$cols = $_SESSION['client']['utils_recordbrowser'][$key]['cols'];
$order = $_SESSION['client']['utils_recordbrowser'][$key]['order'];
$admin = $_SESSION['client']['utils_recordbrowser'][$key]['admin'];
$tab = $_SESSION['client']['utils_recordbrowser'][$key]['tab'];
$more_table_properties = $_SESSION['client']['utils_recordbrowser'][$key]['more_table_properties'];
$limit = $_SESSION['client']['utils_recordbrowser'][$key]['limit'];

ModuleManager::load_modules();
if (!Utils_RecordBrowserCommon::get_access($tab, 'print') && !Base_AclCommon::i_am_admin())
	die('Access denied');

set_time_limit(0);

$rb = ModuleManager::new_instance('Utils_RecordBrowser', null, 'print_rb');
$rb->construct($tab);
$rb->set_inline_display();
$rb->set_header_properties($more_table_properties);
$rb->disable_pagination();

ob_start();
$rb->show_data($crits, $cols, $order, $admin, false, true, $limit);
$html = ob_get_clean();

$limit_info = '';
开发者ID:62BRAINS,项目名称:EPESI,代码行数:31,代码来源:print.php

示例8: die

<?php

/**
 * @author Arkadiusz Bisaga <abisaga@telaxus.com>
 * @copyright Copyright &copy; 2008, Telaxus LLC
 * @license MIT
 * @version 1.0
 * @package epesi-lang
 * @subpackage timesheet
 */
if (!isset($_POST['cid']) || !isset($_POST['lang'])) {
    die('alert(\'Invalid request\')');
}
define('JS_OUTPUT', 1);
define('CID', $_POST['cid']);
define('READ_ONLY_SESSION', true);
require_once '../../../../include.php';
ModuleManager::load_modules();
if (!Base_AclCommon::i_am_admin()) {
    die('');
}
$lang = $_POST['lang'];
Base_Lang_AdministratorCommon::send_lang($lang);
开发者ID:cretzu89,项目名称:EPESI,代码行数:23,代码来源:send_current.php

示例9: view_entry

    public function view_entry($mode='view', $id = null, $defaults = array(), $show_actions=true) {
		Base_HelpCommon::screen_name('rb_'.$mode.'_'.$this->tab);
        if (isset($_SESSION['client']['recordbrowser']['admin_access'])) Utils_RecordBrowserCommon::$admin_access = true;
        self::$mode = $mode;
        if ($this->navigation_executed) {
            $this->navigation_executed = false;
            return true;
        }
        if ($this->check_for_jump()) return;
        $theme = $this->init_module('Base/Theme');
        if ($this->isset_module_variable('id')) {
            $id = $this->get_module_variable('id');
            $this->unset_module_variable('id');
        }
        self::$browsed_records = null;

        Utils_RecordBrowserCommon::$cols_order = array();
        $js = ($mode!='view');
        $time = microtime(true);
        if ($this->is_back()) {
            self::$clone_result = 'canceled';
            return $this->back();
        }

        $this->init();
		if (is_numeric($id)) {
	                $id = intVal($id);
			self::$last_record = $this->record = Utils_RecordBrowserCommon::get_record($this->tab, $id, $mode!=='edit');
		} else {
			self::$last_record = $this->record = $id;
			$id = intVal($this->record['id']);
		}
		if ($id===0) $id = null;
        if ($id!==null && is_numeric($id)) Utils_WatchdogCommon::notified($this->tab,$id);

        if($mode=='add') {
            foreach ($defaults as $k=>$v)
                $this->custom_defaults[$k] = $v;
            foreach($this->table_rows as $field => $args)
                if (!isset($this->custom_defaults[$args['id']]))
					$this->custom_defaults[$args['id']] = $args['type'] == 'multiselect' ? array() : '';
			$this->custom_defaults['created_by'] = Acl::get_user();
		}

        $access = $this->get_access($mode=='history'?'view':$mode, isset($this->record)?$this->record:$this->custom_defaults);
        if ($mode=='edit' || $mode=='add')
            $this->view_fields_permission = $this->get_access('view', isset($this->record)?$this->record:$this->custom_defaults);
        else
            $this->view_fields_permission = $access;

        if ($mode!='add' && (!$access || $this->record==null)) {
            if (Base_AclCommon::i_am_admin()) {
                Utils_RecordBrowserCommon::$admin_access = true;
                $access = $this->get_access($mode, isset($this->record)?$this->record:$this->custom_defaults);
                if ($mode=='edit' || $mode=='add')
                    $this->view_fields_permission = $this->get_access('view', isset($this->record)?$this->record:$this->custom_defaults);
                else
                    $this->view_fields_permission = $access;
            } else {
                print(__('You don\'t have permission to view this record.'));
                if ($show_actions===true || (is_array($show_actions) && (!isset($show_actions['back']) || $show_actions['back']))) {
                    Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
                    //Utils_ShortcutCommon::add(array('esc'), 'function(){'.$this->create_back_href_js().'}');
                }
                return true;
            }
        }
        if ($mode=='add' && !$access) {
			print(__('You don\'t have permission to perform this action.'));
			if ($show_actions===true || (is_array($show_actions) && (!isset($show_actions['back']) || $show_actions['back']))) {
				Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
				//Utils_ShortcutCommon::add(array('esc'), 'function(){'.$this->create_back_href_js().'}');
			}
			return true;
		}

        if($mode == 'add' || $mode == 'edit') {
            $theme -> assign('click2fill', '<div id="c2fBox"></div>');
            load_js('modules/Utils/RecordBrowser/click2fill.js');
            eval_js('initc2f("'.__('Scan/Edit').'","'.__('Paste data here with Ctrl-v, click button below, then click on separated words in specific order and click in text field where you want put those words. They will replace text in that field.').'")');
            Base_ActionBarCommon::add('clone', __('Click 2 Fill'), 'href="javascript:void(0)" onclick="c2f()"');
        }

//        if ($mode!='add' && !$this->record[':active'] && !Base_AclCommon::i_am_admin()) return $this->back();

        $tb = $this->init_module('Utils/TabbedBrowser', null, 'recordbrowser_addons');
		if ($mode=='history') $tb->set_inline_display();
        self::$tab_param = $tb->get_path();

        $form = $this->init_module('Libs/QuickForm',null, $mode);
        if(Base_User_SettingsCommon::get($this->get_type(), 'confirm_leave') && ($mode == 'add' || $mode == 'edit'))
        	$form->set_confirm_leave_page();
        
        $this->form = $form;

        if($mode!='add')
            Utils_RecordBrowserCommon::add_recent_entry($this->tab, Acl::get_user(),$id);

		$dp = Utils_RecordBrowserCommon::record_processing($this->tab, $mode!='add'?$this->record:$this->custom_defaults, ($mode=='view' || $mode=='history')?'view':$mode.'ing');
		if($dp===false) return false;
//.........这里部分代码省略.........
开发者ID:62BRAINS,项目名称:EPESI,代码行数:101,代码来源:RecordBrowser_0.php

示例10: 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;
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:98,代码来源:ContactsCommon_0.php

示例11: admin_access

 public static function admin_access()
 {
     return Base_AclCommon::i_am_admin();
 }
开发者ID:62BRAINS,项目名称:EPESI,代码行数:4,代码来源:AdminCommon_0.php

示例12: basic_clearance

 public static function basic_clearance($all = false)
 {
     $user_clearance = array(__('All users') => 'ALL');
     if ($all || Base_AclCommon::i_am_admin()) {
         $user_clearance[__('Admin')] = 'ADMIN';
     }
     if ($all || Base_AclCommon::i_am_sa()) {
         $user_clearance[__('Superadmin')] = 'SUPERADMIN';
     }
     return $user_clearance;
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:11,代码来源:AclCommon_0.php


注:本文中的Base_AclCommon::i_am_admin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。