query( "SELECT * FROM branch WHERE deleted_at IS NULL " . $user_branch_permission_sql_123 ) ; if ( $get_branch->num_rows > 0 ){ while ( $row_branch = $get_branch->fetch_assoc() ){ $branch_all[$row_branch['branch_id']] = $row_branch['branch_name'] ; } } // check permission if ( !permissionCheck($row_user, 'association-list-view') ){ header('Location: index.php') ; exit ; } // mode type | all list | new | edit switch($page_mode){ // edit association case 'new' : case 'edit' : // check query exsits $submit_type = 'new' ; $mysqli_page = $mysqli->query("SELECT * FROM association WHERE association_id = '".$association_id."' LIMIT 1"); if ($mysqli_page->num_rows > 0){ // keep query value in array $row_page = $mysqli_page->fetch_array(MYSQLI_ASSOC) ; $submit_type = 'edit' ; } // update database if ( isset($type) && ( $type == 'new' || $type == 'edit' ) && $_POST['hide'] == 1 ){ // keep value in variable $page_title = escapeString($_POST['title']) ; $page_title = ($page_title != '' ? $page_title : 'No Title') ; if ( $association_id == '' ){ $mysqli->query( "INSERT INTO association ( created_at ) VALUES ( '".TODAYDATE."' )" ) ; $association_id = $mysqli->insert_id ; } // resize image // set image in variable $image = $_FILES["image"]["name"] ; $image_query = '' ; $remove_photo = $_POST['remove_photo'] ; if ($remove_photo == 1){ $image = '' ; $image_query = "file = ''," ; } if ( $image != '' ){ $get_image = pathinfo($image) ; $create_image = reCreateImage('Association', $association_id, $association_id, '', $image, $_FILES["image"]["type"], $_FILES['image']['tmp_name']) ; // Image uploads when exists if ($create_image['result'] && is_array($create_image['crop']) && count($create_image['result']) > 0){ $resizeObj = new resize($create_image['original']) ; // Initialise load image foreach($create_image['crop'] as $value){ // Resize image (options: exact, portrait, landscape, auto, crop) $resizeObj -> resizeImage($value['width'], $value['height'], $value['type']) ; $resizeObj -> saveImage($value['source'], 70) ; // Save image } $get_image = pathinfo($create_image['image']) ; $image_query = "file = '".$create_image['image']."'," ; } } $array_branch = [] ; foreach ( $_POST['branch'] as $k_branch => $v_branch ){ $array_branch[] = escapeString( $v_branch ) ; } // update database $mysqli->query( "UPDATE association SET ".$image_query." branch = '/".implode('/', $array_branch)."/', category_id = '".escapeString($_POST['category_id'])."', association_type = '".escapeString($_POST['association_type'])."', date_start = '".escapeString($_POST['date_start'])."', date_end = '".escapeString($_POST['date_end'])."', status = '".escapeString($_POST['status'])."' WHERE association_id = '".$association_id."'" ) ; $title_en = '' ; foreach ( $LANGS as $klang => $vlang ){ $title = escapeString( $_POST['title_'.$klang] ) ; $content = escapeString( $_POST['content_'.$klang] ) ; if ( $klang == 'en' ){ $title_en = $title ; } checkLangUpdate( 'association_translation', 'association_id', $association_id, $klang, [ 'title' => [ 'type' => 'input', 'value' => $title ], 'content' => [ 'type' => 'input', 'value' => $content ] ] ) ; } if ( $submit_type == 'new' ){ pushToBranchUser( $array_branch, [], 'association', $association_id, 'New Association', ( $title_en != '' ? $title_en : 'New association has been submitted.' ) ) ; } // refresh page header("Location:app-association.php?page_mode=edit&association_id=".$association_id."&success=1") ; $_SESSION['system_result'] = 'success-updated' ; exit ; } if ( ( $page_mode == 'new' && !permissionCheck($row_user, 'association-list-new') ) || ( $page_mode == 'edit' && !permissionCheck($row_user, 'association-list-edit') ) ){ header('Location: app-association.php') ; exit ; } // start header here include 'requires/page_header.php'; include 'requires/page_top.php'; ?>
'.$lang['Thank you details has been updated'].'
' ; break ; } unset($_SESSION['system_result']) ; } ?>
Category
[ 'type' => 'input', 'title' => $lang['title'] ], 'content' => [ 'type' => 'textarea', 'title' => $lang['Content'] ] ]) ; ?>
Association Type
Date Start
Date End
/>
Status
query("SELECT a.association_id, b.title, b.content FROM association a LEFT JOIN association_translation b ON ( a.association_id = b.association_id ) WHERE a.association_id = '".$association_id."' LIMIT 1"); if ( $mysqli_page->num_rows == 0 ){ exit ; } $row_page = $mysqli_page->fetch_assoc() ; // update database if ( $_POST['hide'] == 1 ){ $update_status = escapeString( $_POST['update_status'] ) ; foreach ( $_POST['multiple_status'] as $kk => $vv ){ $mysqli->query( "UPDATE staff_association SET status = '".$update_status."' WHERE view_id = '".$kk."'" ) ; if ( $update_status == 'rejected' ){ pushToUserCron( 'staff_association', $kk, $vv, 'Association', 'Association has been reject.' ) ; }else{ pushToUserCron( 'staff_association', $kk, $vv, 'Association', 'Association has been update.' ) ; } } header( "Refresh: 0;" ) ; exit ; } //query $search_query = '' ; $search_name = escapeString($_GET['search_name']) ; $search_idno = escapeString($_GET['search_idno']) ; $search_rated = escapeString($_GET['search_rated']) ; $search_date = ( $_GET['search_date']!= '' ? date('Y-m-d', strtotime($_GET['search_date'])) : '' ) ; $search_type = $_GET['search_type'] ; $export_excel = $_GET['export-excel']; $search_query = ''; if( $search_name != ''){ $search_query .= " AND b.staff_name LIKE '%".$search_name."%'" ; } if( $search_idno != ''){ $search_query .= " AND b.staff_idno LIKE '%".$search_idno."%'" ; } if( $search_rated != ''){ $search_query .= " AND a.rated = '".$search_rated."'" ; } if ( $search_date != '' ){ $search_query .= " AND a.created_at >= '".$search_date."' " ; } // search query if ($search != ''){ $search_query .= " AND ( title LIKE '%".$search."%' )" ; } if( $search_type != ''){ $search_query .= " AND a.status = '".$search_type."' " ; } // related staff // 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 // set search url $search_url = '&page_mode='.$page_mode.'&association_id='.$association_id.'search='.$search.'&search_name='.$search_name.'&search_rated='.$search_rated.'&search_date='.$search_date.'&search_idno='.$search_idno; // page query $mysqli_query = "SELECT a.view_id, a.association_so, a.association_id, a.rated, a.comment, a.status, a.created_at, a.updated_at, b.staff_id, b.staff_idno, b.staff_name, b.staff_image, c.title FROM staff_association a LEFT JOIN staff b ON ( a.staff_id = b.staff_id ) LEFT JOIN association_translation c ON ( a.association_id = c.association_id ) WHERE a.deleted_at IS NULL AND c.lang = 'en' AND a.association_id = '".$association_id."' " . $search_query ; $mysqli_list = $mysqli->query( $mysqli_query." ORDER BY a.view_id DESC LIMIT $start_from, " . LIMIT ) ; // load pagination $page_pagination = nextPrevious($product_page, LIMIT, $search_url, $mysqli_query) ; if ( $export_excel == 'export_eae' ){ $page_export_file_name = 'Association Report-'; $array_header_excel = array( 'No.', 'SO Number', 'ID', 'Name', 'Rated', 'Comment', 'Association', 'Status', 'Created At', 'Updated At' ) ; $mysqli_export = $mysqli->query( $mysqli_query ) ; if ( $mysqli_export->num_rows > 0 ){ $count_mysqli_export_page = 0; while ( $mysqli_export_page = $mysqli_export->fetch_assoc() ){ $count_mysqli_export_page ++; $array_body_excel[] = array( $count_mysqli_export_page, $mysqli_export_page['association_so'], $mysqli_export_page['staff_idno'], $mysqli_export_page['staff_name'], $mysqli_export_page['comment'], $mysqli_export_page['rated'], dataFilter($mysqli_export_page['title']), $mysqli_export_page['status'], date('Y-m-d', strtotime($mysqli_export_page['created_at'])), date('Y-m-d', strtotime($mysqli_export_page['updated_at'])) ) ; } $count_mysqli_export_page = 0; } include 'export_excel_default.php'; } // start header here include 'requires/page_header.php'; include 'requires/page_top.php'; ?>
query( $mysqli_query." ORDER BY a.view_id DESC LIMIT $start_from, " . LIMIT ) ; // load pagination $page_pagination = nextPrevious($product_page, LIMIT, $search_url, $mysqli_query) ; if ( $export_excel == 'export_eae' ){ $page_export_file_name = 'Association List-'; $array_header_excel = array( 'No.', 'SO Number', 'ID', 'Name', 'Association', 'Status', 'Created At', 'Updated At' ) ; $mysqli_export = $mysqli->query( $mysqli_query ) ; if ( $mysqli_export->num_rows > 0 ){ $count_mysqli_export_page = 0; while ( $mysqli_export_page = $mysqli_export->fetch_assoc() ){ $count_mysqli_export_page ++; $array_body_excel[] = array( $count_mysqli_export_page, $mysqli_export_page['association_so'], $mysqli_export_page['staff_idno'], $mysqli_export_page['staff_name'], dataFilter($mysqli_export_page['title']), $mysqli_export_page['status'], date('Y-m-d', strtotime($mysqli_export_page['created_at'])), date('Y-m-d', strtotime($mysqli_export_page['updated_at'])) ) ; } $count_mysqli_export_page = 0; } include 'export_excel_default.php'; } // start header here include 'requires/page_header.php'; include 'requires/page_top.php'; ?>
Join Staff
num_rows > 0 ){ while ( $row_list = $mysqli_list->fetch_array(MYSQLI_ASSOC) ){ $staff_image = ( $row_list['staff_image'] != '' ? PATH.'uploads/Staff/'.dataFilter($row_list['staff_image']) : '' ) ; echo ' '; } }else{ echo ''; } ?>
So Number Profile Staff ID Name Association Status Created At Updated At
'.dataFilter($row_list['association_so']).' '.( $staff_image != '' ? '' : '' ).' '.dataFilter($row_list['staff_idno']).' '.dataFilter($row_list['staff_name']).' '.dataFilter($row_list['title']).' '.resetStatus($row_list['status']).' '.resetDateFormat($row_list['created_at']).' '.resetDateFormat($row_list['updated_at']).'
No data.
query( "SELECT association_id, status FROM staff_association WHERE deleted_at IS NULL AND association_so = '".$qrcode."' LIMIT 1" ) ; if ( $select->num_rows > 0 ){ $error = 'Invalid status' ; $row = $select->fetch_assoc() ; if ( $row['status'] == 'approved' ){ $error = 'Success' ; $mysqli->query( "UPDATE staff_association SET status = 'confirmed' WHERE association_id = '".$row['association_id']."'" ) ; } } } $_SESSION['system_result'] = $error ; header( "Refresh: 0;" ) ; exit ; } // 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 // set search url $search_url = 'search='.$search ; // page query $mysqli_query = "SELECT a.association_so, a.created_at, a.updated_at, c.staff_idno, c.staff_name FROM staff_association a LEFT JOIN association b ON ( a.association_id = b.association_id ) LEFT JOIN staff c ON ( a.staff_id = c.staff_id ) WHERE a.deleted_at IS NULL AND a.status = 'confirmed' " . $search_query ; $mysqli_page = $mysqli->query( $mysqli_query." ORDER BY a.view_id DESC LIMIT $start_from, " . LIMIT ) ; // load pagination $page_pagination = nextPrevious($product_page, LIMIT, $search_url, $mysqli_query) ; // start header here include 'requires/page_header.php' ; include 'requires/page_top.php' ; ?>
Scan Qrde
num_rows > 0 ){ while ( $row_page = $mysqli_page->fetch_assoc() ){ echo ' '; } } ?>
So Number Staff ID Staff Name Created Date Updated Date
'.dataFilter($row_page['association_so']).' '.dataFilter($row_page['staff_idno']).' '.dataFilter($row_page['staff_name']).' '.resetDateFormat($row_page['created_at']).' '.resetDateFormat($row_page['updated_at']).'
query( $mysqli_query." ORDER BY a.association_id DESC LIMIT $start_from, " . LIMIT ) ; // load pagination $page_pagination = nextPrevious($product_page, LIMIT, $search_url, $mysqli_query) ; // start header here include 'requires/page_header.php' ; include 'requires/page_top.php' ; ?>
search
num_rows > 0){ while ( $row_page = $mysqli_page->fetch_assoc() ){ $staff_association = $mysqli->query( "SELECT view_id FROM staff_association WHERE deleted_at IS NULL AND association_id = '".$row_page['association_id']."' AND status IN ( 'pending' )" ) ; $total_association = $staff_association->num_rows ; echo ' '; } }else{ echo ' ' ; } ?>
Period Created Date
'; if ( permissionCheck($row_user, 'association-list-edit') ){ echo ' |'; } echo ' ( '.$total_association.' ) '.dataFilter($row_page['title']).' '.resetDateFormat($row_page['date_start']).' ~ '.resetDateFormat($row_page['date_end']).' '.resetStatus($row_page['status']).' '.resetDateFormat($row_page['created_at']).'
'.$lang['no_data'].'