Merge branch 'MDL-27490' of git://github.com/timhunt/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2011-06-17 17:24:51 +02:00
commit faf1f957ac
15 changed files with 549 additions and 130 deletions

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
*