本文整理汇总了PHP中Base_AclCommon::check_permission方法的典型用法代码示例。如果您正苦于以下问题:PHP Base_AclCommon::check_permission方法的具体用法?PHP Base_AclCommon::check_permission怎么用?PHP Base_AclCommon::check_permission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base_AclCommon
的用法示例。
在下文中一共展示了Base_AclCommon::check_permission方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: menu
public static function menu()
{
if (Base_AclCommon::check_permission('Dashboard')) {
return array(_M('Dashboard') => array());
}
return array();
}
示例2: menu
public static function menu()
{
if (Base_AclCommon::check_permission('Advanced User Settings')) {
return array(_M('My settings') => array('__weight__' => 10, '__submenu__' => 1, _M('Control panel') => array()));
}
return array();
}
示例3: menu
public static function menu()
{
if (!Acl::is_user() || !Base_AclCommon::check_permission('Fax - Browse')) {
return array();
}
return array(_M('CRM') => array('__submenu__' => 1, _M('Fax') => array()));
}
示例4: applet_caption
public static function applet_caption()
{
if (!Base_AclCommon::check_permission('Calendar')) {
return false;
}
return __('Agenda');
}
示例5: applet_info
public static function applet_info()
{
if (Base_AclCommon::check_permission('Shoutbox')) {
return __('Mini shoutbox');
}
//here can be associative array
return '';
}
示例6: menu
public static function menu()
{
if (Base_AclCommon::check_permission('Dashboard')) {
$tray_settings = Utils_TrayCommon::get_trays();
if (count($tray_settings) > 0) {
return array(_M('Tray') => array('__icon__' => 'pile_small.png'));
}
}
return array();
}
示例7: body
public function body()
{
if (!Base_AclCommon::i_am_user()) {
print __('First log in to the system.');
return;
}
$form = $this->init_module(Libs_QuickForm::module_name(), __('Saving settings'));
//pass
$form->addElement('header', null, __('Change password'));
$form->addElement('html', '<tr><td colspan=2>' . __('Leave password boxes empty if you prefer your current password') . '</td></tr>');
$form->addElement('password', 'new_pass', __('New password'));
$form->addElement('password', 'new_pass_c', __('Confirm new password'));
$form->addRule(array('new_pass', 'new_pass_c'), __('Your passwords don\'t match'), 'compare');
$form->addRule('new_pass', __('Your password must be longer then 5 chars'), 'minlength', 6);
//mail
$form->addElement('header', null, __('Change e-mail'));
$form->addElement('text', 'mail', __('New e-mail address'));
$form->addRule('mail', __('Field required'), 'required');
$form->addRule('mail', __('Invalid e-mail address'), 'email');
//autologin
$ret = DB::GetAll('SELECT autologin_id,description,last_log FROM user_autologin WHERE user_login_id=%d', array(Acl::get_user()));
if ($ret) {
$form->addElement('header', null, __('Delete autologin'));
}
foreach ($ret as $row) {
$form->addElement('checkbox', 'delete_autologin[' . $row['autologin_id'] . ']', $row['description'], Base_RegionalSettingsCommon::time2reg($row['last_log']));
}
//confirmation
$form->addElement('header', null, __('Confirmation'));
$form->addElement('password', 'old_pass', __('Old password'));
$form->registerRule('check_old_pass', 'callback', 'check_old_pass', $this);
$form->addRule('old_pass', __('Old password incorrect'), 'check_old_pass');
$form->addRule('old_pass', __('Field required'), 'required');
if (Base_AclCommon::check_permission('Advanced User Settings')) {
Base_ActionBarCommon::add('back', __('Back'), $this->create_main_href('Base_User_Settings'));
}
Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
#$form->addElement('submit', 'submit_button', __('OK'));
if ($form->validate_with_message('Setting saved', __('Problem encountered'))) {
if ($form->process(array(&$this, 'submit_user_preferences'))) {
if (Base_AclCommon::check_permission('Advanced User Settings')) {
Base_BoxCommon::location('Base_User_Settings');
}
}
} else {
//defaults
$ret = DB::Execute('SELECT p.mail FROM user_password p WHERE p.user_login_id=%d', Acl::get_user());
if ($row = $ret->FetchRow()) {
$form->setDefaults(array('mail' => $row[0]));
}
$form->display();
}
}
示例8: body
public function body()
{
if (!Base_AclCommon::check_permission('Dashboard')) {
return;
}
$this->help('Dashboard Help', 'main');
if (Utils_RecordBrowserInstall::is_installed()) {
//speed up links to RB
if (Utils_RecordBrowserCommon::check_for_jump()) {
return;
}
}
$this->dashboard();
Base_ActionBarCommon::show_quick_access_shortcuts(true);
}
示例9: has_access_to_report
public static function has_access_to_report($contact_record = null)
{
$has_permission = Base_AclCommon::check_permission('View Activity Report');
if ($contact_record === null && $has_permission) {
return true;
}
if (isset($contact_record['login']) && $contact_record['login']) {
if ($has_permission) {
return true;
}
$id = isset($contact_record['id']) ? $contact_record['id'] : false;
if (!$id) {
return false;
}
$my_record = CRM_ContactsCommon::get_my_record();
return $id == $my_record['id'];
}
}
示例10: mini
public function mini()
{
if (!Base_AclCommon::check_permission('Search')) {
return '';
}
$form = $this->init_module(Libs_QuickForm::module_name(), __('Searching'));
$form->addElement('text', 'quick_search', __('Quick Search'), array('x-webkit-speech' => 'x-webkit-speech', 'lang' => Base_LangCommon::get_lang_code(), 'onwebkitspeechchange' => $form->get_submit_form_js()));
$form->addElement('submit', 'quick_search_submit', __('Search'), array('class' => 'mini_submit'));
$theme = $this->pack_module(Base_Theme::module_name());
$theme->assign('submit_href', $form->get_submit_form_href());
$theme->assign('submit_label', __('Search'));
$form->assign_theme('form', $theme);
$theme->assign('form_mini', 'yes');
$theme->display('Search');
if ($form->validate()) {
$search = $form->exportValues();
Base_BoxCommon::location('Base_Search', null, null, null, array('quick_search' => $search['quick_search']));
}
}
示例11: body
public function body()
{
if (!Base_AclCommon::check_permission('View Activity Report')) {
return;
}
$rb_tabs = DB::GetAssoc('SELECT tab, caption FROM recordbrowser_table_properties ORDER BY caption');
foreach ($rb_tabs as $k => $v) {
$rb_tabs[$k] = Utils_RecordBrowserCommon::get_caption($k);
}
$form = $this->init_module('Libs/QuickForm');
$users_count = DB::GetOne('SELECT COUNT(id) FROM user_login') > Base_User_SettingsCommon::get('Utils_RecordBrowser', 'enable_autocomplete');
if ($users_count) {
$crits = array('!login' => '');
$fcallback = array('CRM_ContactsCommon', 'contact_format_no_company');
$form->addElement('autoselect', 'user', __('User'), array(), array(array('CRM_ContactsCommon', 'autoselect_contact_suggestbox'), array($crits, $fcallback)), $fcallback);
} else {
$users = DB::GetAssoc('SELECT id, id FROM user_login');
foreach ($users as $k => $u) {
$users[$k] = Base_UserCommon::get_user_label($u, true);
}
asort($users);
$users = array('' => '[' . __('All') . ']') + $users;
$form->addElement('select', 'user', __('User'), $users);
}
$form->addElement('multiselect', 'recordsets', __('Record Type'), $rb_tabs);
$form->addElement('checkbox', 'new', __('New record'));
$form->addElement('checkbox', 'edit', __('Record edit'));
$form->addElement('checkbox', 'delete_restore', __('Record Delete/restore'));
$form->addElement('checkbox', 'file', __('Files'));
$form->addElement('datepicker', 'start_date', __('Start Date'));
$form->addElement('datepicker', 'end_date', __('End Date'));
//$form->addElement('submit', 'submit', __('Show'));
Base_ActionBarCommon::add('search', __('Show'), $form->get_submit_form_href());
$filters = $this->get_module_variable('filters', array('user' => '', 'new' => 1, 'edit' => 1, 'delete_restore' => 1, 'recordsets' => array_keys($rb_tabs), 'start_date' => date('Y-m-01'), 'end_date' => date('Y-m-d')));
if ($form->validate()) {
$filters = $form->exportValues();
$this->set_module_variable('filters', $filters);
}
$form->setDefaults($filters);
$theme = $this->init_module('Base/Theme');
$form->assign_theme('form', $theme);
$theme->display();
$filters['recordsets'] = array_flip($filters['recordsets']);
foreach ($rb_tabs as $k => $v) {
if (!isset($filters['recordsets'][$k])) {
unset($rb_tabs[$k]);
}
}
$gb = $this->init_module('Utils/GenericBrowser', null, 'activity_report');
$gb->set_table_columns(array(array('name' => __('Date'), 'width' => 40), array('name' => __('User'), 'width' => 40), array('name' => __('Type'), 'width' => 40), array('name' => __('Label')), array('name' => __('Actions taken'), 'width' => 40)));
$tables = array();
if ($users_count) {
$filters['user'] = CRM_ContactsCommon::get_contact($filters['user']);
$filters['user'] = $filters['user']['login'];
}
$af_where = array();
foreach ($rb_tabs as $k => $t) {
$af_where[] = 'ual.local ' . DB::like() . ' ' . DB::Concat(DB::qstr($k . '/'), DB::qstr('%'));
}
$af_where = count($af_where) ? ' (' . implode(' OR ', $af_where) . ')' : 'TRUE ';
$e_where = array();
$c_where = '';
if ($filters['user']) {
$e_where[] = ' edited_by = ' . $filters['user'];
$c_where = ' created_by = ' . $filters['user'];
$af_where .= ' AND uaf.created_by = ' . $filters['user'];
}
if (isset($filters['edit'])) {
if (!isset($filters['delete_restore'])) {
$e_where[] = ' ehd.field!=' . DB::qstr('id');
}
} else {
if (isset($filters['delete_restore'])) {
$e_where[] = ' ehd.field=' . DB::qstr('id');
}
}
if ($filters['start_date']) {
$date = DB::qstr(date('Y-m-d', strtotime($filters['start_date'])));
$af_where .= ' AND uaf.created_on >= ' . $date;
$c_where .= ($c_where ? ' AND' : '') . ' created_on >= ' . $date;
$e_where[] = ' edited_on >= ' . $date;
}
if ($filters['end_date']) {
$date = DB::qstr(date('Y-m-d 23:59:59', strtotime($filters['end_date'])));
$af_where .= ' AND uaf.created_on <= ' . $date;
$c_where .= ($c_where ? ' AND' : '') . ' created_on <= ' . $date;
$e_where[] = ' edited_on <= ' . $date;
}
if (!empty($e_where)) {
$e_where = ' WHERE' . implode(' AND', $e_where);
} else {
$e_where = '';
}
if ($c_where) {
$c_where = ' WHERE' . $c_where;
}
$postgre_cast_type = DB::is_postgresql() ? '::varchar' : '';
// **** files ****
if (isset($filters['file'])) {
$tables[] = 'SELECT uaf.id AS id,uaf.created_on AS edited_on,uaf.created_by AS edited_by, ual.local AS r_id, ' . DB::qstr('') . ' AS tab, ' . DB::qstr('file') . ' AS action FROM utils_attachment_file uaf INNER JOIN utils_attachment_data_1 ua ON uaf.attach_id=ua.id INNER JOIN utils_attachment_local ual ON ua.id=ual.attachment WHERE original!=' . DB::qstr('') . ' AND ' . $af_where;
//.........这里部分代码省略.........
示例12: menu
public static function menu()
{
if (!Base_AclCommon::check_permission('Advanced User Settings')) {
return array(_M('My settings') => array('__weight__' => 10, '__submenu__' => 1, _M('Change password') => array()));
}
}
示例13: add_actionbar_change_subscription_button
public static function add_actionbar_change_subscription_button($category_name, $id = null)
{
if (!Base_AclCommon::check_permission('Watchdog - subscribe to categories')) {
return;
}
$category_id = self::get_category_id($category_name);
if (!$category_id) {
return;
}
$href = self::get_change_subscr_href($category_name, $id);
$subscribed = self::check_if_user_subscribes(Acl::get_user(), $category_id, $id);
if ($subscribed) {
$icon = Base_ThemeCommon::get_template_file('Utils_Watchdog', 'unwatch_big.png');
$label = __('Stop Watching');
} else {
$icon = Base_ThemeCommon::get_template_file('Utils_Watchdog', 'watch_big.png');
$label = __('Watch');
}
Base_ActionBarCommon::add($icon, $label, $href);
}
示例14: body_access
public static function body_access()
{
return Base_AclCommon::check_permission('Manage Perspective');
}
示例15: menu
public static function menu() {
if (Base_AclCommon::check_permission('Messenger Alerts'))
return array(_M('Messenger Alerts')=>array(
'__function__'=>'browse'));
return array();
}