forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-75125 qbank: Convert qbank plugins to new actions API
- Loading branch information
1 parent
be1bc85
commit 359bb7e
Showing
15 changed files
with
57 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
namespace qbank_deletequestion; | ||
|
||
use core_question\local\bank\question_version_status; | ||
use core_question\local\bank\menu_action_column_base; | ||
use core_question\local\bank\question_action_base; | ||
|
||
/** | ||
* Action to delete (or hide) a question, or restore a previously hidden question. | ||
|
@@ -35,7 +35,7 @@ | |
* @author 2021 Safat Shahin <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class delete_action_column extends menu_action_column_base { | ||
class delete_action extends question_action_base { | ||
|
||
/** | ||
* @var string $strdelete | ||
|
@@ -75,10 +75,6 @@ public function init(): void { | |
} | ||
} | ||
|
||
public function get_name(): string { | ||
return 'deleteaction'; | ||
} | ||
|
||
protected function get_url_icon_and_label(\stdClass $question): array { | ||
if (!question_has_capability_on($question, 'edit')) { | ||
return [null, null, null]; | ||
|
@@ -100,9 +96,4 @@ protected function get_url_icon_and_label(\stdClass $question): array { | |
return [$url, 't/delete', $this->strdelete]; | ||
} | ||
} | ||
|
||
public function get_required_fields(): array { | ||
$required = parent::get_required_fields(); | ||
return $required; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
|
||
namespace qbank_editquestion; | ||
|
||
use core_question\local\bank\menu_action_column_base; | ||
use core_question\local\bank\question_action_base; | ||
use moodle_url; | ||
|
||
/** | ||
|
@@ -34,7 +34,7 @@ | |
* @author 2021 Safat Shahin <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class copy_action_column extends menu_action_column_base { | ||
class copy_action extends question_action_base { | ||
|
||
/** @var string avoids repeated calls to get_string('duplicate'). */ | ||
protected $strcopy; | ||
|
@@ -57,10 +57,6 @@ public function init(): void { | |
} | ||
} | ||
|
||
public function get_name() { | ||
return 'copyaction'; | ||
} | ||
|
||
/** | ||
* Get the URL for duplicating a question as a moodle_url. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
|
||
namespace qbank_editquestion; | ||
|
||
use core_question\local\bank\menu_action_column_base; | ||
use core_question\local\bank\question_action_base; | ||
use moodle_url; | ||
|
||
/** | ||
|
@@ -34,7 +34,7 @@ | |
* @author 2021 Safat Shahin <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class edit_action_column extends menu_action_column_base { | ||
class edit_action extends question_action_base { | ||
|
||
/** | ||
* Contains the string. | ||
|
@@ -67,10 +67,6 @@ public function init(): void { | |
} | ||
} | ||
|
||
public function get_name() { | ||
return 'editaction'; | ||
} | ||
|
||
/** | ||
* Get the URL for editing a question as a link. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
|
||
namespace qbank_exporttoxml; | ||
|
||
use core_question\local\bank\menu_action_column_base; | ||
use core_question\local\bank\question_action_base; | ||
|
||
/** | ||
* Question bank column export the question in Moodle XML format. | ||
|
@@ -26,7 +26,7 @@ | |
* @author 2021 Safat Shahin <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class export_xml_action_column extends menu_action_column_base { | ||
class export_xml_action extends question_action_base { | ||
|
||
/** @var string avoids repeated calls to get_string('duplicate'). */ | ||
protected $strexportasxml; | ||
|
@@ -36,10 +36,6 @@ public function init(): void { | |
$this->strexportasxml = get_string('exportasxml', 'question'); | ||
} | ||
|
||
public function get_name(): string { | ||
return 'exportasxmlaction'; | ||
} | ||
|
||
protected function get_url_icon_and_label(\stdClass $question): array { | ||
if (!\question_bank::is_qtype_installed($question->qtype)) { | ||
// It sometimes happens that people end up with junk questions | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
|
||
namespace qbank_history; | ||
|
||
use core_question\local\bank\menu_action_column_base; | ||
use core_question\local\bank\question_action_base; | ||
|
||
/** | ||
* Question bank column for the history action icon. | ||
|
@@ -26,7 +26,7 @@ | |
* @author Safat Shahin <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class history_action_column extends menu_action_column_base { | ||
class history_action extends question_action_base { | ||
|
||
// Store this lang string for performance. | ||
protected $strpreview; | ||
|
@@ -36,14 +36,6 @@ public function init(): void { | |
$this->strpreview = get_string('history_action', 'qbank_history'); | ||
} | ||
|
||
public function get_extra_classes(): array { | ||
return ['pr-3']; | ||
} | ||
|
||
public function get_name(): string { | ||
return 'historyaction'; | ||
} | ||
|
||
protected function get_url_icon_and_label(\stdClass $question): array { | ||
if (!\question_bank::is_qtype_installed($question->qtype)) { | ||
// It sometimes happens that people end up with junk questions | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
|
||
namespace qbank_previewquestion; | ||
|
||
use core_question\local\bank\menu_action_column_base; | ||
use core_question\local\bank\question_action_base; | ||
|
||
/** | ||
* Question bank columns for the preview action icon. | ||
|
@@ -26,7 +26,7 @@ | |
* @author 2021 Safat Shahin <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class preview_action_column extends menu_action_column_base { | ||
class preview_action extends question_action_base { | ||
|
||
/** | ||
* @var string store this lang string for performance. | ||
|
@@ -38,10 +38,6 @@ public function init(): void { | |
$this->strpreview = get_string('preview'); | ||
} | ||
|
||
public function get_name(): string { | ||
return 'previewaction'; | ||
} | ||
|
||
protected function get_url_icon_and_label(\stdClass $question): array { | ||
if (!\question_bank::is_qtype_installed($question->qtype)) { | ||
// It sometimes happens that people end up with junk questions | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,7 @@ | |
|
||
namespace qbank_tagquestion; | ||
|
||
use core_question\local\bank\action_column_base; | ||
use core_question\local\bank\menuable_action; | ||
use core_question\local\bank\question_action_base; | ||
|
||
/** | ||
* Action to add and remove tags to questions. | ||
|
@@ -27,7 +26,7 @@ | |
* @author 2021 Safat Shahin <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class tags_action_column extends action_column_base implements menuable_action { | ||
class tags_action extends question_action_base { | ||
|
||
/** | ||
* @var string store this lang string for performance. | ||
|
@@ -56,10 +55,6 @@ protected function check_tags_status(): void { | |
} | ||
} | ||
|
||
public function get_name(): string { | ||
return 'tagsaction'; | ||
} | ||
|
||
protected function display_content($question, $rowclasses): void { | ||
global $OUTPUT; | ||
|
||
|
Oops, something went wrong.