Skip to content

Commit

Permalink
Refactored variable name to selected questions
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusgreen committed Sep 30, 2024
1 parent 970851d commit 611c46b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion classes/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class helper {
public static function bulk_tag_questions($fromform) {
global $DB;
$tags = $fromform->formtags;
if ($questionids = explode(',', $fromform->tagsquestionsselected)) {
if ($questionids = explode(',', $fromform->selectedquestions)) {
[$usql, $params] = $DB->get_in_or_equal($questionids);
$sql = "SELECT q.*, c.contextid
FROM {question} q
Expand Down
6 changes: 3 additions & 3 deletions classes/output/form/bulk_tags_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ protected function definition() {
$mform = $this->_form;

// Add hidden form fields.
$mform->addElement('hidden', 'tagsquestionsselected');
$mform->setType('tagsquestionsselected', PARAM_TEXT);
$mform->addElement('hidden', 'selectedquestions');
$mform->setType('selectedquestions', PARAM_TEXT);
$mform->addElement('hidden', 'returnurl');
$mform->setType('returnurl', PARAM_URL);
$mform->addElement('hidden', 'cmid');
Expand Down Expand Up @@ -76,7 +76,7 @@ protected function definition() {
public function set_data($data) {
$mform = $this->_form;
$data = (object) $data;
$mform->getElement('tagsquestionsselected')->setValue($data->tagsquestionsselected);
$mform->getElement('selectedquestions')->setValue($data->selectedquestions);
$mform->getElement('returnurl')->setValue($data->returnurl);
$mform->getElement('cmid')->setValue($data->cmid);
$mform->getElement('courseid')->setValue($data->courseid);
Expand Down
2 changes: 1 addition & 1 deletion tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
}
// Create the urls.
$bulktagsparams = [
'tagsquestionsselected' => $questionlist,
'selectedquestions' => $questionlist,
'confirm' => md5($questionlist),
'sesskey' => sesskey(),
'returnurl' => $returnurl,
Expand Down
2 changes: 1 addition & 1 deletion tests/helper_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function test_bulk_tag_questions(): void {

$fromform = (object) [
'tags' => ['tag1', 'tag2'],
'tagsquestionsselected' => implode(",", [$this->question1->id, $this->question2->id]),
'selectedquestions' => implode(",", [$this->question1->id, $this->question2->id]),
'formtags' => ['foo', 'bar'],
'replacetags' => 0,
];
Expand Down

0 comments on commit 611c46b

Please sign in to comment.