template = ' {field_title} {field_content} '; } //--- Show text field --- function text($field_title, $field_name, $field_value, $style="", $template=""){ $field_content = ""; $field_content = ''; $template = $this->all_template($field_title, $field_content, $template); return $template; } //--- End Show text field --- //--- Show text date--- function text_date($field_title, $field_name, $field_value, $style="", $template=""){ $field_content = ""; $field_content = ''; //document.forms[0] '.($field_value != "" ? $field_value : date("Y-m-d")).' $template = $this->all_template($field_title, $field_content, $template); return $template; } //--- End Show text date--- //--- Show text editor --- function text_editor($field_title, $field_name, $field_value, $style="", $configpath = "", $template=""){ include("../../include/fckeditor/fckeditor.php"); $field_content = ""; $object_name = ${$field_name."_editor"}; $object_name = new FCKeditor($field_name); $object_name->BasePath = '../../include/fckeditor/'; if($configpath != ""){ $object_name->Config['CustomConfigurationsPath'] = $configpath; //'../../../include/fckeditor/fckconfig.js'; } $object_name->Value = $field_value; $object_name->Width = '100%'; $object_name->Height = '450'; if($style != ""){ $object_name->ToolbarSet = $style; } $field_content = $object_name->CreateHtml(); $template = $this->all_template($field_title, $field_content, $template); return $template; } //--- End Show text editor --- //--- Show text area --- function textarea($field_title, $field_name, $field_value, $style="", $template=""){ $field_content = ""; if($style == ""){ $field_content .= ' 
'; } $field_content .= ''; //''; $template = $this->all_template($field_title, $field_content, $template); return $template; } //--- End sShow text area --- /* $all_sub_field_title $all_sub_field_title["1"] = "category 1"; //--- is checked $all_sub_field_title["2"] = "category 2"; */ //--- Show Select Box (can multiple)--- function selectbox($field_title, $field_name, $all_sub_field_title, $all_field_value, $style="", $template=""){ $field_content = ""; $field_content .= ''; $template = $this->all_template($field_title, $field_content, $template); return $template; } //--- End Show Select Box(can multiple) --- //--- Password input field --- function password($field_title, $field_name, $field_value, $style="", $template=""){ $field_content = ""; $field_content = ''; $template = $this->all_template($field_title, $field_content, $template); return $template; } //--- End Password input field --- //--- Show plain text only --- function plain_text($field_title, $field_name, $field_value, $style="", $template=""){ $field_content = ""; $field_content = $field_value; $template = $this->all_template($field_title, $field_content, $template); return $template; } //--- End Show plain text only --- function all_template($field_title, $field_content, $template=""){ if($template == ""){ $template = $this->template; } $template = str_replace("{field_title}", $field_title, $template); $template = str_replace("{field_content}", $field_content, $template); return $template; } /* $field_title = "Show"; $field_name = "display" $all_field_title: $all_field_name["Y"] = "Show"; $all_field_name["N"] = "Hidden"; $all_field_value: $all_field_value["Y"] = "checked"; $all_field_value["N"] = ""; $all_style = array(); $style["Y"] = "{field_title}"; $style["N"] = "{field_title}"; */ //--- Show radio box --- function radio_box($field_title, $field_name, $all_sub_field_title, $all_field_value, $all_style=array(), $template=""){ $field_content = ""; foreach($all_sub_field_title as $sub_field_value => $sub_field_title){ $style = $all_style[$sub_field_value]; $this_field_value = $all_field_value[$sub_field_value]; $field_content .= ''.($style == "" ? $sub_field_title : str_replace("{field_title}", $sub_field_title, $style)); } $template = $this->all_template($field_title, $field_content, $template); return $template; } //--- End Show radio box --- /* $all_field_name: $all_field_name["Y"]["Show"] = "chkbox_1"; $all_field_name["N"]["Hidden"] = "chkbox_2"; $all_field_value: $all_field_value["Y"]["Show"] = "checked"; $all_field_value["N"]["Hidden"] = ""; $all_style : $all_style["Y"]["Show"] = "{field_title}"; $all_style["N"]["Show"] = "{field_title}"; */ //--- Show check box --- function check_box($field_title, $field_name, $all_sub_field_title, $all_field_value, $all_style=array(), $template=""){ $field_content = ""; foreach($all_sub_field_title as $sub_field_value => $sub_field_title){ $style = $all_style[$sub_field_value]; $this_field_value = $all_field_value[$sub_field_value]; $field_content .= ''.($style == "" ? $sub_field_title : str_replace("{field_title}", $sub_field_title, $style)); } $template = $this->all_template($field_title, $field_content, $template); return $template; } //--- End Show check box --- //---- Pop up upload file User Interface ---- function popup_upload_file($db, $page_tbname, $page_attachment_tbname, $page_address_upload_form, $page_show_attachment_file, $table_id, $temp_id, $num_of_files, $attachment_text, $col_name, $have_upload_file_caption = "N", $is_youtube_upload = "N"){ $files_content = ""; if($template == ""){ $template = $this->template; } for ($i=1;$i<=$num_of_files;$i++) { if ($table_id != "") { $sql = "SELECT * FROM `".$page_attachment_tbname."` WHERE `table_name` = '".$page_tbname."' AND `table_id` = '".escapeit($table_id)."' AND `col_name` = '".$col_name[$i]."'"; $rs = $db->query($sql); if (mysql_num_rows($rs) > 0) { $rowfile = $db->fetch_array($rs); $attachment_id = $rowfile["attachment_id"]; $real_name = $rowfile["real_name"]; $youtube_code = $rowfile["youtube_code"]; $attach_caption_en = $rowfile["attach_caption_en"]; $attach_caption_zh = $rowfile["attach_caption_zh"]; //--- Check have attachment caption --- $attachment_content = ""; $attachment_link = ""; if($have_upload_file_caption == "Y"){ $attachment_content = '
Caption: '; $attachment_link = '&attach_caption_en='.urlencode($attach_caption_en); } //--- End Check have attachment caption --- //--- Check have youtube upload --- $attachment_youtube_content = ""; if($is_youtube_upload == "Y" && $youtube_code != ""){ $attachment_youtube_content = '
'; } //--- End Check have youtube upload --- ${"file".$i} = '
File name: '.$real_name.' Delete '.$attachment_content.$attachment_youtube_content; } } //--- Check have youtube upload --- $attachment_youtube_link = ""; if($is_youtube_upload == "Y"){ $attachment_youtube_link = "&is_youtube_upload=".$is_youtube_upload; } //--- End Check have youtube upload --- $files_content .= $template; $files_content = str_replace("{field_title}", $attachment_text[$i], $files_content); $files_content = str_replace("{field_content}", ' '.(($table_id != "") ? ${"file".$i} : "").'', $files_content); } return $files_content; } //---- End Pop up upload file User Interface ---- //--- Mulitple Upload File --- function multi_upload_file($field_title, $table_id, $temp_id){ $files_content = ""; $files_content .= '
Upload
'; return $files_content; } //--- End Mulitple Upload File --- //--- AJAX upload file --- function ajax_upload_file($db, $page_tbname, $page_attachment_tbname, $page_address_upload_form, $page_show_attachment_file, $table_id, $temp_id, $num_of_files, $attachment_text, $col_name, $have_upload_file_caption = "N", $is_youtube_upload = "N"){ $files_content = ""; if($template == ""){ $template = $this->template; } for ($i=1;$i<=$num_of_files;$i++) { if ($table_id != "") { $sql = "SELECT * FROM `".$page_attachment_tbname."` WHERE `table_name` = '".$page_tbname."' AND `table_id` = '".escapeit($table_id)."' AND `col_name` = '".$col_name[$i]."'"; $rs = $db->query($sql); if (mysql_num_rows($rs) > 0) { $rowfile = $db->fetch_array($rs); $attachment_id = $rowfile["attachment_id"]; $real_name = $rowfile["real_name"]; $youtube_code = $rowfile["youtube_code"]; $attach_caption_en = $rowfile["attach_caption_en"]; $attach_caption_zh = $rowfile["attach_caption_zh"]; //--- Check have attachment caption --- $attachment_content = ""; $attachment_link = ""; if($have_upload_file_caption == "Y"){ $attachment_content = '
Caption:
'; $attachment_link = '&attach_caption_en='.urlencode($attach_caption_en); } //--- End Check have attachment caption --- //--- Check have youtube upload --- $attachment_youtube_content = ""; if($is_youtube_upload == "Y" && $youtube_code != ""){ $attachment_youtube_content = '

'; } //--- End Check have youtube upload --- ${"file".$i} = 'File name: '.$real_name.' Delete
'.$attachment_content.$attachment_youtube_content; } } $files_content .= $template; $files_content = str_replace("{field_title}", $attachment_text[$i], $files_content); $files_content = str_replace("{field_content}", ''.(($table_id != "") ? ${"file".$i} : "").'
', $files_content); } return $files_content; } //--- End AJAX upload file --- } ?>