本文整理汇总了PHP中quiz_report_list函数的典型用法代码示例。如果您正苦于以下问题:PHP quiz_report_list函数的具体用法?PHP quiz_report_list怎么用?PHP quiz_report_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quiz_report_list函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quiz_report_default_report
/**
* Get the default report for the current user.
* @param object $context the quiz context.
*/
function quiz_report_default_report($context)
{
$reports = quiz_report_list($context);
return reset($reports);
}
示例2: print_error
print_error('invalidcoursemodule');
}
} else {
if (!($quiz = $DB->get_record('quiz', array('id' => $q)))) {
print_error('invalidquizid', 'quiz');
}
if (!($course = $DB->get_record('course', array('id' => $quiz->course)))) {
print_error('invalidcourseid');
}
if (!($cm = get_coursemodule_from_instance("quiz", $quiz->id, $course->id))) {
print_error('invalidcoursemodule');
}
}
require_login($course, false, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$reportlist = quiz_report_list($context);
if (count($reportlist) == 0) {
print_error('erroraccessingreport', 'quiz');
}
if ($mode == '') {
$mode = reset($reportlist);
//first element in array
} elseif (!in_array($mode, $reportlist)) {
print_error('erroraccessingreport', 'quiz');
}
// if no questions have been set up yet redirect to edit.php
if (!$quiz->questions and has_capability('mod/quiz:manage', $context)) {
redirect('edit.php?cmid=' . $cm->id);
}
// Upgrade any attempts that have not yet been upgraded to the
// Moodle 1.5 model (they will not yet have the timestamp set)
示例3: quiz_extend_navigation
/**
* This fucntion extends the global navigation for the site.
* It is important to note that you should not rely on PAGE objects within this
* body of code as there is no guarantee that during an AJAX request they are
* available
*
* @param navigation_node $quiznode The quiz node within the global navigation
* @param object $course The course object returned from the DB
* @param object $module The module object returned from the DB
* @param object $cm The course module instance returned from the DB
*/
function quiz_extend_navigation($quiznode, $course, $module, $cm) {
global $CFG;
$context = context_module::instance($cm->id);
if (has_capability('mod/quiz:view', $context)) {
$url = new moodle_url('/mod/quiz/view.php', array('id'=>$cm->id));
$quiznode->add(get_string('info', 'quiz'), $url, navigation_node::TYPE_SETTING,
null, null, new pix_icon('i/info', ''));
}
if (has_any_capability(array('mod/quiz:viewreports', 'mod/quiz:grade'), $context)) {
require_once($CFG->dirroot . '/mod/quiz/report/reportlib.php');
$reportlist = quiz_report_list($context);
$url = new moodle_url('/mod/quiz/report.php',
array('id' => $cm->id, 'mode' => reset($reportlist)));
$reportnode = $quiznode->add(get_string('results', 'quiz'), $url,
navigation_node::TYPE_SETTING,
null, null, new pix_icon('i/report', ''));
foreach ($reportlist as $report) {
$url = new moodle_url('/mod/quiz/report.php',
array('id' => $cm->id, 'mode' => $report));
$reportnode->add(get_string($report, 'quiz_'.$report), $url,
navigation_node::TYPE_SETTING,
null, 'quiz_report_' . $report, new pix_icon('i/item', ''));
}
}
}
示例4: quiz_extend_settings_navigation
/**
* This function extends the settings navigation block for the site.
*
* It is safe to rely on PAGE here as we will only ever be within the module
* context when this is called
*
* @param settings_navigation $settings
* @param navigation_node $quiznode
* @return void
*/
function quiz_extend_settings_navigation($settings, $quiznode)
{
global $PAGE, $CFG;
// Require {@link questionlib.php}
// Included here as we only ever want to include this file if we really need to.
require_once $CFG->libdir . '/questionlib.php';
// We want to add these new nodes after the Edit settings node, and before the
// Locally assigned roles node. Of course, both of those are controlled by capabilities.
$keys = $quiznode->get_children_key_list();
$beforekey = null;
$i = array_search('modedit', $keys);
if ($i === false and array_key_exists(0, $keys)) {
$beforekey = $keys[0];
} else {
if (array_key_exists($i + 1, $keys)) {
$beforekey = $keys[$i + 1];
}
}
if (has_capability('mod/quiz:manageoverrides', $PAGE->cm->context)) {
$url = new moodle_url('/mod/quiz/overrides.php', array('cmid' => $PAGE->cm->id));
$node = navigation_node::create(get_string('groupoverrides', 'quiz'), new moodle_url($url, array('mode' => 'group')), navigation_node::TYPE_SETTING, null, 'mod_quiz_groupoverrides');
$quiznode->add_node($node, $beforekey);
$node = navigation_node::create(get_string('useroverrides', 'quiz'), new moodle_url($url, array('mode' => 'user')), navigation_node::TYPE_SETTING, null, 'mod_quiz_useroverrides');
$quiznode->add_node($node, $beforekey);
}
if (has_capability('mod/quiz:manage', $PAGE->cm->context)) {
$node = navigation_node::create(get_string('editquiz', 'quiz'), new moodle_url('/mod/quiz/edit.php', array('cmid' => $PAGE->cm->id)), navigation_node::TYPE_SETTING, null, 'mod_quiz_edit', new pix_icon('t/edit', ''));
$quiznode->add_node($node, $beforekey);
}
if (has_capability('mod/quiz:preview', $PAGE->cm->context)) {
$url = new moodle_url('/mod/quiz/startattempt.php', array('cmid' => $PAGE->cm->id, 'sesskey' => sesskey()));
$node = navigation_node::create(get_string('preview', 'quiz'), $url, navigation_node::TYPE_SETTING, null, 'mod_quiz_preview', new pix_icon('i/preview', ''));
$quiznode->add_node($node, $beforekey);
}
if (has_any_capability(array('mod/quiz:viewreports', 'mod/quiz:grade'), $PAGE->cm->context)) {
require_once $CFG->dirroot . '/mod/quiz/report/reportlib.php';
$reportlist = quiz_report_list($PAGE->cm->context);
$url = new moodle_url('/mod/quiz/report.php', array('id' => $PAGE->cm->id, 'mode' => reset($reportlist)));
$reportnode = $quiznode->add_node(navigation_node::create(get_string('results', 'quiz'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', '')), $beforekey);
foreach ($reportlist as $report) {
$url = new moodle_url('/mod/quiz/report.php', array('id' => $PAGE->cm->id, 'mode' => $report));
$reportnode->add_node(navigation_node::create(get_string($report, 'quiz_' . $report), $url, navigation_node::TYPE_SETTING, null, 'quiz_report_' . $report, new pix_icon('i/item', '')));
}
}
question_extend_settings_navigation($quiznode, $PAGE->cm->context)->trim_if_empty();
}
示例5: quiz_report_default_report
/**
* Get the default report for the current user.
* @param object $context the quiz context.
*/
function quiz_report_default_report($context)
{
return reset(quiz_report_list($context));
}
示例6: dirname
*
* @package mod_quiz
* @category grade
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once dirname(__FILE__) . '/../../config.php';
require_once $CFG->dirroot . '/mod/quiz/locallib.php';
require_once $CFG->dirroot . '/mod/quiz/report/reportlib.php';
$id = required_param('id', PARAM_INT);
$userid = optional_param('userid', 0, PARAM_INT);
$cm = get_coursemodule_from_id('quiz', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$quiz = $DB->get_record('quiz', array('id' => $cm->instance), '*', MUST_EXIST);
require_login($course, false, $cm);
$reportlist = quiz_report_list(context_module::instance($cm->id));
if (empty($reportlist) || $userid == $USER->id) {
// If the user cannot see reports, or can see reports but is looking
// at their own grades, redirect them to the view.php page.
// (The looking at their own grades case is unlikely, since users who
// appear in the gradebook are unlikely to be able to see quiz reports,
// but it is possible.)
redirect(new moodle_url('/mod/quiz/view.php', array('id' => $cm->id)));
}
// Now we know the user is interested in reports. If they are interested in a
// specific other user, try to send them to the most appropriate attempt review page.
if ($userid) {
// Work out which attempt is most significant from a grading point of view.
$attempts = quiz_get_user_attempts($quiz->id, $userid, 'finished');
$attempt = null;
switch ($quiz->grademethod) {
示例7: dirname
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This page is the entry page into the quiz UI. Displays information about the
* quiz to students and teachers, and lets students see their previous attempts.
*
* @package mod
* @subpackage quiz
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once dirname(__FILE__) . '/../../config.php';
require_once $CFG->dirroot . '/mod/quiz/report/reportlib.php';
$id = required_param('id', PARAM_INT);
if (!($cm = get_coursemodule_from_id('quiz', $id))) {
print_error('invalidcoursemodule');
}
if (!($quiz = $DB->get_record('quiz', array('id' => $cm->instance)))) {
print_error('invalidquizid');
}
if (!($course = $DB->get_record('course', array('id' => $quiz->course)))) {
print_error('coursemisconf');
}
require_login($course, false, $cm);
$reportlist = quiz_report_list(get_context_instance(CONTEXT_MODULE, $cm->id));
if (!empty($reportlist)) {
redirect(new moodle_url('/mod/quiz/report.php', array('id' => $cm->id, 'mode' => reset($reportlist))));
} else {
redirect(new moodle_url('/mod/quiz/view.php', array('id' => $cm->id)));
}