LAPTOP-V9RRD1TL\Michelle's Computer f8f8fcaf96 first commit
2025-07-21 21:38:17 +08:00

65 lines
2.8 KiB
PHP

<?php
$must_login = true ;
$require_path = '../../../' ;
$require_sub = '../../' ;
require( $require_sub.'header.php' ) ;
if ( $boolean_login ){
$status = '201' ;
$search_query = '' ;
$search_query .= " AND formnomination_id = '".$array['formnomination_id']."'" ;
$query = "SELECT formnomination_id, nominee_staff_id, comment, status, created_at, updated_at FROM formnomination
WHERE deleted_at IS NULL " . $search_query ;
$mysqli_query = $mysqli->query( $query . " LIMIT 1" ) ;
if ( $mysqli_query->num_rows > 0 ){
$status = '200' ;
$list = [] ;
$row = $mysqli_query->fetch_assoc() ;
$row['comment'] = dataFilter( $row['comment'] ) ;
// select all staff
$nominee_to_name = '' ;
$select_related_staff = $mysqli->query( "SELECT a.staff_id, a.staff_name FROM staff a
WHERE a.deleted_at IS NULL AND a.staff_id = '".$row['nominee_staff_id']."' LIMIT 1" ) ;
if ( $select_related_staff->num_rows > 0 ){
$row_related_staff = $select_related_staff->fetch_assoc() ;
$nominee_to_name = $row_related_staff['staff_name'] ;
}
$row['nominee_to_name'] = $nominee_to_name ;
// select all answer
$question_list = [] ;
$form_list = [] ;
$select_answer = $mysqli->query( "SELECT a.question_type, a.checkbox, a.chosen, a.remark, c.title, c.content FROM formnomination_answer a
LEFT JOIN formnomination_question b ON ( a.question_id = b.question_id )
LEFT JOIN formnomination_question_translation c ON ( b.question_id = c.question_id )
WHERE a.formnomination_id = '".$row['formnomination_id']."' AND c.lang = '".$array['lang']."' ORDER BY b.sortable" ) ;
if ( $select_answer->num_rows > 0 ){
while ( $row_answer = $select_answer->fetch_assoc() ){
if ( $row_answer['question_type'] == 'question' ){
$question_list[] = $row_answer ;
}
if ( $row_answer['question_type'] == 'form' ){
$form_list[] = $row_answer ;
}
}
}
$row['questions'] = $question_list ;
$row['forms'] = $form_list ;
$data = $row ;
}
}
require( $require_sub.'footer.php' ) ;
?>