コード例 #1
0
                } else {
                    $sql = standard_search($db, $_GET['student'], $fields);
                }
            }
        }
        if (($result = $db->query($sql)) && mysqli_num_rows($result) > 0) {
            $html = '';
            while ($row = mysqli_fetch_assoc($result)) {
                $fullname = '';
                $incampus = '';
                $offcampus = '';
                $photo = '';
                $cert = '';
                $eval = '';
                $ontotal = 0;
                $fullname = create_name($row['fname'], $row['lname'], $row['mname'], 'lname');
                $photo = good_or_bad('Photo', $row['HasPhoto'], 1, 'rp');
                $ondetails = getReqDetails('oncampus', $row['sid'], $year, $sem, false);
                $incampus = good_or_bad('On-campus hours', $ondetails['total'], 8, 'ri');
                //			$ineval = good_or_bad('Evaluation', $ondetails['eval'], 1, 're');
                $offdetails = getReqDetails('offcampus', $row['sid'], $year, $sem, true);
                $offcampus = good_or_bad('Off-campus hours', $offdetails['total'], 4, 'ro');
                //			$offeval = good_or_bad('Evaluation', $offdetails['eval'], 1, 're');
                $cert = good_or_bad('Certificate', $offdetails['cert'], 1, 'rc');
                $haseval = getEvalDetails($row['sid'], $year, $sem);
                $eval = good_or_bad('Evaluation', $haseval, 1, 're');
                $html .= <<<EOHTML
<div class="resultbox noselect">
\t<span class="result-name">{$fullname}</span><span class="result-edit quickbutton" data="{$row['sid']}">edit</span><br />
\t<span class="result-course">{$row['course']}</span><span class="result-details quickbutton" Title="Details of Community Service">details</span><br />
\t<br />
コード例 #2
0
date_default_timezone_set('Asia/Manila');
require_once 'includes/functions.php';
$db = new DBObject(CURRENT_DB);
if (isset($_POST['evalcode'])) {
    if (strtoupper($_POST['evalcode']) === 'OK') {
        die('Error: Invalid evaluation code.');
    }
    $json = array();
    $reqcode = $db->escape(trim($_POST['evalcode']));
    $select = 'evaluation.id as evalid, evaluation.schoolyear, evaluation.semester, students.lname, students.fname, students.mname, students.course, students.year';
    $where = "evaluation.reqcode = '{$reqcode}'";
    $sql = "SELECT {$select} FROM evaluation INNER JOIN students ON evaluation.student = students.sid WHERE {$where}";
    if (($result = $db->query($sql)) && mysqli_num_rows($result) > 0) {
        $row = mysqli_fetch_assoc($result);
        $json['id'] = $row['evalid'];
        $json['name'] = create_name($row['fname'], $row['lname'], $row['mname'], 'reverse');
        $json['course'] = $row['course'];
        $json['year'] = $row['year'];
        $json['schoolyear'] = $row['schoolyear'];
        $json['semester'] = $row['semester'];
        echo json_encode($json);
    } else {
        die('Error: Invalid evaluation code.');
    }
} else {
    if (isset($_POST['evaluation'])) {
        $set = array();
        $numbers = array('q5-1', 'q6-1');
        foreach ($_POST as $key => $value) {
            if ($key !== 'evaluation') {
                $value = in_array($key, $numbers) ? intval($value) : "'" . $db->escape($value) . "'";