0 && $clsConfig->langMulti) {
echo '
';
} elseif ( $af['type'] == 'subTitle' ) {
echo '
'.$af['lbl'].'
';
} else {
echo '
'.
showInput($af,$data,$crop_image_index).'
';
}
if ($af['type'] == 'image')
{
$crop_image_index = $crop_image_index + 1;
}
}
}
}
if(!function_exists('showInput')) {
function showInput($af,$data,$crop_image_index=1) {
global $ACT,$db, $strSesName, $index;
if($ACT=='view' && ( !isset($af['customView']) || !$af['customView'] ) ) {
if($af['type']=='image') {
$path = '../'.end(explode('|',$data[$af['Name']]));
//return '
';
$htmlIMG = '';
if ( $path != '../' )
{
$htmlIMG = file_exists($path) ? '
' : $htmlIMG;
$htmlIMG = file_exists(img_path($path))
? '
'
: $htmlIMG;
}
return $htmlIMG;
} elseif($af['type']=='file') {
return '';
} elseif($af['type']=='multiupload') {
/* ********** ********** Load Attachment ********** ********** ********** */
$sql = "SELECT * FROM attachment WHERE a_ref_id = '".$GLOBALS['id']."' AND a_ref_type = '".$af['ref_type']."' ORDER BY a_sort_id, a_crt_dt DESC";
$query = $db->execSQL($sql);
while($a = $db->fetchAry($query)) {
if(file_exists('../'.img_path($a['a_path'],'thumb'))) {
$fPath = img_path($a['a_path'],'thumb');
} else {
$fPath = $a['a_path'];
}
$uploaded_file .= '';
}
return '
';
/* ********** ********** ********** ********** ********** ********** ********** */
} elseif($af['type']=='custom') {
eval('$input = '.$af['loopFunction'].';');
return $input;
} else {
if( isset($af['option']) && $af['option']) {
$val = showOption($af['option'],$data[$af['Name']],$af['type']);
} else {
$val = $data[$af['Name']];
}
if ( isset($af['FldType']) )
{ switch($af['FldType'])
{ case 'DATE': case 'TIME':
$val = substr( $val , 0 , $af['Len'] );
switch( $val )
{ case '0000-00-00': case '00:00:00': case '0000-00-00 00:00:00':
$val = '';
break;
}
break;
} }
return $af['type']=='textarea' ? '' : '';
}
}
if ( !isset($af['type']) ) { $af['type'] = 'text'; }
switch($af['type']) {
case 'label':
$input = isset($data[$af['Name']]) ? $data[$af['Name']] : '';
$input = nl2br(htmlspecialchars( $input ));
$input = ''.$input.'
';
if ( isset($af['lblDesc']) && $af['lblDesc']) { $input.= $af['lblDesc']; }
return $input;
break;
case 'textarea':
$input = '';
if ( isset($af['showRemainChar']) && $af['showRemainChar'] )
{
$intRemainLen = $af['Len'] - strlen($data[$af['Name']]);
if ( $intRemainLen < 0 ) { $intRemainLen = 0; }
$css = 'margin-left: 5px; border: gainsboro solid 1px; background-color: snow; color: grey;';
$css.= 'padding: 3px; vertical-align: top;';
$input.= ''.$intRemainLen.'';
}
if ( isset($af['lblDesc']) && $af['lblDesc']) { $input.= $af['lblDesc']; }
return $input;
break;
case 'select':
$optionList = '';
foreach($af['option'] as $o) {
$optionList .= '';
}
$input = '';
if ( isset($af['lblDesc']) && $af['lblDesc']) { $input.= $af['lblDesc']; }
return $input;
break;
case 'radio':
$optionList = '';
foreach($af['option'] as $key => $o) {
$optionList.= '';
}
$input = ''.$optionList.'
';
if ( isset($af['lblDesc']) && $af['lblDesc']) { $input.= $af['lblDesc']; }
return $input;
break;
case 'checkbox':
$optionList = ''; $selected = array();
$e = isset($data[$af['Name']]) ? explode(',',str_replace('*','',$data[$af['Name']])) : array();
foreach($e as $sted) {
$selected[] = $sted;
}
foreach($af['option'] as $key => $o) {
$optionList.= '';
}
$input = ''.$optionList.'
';
if ( isset($af['lblDesc']) && $af['lblDesc']) { $input.= $af['lblDesc']; }
return $input;
break;
case 'time':
for($i=0;$i<24;$i++) { $v = str_pad($i,2,0,STR_PAD_LEFT); $hList[] = array(v=>$v); }
for($i=0;$i<59;($af['timePeriod']>1 ? $i+=$af['timePeriod'] : $i++)) { $v = str_pad($i,2,0,STR_PAD_LEFT); $mList[] = array(v=>$v); }
foreach($hList as $h) {
$hOption .= '';
}
foreach($mList as $m) {
$mOption .= '';
}
$sList .= ' : ';
if ($af['lblDesc']) { $sList.= $af['lblDesc']; }
return $sList;
break;
// case 'multiupload':
// global $swfuId, $swfuJs;
// $swfuId++;
// if($swfuId==1) { $swfuJs .= '$("a[rel=photo]").fancybox();'; }
// $swfuJs .= 'var swfu'.$swfuId.';';
// $swfuJs .= 'var setting;';
// $swfuJs .= 'setting = getSwfu('.$swfuId.');';
// $swfuJs .= 'setting.post_params = {PHPSESSID: "'.session_id().'", "upload_id" : "'.$_SESSION[$strSesName.'_ADMIN_'.$GLOBALS['index']]['upload_id'].'", ref_type: "'.$af['ref_type'].'", resize: "'.$af['resize'].'"};';
// if($af['file_types']) { $swfuJs .= "setting.file_types = '".$af['file_types']."'; setting.file_types_description = 'FILES';"; }
// if(is_array($af['swfu']) && count($af['swfu'])>0) {
// foreach($af['swfu'] as $swKey => $sws) {
// $swfuJs .= "setting.$swKey = '$sws';";
// }
// }
// $swfuJs .= 'swfu'.$swfuId.' = new SWFUpload(setting);';
// $uploaded_file_num = 0;
// if($ACT=='edit') {
// /* ********** ********** Load Attachment ********** ********** ********** */
// $uploaded_file_num = $uploaded_photo_num = 0;
// $sql = "SELECT * FROM attachment WHERE a_ref_id = '".$GLOBALS['id']."' AND a_ref_type = '".$af['ref_type']."' ORDER BY a_sort_id, a_crt_dt DESC";
// $query = $db->execSQL($sql);
// while($a = $db->fetchAry($query)) {
// if(file_exists('../'.img_path($a['a_path'],'thumb'))) {
// $fPath = img_path($a['a_path'],'thumb');
// } else {
// $fPath = $a['a_path'];
// }
// $uploaded_file .= '
//
// '.($a[a_width]>0 ? '

' :
// '
').'
//
//
//
';
// $uploaded_file_num++;
// }
// /* ********** ********** ********** ********** ********** ********** ********** */
// }
// return '
//
//
Uploaded files (total: '.$uploaded_file_num.')
// '.($af[allowSort] ? '
//
// ' : '').'
//
//
'.$uploaded_file.'
//
//
// Upload Queue
//
// 0 Files Uploaded
//
//
//
//
';
// break;
case 'multiupload':
global $swfuId, $swfuJs;
$swfuId++;
$uploaded_file_num = 0;
if($ACT=='edit') {
// ********** ********** Load Attachment ********** ********** ********** //
$uploaded_file_num = $uploaded_photo_num = 0;
$sql = "SELECT * FROM attachment WHERE a_ref_id = '".$GLOBALS['id']."' AND a_ref_type = '".$af['ref_type']."' ORDER BY a_sort_id, a_crt_dt DESC";
$query = $db->execSQL($sql);
while($a = $db->fetchAry($query)) {
if(file_exists('../'.img_path($a['a_path'],'thumb'))) {
$fPath = img_path($a['a_path'],'thumb');
} else {
$fPath = $a['a_path'];
}
$uploaded_file .= '
'.($a['a_width']>0 ? '

' :
'
').'
';
$uploaded_file_num++;
}
// ********** ********** ********** ********** ********** ********** ********** //
}
$vHtml = '
Uploaded files (total: '.$uploaded_file_num.')
'.($af['allowSort'] ? '
' : '').'
'.$uploaded_file.'
0 Files Uploaded
';
//$iFrameUrl = 'index.php?index=ajax&act=btnmultiupload&noframe=yes';
$iFrameUrl = 'include/btnmultiupload.php?';
$iFrameUrl.= '&id='.$GLOBALS['id'];
$iFrameUrl.= '&upload_id='.$_SESSION[$strSesName.'_ADMIN_'.$index]['upload_id'];
$iFrameUrl.= '&resize='.$af['resize'];
$iFrameUrl.= '&refType='.$af['ref_type'];
$iFrameUrl.= '&swfuId='.$swfuId;
$iFrameUrl.= '&pageIndex='.$index;
$iFrameUrl.= '&fldName='.$af['Name'];
$vHtml.= '
Reminder: maximum 20 files per upload, total not more than 32Mb
';
//$vHtml.= "{$iFrameUrl}";
return $vHtml;
case 'file':
$filePath = '../'.end(explode('|',$data[$af['Name']]));
$cssHasFile = "";
if($data[$af['Name']] && file_exists($filePath)) {
$cssHasFile = " hasFile ";
}
$input = ' ';
if($data[$af['Name']] && file_exists($filePath)) {
$input .= ' ';
if ( $af['noDel'] != 1 && $af['noDelete'] != 1 )
{
$input .= ' ';
}
}
if ($af['lblDesc']) { $input.= $af['lblDesc']; }
return $input;
break;
case 'image':
$itemID = md5(date('Y-m-d.H.i.s').rand(100000,999999));
$filePath = isset($data[$af['Name']]) ? '../'.end(explode('|',$data[$af['Name']])) : '';
$cssHasFile = "";
if(isset($data[$af['Name']]) && $data[$af['Name']] && file_exists($filePath)) {
$cssHasFile = " hasFile ";
}
$input = ' ';
if(isset($data[$af['Name']]) && $data[$af['Name']] && file_exists($filePath)) {
$input .= ' View Existing ';
if ( ( !isset($af['noDel']) || ( isset($af['noDel']) && $af['noDel'] != 1 ) )
&& ( !isset($af['noDelete']) || ( isset($af['noDelete']) && $af['noDelete'] != 1 ) ) )
{
$input .= ' ';
}
}
//$input.= '
'.$filePath;
if (isset($af['lblDesc']) && $af['lblDesc']) { $input.= $af['lblDesc']; }
$input.= '';
$input.= '
![]()
';
$input.= '';
//$input.= '';
$input.= '
';
$input.= '';
$input.= '';
$input.= '';
return $input;
break;
case 'custom':
eval('$input = '.$af['loopFunction'].';');
return $input;
break;
default:
$showValue = isset($data[$af['Name']]) ? $data[$af['Name']] : '';
$input = '';
if ( isset($af['FldType']) )
{ switch($af['FldType'])
{ case 'DATE': case 'TIME':
$showValue = substr( $showValue , 0 , $af['Len'] );
switch( $showValue )
{ case '0000-00-00': case '00:00:00': case '0000-00-00 00:00:00':
$showValue = '';
break;
}
break;
case 'CURRENCY':
$input.= '';
$input.= $_SESSION[$strSesName.'_ADMIN']['cur_symbol'];
$input.= '
';
break;
} }
$input.= ' 0 ? ' maxlength="'.$af['Len'].'" ' : '' ;
$input.= isset($af['isMail']) && $af['isMail'] ? ' check-Mail="1" ' : ' check-Mail="" ' ;
$input.= isset($af['isAlphaNumeric']) && $af['isAlphaNumeric'] ? ' check-AlphaNumeric="1" ' : ' check-AlphaNumeric="" ' ;
$input.= ' name="'.$af['Name'].'" id="'.$af['Name'].'" ';
$input.= ' class="'.( isset($af['cls']) ? $af['cls'] : '' )
.( ( isset($af['FldType']) && $af['FldType'] == 'CURRENCY' ) ? ' input_money ' : '' )
.( ( isset($af['showRemainChar']) && $af['showRemainChar'] ) ? ' show_count ' : '' )
.'" ';
$input.= ' value="'.$showValue.'" '.( isset($af['attr']) ? $af['attr'] : '' ).' />';
if ( isset($af['showRemainChar']) && $af['showRemainChar'] )
{
$intRemainLen = $af['Len'] - strlen($showValue);
if ( $intRemainLen < 0 ) { $intRemainLen = 0; }
$css = 'margin-left: 5px; border: gainsboro solid 1px; background-color: snow; padding: 3px; color: grey;';
$input.= ''.$intRemainLen.'';
}
if ( isset($af['isMail']) && $af['isMail'] )
{
$input.= '';
$input.= '電郵格式不正確';
$input.= '';
}
if ( isset($af['isAlphaNumeric']) && $af['isAlphaNumeric'] )
{
$input.= '';
$input.= '只限英文字母';
$input.= '';
}
$input.= ( isset($af['lblDesc']) && $af['lblDesc'] ? $af['lblDesc'] : '');
return $input;
}
}
}
?>