78 lines
3.0 KiB
PHP
78 lines
3.0 KiB
PHP
<?php
|
|
$must_login = true ;
|
|
$require_path = '../../../' ;
|
|
$require_sub = '../../' ;
|
|
require( $require_sub.'header.php' ) ;
|
|
|
|
if ( $boolean_login ){
|
|
$status = '200' ;
|
|
|
|
// select all
|
|
$staffs = [] ;
|
|
$question_list = [] ;
|
|
$form_list = [] ;
|
|
$all_tier = getAllTier( $array['lang'] ) ;
|
|
|
|
|
|
|
|
|
|
// select all staff
|
|
$select = $mysqli->query( "SELECT a.staff_id, a.staff_idno, a.staff_name, a.staff_shortname, a.staff_tier FROM staff a
|
|
WHERE a.deleted_at IS NULL AND a.branch_id = '".$array['branch_id']."' AND ( a.staff_date_resigned >= '".date("Y-m-d",time())."' OR a.staff_date_resigned = '0000-00-00' OR a.staff_date_resigned IS NULL ) " ) ;
|
|
|
|
if ( $select->num_rows > 0 ){
|
|
while ( $row = $select->fetch_assoc() ){
|
|
$get_staff_tier = $all_tier[$row['staff_tier']] ;
|
|
|
|
$staffs[] = [
|
|
'id' => $row['staff_id'],
|
|
'title' => $row['staff_shortname'] . ' ('.$row['staff_idno'].' / '.strtoupper( $get_staff_tier['title'] ).')',
|
|
'name' => $row['staff_name'],
|
|
'tier' => $get_staff_tier['level']
|
|
] ;
|
|
}
|
|
}
|
|
|
|
|
|
$where_question = '' ;
|
|
if ( $array['submission_type'] != '' ){
|
|
$where_question .= " AND a.nomination_type = '".$array['submission_type']."'" ;
|
|
}
|
|
|
|
// question & form
|
|
$select_question = $mysqli->query( "SELECT a.question_id, a.question_type, b.title, b.content, b.questions FROM formnomination_question a
|
|
LEFT JOIN formnomination_question_translation b ON ( a.question_id = b.question_id )
|
|
WHERE a.deleted_at IS NULL AND b.lang = '".$array['lang']."' ".$where_question." ORDER BY a.sortable" ) ;
|
|
if ( $select_question->num_rows > 0 ){
|
|
while ( $row_question = $select_question->fetch_assoc() ){
|
|
|
|
if ( $row_question['question_type'] == 'question' ){
|
|
$temp = $row_question ;
|
|
$temp['title'] = dataFilter( $temp['title'] ) ;
|
|
$temp['content'] = dataFilter( $temp['content'] ) ;
|
|
$temp['questions'] = ( $temp['questions'] != '' ? explode( '|', $temp['questions'] ) : [] ) ;
|
|
|
|
$question_list[] = $temp ;
|
|
}
|
|
if ( $row_question['question_type'] == 'form' ){
|
|
$temp = $row_question ;
|
|
$temp['title'] = dataFilter( $temp['title'] ) ;
|
|
$temp['content'] = dataFilter( $temp['content'] ) ;
|
|
$temp['questions'] = ( $temp['questions'] != '' ? explode( '|', $temp['questions'] ) : [] ) ;
|
|
|
|
$form_list[] = $temp ;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
$data = [
|
|
'staffs' => $staffs,
|
|
'questions' => $question_list,
|
|
'forms' => $form_list
|
|
] ;
|
|
}
|
|
|
|
require( $require_sub.'footer.php' ) ;
|
|
?>
|