From 36c23051e1113a9193b913ef50e75507eba310b5 Mon Sep 17 00:00:00 2001 From: Marcus Green Date: Sat, 14 Sep 2024 22:29:38 +0100 Subject: [PATCH] Removed duplicate copy of plugin_feature.php --- classes/bulk_tag_action.php | 23 ++++++++++- classes/question_text_row.php | 77 ----------------------------------- plugin_feature.php | 36 ---------------- tests/helper_test.php | 2 +- 4 files changed, 23 insertions(+), 115 deletions(-) delete mode 100644 classes/question_text_row.php delete mode 100644 plugin_feature.php diff --git a/classes/bulk_tag_action.php b/classes/bulk_tag_action.php index f2b7d27..db868b4 100644 --- a/classes/bulk_tag_action.php +++ b/classes/bulk_tag_action.php @@ -20,26 +20,47 @@ * Class bulk_move_action is the base class for moving questions. * * @package qbank_bulktags - * @author Marcus Green + * @copyright 2024 Marcus Green * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class bulk_tag_action extends \core_question\local\bank\bulk_action_base { + /** + * Get the title for the bulk action. + * + * @return string The localized string for the bulk action title. + */ public function get_bulk_action_title(): string { return get_string('tagbulkaction', 'qbank_bulktags'); } + /** + * Get the key for the bulk action. + * + * @return string The key for the bulk action. + */ public function get_key(): string { return 'bulktags'; } + /** + * Returns the URL for the bulk tag action. + * + * @return \moodle_url The URL for the bulk tag action. + */ public function get_bulk_action_url(): \moodle_url { return new \moodle_url('/question/bank/bulktags/tag.php'); } + /** + * Returns the required capabilities for this bulk tag action. + * + * @return array|null An array of required capabilities, or null if no capabilities are required. + */ public function get_bulk_action_capabilities(): ?array { return [ 'moodle/question:editall', ]; } + } diff --git a/classes/question_text_row.php b/classes/question_text_row.php deleted file mode 100644 index d05c675..0000000 --- a/classes/question_text_row.php +++ /dev/null @@ -1,77 +0,0 @@ -. - -namespace qbank_bulktags; - -use core_question\local\bank\row_base; - -/** - * A column type for the name of the question name. - * - * @package qbank_bulktags - * @author 2024 Marcus Green - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class question_text_row extends row_base { - - /** - * To initialise subclasses - * @var $formatoptions - */ - protected $formatoptions; - - protected function init(): void { - $this->formatoptions = new \stdClass(); - $this->formatoptions->noclean = true; - $this->formatoptions->para = false; - } - - public function get_name(): string { - return 'questiontext'; - } - - protected function get_title(): string { - return get_string('questiontext', 'question'); - } - - protected function display_content($question, $rowclasses): void { - $text = question_rewrite_question_preview_urls($question->questiontext, $question->id, - $question->contextid, 'question', 'questiontext', $question->id, - $question->contextid, 'core_question'); - $text = format_text($text, $question->questiontextformat, - $this->formatoptions); - if ($text == '') { - $text = ' '; - } - echo $text; - } - - public function get_required_fields(): array { - return ['q.questiontext', 'q.questiontextformat']; - } - - public function has_preference(): bool { - return true; - } - - public function get_preference_key(): string { - return 'qbshowtext'; - } - - public function get_preference(): bool { - return question_get_display_preference($this->get_preference_key(), 0, PARAM_BOOL, new \moodle_url('')); - } -} diff --git a/plugin_feature.php b/plugin_feature.php deleted file mode 100644 index c1b6872..0000000 --- a/plugin_feature.php +++ /dev/null @@ -1,36 +0,0 @@ -. - -namespace qbank_bulktags; - -use core_question\local\bank\bulk_action_base; -use core_question\local\bank\plugin_features_base; - -/** - * Class plugin_feature is the entrypoint for the features. - * - * @package qbank_bulktags - * @author Marcus Green - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class plugin_feature extends plugin_features_base { - - public function get_bulk_actions(): array { - return [ - new bulk_tag_action(), - ]; - } -} diff --git a/tests/helper_test.php b/tests/helper_test.php index a9d0c67..48e8595 100644 --- a/tests/helper_test.php +++ b/tests/helper_test.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace qbank_bulktags\tests; +namespace qbank_bulktags; use qbank_bulktags\helper; use advanced_testcase;