本文整理汇总了PHP中table_sql::build_table方法的典型用法代码示例。如果您正苦于以下问题:PHP table_sql::build_table方法的具体用法?PHP table_sql::build_table怎么用?PHP table_sql::build_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table_sql
的用法示例。
在下文中一共展示了table_sql::build_table方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function build_table()
{
if ($this->rawdata) {
$this->strtimeformat = str_replace(',', ' ', get_string('strftimedatetime'));
parent::build_table();
}
}
示例2: array
function build_table(){
global $CFG, $DB;
if ($this->rawdata) {
// Define some things we need later to process raw data from db.
$this->strtimeformat = str_replace(',', '', get_string('strftimedatetime'));
parent::build_table();
//end of adding data from attempts data to table / download
//now add averages at bottom of table :
$params = array($this->quiz->id);
$averagesql = "SELECT AVG(qg.grade) AS grade " .
"FROM {quiz_grades} qg " .
"WHERE quiz=?";
$this->add_separator();
if ($this->is_downloading()){
$namekey = 'lastname';
} else {
$namekey = 'fullname';
}
if ($this->groupstudents){
list($g_usql, $g_params) = $DB->get_in_or_equal($this->groupstudents);
$groupaveragesql = $averagesql." AND qg.userid $g_usql";
$groupaverage = $DB->get_record_sql($groupaveragesql, array_merge($params, $g_params));
$groupaveragerow = array($namekey => get_string('groupavg', 'grades'),
'sumgrades' => quiz_format_grade($this->quiz, $groupaverage->grade),
'feedbacktext'=> strip_tags(quiz_report_feedback_for_grade($groupaverage->grade, $this->quiz->id, $this->context)));
if($this->detailedmarks && ($this->qmsubselect || $this->quiz->attempts == 1)) {
$avggradebyq = quiz_get_average_grade_for_questions($this->quiz, $this->groupstudents);
$groupaveragerow += quiz_format_average_grade_for_questions($avggradebyq, $this->questions, $this->quiz, $this->is_downloading());
}
$this->add_data_keyed($groupaveragerow);
}
if ($this->students) {
list($s_usql, $s_params) = $DB->get_in_or_equal($this->students);
$overallaverage = $DB->get_record_sql($averagesql." AND qg.userid $s_usql", array_merge($params, $s_params));
$overallaveragerow = array($namekey => get_string('overallaverage', 'grades'),
'sumgrades' => quiz_format_grade($this->quiz, $overallaverage->grade),
'feedbacktext'=> strip_tags(quiz_report_feedback_for_grade($overallaverage->grade, $this->quiz->id, $this->context)));
if($this->detailedmarks && ($this->qmsubselect || $this->quiz->attempts == 1)) {
$avggradebyq = quiz_get_average_grade_for_questions($this->quiz, $this->students);
$overallaveragerow += quiz_format_average_grade_for_questions($avggradebyq, $this->questions, $this->quiz, $this->is_downloading());
}
$this->add_data_keyed($overallaveragerow);
}
}
}