first commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '312' ;
|
||||
|
||||
if ( $array['is_tick'] == 'yes' ){
|
||||
$status = '201' ;
|
||||
|
||||
$search_query = '' ;
|
||||
$search_query .= " AND handbook_id = '".$array['id']."'" ;
|
||||
|
||||
$query = "SELECT handbook_id FROM handbook
|
||||
WHERE deleted_at IS NULL AND ( ( receiver_type IN ( '0' ) ) OR ( receiver_type IN ( '1', '2' ) AND staff_id LIKE '%/".$staff_info['staff_id']."/%' ) ) " . $search_query ;
|
||||
$mysqli_query = $mysqli->query( $query ) ;
|
||||
|
||||
if ( $mysqli_query->num_rows > 0 ){
|
||||
$status = '200' ;
|
||||
|
||||
$mysqli->query( "INSERT INTO staff_handbook
|
||||
( handbook_id, staff_id ) VALUES
|
||||
( '".$array['id']."', '".$staff_info['staff_id']."' ) " ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '201' ;
|
||||
|
||||
$search_query = '' ;
|
||||
$search_query .= " AND a.handbook_id = '".$array['id']."'" ;
|
||||
|
||||
$query = "SELECT a.handbook_id, a.content, a.view_format, a.file, a.file_type, a.video_url, a.is_showagree, a.created_at, b.title FROM handbook a
|
||||
LEFT JOIN handbook_translation b ON ( a.handbook_id = b.handbook_id )
|
||||
WHERE a.deleted_at IS NULL AND b.lang = '".$array['lang']."' AND a.branch LIKE '%/".$array['branch_id']."/%' AND ( ( a.receiver_type IN ( '0' ) ) OR ( a.receiver_type IN ( '1', '2' ) AND a.staff_id LIKE '%/".$staff_info['staff_id']."/%' ) ) " . $search_query ;
|
||||
|
||||
$mysqli_query = $mysqli->query( $query ) ;
|
||||
|
||||
if ( $mysqli_query->num_rows > 0 ){
|
||||
|
||||
$status = '200' ;
|
||||
$row = $mysqli_query->fetch_assoc() ;
|
||||
|
||||
$file = '' ;
|
||||
if ( $row['file'] != '' ){
|
||||
if ( $row['file_type'] == 'pdf' ){
|
||||
$file = PATH.'uploads/Handbook/'.$row['file'] ;
|
||||
}else{
|
||||
$file = PATH.'uploads/Handbook/b/'.$row['file'] ;
|
||||
}
|
||||
}
|
||||
|
||||
// check if agree or not
|
||||
$is_agreed = 'no' ;
|
||||
$select_agree = $mysqli->query( "SELECT * FROM staff_handbook
|
||||
WHERE deleted_at IS NULL AND handbook_id = '".$array['id']."' AND staff_id = '".$staff_info['staff_id']."' LIMIT 1" ) ;
|
||||
if ( $select_agree->num_rows > 0 ){
|
||||
$is_agreed = 'yes' ;
|
||||
}
|
||||
|
||||
|
||||
$row['id'] = dataFilter( $row['handbook_id'] ) ;
|
||||
$row['title'] = dataFilter( $row['title'] ) ;
|
||||
$row['content'] = dataFilter( $row['content'] ) ;
|
||||
$row['file'] = $file ;
|
||||
$row['created_at'] = dataFilter( $row['created_at'] ) ;
|
||||
$row['is_agreed'] = $is_agreed ;
|
||||
|
||||
$data['list'] = $row ;
|
||||
}
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '201' ;
|
||||
|
||||
$search_query = '' ;
|
||||
if ( $array['category_id'] != '' ){
|
||||
$search_query .= " AND a.category_id = '".$array['category_id']."'" ;
|
||||
}
|
||||
if ( $array['search'] != '' ){
|
||||
$search_query .= " AND b.title LIKE '%".$array['search']."%'" ;
|
||||
}
|
||||
|
||||
$query = "SELECT a.handbook_id, a.created_at, b.title FROM handbook a
|
||||
LEFT JOIN handbook_translation b ON ( a.handbook_id = b.handbook_id )
|
||||
WHERE a.deleted_at IS NULL AND b.lang = '".$array['lang']."' AND a.branch LIKE '%/".$array['branch_id']."/%' AND ( ( a.receiver_type IN ( '0' ) ) OR ( a.receiver_type IN ( '1', '2' ) AND a.staff_id LIKE '%/".$staff_info['staff_id']."/%' ) ) " . $search_query ;
|
||||
$mysqli_query = $mysqli->query( $query . " ORDER BY a.sortable ASC, a.created_at DESC LIMIT " . getLimit( $current ) ) ;
|
||||
|
||||
if ( $mysqli_query->num_rows > 0 ){
|
||||
|
||||
$status = '200' ;
|
||||
|
||||
$list = [] ;
|
||||
while ( $row = $mysqli_query->fetch_assoc() ){
|
||||
$row['id'] = dataFilter( $row['handbook_id'] ) ;
|
||||
$row['title'] = dataFilter( $row['title'] ) ;
|
||||
$row['file'] = ( $row['file'] != '' ? PATH.'uploads/Handbook/b/'.$row['file'] : '' ) ;
|
||||
$row['created_at'] = resetDateFormat( $row['created_at'] ) ;
|
||||
$list[] = $row ;
|
||||
}
|
||||
|
||||
$data['list'] = $list ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '201' ;
|
||||
|
||||
$search_query = '' ;
|
||||
if ( $array['search'] != '' ){
|
||||
$search_query .= " AND b.title LIKE '%".$array['search']."%'" ;
|
||||
}
|
||||
|
||||
$query = "SELECT a.category_id, a.file, a.created_at, b.title FROM handbook_category a
|
||||
LEFT JOIN handbook_category_translation b ON ( a.category_id = b.category_id )
|
||||
WHERE a.deleted_at IS NULL AND b.lang = '".$array['lang']."' AND a.category_type = 'main' " . $search_query ;
|
||||
$mysqli_query = $mysqli->query( $query . " ORDER BY a.sortable ASC, a.created_at DESC LIMIT " . getLimit( $current ) ) ;
|
||||
|
||||
if ( $mysqli_query->num_rows > 0 ){
|
||||
|
||||
$status = '200' ;
|
||||
|
||||
$list = [] ;
|
||||
while ( $row = $mysqli_query->fetch_assoc() ){
|
||||
$row['id'] = dataFilter( $row['category_id'] ) ;
|
||||
$row['title'] = dataFilter( $row['title'] ) ;
|
||||
$row['file'] = ( $row['file'] != '' ? PATH.'uploads/HandbookCategory/b/'.$row['file'] : '' ) ;
|
||||
$list[] = $row ;
|
||||
}
|
||||
|
||||
$data['list'] = $list ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
$must_login = true ;
|
||||
$require_path = '../../../' ;
|
||||
$require_sub = '../../' ;
|
||||
require( $require_sub.'header.php' ) ;
|
||||
|
||||
if ( $boolean_login ){
|
||||
$status = '201' ;
|
||||
|
||||
$search_query = '' ;
|
||||
if ( $array['search'] != '' ){
|
||||
$search_query .= " AND b.title LIKE '%".$array['search']."%'" ;
|
||||
}
|
||||
|
||||
$query = "SELECT a.category_id, a.file, a.created_at, b.title FROM handbook_category a
|
||||
LEFT JOIN handbook_category_translation b ON ( a.category_id = b.category_id )
|
||||
WHERE a.deleted_at IS NULL AND b.lang = '".$array['lang']."' AND a.category_type = 'sub' AND a.category_parent = '".$array['category_id']."' " . $search_query ;
|
||||
$mysqli_query = $mysqli->query( $query . " ORDER BY a.sortable ASC, a.created_at DESC LIMIT " . getLimit( $current ) ) ;
|
||||
|
||||
if ( $mysqli_query->num_rows > 0 ){
|
||||
|
||||
$status = '200' ;
|
||||
|
||||
$list = [] ;
|
||||
while ( $row = $mysqli_query->fetch_assoc() ){
|
||||
$row['id'] = dataFilter( $row['category_id'] ) ;
|
||||
$row['title'] = dataFilter( $row['title'] ) ;
|
||||
$row['file'] = ( $row['file'] != '' ? PATH.'uploads/HandbookCategory/b/'.$row['file'] : '' ) ;
|
||||
$list[] = $row ;
|
||||
}
|
||||
|
||||
$data['list'] = $list ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
require( $require_sub.'footer.php' ) ;
|
||||
?>
|
||||
Reference in New Issue
Block a user