Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
qbank_editquestion\copy_action Class Reference

Question bank column for the duplicate action icon. More...

Inheritance diagram for qbank_editquestion\copy_action:
core_question\local\bank\question_action_base core_question\local\bank\view_component

Public Member Functions

 duplicate_question_moodle_url ($questionid)
 Get the URL for duplicating a question as a moodle_url.
 
 get_action_menu_link (\stdClass $question)
 Return the action menu link for this action on the supplied question.
 
 get_extra_joins ()
 Return an array 'table_alias' => 'JOIN clause' to bring in any data that this feature requires.
 
 get_menu_position ()
 Return an integer to indicate the desired position in the menu for this link, smaller at the top.
 
 get_required_fields ()
 Use table alias 'q' for the question table, or one of the ones from get_extra_joins.
 
 init ()
 A chance for subclasses to initialise themselves, for example to load lang strings, without having to override the constructor.
 

Public Attributes

moodle_url string $duplicatequestionurl
 Contains the url of the edit question page.
 
int const MENU_POSITION_NOT_SET = 6666
 value we return from get_menu_position here.
 

Protected Member Functions

 get_url_icon_and_label (\stdClass $question)
 Get the information required to display this action either as a menu item or a separate action column.
 

Protected Attributes

view $qbank
 Question bank view.
 
string $strcopy
 avoids repeated calls to get_string('duplicate').
 

Detailed Description

Question bank column for the duplicate action icon.

Author
2021 Safat Shahin safat.nosp@m.shah.nosp@m.in@ca.nosp@m.taly.nosp@m.st-au.nosp@m..net
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ duplicate_question_moodle_url()

qbank_editquestion\copy_action::duplicate_question_moodle_url ( $questionid)

Get the URL for duplicating a question as a moodle_url.

Parameters
int$questionidthe question id.
Return values
moodle_urlthe URL.

◆ get_action_menu_link()

core_question\local\bank\question_action_base::get_action_menu_link ( \stdClass $question)
inherited

Return the action menu link for this action on the supplied question.

For most actions, you will just need to override {

See also
get_url_icon_and_label()}. You only need to override this method if you need to pass additional attributes to {
action_menu_link_secondary}, or use a different class to render the link.
Parameters
stdClass$question
Return values
action_menu_link|null

Reimplemented in qbank_tagquestion\tags_action.

◆ get_extra_joins()

core_question\local\bank\view_component::get_extra_joins ( )
inherited

Return an array 'table_alias' => 'JOIN clause' to bring in any data that this feature requires.

The return values for all the features will be checked. It is OK if two features join in the same table with the same alias and identical JOIN clauses. If two features try to use the same alias with different joins, you get an error. Tables included by default are question (alias q) and those defined in {

See also
view\get_required_joins()}

It is importnat that your join simply adds additional data (or NULLs) to the existing rows of the query. It must not cause additional rows.

Return values
string[]'table_alias' => 'JOIN clause'

Reimplemented in core_question\local\bank\action_column_base, core_question\local\bank\column_base, qbank_viewcreator\creator_name_column, and qbank_viewcreator\modifier_name_column.

◆ get_menu_position()

qbank_editquestion\copy_action::get_menu_position ( )

Return an integer to indicate the desired position in the menu for this link, smaller at the top.

The standard menu items in Moodle core return these numbers: 100 preview_action 200 edit_action 250 copy_action 300 tags_action 400 delete_action 500 history_action 600 export_xml_action (So, if you want your action at a particular place in the order, there should be space.)

If two actions get the same order number, then the tie-break on the sort is plugin name, then the order returned by get_question_actions for that plugin.

Return values
intdesired position. Smallest at the top.

Reimplemented from core_question\local\bank\view_component.

◆ get_required_fields()

◆ get_url_icon_and_label()

qbank_editquestion\copy_action::get_url_icon_and_label ( \stdClass $question)
protected

Get the information required to display this action either as a menu item or a separate action column.

For most actions, it should be sufficient to override just this method. {

See also
get_action_menu_link()} is the public interface and handles building a renderable menu link object from this data.

If this action cannot apply to this question (e.g. because the user does not have permission, then return [null, null, null].

Parameters
stdClass$questionthe row from the $question table, augmented with extra information.
Return values
arraywith three elements. $url - the URL to perform the action. $icon - the icon for this action. E.g. 't/delete'. $label - text label to display in the UI (either in the menu, or as a tool-tip on the icon)

Reimplemented from core_question\local\bank\question_action_base.

◆ init()

qbank_editquestion\copy_action::init ( )

A chance for subclasses to initialise themselves, for example to load lang strings, without having to override the constructor.

Reimplemented from core_question\local\bank\view_component.

Member Data Documentation

◆ MENU_POSITION_NOT_SET

int const core_question\local\bank\view_component::MENU_POSITION_NOT_SET = 6666
inherited

value we return from get_menu_position here.

Subclasses should override this.


The documentation for this class was generated from the following file: