本文整理汇总了PHP中question_engine_data_mapper::sum_usage_marks_subquery方法的典型用法代码示例。如果您正苦于以下问题:PHP question_engine_data_mapper::sum_usage_marks_subquery方法的具体用法?PHP question_engine_data_mapper::sum_usage_marks_subquery怎么用?PHP question_engine_data_mapper::sum_usage_marks_subquery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_engine_data_mapper
的用法示例。
在下文中一共展示了question_engine_data_mapper::sum_usage_marks_subquery方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dotest_sum_usage_marks_subquery
/**
* This test is executed by {@link test_reporting_queries()}.
*/
protected function dotest_sum_usage_marks_subquery()
{
global $DB;
$totals = $DB->get_records_sql_menu("SELECT qu.id, ({$this->dm->sum_usage_marks_subquery('qu.id')}) AS totalmark\n FROM {question_usages} qu\n WHERE qu.id IN ({$this->usageids[0]}, {$this->usageids[1]})");
$this->assertNull($totals[$this->usageids[0]]);
// Since a question requires grading.
$this->assertNotNull($totals[$this->usageids[1]]);
// Grrr! PHP null == 0 makes this hard.
$this->assertEquals(0, $totals[$this->usageids[1]]);
}
示例2: quiz_update_all_attempt_sumgrades
function quiz_update_all_attempt_sumgrades($quiz)
{
global $DB;
$dm = new question_engine_data_mapper();
$timenow = time();
$sql = "UPDATE {quiz_attempts}\n SET\n timemodified = :timenow,\n sumgrades = (\n {$dm->sum_usage_marks_subquery('uniqueid')}\n )\n WHERE quiz = :quizid AND timefinish <> 0";
$DB->execute($sql, array('timenow' => $timenow, 'quizid' => $quiz->id));
}
示例3: quiz_update_all_attempt_sumgrades
/**
* Update the sumgrades field of the attempts at a quiz.
*
* @param object $quiz a quiz.
*/
function quiz_update_all_attempt_sumgrades($quiz) {
global $DB;
$dm = new question_engine_data_mapper();
$timenow = time();
$sql = "UPDATE {quiz_attempts}
SET
timemodified = :timenow,
sumgrades = (
{$dm->sum_usage_marks_subquery('uniqueid')}
)
WHERE quiz = :quizid AND state = :finishedstate";
$DB->execute($sql, array('timenow' => $timenow, 'quizid' => $quiz->id,
'finishedstate' => quiz_attempt::FINISHED));
}
示例4: offlinequiz_update_all_attempt_sumgrades
/**
* Update the sumgrades field of the results in an offline quiz.
*
* @param object $offlinequiz The offlinequiz.
*/
function offlinequiz_update_all_attempt_sumgrades($offlinequiz)
{
global $DB;
$dm = new question_engine_data_mapper();
$timenow = time();
$sql = "UPDATE {offlinequiz_results}\n SET timemodified = :timenow,\n sumgrades = (\n {$dm->sum_usage_marks_subquery('usageid')}\n )\n WHERE offlinequizid = :offlinequizid\n AND timefinish <> 0";
$DB->execute($sql, array('timenow' => $timenow, 'offlinequizid' => $offlinequiz->id));
}