set_filenames(array("body" => $html_file)); $bhxh = $prefix.'announce'; $prefix_table = "announce_"; $menu1 = $prefix.'menu_1'; $menu2 = $prefix.'menu_2'; $id_table = $vanban; $dir = "uploadfile/vanban/"; $id = $_REQUEST['value'] + 0; if(isset($_REQUEST['value'])) { $sql = "select * from ".$menu2." where menu_2_id = '".$id."'"; $result = mysql_query($sql) or die("Khong the truy cap menu_2"); $row = $db->sql_fetchrowset($result); $template->assign_block_vars("bhxh", array( "NAME" => $row[0]['menu_2_name'], )); $sql = "select * from ".$menu2." where menu_2_sub = '".$id."'"; $result = mysql_query($sql) or die("Khong the truy cap menu_2"); $row = $db->sql_fetchrowset($result) ; if(count($row)>0) { $template->assign_block_vars("bhxh.list", array()); for ($i=0 ; $iassign_block_vars("bhxh.list.menu_1", array( "NAME" => $row[$i]['menu_2_name'], "LINK" => ($row[$i]['menu_2_link'] == "")?($row[$i]['menu_1_link']."?value=".$row[$i]['menu_2_id']):$row[$i]['menu_2_link'], )); } } else { $sql = "select * from ".$bhxh." where announce_group = '".$id."' order by right(announce_reg_sign,4) DESC, left(right(announce_reg_sign,7),2) DESC, left(announce_reg_sign,2) DESC"; $result = mysql_query($sql) or die("Khong the truy cap menu_2, announce"); $record = $db->sql_fetchrowset($result); if(count($record) > 0) { $template->assign_block_vars("bhxh.record", array()); for ($i=0 ; $iassign_block_vars("bhxh.record.row", array( "ID" => $record[$i]['announce_id'], "LINK" => $php_file."?id=".$record[$i]['announce_id'], "TITLE" => $record[$i]['announce_title'], "CONTENT" => $record[$i]['announce_content'], "REG" => $record[$i]['announce_reg'], )); } } else { $template->assign_block_vars("bhxh.record", array()); $template->assign_block_vars("bhxh.record.alert", array( "ALERT" => $alert, )); } } } else if(isset($_REQUEST['id'])) { $id = $_REQUEST['id'] + 0; $sql = "select * from ".$bhxh." where announce_id = '".$id."'"; $result = mysql_query($sql) or die("Khong the truy cap menu_2, announce"); $row = $db->sql_fetchrowset($result); if(count($row) > 0) { $template->assign_block_vars("view", array( "id" => $row[0][$prefix_table.'id'], "title" => $row[0][$prefix_table.'title'], "detail" => $row[0][$prefix_table.'detail'], "date" => $row[0][$prefix_table.'reg'], "content" => $row[0][$prefix_table.'content'], )); if((strlen($row[0][$prefix_table.'attach_doc']) > 0) || (strlen($row[0][$prefix_table.'attach_xls']) > 0) || (strlen($row[0][$prefix_table.'attach_pdf']) > 0)) { $template->assign_block_vars("view.attach", array( "name" => $attach, )); if(strlen($row[0][$prefix_table.'attach_doc']) > 0) $template->assign_block_vars("view.attach.doc", array( "file" => ('download.php?fd=2&file=1&id='.$id), )); if(strlen($row[0][$prefix_table.'attach_xls']) > 0) $template->assign_block_vars("view.attach.xls", array( "file" => ('download.php?fd=2&file=2&id='.$id), )); if(strlen($row[0][$prefix_table.'attach_pdf']) > 0) $template->assign_block_vars("view.attach.pdf", array( "file" => ('download.php?fd=2&file=3&id='.$id), )); /* if(strlen($row[0][$prefix_table.'attach_doc']) > 0) $template->assign_block_vars("view.attach.doc", array( "file" => $dir.$row[0][$prefix_table.'attach_doc'], )); if(strlen($row[0][$prefix_table.'attach_xls']) > 0) $template->assign_block_vars("view.attach.xls", array( "file" => $dir.$row[0][$prefix_table.'attach_xls'], )); if(strlen($row[0][$prefix_table.'attach_pdf']) > 0) $template->assign_block_vars("view.attach.pdf", array( "file" => $dir.$row[0][$prefix_table.'attach_pdf'], )); */ } } else { $template->assign_block_vars("bhxh", array()); $template->assign_block_vars("bhxh.record", array()); $template->assign_block_vars("bhxh.record.alert", array( "ALERT" => $alert, )); } } else { $sql = "select * from ".$menu1." inner join ".$menu2." on ".$menu1.".menu_1_id = ".$menu2.".menu_1_id where ".$menu1.".menu_1_id = '".$id_table."' and menu_2_sub = '0'"; $result = mysql_query($sql) or die("Khong the truy cap menu_2, announce"); $row = $db->sql_fetchrowset($result) ; $template->assign_block_vars("bhxh", array( "NAME" => $row[0]['menu_1_name'], )); if(count($row) > 0) { $template->assign_block_vars("bhxh.list", array()); for ($i=0 ; $iassign_block_vars("bhxh.list.menu_1", array( "NAME" => $row[$i]['menu_2_name'], "LINK" => ($row[$i]['menu_2_link'] == "")?($row[$i]['menu_1_link']."?value=".$row[$i]['menu_2_id']):$row[$i]['menu_2_link'], )); } } } $template->pparse("body"); include('include/right.php') ; include('include/page_footer.php') ; ?>