예제 #1
0
파일: search.php 프로젝트: hughnguy/php
//============================================================================================
// Session, configuration file, localization constructor
//============================================================================================
require '../includes/php/bootstrap.php';
$SESSION = new \Zend_Session_Namespace('internal', true);
if (!isset($SESSION->lang)) {
    $SESSION->lang = DEFAULT_LANGUAGE;
}
\Locale::setDefault($SESSION->lang);
$l10n->setLanguage($SESSION->lang);
$exploded_string = explode(" ", $_GET['term']);
//============================================================================================
// Model
//============================================================================================
$search = new \Ventus\Utilities\Search($dbo);
$verifiedResult = $search->searchStudents($exploded_string, "counselling");
//============================================================================================
// Send the results back to the view in the form of JSON
//============================================================================================
header('Content-Type: application/json; charset=utf-8');
if (empty($verifiedResult)) {
    $resultArray[] = array('value' => $l10n->__('studentSearch.noResults'), 'student_num' => "no-result");
    echo json_encode($resultArray);
    exit;
} else {
    foreach ($verifiedResult as $result) {
        $student_profile_status = empty($result['profile_status']) ? "" : " [" . $result['profile_status'] . "]";
        $resultArray[] = array('value' => trim($result['student_id']) . " " . trim($result['first_name']) . " " . trim($result['last_name']) . $student_profile_status, 'student_num' => $result['student_id']);
    }
    echo json_encode($resultArray);
예제 #2
0
파일: search.php 프로젝트: hughnguy/php
//============================================================================================
// Session, configuration file, localization constructor
//============================================================================================
require '../includes/php/bootstrap.php';
$SESSION = new \Zend_Session_Namespace('internal', true);
if (!isset($SESSION->lang)) {
    $SESSION->lang = DEFAULT_LANGUAGE;
}
\Locale::setDefault($SESSION->lang);
$l10n->setLanguage($SESSION->lang);
$exploded_string = explode(" ", $_GET['term']);
//============================================================================================
// Model
//============================================================================================
$search = new \Ventus\Utilities\Search($dbo);
$verifiedResult = $search->searchStudents($exploded_string, "access");
//============================================================================================
// Send the results back to the view in the form of JSON
//============================================================================================
header('Content-Type: application/json; charset=utf-8');
if (empty($verifiedResult)) {
    $resultArray[] = array('value' => $l10n->__('studentSearch.noResults'), 'student_num' => "no-result");
    echo json_encode($resultArray);
    exit;
} else {
    foreach ($verifiedResult as $result) {
        $student_profile_status = empty($result['profile_status']) ? "" : " [" . $result['profile_status'] . "]";
        $resultArray[] = array('value' => trim($result['student_id']) . " " . trim($result['first_name']) . " " . trim($result['last_name']) . $student_profile_status, 'student_num' => $result['student_id']);
    }
    echo json_encode($resultArray);