本文整理匯總了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);
}