本文整理汇总了PHP中Utils_RecordBrowserCommon::get_field_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils_RecordBrowserCommon::get_field_id方法的具体用法?PHP Utils_RecordBrowserCommon::get_field_id怎么用?PHP Utils_RecordBrowserCommon::get_field_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils_RecordBrowserCommon
的用法示例。
在下文中一共展示了Utils_RecordBrowserCommon::get_field_id方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rename_field
/**
* @param string $tab Recordset identifier. e.g. contact, company
* @param string $old_name Current field name. Not field id. e.g. "First Name"
* @param string $new_name New field name.
*/
public static function rename_field($tab, $old_name, $new_name)
{
$id = Utils_RecordBrowserCommon::get_field_id($old_name);
$new_id = Utils_RecordBrowserCommon::get_field_id($new_name);
Utils_RecordBrowserCommon::check_table_name($tab);
DB::StartTrans();
if (DB::is_postgresql()) {
DB::Execute('ALTER TABLE ' . $tab . '_data_1 RENAME COLUMN f_' . $id . ' TO f_' . $new_id);
} else {
$old_param = DB::GetOne('SELECT param FROM ' . $tab . '_field WHERE field=%s', array($old_name));
$type = DB::GetOne('SELECT type FROM ' . $tab . '_field WHERE field=%s', array($old_name));
DB::RenameColumn($tab . '_data_1', 'f_' . $id, 'f_' . $new_id, Utils_RecordBrowserCommon::actual_db_type($type, $old_param));
}
DB::Execute('UPDATE ' . $tab . '_field SET field=%s WHERE field=%s', array($new_name, $old_name));
DB::Execute('UPDATE ' . $tab . '_edit_history_data SET field=%s WHERE field=%s', array($new_id, $id));
DB::CompleteTrans();
}
示例2: output
private function output($applet = false) {
Base_ThemeCommon::load_css($this->get_type(), 'tray');
$tray_settings = Utils_TrayCommon::get_trays();
$tray_def = array();
$total_pending = 0;
$displayed = 0;
foreach ($tray_settings as $module=>$module_settings) {
foreach ($module_settings as $tab=>$tab_settings) {
if (!isset($tab_settings['__title__'])) continue;
$tray = Utils_TrayCommon::get_tray($tab, $tab_settings);
if (!isset($tray['__slots__']) || count($tray['__slots__'])==0) continue;
$tray_id = $this->get_type().'__'.Utils_RecordBrowserCommon::get_field_id($tray['__title__']);
$tray_def += array($tray_id =>array('__title__' => $tray['__title__'], '__weight__'=>isset($tray['__weight__'])?$tray['__weight__']:0));
foreach ($tray['__slots__'] as $slot_id=>$slot_def) {
$total_pending += $slot_def['__count__'];
$displayed += $slot_def['__count__'];
$tray_def[$tray_id]['__slots__'][$slot_id]['__weight__'] = isset($slot_def['__weight__'])? $slot_def['__weight__']: 0;
$icon = $this->get_icon($slot_def['__count__']);
$tray_count_width = ($slot_def['__count__']>99)? 'style="width:28px;"':'';
$tip_text = __('Click to view %s items from %s<br><br>%d item(s)', array(_V($slot_def['__name__']),_V($tray['__title__']), $slot_def['__count__']));
$tray_def[$tray_id]['__slots__'][$slot_id]['__html__'] = '<td><a '.$this->create_main_href($module, null, array($tab), null, array('tray_slot'=>$slot_id)).'><div class="Utils_Tray__slot">'.
Utils_TooltipCommon::create('<img src="'.$icon.'">
<div class="Utils_Tray__count" '.$tray_count_width.'>'.$slot_def['__count__'].'</div><div>'._V($slot_def['__name__']).'</div>',$tip_text).'</div></a></td>';
}
}
}
Utils_TrayCommon::sort_trays($tray_def);
$trays = array();
$tray_slots_html = array();
$current_tray = 0;
$tray_cols = $applet? 2:$this->get_tray_cols();
foreach ($tray_def as $tray_id=>$def) {
$current_tray += 1;
$current_row = max(array(round($current_tray/$tray_cols), 1));
$current_col = $current_tray - $tray_cols*($current_row-1);
if (isset($this->max_trays) && $this->max_trays != '__NULL__') {
//allow only trays in applet mode as per setting
if (count($trays) >= $this->max_trays) break;
}
if (self::get_tray_layout()=='checkered')
$class = (($current_row+$current_col) % 2)?'Utils_Tray__group_even':'Utils_Tray__group_odd';
else
$class = 'Utils_Tray__group_even';
$trays[] = array(
'class' => $class,
'col'=>$current_col,
'title'=>_V($def['__title__']),
'id'=>$tray_id);
foreach ($def['__slots__'] as $slot) {
$tray_slots_html[$tray_id][] = $slot['__html__'];
if (isset($this->max_slots) && $this->max_slots != '__NULL__') {
//allow slots in applet mode as per setting
if (count($tray_slots_html[$tray_id]) >= $this->max_slots) continue 2;
}
}
}
eval_js(
'function Utils_Tray__trays() {
var trays = '.json_encode($tray_slots_html).';
return trays;
}
jq( document ).ready(function() {
var resizeId;
jq(window).resize(function(){
clearTimeout(resizeId);
resizeId = setTimeout(Utils_Tray__resize, 300);
});
Utils_Tray__resize();
});');
load_js($this->get_module_dir().'tray.js');
$theme = $this->init_module('Base/Theme');
$icon = Base_ThemeCommon::get_template_file($this->get_type(),'pile2.png');
$theme->assign('main_page', !$applet);
$theme->assign('caption', Utils_TrayCommon::caption());
//.........这里部分代码省略.........
示例3: hf_select
protected function hf_select($field, $operator, $value, $raw_sql_val, $field_def)
{
$commondata = isset($field_def['commondata']) && $field_def['commondata'];
if ($commondata) {
return $this->hf_commondata($field, $operator, $value, $raw_sql_val, $field_def);
}
$sql = '';
$vals = array();
list($field, $sub_field) = Utils_RecordBrowser_CritsSingle::parse_subfield($field);
$multiselect = $field_def['type'] == 'multiselect';
$tab2 = isset($field_def['ref_table']) ? $field_def['ref_table'] : false;
$single_tab = !($tab2 == '__RECORDSETS__' || count(explode(',', $tab2)) > 1);
if ($sub_field && $single_tab && $tab2) {
$col2 = explode('|', $sub_field);
if (!isset($this->subqueries_tab_ids[$tab2])) {
$this->subqueries_tab_ids[$tab2] = 0;
}
$tab_alias_id = $this->subqueries_tab_ids[$tab2]++;
$nested_tab_alias = $this->tab_alias . '_' . $tab2 . '_' . $tab_alias_id;
$crits = new Utils_RecordBrowser_Crits();
foreach ($col2 as $col) {
$col = $col[0] == ':' ? $col : Utils_RecordBrowserCommon::get_field_id(trim($col));
if ($col) {
$crits->_or(new Utils_RecordBrowser_CritsSingle($col, $operator, $value, false, $raw_sql_val));
}
}
if (!$crits->is_empty()) {
$subquery = Utils_RecordBrowserCommon::build_query($tab2, $crits, $this->admin_mode, array(), $nested_tab_alias);
$on_rule = $multiselect ? "{$field} LIKE CONCAT('%\\_\\_', {$nested_tab_alias}.id, '\\_\\_%')" : "{$field} = {$nested_tab_alias}.id";
$sql = "EXISTS (SELECT 1 FROM {$subquery['sql']} AND {$on_rule})";
$vals = $subquery['vals'];
}
} else {
if ($raw_sql_val) {
$sql = "{$field} {$operator} {$value}";
} elseif (!$value) {
$sql = "{$field} IS NULL";
if (!$single_tab || $multiselect) {
$sql .= " OR {$field}=''";
}
} else {
if ($single_tab && !$multiselect && $operator != DB::like()) {
$operand = '%d';
} else {
if (DB::is_postgresql()) {
$field .= '::varchar';
}
$operand = '%s';
}
if ($multiselect) {
$value = "%\\_\\_{$value}\\_\\_%";
$operator = DB::like();
}
$sql = "({$field} {$operator} {$operand} AND {$field} IS NOT NULL)";
$vals[] = $value;
}
}
return array($sql, $vals);
}
示例4: check_field_definitions
public function check_field_definitions($data) {
$ret = array();
if ($this->admin_field_mode=='edit')
$type = $this->admin_field_type;
else
$type = $data['select_data_type'];
if ($type == 'text') {
$last = $this->admin_field_name?DB::GetOne('SELECT param FROM '.$this->tab.'_field WHERE field=%s', array($this->admin_field_name)):1;
if ($data['text_length']<$last) $ret['text_length'] = __('Must be a number greater or equal %d', array($last));
if ($data['text_length']>255) $ret['text_length'] = __('Must be a number no greater than %d', array(255));
if (!is_numeric($data['text_length'])) $ret['text_length'] = __('Must be a number');
if ($data['text_length']=='') $ret['text_length'] = __('Field required');
}
if ($type == 'select') {
if (!isset($data['data_source'])) $data['data_source'] = $this->admin_field['data_source'];
if (!isset($data['rset'])) $data['rset'] = $this->admin_field['rset'];
if (!is_array($data['rset'])) $data['rset'] = array_filter(explode('__SEP__', $data['rset'])); // data from multiselect field passed in raw format here
if ($data['data_source']=='commondata' && $data['commondata_table']=='') $ret['commondata_table'] = __('Field required');
if ($data['data_source']=='rset') {
if ($data['label_field']!='') {
$fs = explode(',', $data['label_field']);
foreach($data['rset'] as $rset)
$ret = $ret + $this->detranslate_field_names($rset, $fs);
}
}
if ($this->admin_field_mode=='edit' && $data['select_type']=='select' && $this->admin_field['select_type']=='multiselect') {
$count = DB::GetOne('SELECT COUNT(*) FROM '.$this->tab.'_data_1 WHERE f_'.Utils_RecordBrowserCommon::get_field_id($this->admin_field['field']).' '.DB::like().' %s', array('%_\_\__%'));
if ($count!=0) {
$ret['select_type'] = __('Cannot change type');
print('<span class="important_notice">'.__('Following records have more than one value stored in this field, making type change impossible:'));
$recs = DB::GetCol('SELECT id FROM '.$this->tab.'_data_1 WHERE f_'.Utils_RecordBrowserCommon::get_field_id($this->admin_field['field']).' '.DB::like().' %s', array('%_\_\__%'));
foreach ($recs as $r)
print('<br/>'.Utils_RecordBrowserCommon::create_default_linked_label($this->tab, $r, false, false));
print('</span>');
}
}
}
return empty($ret)?true:$ret;
}
示例5: 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;
//.........这里部分代码省略.........
示例6: refresh_magic_callbacks
public function refresh_magic_callbacks()
{
/** @var $field RBO_FieldDefinition */
foreach ($this->fields() as $field) {
if (!$field->magic_callbacks()) {
continue;
}
$field_id = Utils_RecordBrowserCommon::get_field_id($field->name);
if (!$field->QFfield_callback) {
$qffield_callback = 'QFfield_' . $field_id;
if (method_exists($this, $qffield_callback) || method_exists($this->class, $qffield_callback)) {
Utils_RecordBrowserCommon::set_QFfield_callback($this->tab, $field->name, get_class($this) . '::__QFfield_magic_callback');
} else {
Utils_RecordBrowserCommon::unset_QFfield_callback($this->tab, $field->name);
}
}
if (!$field->display_callback) {
$display_callback = 'display_' . $field_id;
if (method_exists($this, $display_callback) || method_exists($this->class, $display_callback)) {
Utils_RecordBrowserCommon::set_display_callback($this->tab, $field->name, get_class($this) . '::__display_magic_callback');
} else {
Utils_RecordBrowserCommon::unset_display_callback($this->tab, $field->name);
}
}
}
}
示例7: _get_field_id
private static function _get_field_id($property)
{
return Utils_RecordBrowserCommon::get_field_id($property);
}
示例8: array
Utils_RecordBrowserCommon::new_record_field('contact', array('name' => _M('Edit'), 'type' => 'crm_contact', 'param' => array('field_type' => 'multiselect', 'crits' => array('Custom_CADES_AccessRestrictionsCommon', 'employee_crits'), 'format' => array('CRM_ContactsCommon', 'contact_format_no_company')), 'required' => false, 'extra' => true, 'filter' => false, 'visible' => false));
Utils_RecordBrowserCommon::new_record_field('contact', array('name' => _M('Add'), 'type' => 'crm_contact', 'param' => array('field_type' => 'multiselect', 'crits' => array('Custom_CADES_AccessRestrictionsCommon', 'employee_crits'), 'format' => array('CRM_ContactsCommon', 'contact_format_no_company')), 'required' => false, 'extra' => true, 'filter' => false, 'visible' => false));
Utils_RecordBrowserCommon::new_record_field('contact', array('name' => _M('Delete'), 'type' => 'crm_contact', 'param' => array('field_type' => 'multiselect', 'crits' => array('Custom_CADES_AccessRestrictionsCommon', 'employee_crits'), 'format' => array('CRM_ContactsCommon', 'contact_format_no_company')), 'required' => false, 'extra' => true, 'filter' => false, 'visible' => false));
// migrate data
if (Utils_RecordBrowserCommon::check_table_name('cades_access_control', false, false)) {
$recs = DB::Execute('SELECT * FROM cades_access_control_data_1 WHERE active=1');
$perms = array();
$rm_acl = array();
$count = 0;
$done = 0;
while ($r = $recs->FetchRow()) {
if (!isset($rm_acl[$r['f_patient']])) {
$rm_acl[$r['f_patient']] = array();
}
$rm_acl[$r['f_patient']][] = $r['id'];
$field = Utils_RecordBrowserCommon::get_field_id(Utils_CommonDataCommon::get_value('CADES/AccessLevel/' . $r['f_permission_level']));
$fields = explode('_', $field);
foreach ($fields as $field) {
if (!isset($perms[$r['f_patient']][$field])) {
$perms[$r['f_patient']][$field] = array();
}
$perms[$r['f_patient']][$field][] = $r['f_employee'];
}
}
print 'Patients left: ' . count($perms) . '<br>';
foreach ($perms as $patient => $v) {
print 'Patient ' . $patient;
Utils_RecordBrowserCommon::update_record('contact', $patient, $v);
print '... cleanup... ';
DB::StartTrans();
foreach ($rm_acl[$patient] as $i) {
示例9: defined
* @copyright Copyright © 2014, Xoff Software GmbH
* @license MIT
* @version 1.0
* @package epesi-tray
*/
defined("_VALID_ACCESS") || die;
$cols_out = array(array('name' => __('Slot'), 'width' => 70), array('name' => __('Pending'), 'width' => 35));
$tray_settings = Utils_TrayCommon::get_trays();
$tray_def = array();
foreach ($tray_settings as $module => $module_settings) {
foreach ($module_settings as $tab => $tab_settings) {
$tray = Utils_TrayCommon::get_tray($tab, $tab_settings);
if (count($tray['__slots__']) == 0) {
continue;
}
$tray_id = Utils_RecordBrowserCommon::get_field_id($tray['__title__']);
$tray_def += array($tray_id => array('__title__' => $tray['__title__'], '__weight__' => isset($tray['__weight__']) ? $tray['__weight__'] : 0));
foreach ($tray['__slots__'] as $slot_id => $slot_def) {
$cap = _V($tray['__title__']) . ' - ' . _V($slot_def['__name__']);
$sort = isset($tab_settings['__mobile__']['sort']) ? $tab_settings['__mobile__']['sort'] : array();
$cols = isset($tab_settings['__mobile__']['cols']) ? $tab_settings['__mobile__']['cols'] : array();
$open = '<a ' . mobile_stack_href(array('Utils_TrayCommon', 'mobile_tray_rb'), array($tab, $slot_def['__crits__'], $sort, $cols), $cap) . '>';
$close = '</a>';
$tray_def[$tray_id]['__slots__'][$slot_id]['__weight__'] = isset($slot_def['__weight__']) ? $slot_def['__weight__'] : 0;
if (IPHONE) {
$row_info = '';
$row_info .= '<div>' . _V($tray['__title__']) . '</div><div>' . _V($slot_def['__name__']) . ' (' . $slot_def['__count__'] . ')</div>';
$row = $open . $row_info . $close;
$tray_def[$tray_id]['__slots__'][$slot_id]['__html__'] = '<li class="arrow">' . $row . '</li>';
} else {
$row = array();
示例10: get_slots
public static function get_slots($tab, $tray_settings)
{
if (!isset($tray_settings['__title__']) || !isset($tray_settings['__slots__'])) {
return array();
}
$ret = array();
foreach ($tray_settings['__slots__'] as $slot) {
if (!isset($slot['__name__'])) {
continue;
}
$crits = self::get_slot_crits($slot, $tray_settings);
$slot_id = Utils_RecordBrowserCommon::get_field_id($slot['__name__']);
$ret[$slot_id] = $slot + array('__id__' => $slot_id, '__count__' => Utils_RecordBrowserCommon::get_records_count($tab, $crits), '__crits__' => $crits);
}
return $ret;
}
示例11: defined
<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
$tables = DB::GetAssoc('SELECT tab, tab FROM recordbrowser_table_properties');
foreach ($tables as $tab) {
$fields = DB::GetAssoc('SELECT field, field FROM ' . $tab . '_field WHERE type=%s', array('checkbox'));
foreach ($fields as $f) {
$f = Utils_RecordBrowserCommon::get_field_id($f);
DB::Execute('UPDATE ' . $tab . '_data_1 SET f_' . $f . '=NULL WHERE f_' . $f . '=0');
}
}