|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /var/www/html/pathumthani_eoffice/application/agenda/ |
Upload File : |
<?
include("../../config/config.inc.php");
function selectDocType()
{
$arr = array();
$sql = "SELECT
tbl_main_menu.id_menu,
tbl_main_menu.name_menu
FROM
tbl_main_menu
WHERE
tbl_main_menu.status_menu = '1'
ORDER BY tbl_main_menu.id_menu ASC";
$query = mysql_query($sql);
while($rs = mysql_fetch_assoc($query))
{
$arr[$rs[id_menu]] = $rs[name_menu];
}
return $arr;
}
//=========================================
// Select attach files where status id_attach_file = $sub_id
// @author Kridsada Satakarn
// @date 2009/06/20
// @return a array of list attach files where status id_attach_file = $sub_id
//=========================================
function selectAttachFiles($sub_id,$type)
{
$arr = array();
$sql = "SELECT
*
FROM
tbl_attach_file
WHERE
tbl_attach_file.id_attach_file = '$sub_id' and id_type='$type' order by attach_file ASC";
$query = mysql_query($sql);
while($rs = mysql_fetch_assoc($query))
{
$arr[$rs[run_id]] = $rs;
}
return $arr;
}
function showListFile($id,$approveshow)
{
$docType = selectDocType();
$strtable.= " <table width=\"603\" border=\"0\" bgcolor=\"#999999\"cellpadding=\"1\" cellspacing=\"1\">\n";
$strtable.= " <tr bgcolor=\"#333333\">";
$strtable.= " <td width=\"200\" align=\"center\" bgcolor=\"#CCCCCC\">หมวด</td>\n";
$strtable.= " <td width=\"200\" align=\"center\" bgcolor=\"#CCCCCC\">ชื่อไฟล์ listfile</td>\n";
# $strtable.= " <td width=\"200\" align=\"center\" bgcolor=\"#CCCCCC\">รับรองรายงานการประชุม</td>\n";
$strtable.= " </tr>";
foreach($docType as $key => $value)
{
$strtable.= "<tr >";
$listFiles= selectAttachFiles($id,$key);
$strfile="";
$strdel="";
$buttonconfirm="";
if($key=="3"){
$tagid=" id='button' ";
if($approveshow=="on"){
$buttonconfirm="<input name=\"confirm\" type=\"button\" onclick =\"formE.conf.value=1\" value=\"รับรองการประชุม\" style=\"font-size:12px;width:150px;height:20px\" />\n";
}
}
foreach($listFiles as $keyfile => $valuefile) {
$filename = urlencode($valuefile[attach_file]);
$file_comment = urlencode($valuefile[comment]);
$path = "attach_file/agenda/". $filename;
# $path = "attach_file/agenda/" ;
$strfile.="<div id=\"sub_$keyfile\"><a href=\"download.php?path=$path&filename=$filename\" target=\"fdownload\" >".$valuefile[comment]."</a>\n";
$strfile.="<a href=\"#\"onclick=\"delFile('DEL', '$valuefile[attach_file] ','' , '$keyfile ','$key')\"><img src=\"images/delete.gif\"width=\"15\" height=\"15\" alt=\"ลบไฟล์\" border=\"0\"></a></div>\n";
}
$strtable.= " <td bgcolor=\"#FFFFFF\">$docType[$key]</td>\n";
$strtable.= " <td bgcolor=\"#FFFFFF\" id=\"mode_$key\">$strfile</td>\n";
if(strlen($strfile)>0){
# $strtable.= " <td bgcolor=\"#FFFFFF\" $tagid align=\"center\"> $buttonconfirm</td>\n";
}else{
#$strtable.= " <td bgcolor=\"#FFFFFF\" $tagid> </td>\n";
}
$strtable.= " </tr>\n";
$buttonconfirm ="";
}
$strtable.= " </table>\n";
return $strtable;
}
function showListFile2($id,$approveshow){
$docType = selectDocType();
$strtable.= " <table width=\"400\" border=\"0\" bgcolor=\"#999999\"cellpadding=\"1\" cellspacing=\"1\">\n";
$strtable.= " <tr bgcolor=\"#333333\">";
$strtable.= " <td width=\"120\" align=\"center\" bgcolor=\"#CCCCCC\">หมวด</td>\n";
$strtable.= " <td width=\"200\" align=\"center\" bgcolor=\"#CCCCCC\">ชื่อไฟล์</td>\n";
$strtable.= " </tr>";
foreach($docType as $key => $value) {
$strtable.= "<tr >";
$listFiles= selectAttachFiles($id,$key);
$strfile="";
$strdel="";
$buttonconfirm="";
foreach($listFiles as $keyfile => $valuefile) {
$filename = urlencode($valuefile[attach_file]);
$path = "attach_file/".$id. "/". $filename;
$path = "attach_file/agenda/". $filename;
$strfile.="<div id=\"sub_$keyfile\"><a href=\"download.php?path=$path&filename=$filename\" target=\"fdownload\" >".$valuefile[comment]."</a>\n";
// $strfile.="<a href=\"#\"onclick=\"delFile('DEL', '$valuefile[attach_file] ','' , '$keyfile ','$key')\"><img src=\"images/delete.gif\"width=\"15\" height=\"15\" alt=\"ลบไฟล์\" border=\"0\"></a></div>\n";
} ###### END foreach($listFiles as $keyfile => $valuefile) {
$strtable.= " <td bgcolor=\"#FFFFFF\"> $docType[$key]</td>\n";
$strtable.= " <td bgcolor=\"#FFFFFF\" id=\"mode_$key\">$strfile</td>\n";
$strtable.= " </tr>\n";
$buttonconfirm ="";
} ################### END foreach($docType as $key => $value) {
$strtable.= " </table>\n";
return $strtable;
} ###################### END function showListFile2($id,$approveshow){
?>