本文整理汇总了PHP中flexible_table::add_separator方法的典型用法代码示例。如果您正苦于以下问题:PHP flexible_table::add_separator方法的具体用法?PHP flexible_table::add_separator怎么用?PHP flexible_table::add_separator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flexible_table
的用法示例。
在下文中一共展示了flexible_table::add_separator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
//.........这里部分代码省略.........
}
}
}
// Feedback column.
if ($hasfeedback) {
if ($attempt->timefinish) {
$row[] = quiz_report_feedback_for_grade(quiz_rescale_grade($attempt->sumgrades, $quiz), $quiz->id);
} else {
$row[] = '-';
}
}
if (!$download) {
$table->add_data($row);
} else {
if ($download == 'Excel' or $download == 'ODS') {
$colnum = 0;
foreach ($row as $item) {
$myxls->write($rownum, $colnum, $item, $format);
$colnum++;
}
$rownum++;
} else {
if ($download == 'CSV') {
$text = implode("\t", $row);
echo $text . " \n";
}
}
}
}
//end of adding data from attempts data to table / download
//now add averages :
if (!$download && $attempts) {
$averagesql = "SELECT AVG(qg.grade) AS grade " . "FROM {$CFG->prefix}quiz_grades qg " . "WHERE quiz=" . $quiz->id;
$table->add_separator();
if ($groupstudentslist) {
$groupaveragesql = $averagesql . " AND qg.userid IN ({$groupstudentslist})";
$groupaverage = get_record_sql($groupaveragesql);
$groupaveragerow = array('fullname' => get_string('groupavg', 'grades'), 'sumgrades' => round($groupaverage->grade, $quiz->decimalpoints), 'feedbacktext' => quiz_report_feedback_for_grade($groupaverage->grade, $quiz->id));
if ($detailedmarks && $qmsubselect) {
$avggradebyq = quiz_get_average_grade_for_questions($quiz, $groupstudentslist);
$groupaveragerow += quiz_format_average_grade_for_questions($avggradebyq, $questions, $quiz, $download);
}
$table->add_data_keyed($groupaveragerow);
}
$overallaverage = get_record_sql($averagesql . " AND qg.userid IN ({$studentslist})");
$overallaveragerow = array('fullname' => get_string('overallaverage', 'grades'), 'sumgrades' => round($overallaverage->grade, $quiz->decimalpoints), 'feedbacktext' => quiz_report_feedback_for_grade($overallaverage->grade, $quiz->id));
if ($detailedmarks && $qmsubselect) {
$avggradebyq = quiz_get_average_grade_for_questions($quiz, $studentslist);
$overallaveragerow += quiz_format_average_grade_for_questions($avggradebyq, $questions, $quiz, $download);
}
$table->add_data_keyed($overallaveragerow);
}
if (!$download) {
// Start form
echo '<div id="tablecontainer">';
echo '<form id="attemptsform" method="post" action="' . $reporturlwithdisplayoptions->out(true) . '" onsubmit="return confirm(\'' . $strreallydel . '\');">';
echo '<div style="display: none;">';
echo $reporturlwithdisplayoptions->hidden_params_out();
echo '</div>';
echo '<div>';
// Print table
$table->print_html();
// Print "Select all" etc.
if (!empty($attempts) && $candelete) {
echo '<table id="commands">';
echo '<tr><td>';
示例2: count
/**
* Prints a table with users and their attempts
*
* @return void
* @todo Add current grade to the table
* Finnish documenting
**/
function view_question($quiz, $question, $totalattempts, $ungraded)
{
global $CFG;
$usercount = count($this->users);
// set up table
$tablecolumns = array('picture', 'fullname', 'timefinish', 'grade');
$tableheaders = array('', get_string('name'), get_string("completedon", "quiz"), '');
$table = new flexible_table('mod-quiz-report-grading');
$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($this->viewurl->out());
$table->sortable(true);
$table->initialbars($usercount > 20);
// will show initialbars if there are more than 20 users
$table->pageable(true);
$table->collapsible(true);
$table->column_suppress('fullname');
$table->column_suppress('picture');
$table->column_suppress('grade');
$table->column_class('picture', 'picture');
// attributes in the table tag
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'attempts');
$table->set_attribute('class', 'generaltable generalbox');
$table->set_attribute('align', 'center');
//$table->set_attribute('width', '50%');
// get it ready!
$table->setup();
list($select, $from, $where) = $this->attempts_sql($quiz->id, true, $question->id);
if ($table->get_sql_where()) {
// forgot what this does
$where .= 'AND ' . $table->get_sql_where();
}
// sorting of the table
if ($sort = $table->get_sql_sort()) {
$sort = 'ORDER BY ' . $sort;
// seems like I would need to have u. or qa. infront of the ORDER BY attribues... but seems to work..
} else {
// my default sort rule
$sort = 'ORDER BY u.firstname, u.lastname, qa.timefinish ASC';
}
// set up the pagesize
$table->pagesize(QUIZ_REPORT_DEFAULT_PAGE_SIZE, $totalattempts);
// get the attempts and process them
if ($attempts = get_records_sql($select . $from . $where . $sort, $table->get_page_start(), $table->get_page_size())) {
// grade all link
$links = "<strong><a href=\"report.php?mode=grading&gradeall=1&q={$quiz->id}&questionid={$question->id}\">" . get_string('gradeall', 'quiz_grading', $totalattempts) . '</a></strong>';
if ($ungraded > 0) {
$links .= "<br /><strong><a href=\"report.php?mode=grading&gradeungraded=1&q={$quiz->id}&questionid={$question->id}\">" . get_string('gradeungraded', 'quiz_grading', $ungraded) . '</a></strong>';
if ($ungraded > QUIZ_REPORT_DEFAULT_GRADING_PAGE_SIZE) {
$links .= "<br /><strong><a href=\"report.php?mode=grading&gradenextungraded=1&q={$quiz->id}&questionid={$question->id}\">" . get_string('gradenextungraded', 'quiz_grading', QUIZ_REPORT_DEFAULT_GRADING_PAGE_SIZE) . '</a></strong>';
}
}
$table->add_data_keyed(array('grade' => $links));
$table->add_separator();
foreach ($attempts as $attempt) {
$picture = print_user_picture($attempt->userid, $quiz->course, $attempt->picture, false, true);
// link to student profile
$userlink = "<a href=\"{$CFG->wwwroot}/user/view.php?id={$attempt->userid}&course={$quiz->course}\">" . fullname($attempt, true) . '</a>';
$gradedclass = question_state_is_graded($attempt) ? ' class="highlightgraded" ' : '';
$gradedstring = question_state_is_graded($attempt) ? ' ' . get_string('graded', 'quiz_grading') : '';
// link for the attempt
$attemptlink = "<a {$gradedclass}href=\"report.php?mode=grading&q={$quiz->id}&questionid={$question->id}&attemptid={$attempt->attemptid}\">" . userdate($attempt->timefinish, get_string('strftimedatetime')) . $gradedstring . '</a>';
// grade all attempts for this user
$gradelink = "<a href=\"report.php?mode=grading&q={$quiz->id}&questionid={$question->id}&userid={$attempt->userid}\">" . get_string('grade') . '</a>';
$table->add_data(array($picture, $userlink, $attemptlink, $gradelink));
}
$table->add_separator();
$table->add_data_keyed(array('grade' => $links));
// print everything here
echo '<div id="tablecontainer">';
$table->print_html();
echo '</div>';
} else {
notify(get_string('noattemptstoshow', 'quiz'));
}
}
示例3: array
echo $OUTPUT->header();
echo $OUTPUT->heading($title);
echo html_writer::tag('p', stack_string('stackInstall_testsuite_intro'));
echo html_writer::tag('p', stack_string('stackInstall_testsuite_choose'));
echo $OUTPUT->single_select($PAGE->url, 'anstest', $availabletests, $anstest);
// Run the tests.
$allpassed = true;
$failedtable = array();
$notests = 0;
$start = microtime(true);
$oldtest = '';
foreach ($tests as $test) {
$notests++;
if ($oldtest != $test->name) {
if ('' != $oldtest) {
$table->add_separator();
}
$oldtest = $test->name;
}
if ($test->notes) {
reset($columns);
$firstcol = key($columns);
$table->add_data_keyed(array($firstcol => $test->notes), 'notes');
}
set_time_limit(30);
list($passed, $error, $rawmark, $feedback, $ansnote) = stack_answertest_test_data::run_test($test);
$allpassed = $allpassed && $passed;
if ($passed) {
$class = 'pass';
if (-1 === $test->expectedscore) {
$class = 'expectedfail';