本文整理汇总了PHP中Utils_RecordBrowserCommon::get_record_info方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils_RecordBrowserCommon::get_record_info方法的具体用法?PHP Utils_RecordBrowserCommon::get_record_info怎么用?PHP Utils_RecordBrowserCommon::get_record_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils_RecordBrowserCommon
的用法示例。
在下文中一共展示了Utils_RecordBrowserCommon::get_record_info方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_html_record_info
public static function get_html_record_info($tab, $id)
{
if (is_string($id)) {
// to separate id in recurrent event
$tmp = explode('_', $id);
$id = $tmp[0];
}
if (is_numeric($id)) {
$info = Utils_RecordBrowserCommon::get_record_info($tab, $id);
} elseif (is_array($id)) {
$info = $id;
} else {
trigger_error('Cannot decode record id: ' . print_r($id, true), E_USER_ERROR);
}
if (isset($info['id'])) {
$id = $info['id'];
}
// If CRM Module is not installed get user login only
$created_by = Base_UserCommon::get_user_label($info['created_by']);
$htmlinfo = array(__('Record ID') . ':' => $id, __('Created by') . ':' => $created_by, __('Created on') . ':' => Base_RegionalSettingsCommon::time2reg($info['created_on']));
if ($info['edited_on'] !== null) {
$htmlinfo = $htmlinfo + array(__('Edited by') . ':' => $info['edited_by'] !== null ? Base_UserCommon::get_user_label($info['edited_by']) : '', __('Edited on') . ':' => Base_RegionalSettingsCommon::time2reg($info['edited_on']));
}
return Utils_TooltipCommon::format_info_tooltip($htmlinfo);
}
示例2: mini_view
public function mini_view($cols, $crits, $order, $info=null, $limit=null, $conf = array('actions_edit'=>true, 'actions_info'=>true), & $opts = array()){
unset($_SESSION['client']['recordbrowser']['admin_access']);
$this->init();
$gb = $this->init_module('Utils/GenericBrowser',$this->tab,$this->tab);
$field_hash = array();
foreach($this->table_rows as $field => $args)
$field_hash[$args['id']] = $field;
$header = array();
$callbacks = array();
foreach($cols as $k=>$v) {
if (isset($v['callback'])) $callbacks[] = $v['callback'];
else $callbacks[] = null;
if (is_array($v)) {
$arr = array('name'=>_V($field_hash[$v['field']])); // TRSL
if (isset($v['width'])) $arr['width'] = $v['width'];
$cols[$k] = $v['field'];
} else {
$arr = array('name'=>_V($field_hash[$v])); // TRSL
$cols[$k] = $v;
}
if (isset($v['label'])) $arr['name'] = $v['label'];
$arr['wrapmode'] = 'nowrap';
$header[] = $arr;
}
$gb->set_table_columns($header);
$gb->set_fixed_columns_class($this->fixed_columns_class);
$clean_order = array();
foreach($order as $k=>$v) {
if ($k==':Visited_on') $field_hash[$k] = $k;
if ($k==':Fav') $field_hash[$k] = $k;
if ($k==':Edited_on') $field_hash[$k] = $k;
if ($k==':id') $field_hash[$k] = $k;
$clean_order[] = array('column'=>$field_hash[$k],'order'=>$field_hash[$k],'direction'=>$v);
}
if ($limit!=null && !isset($conf['force_limit'])) {
$limit = array('offset'=>0, 'numrows'=>$limit);
$records_qty = Utils_RecordBrowserCommon::get_records_count($this->tab, $crits);
if ($records_qty>$limit['numrows']) {
if ($this->get_module_variable('no_limit_in_mini_view',false)) {
$opts['actions'][] = '<a '.Utils_TooltipCommon::open_tag_attrs(__('Display first %d records', array($limit['numrows']))).' '.$this->create_callback_href(array($this, 'set_no_limit_in_mini_view'), array(false)).'><img src="'.Base_ThemeCommon::get_template_file('Utils_RecordBrowser','show_some.png').'" border="0"></a>';
$limit = null;
} else {
print(__('Displaying %s of %s records', array($limit['numrows'], $records_qty)));
$opts['actions'][] = '<a '.Utils_TooltipCommon::open_tag_attrs(__('Display all records')).' '.$this->create_callback_href(array($this, 'set_no_limit_in_mini_view'), array(true)).'><img src="'.Base_ThemeCommon::get_template_file('Utils_RecordBrowser','show_all.png').'" border="0"></a>';
}
}
}
$records = Utils_RecordBrowserCommon::get_records($this->tab, $crits, array(), $clean_order, $limit);
foreach($records as $v) {
$gb_row = $gb->get_new_row();
$arr = array();
foreach($cols as $k=>$w) {
if (!isset($callbacks[$k])) $s = $this->get_val($field_hash[$w], $v, false, $this->table_rows[$field_hash[$w]]);
else $s = call_user_func($callbacks[$k], $v);
$arr[] = $s;
}
$gb_row->add_data_array($arr);
if (is_callable($info)) {
$additional_info = call_user_func($info, $v);
} else $additional_info = '';
if (!is_array($additional_info) && isset($additional_info)) $additional_info = array('notes'=>$additional_info);
if (isset($additional_info['notes'])) $additional_info['notes'] = $additional_info['notes'].'<hr />';
if (isset($additional_info['row_attrs'])) $gb_row->set_attrs($additional_info['row_attrs']);
if (isset($conf['actions_info']) && $conf['actions_info']) $gb_row->add_info($additional_info['notes'].Utils_RecordBrowserCommon::get_html_record_info($this->tab, $v['id']));
if (isset($conf['actions_view']) && $conf['actions_view']) $gb_row->add_action($this->create_callback_href(array($this,'navigate'),array('view_entry', 'view',$v['id'])),'View');
if (isset($conf['actions_edit']) && $conf['actions_edit']) if ($this->get_access('edit',$v)) $gb_row->add_action($this->create_callback_href(array($this,'navigate'),array('view_entry', 'edit',$v['id'])),'Edit');
if (isset($conf['actions_delete']) && $conf['actions_delete']) if ($this->get_access('delete',$v)) $gb_row->add_action($this->create_confirm_callback_href(__('Are you sure you want to delete this record?'),array($this,'delete_record'),array($v['id'], false)),'Delete');
if (isset($conf['actions_history']) && $conf['actions_history']) {
$r_info = Utils_RecordBrowserCommon::get_record_info($this->tab, $v['id']);
if ($r_info['edited_on']===null) $gb_row->add_action('','This record was never edited',null,'history_inactive');
else $gb_row->add_action($this->create_callback_href(array($this,'navigate'),array('view_edit_history', $v['id'])),'View edit history',null,'history');
}
$this->call_additional_actions_methods($v, $gb_row);
}
$this->display_module($gb);
}
示例3: str_replace
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']]) {
$val = '';
} else {
$val = Utils_RecordBrowserCommon::get_val($tab, $field_name, $r, true, $v);
}
ob_end_clean();
示例4: validate_single
protected function validate_single(Utils_RecordBrowser_CritsSingle $crits, $record)
{
$id = isset($record['id']) ? $record['id'] : '';
list($field, $subfield) = Utils_RecordBrowser_CritsSingle::parse_subfield($crits->get_field());
$field = ltrim(Utils_RecordBrowserCommon::get_field_id($field), '_');
$subfield = ltrim(Utils_RecordBrowserCommon::get_field_id($subfield), '_');
$r_val = isset($record[$field]) ? $record[$field] : '';
$crit_value = $crits->get_value();
$field_definition = $this->get_field_definition($field);
if ($subfield && $field_definition) {
$sub_tab = isset($field_definition['ref_table']) ? $field_definition['ref_table'] : false;
if ($sub_tab) {
if (is_array($r_val)) {
foreach ($r_val as $k => $v) {
$r_val[$k] = Utils_RecordBrowserCommon::get_value($sub_tab, $v, $subfield);
}
} else {
if ($r_val) {
$r_val = Utils_RecordBrowserCommon::get_value($sub_tab, $r_val, $subfield);
} else {
$r_val = '';
}
if (substr($r_val, 0, 2) == '__') {
$r_val = Utils_RecordBrowserCommon::decode_multi($r_val);
}
// FIXME need better check
}
}
}
$k = strtolower($field);
$record[$k] = $r_val;
$result = false;
$transform_date = false;
if ($k == 'created_on') {
$transform_date = 'timestamp';
} elseif ($k == 'edited_on') {
$details = Utils_RecordBrowserCommon::get_record_info($this->tab, $id);
$record[$k] = $details['edited_on'];
$transform_date = 'timestamp';
} elseif ($field_definition) {
$type = $field_definition['type'];
if ($type == 'timestamp') {
$transform_date = 'timestamp';
} elseif ($type == 'date') {
$transform_date = 'date';
}
}
if ($transform_date == 'timestamp' && $crit_value) {
$crit_value = Base_RegionalSettingsCommon::reg2time($crit_value, false);
$crit_value = date('Y-m-d H:i:s', $crit_value);
} else {
if ($transform_date == 'date' && $crit_value) {
$crit_value = Base_RegionalSettingsCommon::reg2time($crit_value, false);
$crit_value = date('Y-m-d', $crit_value);
}
}
$vv = explode('::', $crit_value, 2);
if (isset($vv[1]) && is_callable($vv)) {
$result = call_user_func_array($vv, array($this->tab, &$record, $k, $crits));
} else {
if (is_array($record[$k])) {
if ($crit_value) {
$result = in_array($crit_value, $record[$k]);
} else {
$result = empty($record[$k]);
}
if ($crits->get_operator() == '!=') {
$result = !$result;
}
} else {
switch ($crits->get_operator()) {
case '>':
$result = $record[$k] > $crit_value;
break;
case '>=':
$result = $record[$k] >= $crit_value;
break;
case '<':
$result = $record[$k] < $crit_value;
break;
case '<=':
$result = $record[$k] <= $crit_value;
break;
case '!=':
$result = $record[$k] != $crit_value;
break;
case '=':
$result = $record[$k] == $crit_value;
break;
case 'LIKE':
$result = self::check_like_match($record[$k], $crit_value);
break;
case 'NOT LIKE':
$result = !self::check_like_match($record[$k], $crit_value);
break;
}
}
}
if ($crits->get_negation()) {
$result = !$result;
//.........这里部分代码省略.........
示例5: display_date
public static function display_date($row, $nolink = false, $a=null,$view=false) {
$date = Base_RegionalSettingsCommon::time2reg($row['edited_on'], false);
$time = Base_RegionalSettingsCommon::time2reg($row['edited_on'], true, false);
$info = Utils_RecordBrowserCommon::get_record_info('utils_attachment',$row['id']);
$by = Base_UserCommon::get_user_label($info['edited_by']?$info['edited_by']:$info['created_by'], $nolink);
$format = Base_User_SettingsCommon::get('Utils/Attachment', 'edited_on_format');
return str_replace(array('%D', '%T', '%U'), array($date, $time, $by), $format);
}