当前位置: 首页>>代码示例>>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;未经允许,请勿转载。