本文整理汇总了PHP中Utils_RecordBrowserCommon::encode_autonumber_param方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils_RecordBrowserCommon::encode_autonumber_param方法的具体用法?PHP Utils_RecordBrowserCommon::encode_autonumber_param怎么用?PHP Utils_RecordBrowserCommon::encode_autonumber_param使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utils_RecordBrowserCommon
的用法示例。
在下文中一共展示了Utils_RecordBrowserCommon::encode_autonumber_param方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view_field
//.........这里部分代码省略.........
$form->addElement('text', 'QFfield_callback', __('Field generator function'), array('maxlength'=>255, 'style'=>'width:300px', 'id'=>'QFfield_callback'));
if ($action=='edit') {
$form->freeze('field');
$form->freeze('select_data_type');
$form->freeze('data_source');
$form->freeze('rset');
}
if ($action=='edit') {
$display_callbacback = DB::GetOne('SELECT callback FROM '.$this->tab.'_callback WHERE freezed=1 AND field=%s', array($field));
$QFfield_callbacback = DB::GetOne('SELECT callback FROM '.$this->tab.'_callback WHERE freezed=0 AND field=%s', array($field));
$form->setDefaults(array('display_callback'=>$display_callbacback));
$form->setDefaults(array('QFfield_callback'=>$QFfield_callbacback));
}
if ($form->validate()) {
$data = $form->exportValues();
$data['caption'] = trim($data['caption']);
$data['field'] = trim($data['field']);
$type = DB::GetOne('SELECT type FROM '.$this->tab.'_field WHERE field=%s', array($field));
if (!isset($data['select_data_type'])) $data['select_data_type'] = $type;
if ($action=='add')
$field = $data['field'];
$id = preg_replace('/[^a-z0-9]/','_',strtolower($field));
$new_id = preg_replace('/[^a-z0-9]/','_',strtolower($data['field']));
if (preg_match('/^[a-z0-9_]*$/',$id)==0) trigger_error('Invalid column name: '.$field);
if (preg_match('/^[a-z0-9_]*$/',$new_id)==0) trigger_error('Invalid new column name: '.$data['field']);
$param = '';
switch ($data['select_data_type']) {
case 'autonumber':
$data['required'] = false;
$data['filter'] = false;
$param = Utils_RecordBrowserCommon::encode_autonumber_param(
$data['autonumber_prefix'],
$data['autonumber_pad_length'],
$data['autonumber_pad_mask']);
// delete field and add again later to generate values
if ($action != 'add') {
Utils_RecordBrowserCommon::delete_record_field($this->tab, $field);
$action = 'add';
$field = $data['field'];
}
break;
case 'checkbox':
$data['required'] = false;
break;
case 'text': if ($action=='add') $param = $data['text_length'];
else {
if ($data['text_length']<$row['param']) trigger_error('Invalid field length', E_USER_ERROR);
$param = $data['text_length'];
if ($data['text_length']!=$row['param']) {
if(DB::is_postgresql())
DB::Execute('ALTER TABLE '.$this->tab.'_data_1 ALTER COLUMN f_'.$id.' TYPE VARCHAR('.$param.')');
else
DB::Execute('ALTER TABLE '.$this->tab.'_data_1 MODIFY f_'.$id.' VARCHAR('.$param.')');
}
}
break;
case 'select':
if ($data['data_source']=='commondata') {
if ($data['select_type']=='select') {
$param = Utils_RecordBrowserCommon::encode_commondata_param(array('order_by_key'=>$data['order_by']=='key', 'array_id'=>$data['commondata_table']));
$data['select_data_type'] = 'commondata';
} else {
$param = '__COMMON__::'.$data['commondata_table'].'::'.$data['order_by'];
示例2: format_param
private static function format_param($prefix = '#', $pad_length = 6, $pad_mask = '0')
{
if (!is_int($pad_length)) {
trigger_error('pad_length is not integer');
}
if ($pad_mask == ',') {
trigger_error('pad_mask cannot be comma');
}
if ($prefix == ',') {
trigger_error('prefix cannot be comma');
}
return Utils_RecordBrowserCommon::encode_autonumber_param($prefix, $pad_length, $pad_mask);
}