233 lines
9.0 KiB
PHP
233 lines
9.0 KiB
PHP
<?php
|
|
include 'connect/cms-config.php' ;
|
|
include 'requires/function.php' ;
|
|
include 'requires/session.php' ;
|
|
|
|
// include the class
|
|
include 'requires/class_resize.php' ;
|
|
|
|
// keep parameter in value
|
|
$page = escapeString($_GET['page']) ;
|
|
$page_mode = escapeString($_GET['page_mode']) ;
|
|
$type = escapeString($_GET['type']) ;
|
|
$search = escapeString($_GET['search']) ;
|
|
|
|
// active menu bar
|
|
$active_main_menu = 'service' ;
|
|
$active_sub_menu = 'training' ;
|
|
$active_menu = 'training-list-list' ;
|
|
|
|
// check permission
|
|
if ( !permissionCheck($row_user, 'training-gallery') ){
|
|
header('Location: index.php') ;
|
|
exit ;
|
|
}
|
|
|
|
// update database
|
|
if ( $_POST['hide'] == 1 ){
|
|
$update_status = escapeString( $_POST['update_status'] ) ;
|
|
|
|
foreach ( $_POST['multiple_status'] as $kk => $vv ){
|
|
$mysqli->query( "UPDATE training_gallery SET
|
|
status = '".$update_status."'
|
|
WHERE gallery_id = '".$kk."'" ) ;
|
|
|
|
if ( $update_status == 'rejected' ){
|
|
pushToUserCron( 'training_gallery', $kk, $vv, 'Training Gallery', 'Training gallery has been reject.' ) ;
|
|
}else{
|
|
pushToUserCron( 'training_gallery', $kk, $vv, 'Training Gallery', 'Training gallery has been update.' ) ;
|
|
}
|
|
}
|
|
|
|
header( "Refresh: 0;" ) ;
|
|
exit ;
|
|
}
|
|
|
|
|
|
|
|
//query
|
|
$search_query = '' ;
|
|
$search_name = escapeString($_GET['search_name']) ;
|
|
$search_idno = escapeString($_GET['search_idno']) ;
|
|
$search_status = escapeString($_GET['search_status']) ;
|
|
$search_date = ( $_GET['search_date'] != '' ? date('Y-m-d', strtotime($_GET['search_date'])) : '' ) ;
|
|
|
|
$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_status != ''){
|
|
$search_query .= " AND a.status = '".$search_status."'" ;
|
|
}
|
|
if ( $search_date != '' ){
|
|
$search_query .= " AND a.created_at LIKE '%".$search_date."%'" ;
|
|
}
|
|
|
|
// 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 = 'search_name='.$search_name.'&search_idno='.$search_idno.'&search_status='.$search_status.'&search_date='.$search_date ;
|
|
|
|
// page query
|
|
$mysqli_query = "SELECT a.gallery_id, a.title, a.file, a.status, a.created_at, a.updated_at, b.staff_id, b.staff_idno, b.staff_name FROM training_gallery a
|
|
LEFT JOIN staff b ON ( a.staff_id = b.staff_id )
|
|
WHERE a.deleted_at IS NULL " . $search_query ;
|
|
$mysqli_list = $mysqli->query( $mysqli_query." ORDER BY a.gallery_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';
|
|
?>
|
|
|
|
<div class="warper container-fluid">
|
|
<div class='container' style="background-color: white; border-radius: 10px;">
|
|
<div class="page-header" style="margin: 30px 0px 0px 0px;padding: 0px;">
|
|
<div class="row">
|
|
<div class="pull-left col">
|
|
<h1>Training Gallery <small>View</small></h1>
|
|
</div>
|
|
<div class="pull-right col">
|
|
<?php if ( permissionCheck($row_user, 'training-gallery-category') ){ ?>
|
|
<a href="app-training-gallery-category.php?page_mode=all" class="btn" style="color:white;background-color: #5e5bd0;" target="_blank">Category Gallery</a>
|
|
<?php } ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="panel panel-default" id="basic-table-title">
|
|
<div class="panel-body">
|
|
<form method="get" class="form-horizontal">
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['Name'] ?></label>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="search_name" value="<?= $search_name ?>" class="form-control" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['ID No'] ?></label>
|
|
<div class="col-sm-9">
|
|
<input type="text" name="search_idno" value="<?= $search_idno ?>" class="form-control" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['date'] ?></label>
|
|
<div class="col-sm-9">
|
|
<input class="form-control" name="search_date" type="date" value="<?= $search_date ?>" placeholder="Date Resigned">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label"><?= $lang['status'] ?></label>
|
|
<div class="col-sm-9">
|
|
<select name="search_status" class="form-control">
|
|
<option value=""><?= $lang['All'] ?></option>
|
|
<option value="pending" <?= ($search_status == 'pending' ? 'selected' : '') ?>>Pending</option>
|
|
<option value="confirmed" <?= ($search_status == 'confirmed' ? 'selected' : '') ?>>Confirmed</option>
|
|
<option value="rejected" <?= ($search_status == 'rejected' ? 'selected' : '') ?>>Rejected</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<div class="col-sm-11">
|
|
<button type="submit" class="btn" style="color:white;background-color: #5e5bd0;float:right; margin-top: 5px;width: 100px;"><?= $lang['submit'] ?></button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<form method="post">
|
|
|
|
<div class="panel panel-default">
|
|
<div class="panel-body">
|
|
<select name="update_status" class="form-control selectpicker">
|
|
<option value="pending">Pending</option>
|
|
<option value="confirmed">Confirmed</option>
|
|
<option value="rejected">Rejected</option>
|
|
</select>
|
|
<input type="hidden" name="hide" value="1" />
|
|
<input type="hidden" name="hide_status" value="action" />
|
|
<input type="submit" class="btn" style="color:white; background-color:#5e5bd0; width:100px;" value="<?= $lang['submit'] ?>" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">Join Staff</div>
|
|
<div class="panel-body">
|
|
<table cellpadding="0" cellspacing="0" border="0" class="responsive table table-striped table-bordered" id="basic-datatable">
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th>Action</th>
|
|
<th>Image</th>
|
|
<th>Staff ID</th>
|
|
<th>Title</th>
|
|
<th>Status</th>
|
|
<th>Created At</th>
|
|
<th>Updated At</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
if ( $mysqli_list->num_rows > 0 ){
|
|
while ( $row_list = $mysqli_list->fetch_assoc() ){
|
|
$image = ( $row_list['file'] != '' ? PATH.'uploads/TrainingGallery/'.dataFilter($row_list['file']) : '' ) ;
|
|
|
|
echo '
|
|
<tr class="odd gradeX">
|
|
<td>' ;
|
|
if ( $row_list['status'] == 'pending' ){
|
|
echo '
|
|
<div class="checkbox multiple_trash">
|
|
<input type="checkbox" name="multiple_status['.$row_list['gallery_id'].']" class="trash_button" value="'.$row_list['staff_id'].'" />
|
|
<label for="checkbox1"></label>
|
|
</div>' ;
|
|
}
|
|
echo '
|
|
</td>
|
|
<td class="text-center">
|
|
<a title="Edit Current Gallery" href="app-training-gallery-view.php?page_mode=edit&gallery_id='.$row_list['gallery_id'].'" target="_blank"><i class="fa fa-edit"></i></a>
|
|
</td>
|
|
<td class="text-center">'.( $image != '' ? '<a href="'.$image.'" target="_blank"><img src="'.$image.'" style="width:80px;" /></a>' : '' ).'</td>
|
|
<td>'.dataFilter($row_list['staff_name']).' ( '.dataFilter($row_list['staff_idno']).' )</td>
|
|
<td>'.dataFilter($row_list['title']).'</td>
|
|
<td class="text-center">'.resetStatus($row_list['status']).'</td>
|
|
<td class="text-center">'.resetDateFormat($row_list['created_at']).'</td>
|
|
<td class="text-center">'.resetDateFormat($row_list['updated_at']).'</td>
|
|
</tr>';
|
|
}
|
|
}else{
|
|
echo
|
|
'<tr class="odd gradeX">
|
|
<td class="border_none">No data.</td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
<td class="border_none"></td>
|
|
</td>';
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
<?= $page_pagination['page_pagination'] ?>
|
|
</div>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
include 'requires/page_footer.php' ;
|