MDL-27490 Implement a manage question behaviours admin page

While doing this, I found various bugs in the manages question types admin page, and so fixed them, and updated the code
there to use $OUTPUT and html_writer.

AMOS BEGIN
 MOV [cannotdeletemissingqtype,admin],[cannotdeletemissingqtype,question]
 MOV [cannotdeleteqtypeinuse,admin],[cannotdeleteqtypeinuse,question]
 MOV [cannotdeleteqtypeneeded,admin],[cannotdeleteqtypeneeded,question]
 MOV [deleteqtypeareyousure,admin],[deleteqtypeareyousure,question]
 MOV [deleteqtypeareyousuremessage,admin],[deleteqtypeareyousuremessage,question]
 MOV [deletingqtype,admin],[deletingqtype,question]
 MOV [numquestions,admin],[numquestions,question]
 MOV [numquestionsandhidden,admin],[numquestionsandhidden,question]
 MOV [qtypedeletefiles,admin],[qtypedeletefiles,question]
 MOV [uninstallqtype,admin],[uninstallqtype,question]
AMOS END
This commit is contained in:
Tim Hunt
2011-06-17 16:21:32 +01:00
parent d037c6bc3c
commit fde4560dae
15 changed files with 549 additions and 130 deletions
+51
View File
@@ -5017,6 +5017,57 @@ class admin_page_defaultmessageoutputs extends admin_page_managemessageoutputs {
}
}
/**
* Manage question behaviours page
*
* @copyright 2011 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_page_manageqbehaviours extends admin_externalpage {
/**
* Constructor
*/
public function __construct() {
global $CFG;
parent::__construct('manageqbehaviours', get_string('manageqbehaviours', 'admin'),
new moodle_url('/admin/qbehaviours.php'));
}
/**
* Search question behaviours for the specified string
*
* @param string $query The string to search for in question behaviours
* @return array
*/
public function search($query) {
global $CFG;
if ($result = parent::search($query)) {
return $result;
}
$found = false;
$textlib = textlib_get_instance();
require_once($CFG->dirroot . '/question/engine/lib.php');
foreach (get_plugin_list('qbehaviour') as $behaviour => $notused) {
if (strpos($textlib->strtolower(question_engine::get_behaviour_name($behaviour)),
$query) !== false) {
$found = true;
break;
}
}
if ($found) {
$result = new stdClass();
$result->page = $this;
$result->settings = array();
return array($this->name => $result);
} else {
return array();
}
}
}
/**
* Question type manage page
*