2009-11-04 11:57:52 +00:00
|
|
|
<?php
|
2011-02-22 19:59:12 +00:00
|
|
|
// This file is part of Moodle - http://moodle.org/
|
|
|
|
//
|
|
|
|
// Moodle is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// Moodle is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
2009-01-19 05:30:01 +00:00
|
|
|
|
2006-02-24 10:21:40 +00:00
|
|
|
/**
|
2010-08-10 09:56:48 +00:00
|
|
|
* Page to edit the question bank
|
|
|
|
*
|
2011-02-22 19:59:12 +00:00
|
|
|
* @package moodlecore
|
|
|
|
* @subpackage questionbank
|
|
|
|
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
2010-08-10 09:56:48 +00:00
|
|
|
*/
|
2007-05-07 16:57:23 +00:00
|
|
|
|
2023-05-25 13:29:46 +01:00
|
|
|
use core\event\question_category_viewed;
|
|
|
|
use core_question\output\qbank_action_menu;
|
|
|
|
use core_question\local\bank\view;
|
|
|
|
|
2016-02-26 17:47:58 +11:00
|
|
|
require_once(__DIR__ . '/../config.php');
|
2011-02-22 19:59:12 +00:00
|
|
|
require_once($CFG->dirroot . '/question/editlib.php');
|
2009-09-16 02:43:58 +00:00
|
|
|
|
2012-08-09 13:48:56 +01:00
|
|
|
list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
|
|
|
|
question_edit_setup('questions', '/question/edit.php');
|
|
|
|
|
2023-05-25 13:29:46 +01:00
|
|
|
$actionurl = new moodle_url($thispageurl);
|
2011-02-22 19:59:12 +00:00
|
|
|
if (($lastchanged = optional_param('lastchanged', 0, PARAM_INT)) !== 0) {
|
2023-01-27 15:10:50 +07:00
|
|
|
$thispageurl->param('lastchanged', $lastchanged);
|
2011-02-22 19:59:12 +00:00
|
|
|
}
|
2023-01-27 15:10:50 +07:00
|
|
|
$PAGE->set_url($thispageurl);
|
2007-08-09 21:51:09 +00:00
|
|
|
|
2021-12-09 14:43:56 +08:00
|
|
|
if ($PAGE->course->id == $SITE->id) {
|
|
|
|
$PAGE->set_primary_active_tab('home');
|
|
|
|
}
|
|
|
|
|
2023-07-10 14:30:01 +07:00
|
|
|
$thispageurl->param('deleteall', 1);
|
2023-05-25 13:29:46 +01:00
|
|
|
$questionbank = new view($contexts, $thispageurl, $COURSE, $cm, $pagevars);
|
2021-06-25 00:08:16 +10:00
|
|
|
|
2011-02-22 19:59:12 +00:00
|
|
|
$context = $contexts->lowest();
|
2011-02-23 18:53:50 +00:00
|
|
|
$streditingquestions = get_string('editquestions', 'question');
|
2011-02-22 19:59:12 +00:00
|
|
|
$PAGE->set_title($streditingquestions);
|
|
|
|
$PAGE->set_heading($COURSE->fullname);
|
2021-09-23 11:40:07 +08:00
|
|
|
$PAGE->activityheader->disable();
|
2006-02-24 10:21:40 +00:00
|
|
|
|
2022-01-09 13:12:48 +05:30
|
|
|
echo $OUTPUT->header();
|
|
|
|
|
2017-03-23 15:57:16 +05:30
|
|
|
// Print horizontal nav if needed.
|
|
|
|
$renderer = $PAGE->get_renderer('core_question', 'bank');
|
2022-01-09 20:57:54 +05:30
|
|
|
|
|
|
|
// Render the selection action.
|
2023-05-25 13:29:46 +01:00
|
|
|
$qbankaction = new qbank_action_menu($actionurl);
|
2022-01-09 20:57:54 +05:30
|
|
|
echo $renderer->render($qbankaction);
|
2017-03-23 15:57:16 +05:30
|
|
|
|
2021-06-25 00:08:16 +10:00
|
|
|
// Print the question area.
|
2023-05-25 13:29:46 +01:00
|
|
|
$questionbank->display();
|
2009-11-04 11:57:52 +00:00
|
|
|
|
2016-08-21 21:41:16 -04:00
|
|
|
// Log the view of this category.
|
2019-03-04 16:38:11 +07:00
|
|
|
list($categoryid, $contextid) = explode(',', $pagevars['cat']);
|
|
|
|
$category = new stdClass();
|
|
|
|
$category->id = $categoryid;
|
2023-05-25 13:29:46 +01:00
|
|
|
$catcontext = context::instance_by_id($contextid);
|
|
|
|
$event = question_category_viewed::create_from_question_category_instance($category, $catcontext);
|
2016-08-21 21:41:16 -04:00
|
|
|
$event->trigger();
|
|
|
|
|
2011-02-22 19:59:12 +00:00
|
|
|
echo $OUTPUT->footer();
|