= 0 ){
$mysqli->query("INSERT INTO system_orgChart (chart_parent, created_at, updated_at, chartTitle_id) VALUES ('".$add."', '".$current_date."', '".$current_date."', '".$page."')");
}
if ( isset($_POST['remove']) && $remove > 0 ){
$mysqli->query("UPDATE system_orgChart set chart_trash = '1' where chart_id = '".$remove."'");
}
}
// udpate time
if ($_POST['hide'] == "1" && $_POST['action'] == "edit"){
$name = ($_POST['name']);
$start = ($_POST['start']);
$end = ($_POST['end']);
$trash = ($_POST['trash']);
$new_name = ($_POST['new_name']);
$new_start = ($_POST['new_start']);
$new_end = ($_POST['new_end']);
$new_trash = ($_POST['new_trash']);
$temp = [];
foreach ($name as $k => $v) {
$temp[0][] = "When ".$k." Then '".$name[$k]."'";
$temp[1][] = "When ".$k." Then '".$start[$k]."'";
$temp[2][] = "When ".$k." Then '".$end[$k]."'";
$temp[3][] = "When ".$k." Then '".(!empty($trash[$k]) ? "1" : "0")."'";
$temp[4][] = $k;
}
$mysqli->query("UPDATE system_chartTime SET
time_name = CASE time_id ".implode(",", $temp[0]). " END,
time_start = CASE time_id ".implode(",", $temp[1]). " END,
time_end = CASE time_id ".implode(",", $temp[2]). " END,
time_trash = CASE time_id ".implode(",", $temp[3]). " END
WHERE time_id IN (".implode(",", $temp[4]).") ");
$temp = [];
foreach ($new_name as $k => $v) {
$temp[] = '( "'.$new_name[$k].'", "'.$new_start[$k].'", "'.$new_end[$k].'", "'.$page.'" )';
}
$mysqli->query("INSERT INTO system_chartTime (time_name, time_start, time_end, time_chart) VALUES ".implode(",", $temp));
}
// all data
$data[] = ["Name",'Parent'];
$chart = [];
// array for seaching query
$staff_list = [];
//parent_list
$parent = [];
// default parameter
$title_name = '';
$group_title = [];
$query = $mysqli->query("SELECT a.chart_id, a.staff_id, a.chart_parent, b.group_id, c.chart_title, c.chart_group, a.type, a.remark,c.group_title
from system_orgChart a
LEFT JOIN (SELECT * FROM system_formula WHERE formula_group = '".$type."') b on (a.chart_id = b.chart_id)
LEFT JOIN system_chartTitle c on ( a.chartTitle_id = c.chartTitle_id )
where a.chartTitle_id = '".$page."' AND a.chart_trash = '0' ");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$chart[$row['chart_parent']][] = [
"staff_id" => $row['staff_id'],
"parent" => $row['chart_parent'],
"id" => $row['chart_id'],
"group_id" => $row['group_id'],
"type" => $row['type'],
"remark" => $row['remark'],
];
$group_title = json_decode( $row['group_title'] , true );
$title_name = $row['chart_title'];
$staff_list[$row['staff_id']] = $row['staff_id'];
$parent[] = $row['chart_parent'];
}
$query = $mysqli->query("SELECT staff_id, staff_idno, staff_image, staff_name from staff where (staff_date_resigned IS NULL || staff_date_resigned = '0000-00-00') AND deleted_at IS NULL ");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$staff_list[$row['staff_id']] = [
"staff_idno" => $row['staff_idno'],
"image" => $row['staff_image'],
"name" => $row['staff_name'],
];
}
}
//get working hours
$working_hours = [];
$query = $mysqli->query("SELECT group_id, group_name FROM setting_working_group WHERE deleted_at IS NULL ORDER BY group_id ");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$working_hours[$row['group_id']] = [
"name" => $row['group_name'],
];
}
}
}else{
$query = $mysqli->query("SELECT chart_title FROM system_chartTitle
where chartTitle_id = '".$page."' AND chart_trash = '0'");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$title_name = $row['chart_title'];
}
}
}
if ( arrayCheck($chart) ){
foreach ($chart as $k => $v) {
foreach ($v as $k1 => $v1) {
$image = '';
$content = '';
foreach ($staff_list as $k2 => $v2) {
$selected = "";
if ($v1['staff_id'] > 0 ){
if ($v1['staff_id'] == $k2){
$selected = "selected";
$image = $v2['image'];
}
}
$content .= '';
}
$content_working = '';
foreach ($working_hours as $k2 => $v2) {
$selected = "";
if ($v1['group_id'] > 0 ){
if ($v1['group_id'] == $k2){
$selected = "selected";
}
}
$content_working .= '';
}
$data[] = [
[
"v" => "child_node_".$v1['id'],
"f" => '
'.(in_array($v1['id'], $parent) ? '' : '
').'
',
],
( $k == 0 ? "" : "child_node_".$v1['parent'] ),
];
}
}
}else{
$data[] = [
[
"v" => "child_node_".$v1['id'],
"f" => '
New
',
],
( $k == 0 ? "" : "child_node_".$v1['parent'] ),
];
}
// start header here
include 'requires/page_header.php';
include 'requires/page_top.php';
?>
$v) {
$temp[] = " ('".explode("-", $k)[0]."', '".explode("-", $k)[1]."', '".date("Y-m-d", strtotime($v))."', '".$current_date."', '".$_SESSION['system_id']."') ";
$old_chart[] = explode("-", $k)[0];
}
// start commits
$error = 0 ;
if (!$mysqli->query("UPDATE system_record_chart SET record_trash = '1' where chart_id IN (".implode(",", $old_chart).")") ){
$error ++;
}
if (!$mysqli->query("UPDATE system_chartTitle SET chart_group = '".$type."' where chartTitle_id = '".$page."'")){
$error ++;
}
if (!$mysqli->query("INSERT INTO system_record_chart (chart_id, group_id, `date`, created_at, user_id) VALUES ".implode(",", $temp))){
$error ++;
}
if( $error == 0 ) {
// commit query
$mysqli->commit() ;
$status = '200' ;
$message = 'Process Successful.' ;
}else{
$data = $error;
$status = '216' ;
$message = 'Error Occur' ;
$mysqli->rollback() ;
}
if ( $status == '200' ){
$_SESSION['result'] = "success";
}else{
$_SESSION['result'] = "failed";
}
}
// all data
$data[] = ["Name",'Parent'];
$chart = [];
// array for seaching query
$staff_list = [];
//parent_list
$parent = [];
// default parameter
$title_name = '';
$chart_group = '';
$group_title = [];
$query = $mysqli->query("SELECT a.chart_id, a.staff_id, a.chart_parent, b.group_id, c.chart_title, c.chart_group, d.date, a.type, a.remark, c.group_title, e.date as last_Record
from system_orgChart a
LEFT JOIN (SELECT * FROM system_formula WHERE formula_group = '".$type."') b on (a.chart_id = b.chart_id)
LEFT JOIN system_chartTitle c on ( a.chartTitle_id = c.chartTitle_id )
LEFT JOIN (SELECT * FROM system_record_chart WHERE record_trash = '0') d on ( a.chart_id = d.chart_id)
LEFT JOIN (SELECT * FROM system_record_chart WHERE record_trash = '1') e on ( a.chart_id = e.chart_id)
where a.chartTitle_id = '".$page."' AND a.chart_trash = '0'");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$chart[$row['chart_parent']][] = [
"staff_id" => $row['staff_id'],
"parent" => $row['chart_parent'],
"id" => $row['chart_id'],
"group_id" => $row['group_id'],
"date" => $row['date'],
"last_modified" => $row['last_Record'],
"type" => $row['type'],
"remark" => $row['remark'],
];
$group_title = json_decode( $row['group_title'], true );
$chart_group = $row['chart_group'];
$staff_list[$row['staff_id']] = $row['staff_id'];
$title_name = $row['chart_title'];
}
$query = $mysqli->query("SELECT staff_id, staff_idno, staff_image, staff_name from staff where (staff_date_resigned IS NULL || staff_date_resigned = '0000-00-00') AND deleted_at IS NULL");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$staff_list[$row['staff_id']] = [
"staff_idno" => $row['staff_idno'],
"image" => $row['staff_image'],
"name" => $row['staff_name'],
];
}
}
//get working hours
$working_hours = [];
$query = $mysqli->query("SELECT group_id, group_name FROM setting_working_group WHERE deleted_at IS NULL ORDER BY group_id ");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$working_hours[$row['group_id']] = [
"name" => $row['group_name'],
];
}
}
}else{
$query = $mysqli->query("SELECT chart_title FROM system_chartTitle
where chartTitle_id = '".$page."' AND chart_trash = '0'");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$title_name = $row['chart_title'];
}
}
}
if ( arrayCheck($chart) ){
foreach ($chart as $k => $v) {
foreach ($v as $k1 => $v1) {
$data[] = [
[
"v" => "child_node_".$v1['id'],
"f" => '
 ? )
'.dataFilterDash($staff_list[$v1['staff_id']]['staff_idno']).'
'.dataFilterDash($working_hours[$v1['group_id']]['name']).'
'.( $v1['type'] == "staff" || empty($v1['type']) ? '
' : '').'
'.( !empty($v1['last_modified']) ? '
Last Modified: '.date("Y-m-d", strtotime($v1['last_modified']))."
" : '').'
',
],
( $k == 0 ? "" : "child_node_".$v1['parent'] ),
];
}
}
}else{
$data[] = [
[
"v" => "child_node_".$v1['id'],
"f" => '
No Data
',
],
( $k == 0 ? "" : "child_node_".$v1['parent'] ),
];
}
// start header here
include 'requires/page_header.php';
include 'requires/page_top.php';
?>
'.$lang['Thank you details has been updated'].'
';
break;
case 'failed':
echo '
'.$lang['Sorry something error'].'
';
break;
default:
# code...
break;
}
unset( $_SESSION['result'] );
}
?>
$v) {
// $temp[] = " ('".explode("-", $k)[0]."', '".explode("-", $k)[1]."', '".date("Y-m-d", strtotime($v))."', '".$current_date."', '".$_SESSION['system_id']."') ";
// $old_chart[] = explode("-", $k)[0];
// }
// start commits
$error = 0 ;
foreach ($day as $key => $value) {
$temp[0][] = "When formula_id = ".$key." Then '".$value."'";
$temp[1][] = $key;
}
if (!$mysqli->query("UPDATE system_formula SET chart_day = CASE ".implode(" ", $temp[0]). " END where formula_id IN (".implode(",", $temp[1]).")")){
$error ++;
}
if( $error == 0 ) {
// commit query
$mysqli->commit() ;
$status = '200' ;
$message = 'Process Successful.' ;
}else{
$data = $error;
$status = '216' ;
$message = 'Error Occur' ;
$mysqli->rollback() ;
}
if ( $status == '200' ){
$_SESSION['result'] = "success";
}else{
$_SESSION['result'] = "failed";
}
}
// all data
$data[] = ["Name",'Parent'];
$chart = [];
// array for seaching query
$staff_list = [];
//parent_list
$parent = [];
// default parameter
$title_name = '';
$chart_group = '';
$group_title = [];
$query = $mysqli->query("SELECT a.chart_id, a.staff_id, a.chart_parent, b.group_id, c.chart_title, c.chart_group, d.date, a.type, a.remark, c.group_title, e.date as last_Record , b.chart_day, b.formula_id
from system_orgChart a
LEFT JOIN (SELECT * FROM system_formula WHERE formula_group = '".$type."') b on (a.chart_id = b.chart_id)
LEFT JOIN system_chartTitle c on ( a.chartTitle_id = c.chartTitle_id )
LEFT JOIN (SELECT * FROM system_record_chart WHERE record_trash = '0') d on ( a.chart_id = d.chart_id)
LEFT JOIN (SELECT * FROM system_record_chart WHERE record_trash = '1') e on ( a.chart_id = e.chart_id)
where a.chartTitle_id = '".$page."' AND a.chart_trash = '0'");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$chart[$row['chart_parent']][] = [
"staff_id" => $row['staff_id'],
"parent" => $row['chart_parent'],
"id" => $row['chart_id'],
"group_id" => $row['group_id'],
"date" => $row['date'],
"last_modified" => $row['last_Record'],
"day" => $row['chart_day'],
"type" => $row['type'],
"remark" => $row['remark'],
"formula_id" => $row['formula_id'],
];
$group_title = json_decode( $row['group_title'], true );
$chart_group = $row['chart_group'];
$staff_list[$row['staff_id']] = $row['staff_id'];
$title_name = $row['chart_title'];
}
$query = $mysqli->query("SELECT staff_id, staff_idno, staff_image, staff_name from staff where (staff_date_resigned IS NULL || staff_date_resigned = '0000-00-00') AND deleted_at IS NULL");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$staff_list[$row['staff_id']] = [
"staff_idno" => $row['staff_idno'],
"image" => $row['staff_image'],
"name" => $row['staff_name'],
];
}
}
//get working hours
$working_hours = [];
$query = $mysqli->query("SELECT group_id, group_name FROM setting_working_group WHERE deleted_at IS NULL ORDER BY group_id ");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$working_hours[$row['group_id']] = [
"name" => $row['group_name'],
];
}
}
}else{
$query = $mysqli->query("SELECT chart_title FROM system_chartTitle
where chartTitle_id = '".$page."' AND chart_trash = '0'");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$title_name = $row['chart_title'];
}
}
}
$array_day = [
1 => "Monday",
2 => "Tuesday",
3 => "Wednesday",
4 => "Thursday",
5 => "Friday",
6 => "Saturday",
7 => "Sunday",
];
if ( arrayCheck($chart) ){
foreach ($chart as $k => $v) {
foreach ($v as $k1 => $v1) {
$day_option = '';
foreach ($array_day as $key => $value) {
$day_option .= "";
}
$data[] = [
[
"v" => "child_node_".$v1['id'],
"f" => '
 ? )
'.dataFilterDash($staff_list[$v1['staff_id']]['staff_idno']).'
'.dataFilterDash($working_hours[$v1['group_id']]['name']).'
'.( $v1['type'] == "staff" || empty($v1['type']) ? '
' : '').'
'.( !empty($v1['last_modified']) ? '
Last Modified: '.date("Y-m-d", strtotime($v1['last_modified']))."
" : '').'
',
],
( $k == 0 ? "" : "child_node_".$v1['parent'] ),
];
}
}
}else{
$data[] = [
[
"v" => "child_node_".$v1['id'],
"f" => '
No Data
',
],
( $k == 0 ? "" : "child_node_".$v1['parent'] ),
];
}
// start header here
include 'requires/page_header.php';
include 'requires/page_top.php';
?>
'.$lang['Thank you details has been updated'].'
';
break;
case 'failed':
echo '
'.$lang['Sorry something error'].'
';
break;
default:
# code...
break;
}
unset( $_SESSION['result'] );
}
?>
$v) {
// $temp[] = " ('".explode("-", $k)[0]."', '".explode("-", $k)[1]."', '".date("Y-m-d", strtotime($v))."', '".$current_date."', '".$_SESSION['system_id']."') ";
// $old_chart[] = explode("-", $k)[0];
// }
// start commits
$error = 0 ;
$mysqli->autocommit( false ) ;
$boolean = false;
foreach ($day as $key => $value) {
$temp[] = $key;
}
$query = $mysqli->query("SELECT * FROM system_chart_day WHERE chart_id IN (".implode(",", $temp).")");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC) ){
$exists[] = $row['chart_id'];
}
}
$temp = [];
foreach ($day as $key => $value) {
if ( in_array($key, $exists) ){
$temp[0][] = "When chart_id = ".$key." Then '".$value."'";
$temp[1][] = $key;
}else{
$temp[2][] = " ('".$key."', '".$value."', '".$_SESSION['system_id']."' ) ";
}
}
if ( arrayCheck($temp[0]) ){
if (!$mysqli->query("UPDATE system_chart_day SET chart_day = CASE ".implode(" ", $temp[0]). " END where chart_id IN (".implode(",", $temp[1]).")")){
$error ++;
}
}
if ( arrayCheck($temp[2]) ){
if (!$mysqli->query("INSERT INTO system_chart_day ( chart_id , chart_day, updated_by ) VALUES ".implode(",", $temp[2]). "")){
$error ++;
}
}
if( $error == 0 ) {
// commit query
$mysqli->commit() ;
$status = '200' ;
$message = 'Process Successful.' ;
}else{
$data = $error;
$status = '216' ;
$message = 'Error Occur' ;
$mysqli->rollback() ;
}
if ( $status == '200' ){
$_SESSION['result'] = "success";
}else{
$_SESSION['result'] = "failed";
}
}
// all data
$data[] = ["Name",'Parent'];
$chart = [];
// array for seaching query
$staff_list = [];
//parent_list
$parent = [];
// default parameter
$title_name = '';
$chart_group = '';
$group_title = [];
$query = $mysqli->query("SELECT b.*,a.*,c.*
from system_orgChart a
LEFT JOIN system_chart_day b ON ( b.chart_id = a.chart_id )
LEFT JOIN system_chartTitle c on ( a.chartTitle_id = c.chartTitle_id )
where a.chartTitle_id = '".$page."' AND a.chart_trash = '0'");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$chart[$row['chart_parent']][] = [
"staff_id" => $row['staff_id'],
"parent" => $row['chart_parent'],
"id" => $row['chart_id'],
"group_id" => $row['group_id'],
"date" => $row['date'],
"last_modified" => $row['last_autoupdate'],
"day" => $row['chart_day'],
"type" => $row['type'],
"remark" => $row['remark'],
"chart_id" => $row['chart_id'],
];
$group_title = json_decode( $row['group_title'], true );
$chart_group = $row['chart_group'];
$staff_list[$row['staff_id']] = $row['staff_id'];
$title_name = $row['chart_title'];
$type = ( !empty( $group_title[$row['chart_next_group']] ) ? $group_title[$row['chart_next_group']] : $row['chart_next_group'] );
}
$query = $mysqli->query("SELECT staff_id, staff_idno, staff_image, staff_name from staff where (staff_date_resigned IS NULL || staff_date_resigned = '0000-00-00') AND deleted_at IS NULL");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$staff_list[$row['staff_id']] = [
"staff_idno" => $row['staff_idno'],
"image" => $row['staff_image'],
"name" => $row['staff_name'],
];
}
}
//get working hours
$working_hours = [];
$query = $mysqli->query("SELECT group_id, group_name FROM setting_working_group WHERE deleted_at IS NULL ORDER BY group_id ");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$working_hours[$row['group_id']] = [
"name" => $row['group_name'],
];
}
}
}else{
$query = $mysqli->query("SELECT chart_title FROM system_chartTitle
where chartTitle_id = '".$page."' AND chart_trash = '0'");
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC)){
$title_name = $row['chart_title'];
}
}
}
$array_day = [
1 => "Monday",
2 => "Tuesday",
3 => "Wednesday",
4 => "Thursday",
5 => "Friday",
6 => "Saturday",
7 => "Sunday",
];
if ( arrayCheck($chart) ){
foreach ($chart as $k => $v) {
foreach ($v as $k1 => $v1) {
$day_option = '';
foreach ($array_day as $key => $value) {
$day_option .= "";
}
$data[] = [
[
"v" => "child_node_".$v1['id'],
"f" => '
 ? )
'.dataFilterDash($staff_list[$v1['staff_id']]['staff_idno']).'
'.( $v1['type'] == "staff" || empty($v1['type']) ? '
' : '').'
'.( !empty($v1['last_modified']) ? '
Last Modified: '.date("Y-m-d", strtotime($v1['last_modified']))."
" : '').'
',
],
( $k == 0 ? "" : "child_node_".$v1['parent'] ),
];
}
}
}else{
$data[] = [
[
"v" => "child_node_".$v1['id'],
"f" => '
No Data
',
],
( $k == 0 ? "" : "child_node_".$v1['parent'] ),
];
}
// start header here
include 'requires/page_header.php';
include 'requires/page_top.php';
?>
'.$lang['Thank you details has been updated'].'
';
break;
case 'failed':
echo '
'.$lang['Sorry something error'].'
';
break;
default:
# code...
break;
}
unset( $_SESSION['result'] );
}
?>
query("INSERT INTO system_chartTitle (chart_organization_group,created_at, updated_at) VALUES ('hr','".TODAYDATE."', '".TODAYDATE."')") ;
$page = $mysqli->insert_id ;
}
$query = "SELECT * FROM system_chartTitle where chartTitle_id = '".$page."' LIMIT 1";
$query = $mysqli->query($query);
if ( $query->num_rows > 0 ){
$row_page = $query->fetch_array(MYSQLI_ASSOC);
$row_page['group_title'] = json_decode($row_page['group_title'],true);
// update database
if (isset($type) && $type == 'edit' && $_POST['hide'] == 1){
$title = escapeString($_POST['title']);
// $post_parent_type = escapeString($_POST['post_parent_type']);
$group = $_POST['group'];
$post_parent_type = $_POST['post_parent_type'] ;
$post_parent_type = ( $post_parent_type != '' ? '('.implode( '),(', $post_parent_type).')' : '' ) ;
$array_title = [];
foreach ($group as $k => $v) {
$array_title[$k] = $v;
}
$success = 'failed' ;
// update database
if ($mysqli->query("UPDATE system_chartTitle SET
chart_title = '".$title."',
post_parent_type = '".$post_parent_type."',
group_title = '".json_encode($array_title)."',
updated_at = '".TODAYDATE."'
WHERE chartTitle_id = '".$page."'") ){
$success = 'success' ;
}
// refresh page
$redirect = 'org_chart.php?page_mode=edit_title&page='.$page.'&success='.$success;
// header("Location:") ;
header("Location:".$redirect) ;
exit ;
}
}
// start header here
include 'requires/page_header.php';
include 'requires/page_top.php';
?>
'.$lang['Thank you details has been updated'].'
';
break;
case 'failed':
echo '
'.$lang['Sorry something error'].'
';
break;
default:
# code...
break;
}
}
?>
query("SELECT a.chartTitle_id FROM system_orgChart a
LEFT JOIN system_chartTitle b ON ( a.chartTitle_id = b.chartTitle_id )
LEFT JOIN staff c ON ( a.staff_id = c.staff_id )
WHERE a.chart_trash = '0' AND b.chart_trash = '0' AND c.staff_idno = '".$search."' ");
$chart_list = [];
if ( $query_staff->num_rows > 0 ){
while ( $row_staff = $query_staff->fetch_array(MYSQLI_ASSOC) ){
$chart_list[] = $row_staff['chartTitle_id'];
}
$search_query .= " OR chartTitle_id IN (".implode(",", $chart_list).") )";
}else{
$search_query .= " )";
}
}
if ( $_POST['hide'] == "1" && $_POST['hide_status'] == "action" ){
switch ($_POST['page_action']) {
case 'update':
$id = $_POST['update'];
foreach ($id as $k => $v) {
$mysqli->query('UPDATE '.system_chartTitle.' set chart_next_group = "'.$v.'" where chartTitle_id = "'.$k.'"');
}
break;
case 'trash':
$id = $_POST['multiple_trash'];
foreach ($id as $k => $v) {
$mysqli->query('UPDATE '.system_chartTitle.' set chart_trash = "1" where chartTitle_id = "'.$k.'"');
}
break;
case 'sortable':
$id = $_POST['sortable'];
foreach ($id as $k => $v) {
$mysqli->query('UPDATE '.system_chartTitle.' set chart_order = "'.$v.'" where chartTitle_id = "'.$k.'"');
}
break;
default:
# code...
break;
}
}
$query = "SELECT * FROM system_chartTitle where chart_trash = '0' AND chart_organization_group='hr' AND chart_title != ''".$search_query;
// pagination
if (isset($page) && !empty($page)) { $product_page = $page ; } else { $product_page = 1 ; } // next and prev page (5 thing need to change)
$start_from = ($product_page - 1) * LIMIT ; // end next and prev page
// load pagination
$page_pagination = nextPrevious($product_page, LIMIT, $search_url, $query) ;
$query = $mysqli->query($query." order by chartTitle_id asc LIMIT $start_from, " . LIMIT);
if ( $query->num_rows > 0 ){
while ( $row = $query->fetch_array(MYSQLI_ASSOC) ){
$array_data[] = $row;
}
}
// print_R($array_data) ;
// exit ;
// start header here
include 'requires/page_header.php';
include 'requires/page_top.php';
?>