本文整理汇总了PHP中Utils_RecordBrowserCommon::get_val方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils_RecordBrowserCommon::get_val方法的具体用法?PHP Utils_RecordBrowserCommon::get_val怎么用?PHP Utils_RecordBrowserCommon::get_val使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils_RecordBrowserCommon
的用法示例。
在下文中一共展示了Utils_RecordBrowserCommon::get_val方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applet_info_format
public static function applet_info_format($r)
{
// Build array representing 2-column tooltip
// Format: array (Label,value)
$access = Utils_CommonDataCommon::get_translated_array('CRM/Access');
$priority = Utils_CommonDataCommon::get_translated_array('CRM/Priority');
$status = Utils_CommonDataCommon::get_translated_array('CRM/Status');
$args = array(__('Meeting') => '<b>' . $r['title'] . '</b>', __('Description') => $r['description'], __('Assigned to') => Utils_RecordBrowserCommon::get_val('crm_meeting', 'Employees', $r, true), __('Customers') => Utils_RecordBrowserCommon::get_val('crm_meeting', 'Customers', $r, true), __('Status') => $status[$r['status']], __('Date') => $r['duration'] >= 0 ? Base_RegionalSettingsCommon::time2reg($r['date'] . ' ' . date('H:i:s', strtotime($r['time']))) : Base_RegionalSettingsCommon::time2reg($r['date'], false), __('Duration') => $r['duration'] >= 0 ? Base_RegionalSettingsCommon::seconds_to_words($r['duration']) : '---', __('Permission') => $access[$r['permission']], __('Priority') => $priority[$r['priority']]);
$bg_color = '';
switch ($r['priority']) {
case 0:
$bg_color = '#FFFFFF';
break;
// low priority
// low priority
case 1:
$bg_color = '#FFFFD5';
break;
// medium
// medium
case 2:
$bg_color = '#FFD5D5';
break;
// high
}
// Pass 1 argument: array containing pairs: label/value
//return Utils_TooltipCommon::format_info_tooltip($args);
$ret = array('notes' => Utils_TooltipCommon::format_info_tooltip($args));
if ($bg_color) {
$ret['row_attrs'] = 'style="background:' . $bg_color . ';"';
}
return $ret;
}
示例2: 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) {
//.........这里部分代码省略.........
示例3: get_val
/**
* Get field string representation - display callback gets called.
* @param string $field Field id, e.g. 'first_name'
* @param array|RBO_Record $record Records array or object
* @param bool $nolink Do not create link
* @return string String representation of field value
*/
public function get_val($field, $record, $nolink = false)
{
if (is_object($record) && $record instanceof RBO_Record) {
$record = $record->to_array();
}
return Utils_RecordBrowserCommon::get_val($this->tab, $field, $record, $nolink);
}
示例4: view_entry
//.........这里部分代码省略.........
if ($printer) {
Base_ActionBarCommon::add('print', __('Print'), $printer->get_href(array('tab' => $this->tab, 'record_id' => $this->record['id'])));
}
if ($show_actions===true || (is_array($show_actions) && (!isset($show_actions['back']) || $show_actions['back'])))
Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
} elseif($mode!='history') {
Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
Base_ActionBarCommon::add('delete', __('Cancel'), $this->create_back_href());
}
//Utils_ShortcutCommon::add(array('esc'), 'function(){'.$this->create_back_href_js().'}');
}
if ($mode!='add') {
$theme -> assign('info_tooltip', '<a '.Utils_TooltipCommon::open_tag_attrs(Utils_RecordBrowserCommon::get_html_record_info($this->tab, $id)).'><img border="0" src="'.Base_ThemeCommon::get_template_file('Utils_RecordBrowser','info.png').'" /></a>');
$row_data= array();
if ($mode!='history') {
if ($this->favorites)
$theme -> assign('fav_tooltip', Utils_RecordBrowserCommon::get_fav_button($this->tab, $id));
if ($this->watchdog)
$theme -> assign('subscription_tooltip', Utils_WatchdogCommon::get_change_subscription_icon($this->tab, $id));
if ($this->full_history) {
$info = Utils_RecordBrowserCommon::get_record_info($this->tab, $id);
if ($info['edited_on']===null) $theme -> assign('history_tooltip', '<a '.Utils_TooltipCommon::open_tag_attrs(__('This record was never edited')).'><img border="0" src="'.Base_ThemeCommon::get_template_file('Utils_RecordBrowser','history_inactive.png').'" /></a>');
else $theme -> assign('history_tooltip', '<a '.Utils_TooltipCommon::open_tag_attrs(__('Click to view edit history of currently displayed record')).' '.$this->create_callback_href(array($this,'navigate'), array('view_edit_history', $id)).'><img border="0" src="'.Base_ThemeCommon::get_template_file('Utils_RecordBrowser','history.png').'" /></a>');
}
if ($this->clipboard_pattern) {
$theme -> assign('clipboard_tooltip', '<a '.Utils_TooltipCommon::open_tag_attrs(__('Click to export values to copy')).' '.Libs_LeightboxCommon::get_open_href('clipboard').'><img border="0" src="'.Base_ThemeCommon::get_template_file('Utils_RecordBrowser','clipboard.png').'" /></a>');
$text = $this->clipboard_pattern;
$record = Utils_RecordBrowserCommon::get_record($this->tab, $id);
/* for every field name store its value */
$data = array();
foreach($this->table_rows as $val) {
$fval = Utils_RecordBrowserCommon::get_val($this->tab, $val['id'], $record, true);
if(strlen($fval)) $data[$val['id']] = $fval;
}
/* some complicate preg match to find every occurence
* of %{ .. {f_name} .. } pattern
*/
if (preg_match_all('/%\{(([^%\}\{]*?\{[^%\}\{]+?\}[^%\}\{]*?)+?)\}/', $text, $match)) { // match for all patterns %{...{..}...}
foreach ($match[0] as $k => $matched_string) {
$text_replace = $match[1][$k];
$changed = false;
while(preg_match('/\{(.+?)\}/', $text_replace, $second_match)) { // match for keys in braces {key}
$replace_value = '';
if(array_key_exists($second_match[1], $data)) {
$replace_value = $data[$second_match[1]];
$changed = true;
}
$text_replace = str_replace($second_match[0], $replace_value, $text_replace);
}
if(! $changed ) $text_replace = '';
$text = str_replace($matched_string, $text_replace, $text);
}
}
load_js("modules/Utils/RecordBrowser/selecttext.js");
/* remove all php new lines, replace <br>|<br/> to new lines and quote all special chars */
$ftext = htmlspecialchars(preg_replace('#<[bB][rR]/?>#', "\n", str_replace("\n", '', $text)));
$flash_copy = '<object width="60" height="20">'.
'<param name="FlashVars" value="txtToCopy='.$ftext.'">'.
'<param name="movie" value="'.$this->get_module_dir().'copyButton.swf">'.
'<embed src="'.$this->get_module_dir().'copyButton.swf" flashvars="txtToCopy='.$ftext.'" width="60" height="20">'.
'</embed>'.
'</object>';
$text = '<h3>'.__('Click Copy under the box or move mouse over box below to select text and hit Ctrl-c to copy it.').'</h3><div onmouseover="fnSelect(this)" style="border: 1px solid gray; margin: 15px; padding: 20px;">'.$text.'</div>'.$flash_copy;
示例5: define
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['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');
}
if (isset($_GET['field']) && $_GET['field'] == 'headers') {
$html = Utils_RecordBrowserCommon::get_val('rc_mails', 'headers_data', $rec, false, null);
} else {
$html = $rec['body'];
}
if (!$html) {
die('Invalid e-mail id.');
}
$images = DB::GetAssoc('SELECT mime_id,name FROM rc_mails_attachments WHERE mail_id=%d AND attachment=1 AND type ' . DB::like() . ' %s', array($_GET['id'], 'image/%'));
foreach ($images as $k => &$n) {
$n = '<img src="get.php?' . http_build_query(array('mime_id' => $k, 'mail_id' => $_GET['id'])) . '" onload="fix_height();"/><br />';
}
$html = str_ireplace('<img ', '<img onload="fix_height();" ', $html);
$html = str_replace('__MAIL_ID__', $_GET['id'], $html);
$html = preg_replace("/<a([^>]*)>(.*)<\\/a>/i", '<a$1 target="_blank">$2</a>', $html);
$html = '<html>' . '<head><meta http-equiv=Content-Type content="text/html; charset=utf-8" />' . '<script type="text/javascript">function fix_height(){parent.$("rc_mail_body").height = Math.max(document.body.offsetHeight,document.body.scrollHeight)+30;}</script>' . '</head><body>' . $html . ($images ? '<hr />' . implode('<br />', $images) : '') . '<script type="text/javascript">fix_height();</script>' . '</body>' . '</html>';
print $html;
示例6: array
}
$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();
$val = str_replace(' ', ' ', htmlspecialchars_decode(strip_tags(preg_replace('/\\<[Bb][Rr]\\/?\\>/', "\n", $val))));
if ($v['style'] == 'currency') {
$val = str_replace(' ', '_', $val);
$val = explode(';', $val);
if (isset($val[1])) {
$final = array();
foreach ($val as $v) {
$v = explode('_', $v);
if (isset($v[1])) {
$final[] = rb_csv_export_format_currency_value($v[0], $v[1]) . ' ' . $currency_codes[$v[1]];
}
}
$rec[] = implode('; ', $final);
示例7: note_title_with_attached_to
public static function note_title_with_attached_to($row, $nolink = false) {
$note = self::description_callback($row, $nolink);
$of = Utils_RecordBrowserCommon::get_val('utils_attachment', 'attached_to', $row, $nolink);
$of = " [ $of ]";
return $note . $of;
}
示例8: watchdog_label
public static function watchdog_label($rid = null, $events = array(), $details = true)
{
if ($rid !== null && !self::get_access($rid)) {
return null;
}
$ret = Utils_RecordBrowserCommon::watchdog_label('utils_attachment', __('Note'), $rid, $events, null, $details);
if ($rid && $ret) {
$r = Utils_RecordBrowserCommon::get_record('utils_attachment', $rid);
$of = Utils_RecordBrowserCommon::get_val('utils_attachment', 'attached_to', $r);
$ret['title'] .= " [ {$of} ]";
}
return $ret;
}
示例9: current
$letter_col = current($cols_out);
$letter_col = $letter_col['record']['id'];
print '<ul>';
} else {
$data_out = array();
}
foreach ($data as $v) {
if (IPHONE) {
$row_sort = '';
$row_info = '';
} else {
$row = array();
}
foreach ($cols_out as $col) {
$i = array_key_exists($col['record']['id'], $info);
$val = Utils_RecordBrowserCommon::get_val($table, $col['key'], $v, IPHONE, $col['record']);
if (IPHONE) {
if ($val === '') {
continue;
}
if ($type != 'recent' && $col['record']['id'] == $letter_col && $letter !== $val[0]) {
$letter = $val[0];
print '</ul><h4>' . $letter . '</h4><ul>';
}
if ($i) {
$row_info .= ($info[$col['record']['id']] ? $col['name'] . ': ' : '') . $val . '<br>';
} else {
$row_sort .= $val . ' ';
}
} else {
$row[] = $val;
示例10: foreach
continue;
}
$changed[$row2['field']] = $row2['old_value'];
$last_row = $row2;
}
foreach ($changed as $k => $v) {
if ($k != 'id') {
if (!isset($field_hash[$k])) {
continue;
}
if (!isset($table_rows[$field_hash[$k]])) {
continue;
}
if ($table_rows[$field_hash[$k]]['type'] == 'multiselect') {
$v = Utils_RecordBrowserCommon::decode_multi($v);
}
$created[$k] = $v;
}
}
}
foreach ($table_rows as $field => $args) {
ob_start();
$val = @Utils_RecordBrowserCommon::get_val($tab, $field, $created, false, $args);
if (!$val) {
$val = Utils_RecordBrowserCommon::get_val($tab, $field, $created, true, $args);
}
ob_end_clean();
print 'if($("_' . $args['id'] . '__data"))$("_' . $args['id'] . '__data").innerHTML = "' . Epesi::escapeJS($val) . '";';
// if (!$access[$args['id']]) continue;
// if ($created[$args['id']] !== '') $created[$args['id']] = $val; // TRSL
}
示例11: build_single_crit_to_words
protected function build_single_crit_to_words(Utils_RecordBrowser_CritsSingle $crits)
{
$value = $crits->get_value();
$operator = $crits->get_operator();
list($field, $subfield) = Utils_RecordBrowser_CritsSingle::parse_subfield($crits->get_field());
$negation = $crits->get_negation();
$field_definition = $this->get_field_definition($field);
$subquery_generated = false;
if ($subfield) {
$tab2 = isset($field_definition['ref_table']) ? $field_definition['ref_table'] : false;
$single_tab = !($tab2 == '__RECORDSETS__' || count(explode(',', $tab2)) > 1);
if ($tab2 && $single_tab) {
$cb = new self($tab2);
$cb->enable_html_decoration($this->html_decoration);
$value = $cb->to_words(new Utils_RecordBrowser_CritsSingle($subfield, $operator, $value, $negation, $crits->get_raw_sql_value()));
$subquery_generated = true;
}
}
if (!is_array($value)) {
$value = array($value);
}
foreach ($value as $k => $v) {
if (is_bool($v)) {
$value[$k] = $v ? __('true') : __('false');
} elseif ($v === '' || $v === null) {
$value[$k] = __('empty');
} else {
if ($field == ':Created_on' || $field == ':Edited_on') {
if (isset(Utils_RecordBrowserCommon::$date_values[$v])) {
$value[$k] = Utils_RecordBrowserCommon::$date_values[$v];
} else {
$value[$k] = Base_RegionalSettingsCommon::time2reg($v);
}
} elseif ($field == ':Created_by') {
if (is_numeric($v)) {
$value[$k] = Base_UserCommon::get_user_login($v);
}
} elseif ($field_definition) {
$vv = explode('::', $v, 2);
if (!(isset($vv[1]) && is_callable($vv)) && (is_numeric($v) || $field_definition['commondata'] || !isset($field_definition['ref_table']))) {
$new_val = Utils_RecordBrowserCommon::get_val($this->tab, $field, array($field => $v), true);
if ($new_val) {
$value[$k] = $new_val;
}
}
}
}
if ($this->html_decoration) {
if (!$subquery_generated) {
$value[$k] = '<strong>' . $value[$k] . '</strong>';
}
}
}
if ($operator == '!=') {
$negation ^= $operator == '!=';
$operator = '=';
}
switch ($field) {
case ':Fav':
$field = __('Favorite status');
break;
case ':Recent':
$field = __('Recently viewed');
break;
case ':Sub':
$field = __('Subscription status');
break;
case ':Created_by':
$field = __('Created by');
break;
case ':Created_on':
$field = __('Created on');
break;
case ':Edited_on':
$field = __('Edited on');
break;
case 'id':
$field = __('ID');
break;
default:
if ($field_definition) {
$field = _V($field_definition['name']);
}
}
if ($this->html_decoration) {
$field = "<strong>{$field}</strong>";
}
if ($subquery_generated) {
$operand = __('is set to record where');
} else {
switch ($operator) {
case '<':
$operand = $negation ? __('is not smaller than') : __('is smaller than');
break;
case '<=':
$operand = $negation ? __('is not smaller or equal to') : __('is smaller or equal to');
break;
case '>':
$operand = $negation ? __('is not greater than') : __('is greater than');
break;
//.........这里部分代码省略.........