本文整理汇总了PHP中Utils_RecordBrowserCommon::get_access方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils_RecordBrowserCommon::get_access方法的具体用法?PHP Utils_RecordBrowserCommon::get_access怎么用?PHP Utils_RecordBrowserCommon::get_access使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils_RecordBrowserCommon
的用法示例。
在下文中一共展示了Utils_RecordBrowserCommon::get_access方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format_values
protected function format_values($tab, $record_id)
{
$rb_obj = new RBO_RecordsetAccessor($tab);
$record = $rb_obj->get_record($record_id);
if (!$record) {
return array();
}
$access = Utils_RecordBrowserCommon::get_access($tab, 'view', $record);
if (!$access) {
return array();
}
// use RB object instance for better display callback compatibility
// some of them uses Utils_RecordBrowser::$rb_obj instance
$rb = ModuleManager::new_instance('Utils_RecordBrowser', null, 'rb');
$rb->construct($tab);
$rb->init($tab);
$fields = Utils_RecordBrowserCommon::init($tab);
$printable_data = array();
foreach ($fields as $f) {
if ($access[$f['id']]) {
$printable_data[] = array('label' => _V($f['name']), 'value' => $record->get_val($f['id'], true));
}
}
// fill rows - it's easier here than in template
if ($this->fill_empty_rows()) {
while (count($printable_data) % $this->cols() != 0) {
$printable_data[] = array('label' => '', 'value' => '');
}
}
return $printable_data;
}
示例2: user_settings
public static function user_settings()
{
if (Utils_RecordBrowserCommon::get_access('rc_accounts', 'browse')) {
return array(__('E-mail Accounts') => 'account_manager');
}
return array();
}
示例3: menu
public static function menu()
{
if (Utils_RecordBrowserCommon::get_access('crm_assets', 'browse')) {
return array(_M('CRM') => array('__submenu__' => 1, _M('Assets') => array()));
} else {
return array();
}
}
示例4: menu
public static function menu()
{
$tabs = DB::GetAssoc('SELECT menu, tab FROM recordbrowser_custom_recordsets WHERE active=1');
$result = array();
foreach ($tabs as $k => $v) {
if (!$k) {
continue;
}
if (!Utils_RecordBrowserCommon::get_access($v, 'browse')) {
continue;
}
$k = explode(self::$sep, $k);
$menu = self::build_menu($k, array('tab' => $v));
$result = array_merge_recursive($menu, $result);
}
return $result;
}
示例5: die
// date in the past
if (!isset($_GET['mail_id']) || !is_numeric($_GET['mail_id']) || !isset($_GET['mime_id']) || !is_numeric($_GET['mime_id']) && strlen($_GET['mime_id']) != 32) {
die('Invalid request');
}
define('CID', false);
define('READ_ONLY_SESSION', true);
require_once '../../../include.php';
ModuleManager::load_modules();
if (!Acl::is_user()) {
die('Not logged in');
}
$rec = Utils_RecordBrowserCommon::get_record('rc_mails', $_GET['mail_id']);
if (!$rec) {
die('Invalid e-mail id.');
}
$access_fields = Utils_RecordBrowserCommon::get_access('rc_mails', 'view', $rec);
if (!isset($access_fields['body']) || !$access_fields['body']) {
die('Access forbidden');
}
list($mimetype, $name, $attachment) = DB::GetRow('SELECT type,name,attachment FROM rc_mails_attachments WHERE mail_id=%d AND mime_id=%s', array($_GET['mail_id'], $_GET['mime_id']));
$disposition = $attachment ? 'attachment' : 'inline';
$filename = DATA_DIR . '/CRM_Roundcube/attachments/' . $_GET['mail_id'] . '/' . $_GET['mime_id'];
if (headers_sent()) {
die('Some data has already been output to browser, can\'t send file');
}
if (!file_exists($filename)) {
die('File doesn\'t exists');
}
$buffer = file_get_contents($filename);
header('Content-Type: ' . $mimetype);
header('Content-Length: ' . strlen($buffer));
示例6: fputcsv
fputcsv($f, $cols);
$currency_codes = DB::GetAssoc('SELECT symbol, code FROM utils_currency');
function rb_csv_export_format_currency_value($v, $symbol)
{
static $currency_decimal_signs = null;
static $currency_thou_signs;
if ($currency_decimal_signs === null) {
$currency_decimal_signs = DB::GetAssoc('SELECT symbol, decimal_sign FROM utils_currency');
$currency_thou_signs = DB::GetAssoc('SELECT symbol, thousand_sign FROM utils_currency');
}
$v = str_replace($currency_thou_signs[$symbol], '', $v);
$v = str_replace($currency_decimal_signs[$symbol], '.', $v);
return $v;
}
foreach ($records as $r) {
$has_access = Utils_RecordBrowserCommon::get_access($tab, 'view', $r);
if (!$has_access) {
continue;
}
$rec = array($r['id']);
$details = Utils_RecordBrowserCommon::get_record_info($tab, $r['id']);
$rec[] = $details['created_on'];
$rec[] = Base_UserCommon::get_user_label($details['created_by'], true);
$rec[] = $details['edited_on'];
$rec[] = $details['edited_by'] ? Base_UserCommon::get_user_label($details['edited_by'], true) : '';
foreach ($tab_info as $field_name => $v) {
if (!$v['export']) {
continue;
}
ob_start();
if (!isset($has_access[$v['id']]) || !$has_access[$v['id']]) {
示例7: isset
$cid = $_REQUEST['cid'];
$id = $_REQUEST['id'];
$disposition = isset($_REQUEST['view']) && $_REQUEST['view'] ? 'inline' : 'attachment';
define('CID', $cid);
define('READ_ONLY_SESSION', true);
require_once '../../../include.php';
ModuleManager::load_modules();
if (!Acl::is_user()) {
die('Permission denied');
}
$file = DB::GetRow('SELECT uaf.attach_id, uaf.original, uaf.filestorage_id FROM utils_attachment_file uaf WHERE uaf.id=%d', array($id));
$rec = Utils_RecordBrowserCommon::get_record('utils_attachment', $file['attach_id']);
if (!$rec) {
die('Invalid attachment.');
}
$access_fields = Utils_RecordBrowserCommon::get_access('utils_attachment', 'view', $rec);
if (!isset($access_fields['note']) || !$access_fields['note']) {
die('Access forbidden');
}
$original = $file['original'];
$local = $rec['id'];
$fsid = $file['filestorage_id'];
$crypted = $rec['crypted'];
$meta = Utils_FileStorageCommon::meta($fsid);
require_once 'mime.php';
if (headers_sent()) {
die('Some data has already been output to browser, can\'t send file');
}
$password = '';
if ($crypted) {
$password = $_SESSION['client']['cp' . $rec['id']];
示例8: body
//.........这里部分代码省略.........
}
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;
}
// **** edit ****
if (isset($filters['edit']) || isset($filters['delete_restore'])) {
foreach ($rb_tabs as $k => $t) {
$tables[] = 'SELECT id, edited_on, edited_by, ' . $k . '_id' . $postgre_cast_type . ' as r_id, ' . DB::qstr($k) . ' as tab, ' . DB::qstr('edit') . ' as action FROM ' . $k . '_edit_history eh LEFT JOIN ' . $k . '_edit_history_data ehd ON ehd.edit_id=eh.id' . $e_where;
}
}
// **** create ****
if (isset($filters['new'])) {
foreach ($rb_tabs as $k => $t) {
$tables[] = 'SELECT 0 AS id, created_on AS edited_on, created_by AS edited_by, id' . $postgre_cast_type . ' as r_id, ' . DB::qstr($k) . ' as tab, ' . DB::qstr('create') . ' as action FROM ' . $k . '_data_1' . $c_where;
}
}
if (!empty($tables)) {
$tables = implode(' UNION ', $tables);
$limit = DB::GetOne('SELECT COUNT(*) FROM (' . $tables . ') AS tmp');
$limit = $gb->get_limit($limit);
$ret = DB::SelectLimit('SELECT * FROM (' . $tables . ') AS tmp ORDER BY edited_on DESC', $limit['numrows'], $limit['offset']);
while ($row = $ret->FetchRow()) {
$user = Base_UserCommon::get_user_label($row['edited_by']);
$action = '';
$link = '';
switch ($row['action']) {
case 'edit':
$details = DB::GetAssoc('SELECT field, old_value FROM ' . $row['tab'] . '_edit_history_data WHERE edit_id=%d', array($row['id']));
if (isset($details['id'])) {
$action = $details['id'] == 'DELETED' ? __('Deleted') : __('Restored');
} else {
$action = __('Edited');
$action = '<a ' . Utils_TooltipCommon::tooltip_leightbox_mode() . ' ' . Utils_TooltipCommon::ajax_open_tag_attrs(array('Utils_RecordBrowserCommon', 'get_edit_details_label'), array($row['tab'], $row['r_id'], $row['id']), 500) . '>' . $action . '</a>';
}
$r_id = $row['r_id'];
break;
case 'create':
$action = __('Created');
$r_id = $row['r_id'];
break;
case 'file':
$action = __('Attachment') . ': ';
$action .= $row['id'] == 0 ? __('New') : __('Updated');
$id = explode('/', $row['r_id']);
$row['tab'] = $id[0];
$r_id = $id[1];
break;
case 'note':
$action = __('Note') . ': ';
$action .= $row['id'] == 0 ? __('New') : __('Updated');
$id = explode('/', $row['r_id']);
$row['tab'] = $id[0];
$r_id = $id[1];
break;
}
if (!Utils_RecordBrowserCommon::get_access($row['tab'], 'view', Utils_RecordBrowserCommon::get_record($row['tab'], $r_id))) {
$link = __('Access restricted');
$action = strip_tags($action);
} else {
$link = Utils_TooltipCommon::create('<img src="' . Base_ThemeCommon::get_template_file('Utils_RecordBrowser', 'info.png') . '">', Utils_RecordBrowserCommon::get_html_record_info($row['tab'], $r_id), false);
$link .= ' ';
$link .= Utils_RecordBrowserCommon::create_default_linked_label($row['tab'], $r_id, false, false);
}
$gb->add_row(Base_RegionalSettingsCommon::time2reg($row['edited_on']), $user, $rb_tabs[$row['tab']], $link, $action);
}
}
Base_ThemeCommon::load_css('Utils_RecordBrowser', 'changes_list');
$this->display_module($gb);
}
示例9: mobile_rb_edit
public static function mobile_rb_edit($tab, $id)
{
if ($id === false) {
$rec = array();
} else {
$rec = self::get_record($tab, $id);
}
$cols = Utils_RecordBrowserCommon::init($tab);
$defaults = array();
if ($id === false) {
$mode = 'add';
$access = array();
$defaults = self::record_processing($tab, $defaults, 'adding');
} else {
$mode = 'edit';
$access = Utils_RecordBrowserCommon::get_access($tab, 'view', $rec);
if (is_array($access)) {
foreach ($access as $k => $v) {
if (!$v) {
unset($rec[$k]);
}
}
}
$defaults = $rec = self::record_processing($tab, $rec, 'editing');
}
$QFfield_callback_table = array();
$ret = DB::Execute('SELECT * FROM ' . $tab . '_callback WHERE freezed=0');
while ($row = $ret->FetchRow()) {
$QFfield_callback_table[$row['field']] = $row['callback'];
}
$defaults = array_merge($defaults, $_SESSION['rb_' . $tab . '_defaults']);
$qf = new HTML_QuickForm('rb_edit', 'post', 'mobile.php?' . http_build_query($_GET));
foreach ($cols as $field => $args) {
if (isset($access[$args['id']]) && !$access[$args['id']]) {
continue;
}
if (isset($rec[$args['id']])) {
$val = $rec[$args['id']];
} elseif (isset($defaults[$args['id']])) {
$val = $defaults[$args['id']];
} else {
$val = null;
}
$label = _V($args['name']);
// TRSL
if (isset($QFfield_callback_table[$field])) {
$mobile_rb = new Utils_RecordBrowserMobile($tab, $rec);
self::call_QFfield_callback($QFfield_callback_table[$field], $qf, $args['id'], $label, $mode, $val, $args, $mobile_rb, null);
if ($mode == 'edit') {
unset($defaults[$args['id']]);
}
continue;
}
switch ($args['type']) {
case 'calculated':
$qf->addElement('static', $args['id'], $label);
if (!is_array($rec)) {
$values = $defaults;
} else {
$values = $rec;
if (is_array($defaults)) {
$values = $values + $defaults;
}
}
if (!isset($values[$args['id']])) {
$values[$args['id']] = '';
}
$val = Utils_RecordBrowserCommon::get_val($tab, $field, $values, true, $args);
if ($val !== null) {
$qf->setDefaults(array($args['id'] => $val));
}
break;
case 'integer':
case 'float':
$qf->addElement('text', $args['id'], $label);
if ($args['type'] == 'integer') {
$qf->addRule($args['id'], __('Only integer numbers are allowed.'), 'regex', '/^[0-9]*$/');
} else {
$qf->addRule($args['id'], __('Only numbers are allowed.'), 'numeric');
}
if ($val !== null) {
$qf->setDefaults(array($args['id'] => $val));
}
break;
case 'checkbox':
$qf->addElement('checkbox', $args['id'], $label, '');
if ($val !== null) {
$qf->setDefaults(array($args['id'] => $val));
}
break;
case 'currency':
$qf->addElement('currency', $args['id'], $label);
if ($val !== null) {
$qf->setDefaults(array($args['id'] => $val));
}
break;
case 'text':
$qf->addElement('text', $args['id'], $label, array('maxlength' => $args['param']));
$qf->addRule($args['id'], __('Maximum length for this field is %s characters.', array($args['param'])), 'maxlength', $args['param']);
if ($val !== null) {
//.........这里部分代码省略.........
示例10: contact_activities_access
public static function contact_activities_access()
{
return Utils_RecordBrowserCommon::get_access('contact', 'browse');
}
示例11: companies_actions
public function companies_actions($r, $gb_row)
{
$me = CRM_ContactsCommon::get_my_record();
$emp = array($me['id']);
$cus = array();
$cus[] = 'C:' . $r['id'];
if (ModuleManager::is_installed('CRM/Meeting') !== -1 && Utils_RecordBrowserCommon::get_access('crm_meeting', 'add')) {
$gb_row->add_action(Utils_RecordBrowserCommon::create_new_record_href('crm_meeting', array('employees' => $emp, 'customers' => $cus, 'status' => 0, 'priority' => 1, 'permission' => 0)), __('New Meeting'), null, Base_ThemeCommon::get_template_file('CRM_Calendar', 'icon-small.png'));
}
if (ModuleManager::is_installed('CRM/Tasks') !== -1 && Utils_RecordBrowserCommon::get_access('task', 'add')) {
$gb_row->add_action(Utils_RecordBrowserCommon::create_new_record_href('task', array('employees' => $emp, 'customers' => $cus, 'status' => 0, 'priority' => 1, 'permission' => 0)), __('New Task'), null, Base_ThemeCommon::get_template_file('CRM_Tasks', 'icon-small.png'));
}
if (ModuleManager::is_installed('CRM/PhoneCall') !== -1 && Utils_RecordBrowserCommon::get_access('phonecall', 'add')) {
$gb_row->add_action(Utils_RecordBrowserCommon::create_new_record_href('phonecall', array('date_and_time' => date('Y-m-d H:i:s'), 'customer' => 'C:' . $r['id'], 'employees' => $me['id'], 'status' => 0, 'permission' => 0, 'priority' => 1), 'none', array('date_and_time')), __('New Phonecall'), null, Base_ThemeCommon::get_template_file('CRM_PhoneCall', 'icon-small.png'));
}
$gb_row->add_action(Utils_RecordBrowser::$rb_obj->add_note_button_href('company/' . $r['id']), __('New Note'), null, Base_ThemeCommon::get_template_file('Utils_Attachment', 'icon_small.png'));
}
示例12: die
<?php
if(!isset($_REQUEST['cid']) || !isset($_REQUEST['id']) || !isset($_REQUEST['pass']))
die('Invalid usage');
$cid = $_REQUEST['cid'];
$id = $_REQUEST['id'];
$pass = $_REQUEST['pass'];
define('CID', $cid);
define('READ_ONLY_SESSION',false);
require_once('../../../include.php');
ModuleManager::load_modules();
$row = Utils_RecordBrowserCommon::get_record('utils_attachment',$id);
if(!Utils_RecordBrowserCommon::get_access('utils_attachment','view',$row)) die(json_encode(array('error'=>__('Access denied'))));
$decoded = Utils_AttachmentCommon::decrypt($row['note'],$pass);
if($decoded!==false) {
$_SESSION['client']['cp'.$row['id']] = $pass;
ob_start();
$note = Utils_AttachmentCommon::display_note($row,false, null, true);
$note = ob_get_clean().$note;
die(json_encode(array(
'note'=>$note,
'js'=>Epesi::get_output()
)));
}
die(json_encode(array('error'=>__('Invalid password'))));
示例13: _V
$col['name'] = _V($col['name']);
if ($type != 'recent') {
$cols_out[] = array('name' => $col['name'], 'order' => $col['id'], 'record' => $col, 'key' => $k);
} else {
$cols_out[] = array('name' => $col['name'], 'record' => $col, 'key' => $k);
}
}
//views
/*if($ret['recent'] && $type!='recent') print('<a '.(IPHONE?'class="button red" ':'').'href="mobile.php?'.http_build_query(array_merge($_GET,array('type'=>'recent','rb_offset'=>0))).'">'.__('Recent').'</a>'.(IPHONE?'':'<br>'));
if($ret['favorites'] && $type!='favorites') print('<a '.(IPHONE?'class="button green" ':'').'href="mobile.php?'.http_build_query(array_merge($_GET,array('type'=>'favorites','rb_offset'=>0))).'">'.__('Favorites').'</a>'.(IPHONE?'':'<br>'));
if(($ret['recent'] || $ret['favorites']) && $type!='all') print('<a '.(IPHONE?'class="button white" ':'').'href="mobile.php?'.http_build_query(array_merge($_GET,array('type'=>'all','rb_offset'=>0))).'">'.__('All').'</a>'.(IPHONE?'':'<br>'));*/
print '<form method="GET" action="mobile.php?' . http_build_query($_GET) . '">';
if (!IPHONE) {
print '<table width="100%"><tr><td>';
}
if (Utils_RecordBrowserCommon::get_access($table, 'add')) {
if (IPHONE) {
print '<a ' . 'class="button green" ' . mobile_stack_href(array('Utils_RecordBrowserCommon', 'mobile_rb_edit'), array($table, false), __('Add record')) . '>' . __('Add') . '</a>';
} else {
print '<a ' . mobile_stack_href(array('Utils_RecordBrowserCommon', 'mobile_rb_edit'), array($table, false), __('Add record')) . '><img src="' . Base_ThemeCommon::get_template_file('Utils_RecordBrowser', 'mobile_add.png') . '" border="0"></a>';
}
}
if (!IPHONE) {
print '</td><td align="right">';
}
if (IPHONE) {
print '<ul class="form">';
}
print '<input type="hidden" name="rb_offset" value="0">';
print (IPHONE ? '<li>' : '') . '<select onchange="form.elements[\'search\'].value=\'Search\';form.submit()" name="type"><option value="all"' . ($type == 'all' ? ' selected=1' : '') . '>' . __('All') . '</option><option value="recent"' . ($type == 'recent' ? ' selected=1' : '') . '>' . __('Recent') . '</option><option value="favorites"' . ($type == 'favorites' ? ' selected=1' : '') . '>' . __('Favorites') . '</option></select>' . (IPHONE ? '</li>' : '');
print (IPHONE ? '<li>' : '') . '<input type="text" name="search" value="' . (isset($_GET['search']) ? $_GET['search'] : 'Search') . '" onclick="clickclear(this, \'Search\')" onblur="clickrecall(this,\'Search\')" />' . (IPHONE ? '</li>' : '');
示例14: check_new_record_access
public function check_new_record_access($data) {
$problems = array();
$ret = array();
if (is_array(Utils_RecordBrowser::$last_record))
foreach (Utils_RecordBrowser::$last_record as $k=>$v) if (!isset($data[$k])) $data[$k] = $v;
// $crits = Utils_RecordBrowserCommon::get_access($this->tab,'add',null, true);
$crits2 = Utils_RecordBrowserCommon::get_access($this->tab,'add',null, true, true);
foreach($crits2 as $crits) {
$problems = array();
Utils_RecordBrowserCommon::check_record_against_crits($this->tab, $data, $crits, $problems);
foreach ($problems as $f) {
$f = explode('[', $f);
$ret[$f[0]] = __('Invalid value');
}
if($problems) continue;
return true;
}
return $ret;
}
示例15: die
<?php
if (!isset($_REQUEST['cid']) || !isset($_REQUEST['id']) || !isset($_REQUEST['pass'])) {
die('Invalid usage');
}
$cid = $_REQUEST['cid'];
$id = $_REQUEST['id'];
$pass = $_REQUEST['pass'];
define('CID', $cid);
define('READ_ONLY_SESSION', false);
require_once '../../../include.php';
ModuleManager::load_modules();
$row = Utils_RecordBrowserCommon::get_record('utils_attachment', $id);
if (!Utils_RecordBrowserCommon::get_access('utils_attachment', 'view', $row)) {
die(json_encode(array('error' => __('Access denied'))));
}
$decoded = Utils_AttachmentCommon::decrypt($row['note'], $pass);
if ($decoded !== false) {
$_SESSION['client']['cp' . $row['id']] = $pass;
ob_start();
$note = Utils_AttachmentCommon::display_note($row, false, null, 'utils_attachment', true);
$note = ob_get_clean() . $note;
die(json_encode(array('note' => $note, 'js' => Epesi::get_output())));
}
die(json_encode(array('error' => __('Invalid password'))));