Server IP : 119.59.102.212 / Your IP : 3.145.51.214 Web Server : Apache/2 System : Linux narin 2.6.32-042stab142.1 #1 SMP Tue Jan 28 23:44:17 MSK 2020 x86_64 User : yangkam ( 1022) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/yangkam/domains/yangkam.go.th/private_html/coremain/module/director_chart/ |
Upload File : |
<?php /************************************************************************ * director_chart.php * Show chart by arrange column and row order * * @author pandarianz * Email pandarianz@gmail.com *************************************************************************/ import_request_variables('pG', 'p_'); if($p_id_sub!="") { $id_sub=trim($p_id_sub); } if($p_id_chart!="") { $id_chart=trim($p_id_chart); } if($p_id_1!="") { $id_1=trim($p_id_1); } if($p_id_order1st!="") { $id_order1st=trim($p_id_order1st); } if($p_id_del_chart!="") { $id_del_chart=trim($p_id_del_chart); } // ###############UP & DOWN ################# if ($id_1 != "" && $id_order1st != "") { $sql = "SELECT * FROM cms_director_chart WHERE id_chart='$id_1'"; $re = mysql_query($sql); $data = mysql_fetch_array($re); if ($id_order1st == 1) { $up = $data['row_count'] - 1; } if ($id_order1st == 2) { $up = $data['row_count'] + 1; } // $sql = "UPDATE cms_director_chart SET row_count='$up' WHERE id_chart='$data[id_chart]' and id_sub='$id_sub'"; $re = mysql_query($sql); // $sql = "UPDATE cms_director_chart SET row_count='$data[row_count]' WHERE id_chart !='$data[id_chart]' and row_count='$up' and id_sub='$id_sub'"; $re = mysql_query($sql); } // ##################### DEL ROWS ALL ################ if ($id_del_chart != "") { $sql = "SELECT picture FROM cms_director_chart_profile WHERE id_chart='$id_del_chart'"; $re = mysql_query($sql); while ($data = mysql_fetch_array($re)) { if ($data[0] != "" && file_exists("$_SESSION[web_name]/module_chart/$id_sub/$data[0]")) { unlink("$_SESSION[web_name]/module_chart/$id_sub/$data[0]"); } } $sql = "DELETE FROM cms_director_chart_profile WHERE id_chart='$id_del_chart'"; $result = mysql_query($sql); $sql = "DELETE FROM cms_director_chart WHERE id_chart='$id_del_chart' and id_sub='$id_sub'"; $result = mysql_query($sql); } // ################################################### if ($p_id_sub != "") { $id_top = trim($p_id_sub); } if ($p_id_chart != "") { $id_chart = trim($p_id_chart); } if ($p_header_change != "") { $header_change = trim($p_header_change); } // ส่วนจัดการ สำหรับ admin เท่านั้น if ($_SESSION['admin_web'] == "admin" || id_sub_permission($id_sub) == 1) { // เพิ่มแถวหลักใหม่ if ($_GET['add_row']) { $max_row_count = select_max_query("row_count", "cms_director_chart", "id_sub", $id_sub); if ($max_row_count[0] == "") $max_row_count[0] = 0; $sql = "INSERT INTO cms_director_chart (id_sub,row_count) values ($id_sub," . $max_row_count[0] . ")"; query($sql); } // แก้ไขหัว if(isset($_POST['btn_edit_header'])){//if ($_POST['btn_edit_header']) { $sql = "UPDATE cms_director_chart SET header_text = '$header_change' WHERE id_sub=$id_sub"; query($sql); } // ซ่อน แสดงผล if ($_GET['status'] != "") { $sql = "UPDATE cms_director_chart_profile SET status = $_GET[status] WHERE id_profile = $_GET[profile]"; query($sql); } if ($_GET['delete']) { $sql = "SELECT picture FROM cms_director_chart_profile WHERE id_profile = $_GET[profile]"; $re = mysql_query($sql); $data = mysql_fetch_array($re); if ($data[0] != "") { unlink("$_SESSION[web_name]/module_chart/$id_sub/$data[0]"); } $sql = "DELETE FROM cms_director_chart_profile WHERE id_profile = $_GET[profile]"; query($sql); } if ($_GET['row']) { $sql = "DELETE FROM cms_director_chart WHERE row_count = $_GET[row] and id_sub = $id_sub"; query($sql); } } $count_xx = 1; $navig['link_picture'] = $data_name_menu_sub['name']; navigator($navig); echo "<br>"; bar_header("$data_name_menu_sub[name]"); // Bar_Header fieldset_top($data_name_menu_sub['name']); // header info $dat_info = select_query_object("header_text", "cms_director_chart", "id_sub", $id_sub, " and header_text!=''"); $header_info = $dat_info->header_text; echo "<center>"; if ($_SESSION['admin_web'] == "admin" || id_sub_permission($id_sub) == 1) { echo "<form name='header_form' method='post' action='index.php?mod=director_chart&path=director_chart&id_sub=$id_sub'>"; echo print_arr1(); echo " <b>แก้ไขส่วนหัว</b> : <input type='text' name='header_change' value='$header_info'>"; button_text('แก้ไข', 'btn_edit_header', 0); #text_button_update(); // echo " <input type='submit' name='btn_edit_header' value='แก้ไข'>"; echo "</form>"; } else { echo "<b>$header_info </b>"; } echo "</center>"; // query sturcture table $sql = "SELECT * FROM cms_director_chart WHERE id_sub = $id_sub group by row_count"; $res = query($sql); while ($struct_table = mysql_fetch_array($res)) { // get result column number for get table width percent $sql_count = "SELECT COUNT(*) as numcount FROM cms_director_chart_profile as d1 inner join cms_director_chart as d2 on (d1.id_chart = d2.id_chart and d2.id_sub = $id_sub and d1.id_chart =$struct_table[id_chart])"; $res_count = query($sql_count); $dat_count = mysql_fetch_object($res_count); $count_col = $dat_count->numcount; if ($count_col != 0) $width_table = 100 / $count_col; else $width_table = 100; echo "<table width='98%' border='0'>"; echo "<tr>"; if ($_SESSION['admin_web'] == "admin" || id_sub_permission($id_sub) == 1) // แยกการมองเห็น ตามสถานะ $sql = "SELECT * FROM cms_director_chart_profile WHERE id_chart =" . $struct_table["id_chart"]; else $sql = "SELECT * FROM cms_director_chart_profile WHERE id_chart =" . $struct_table["id_chart"] . " and status=1"; $res_col = query($sql); if ($count_col == 0 && ( $_SESSION['admin_web'] == "admin" || id_sub_permission($id_sub) == 1)) { echo "<td align='center' width='$width_table%'>"; print_nopic(); echo "</td>"; } while ($data_col = mysql_fetch_array($res_col)) { echo "<td align='center' width='$width_table%'>"; if ($_SESSION['admin_web'] == "admin" || id_sub_permission($id_sub) == 1) { echo "<br/>"; if ($data_col['status'] == 1) box_hide("index.php?mod=director_chart&path=director_chart&id_sub=$id_sub&profile=$data_col[id_profile]&status=0"); else box_show("index.php?mod=director_chart&path=director_chart&id_sub=$id_sub&profile=$data_col[id_profile]&status=1"); box_update("index.php?mod=director_edit_profile&path=director_chart&id_profile=$data_col[id_profile]&id_sub=$id_sub&id_chart=$struct_table[id_chart]"); box_delete("index.php?mod=director_chart&path=director_chart&id_sub=$id_sub&profile=$data_col[id_profile]&delete=1", "del_confirm"); echo "<br/>"; } if (file_exists($_SESSION['web_name'] . "/module_chart/$id_sub/$data_col[picture]")) { echo "<a href='index.php?mod=personel_profile&path=director_chart&id_sub=$id_sub&id_profile=$data_col[id_profile]'>"; echo "<img src='" . $_SESSION['web_name'] . "/module_chart/$id_sub/$data_col[picture]' border='0'>"; // show image echo "</a>"; // profile echo "<br/>"; echo "<br/><b>"; echo $data_col["name"]; echo "</b><br/><b><font color='ff9900'>"; echo $data_col["position"]; echo "</font></b><br/>"; if($data_col[telephone]!=""){ echo "<b>โทรศัพท์ :</b> $data_col[telephone]"; echo "<br/>"; } } else print_nopic(); echo "</td>"; } echo "</tr>"; echo "</table>"; if ($_SESSION['admin_web'] == "admin" || id_sub_permission($id_sub) == 1) { echo "<table align='center' width='98%'>"; echo "<tr>"; echo "<td align='right'>"; echo "<a href='index.php?mod=director_add&path=director_chart&id_sub=$id_sub&id_chart=" . $struct_table['id_chart'] . "'>"; print_arr_add(); echo "เพิ่มข้อมูลในแถวนี้"; echo "</a> "; $sql_num = "SELECT count(*) FROM cms_director_chart WHERE id_sub='$id_sub'"; $re_num = mysql_query($sql_num); $data_num1 = mysql_fetch_array($re_num); // UP if ($count_xx > 1) { echo "<a href='index.php?mod=director_chart&path=director_chart&id_sub=$id_sub&id_type=$id_type&id_1=$struct_table[id_chart]&id_order1st=1'>"; echo "<img src='coremain/images/up.gif' border=0></a>"; echo " "; } else { echo " "; } // DOWN if ($count_xx < $data_num1[0]) { echo "<a href='index.php?mod=director_chart&path=director_chart&id_sub=$id_sub&id_type=$id_type&id_1=$struct_table[id_chart]&id_order1st=2'>"; echo "<img src='coremain/images/down.gif' border=0></a>"; } else { echo " "; } // DEL echo " <a href='index.php?mod=director_chart&path=director_chart&id_sub=$id_sub&id_type=$id_type&id_del_chart=$struct_table[id_chart]'><img src='coremain/images/del1.gif' border='0' title='ลบข้อมูล' onclick='return goURLdel();'></a>"; $count_xx++; echo "<td>"; echo "</tr>"; echo "</table>"; echo "<hr/>"; } } // ส่วนปุ่มกดเพื่อเพิ่มแถว if ($_SESSION['admin_web'] == "admin" || id_sub_permission($id_sub) == 1) { echo "<table width='98%'>"; echo "<tr>"; echo "<td align='center'>"; echo "<a href='index.php?mod=director_chart&path=director_chart&id_sub=$id_sub&add_row=1'>"; print_arr_add(); echo "เพิ่มแถวข้อมูล"; echo "</a>"; echo "</td>"; echo "</td>"; echo "</table>"; } fieldset_down(); ?> <script language="javascript"> function del_confirm(){ return confirm("ต้องการลบบุคคลนี้ใช่หรือไม่"); } function del_row(){ return confirm("ต้องการลบแถวนี้ใช่หรือไม่ ประวัติทุกคนในแถวนี้จะถูกดำเนินการลบไปด้วย"); } </script>