當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Answer::query方法代碼示例

本文整理匯總了PHP中Answer::query方法的典型用法代碼示例。如果您正苦於以下問題:PHP Answer::query方法的具體用法?PHP Answer::query怎麽用?PHP Answer::query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Answer的用法示例。


在下文中一共展示了Answer::query方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: jsdie

        }
    }
    jsdie("questionSaved", $question->id, $is_new);
}
if ($is_new) {
    $title = "Новый вопрос";
    $question = new Question();
    $question->id = 'new';
    $question->test_id = $_REQUEST['test_id'];
    $question->wakeup();
    $answers = array();
} else {
    if (!($question = Question::get("WHERE id = %s", $id))) {
        redirect("/", "Извините, этот вопрос уже удален.");
    }
    $title = "{$question->text}";
    $answers = Answer::query("WHERE question_id = %s ORDER BY `order`", $question->id);
}
$max_answer_order = 0;
foreach ($answers as $answer) {
    $max_answer_order = max($max_answer_order, $answer->order);
}
$to_add = max(3, 5 - count($answers));
for ($i = 1; $i <= $to_add; $i++) {
    $answer = new Answer();
    $answer->order = $max_answer_order + $i;
    $answer->id = "new" . $i;
    $answer->wakeup();
    $answers[] = $answer;
}
echo render_partial('question_editor.haml', array('question' => $question, 'answers' => $answers));
開發者ID:andreyvit,項目名稱:retester,代碼行數:31,代碼來源:question_editor.php

示例2: die

    include $test->handler_file();
    if (!function_exists('next_action')) {
        die("Invalid handler {$handler_file}: a handler must define function next_action(\$RES, \$question_count)");
    }
    // if the handler finishes the test right away, the statistics will end up incorrect
    $question = run_handler($RES, $test, null, null);
    $RES->session_id = stat_test_started($test->id, $RES->partner_id, $RES->day, $question->id, $RES->paid);
} else {
    if ($RES->finished) {
        if ($RES->paid) {
            if ($RES->sms_password_entered) {
                $full = true;
            } else {
                $full = false;
                ob_start();
                include 'templates/sms-info.inc.php';
                $sms_info = ob_get_clean();
            }
        } else {
            $full = true;
        }
        include $test->finisher_file();
        exit;
    } else {
        // we always pick a question by id in GET request, so that pressing F5 will render the same
        // question over and over again
        $question = Question::get("WHERE `id` = %d AND `test_id` = %d", $RES->question_id, $test_id);
    }
}
$answers = Answer::query("WHERE `question_id` = %d ORDER BY `order`", $question->id);
include $test->design_file();
開發者ID:andreyvit,項目名稱:retester,代碼行數:31,代碼來源:test.php


注:本文中的Answer::query方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。