Skip to content
Snippets Groups Projects
Unverified Commit 4023e375 authored by Justus Dieckmann's avatar Justus Dieckmann Committed by GitHub
Browse files

Merge pull request #140 from PetriAsi/feature/list-category-paths

Category trigger : select categories with paths
parents 884dc5d3 05b50135
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ use coursecat;
use tool_lifecycle\local\manager\settings_manager;
use tool_lifecycle\local\response\trigger_response;
use tool_lifecycle\settings_type;
use core_course_category;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../lib.php');
......@@ -116,19 +117,14 @@ class categories extends base_automatic {
* @throws \dml_exception
*/
public function extend_add_instance_form_definition($mform) {
global $DB;
$categories = $DB->get_records('course_categories');
$categorynames = array();
foreach ($categories as $category) {
$categorynames[$category->id] = $category->name;
}
$displaylist = core_course_category::make_categories_list();
$options = array(
'multiple' => true,
'noselectionstring' => get_string('categories_noselection', 'lifecycletrigger_categories'),
);
$mform->addElement('autocomplete', 'categories',
get_string('categories', 'lifecycletrigger_categories'),
$categorynames, $options);
$displaylist, $options);
$mform->setType('categories', PARAM_SEQUENCE);
$mform->addElement('advcheckbox', 'exclude', get_string('exclude', 'lifecycletrigger_categories'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment