diff --git a/mod_form.php b/mod_form.php index 9d48893..7d80569 100644 --- a/mod_form.php +++ b/mod_form.php @@ -231,7 +231,8 @@ public function definition() { $mform =& $this->_form; // 20210218 Changed to using a text editor instead of textarea. - $mform->addElement('editor', 'text_editor', $temp->submitdirections, 'wrap="virtual" rows="5"'); + // Changed to format text which allows filters such as Gerico, etc. to work. + $mform->addElement('editor', 'text_editor', format_text($temp->submitdirections, $format = FORMAT_MOODLE, $options = null, $courseid_do_not_use = null), 'wrap="virtual" rows="5"'); $mform->setType('text_editor', PARAM_RAW); $mform->addElement('hidden', 'id', $cm->id, 'id="hotquestion_courseid"'); diff --git a/renderer.php b/renderer.php index fc43f06..b9527f1 100644 --- a/renderer.php +++ b/renderer.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die(); /** - * A custmom renderer class that extends the plugin_renderer_base and is used by the hotquestion module. + * A custom renderer class that extends the plugin_renderer_base and is used by the hotquestion module. * * @package mod_hotquestion * @copyright 2019 onwards AL Rachels drachels@drachels.com @@ -54,6 +54,7 @@ public function introduction() { $output = ''; if (trim($this->hotquestion->instance->intro)) { $output .= $this->box_start('generalbox boxaligncenter', 'intro'); + // Add the description for this activity. $output .= format_module_intro('hotquestion', $this->hotquestion->instance, $this->hotquestion->cm->id); $output .= $this->box_end(); } @@ -83,9 +84,9 @@ public function toolbar($shownew = true) { $options['id'] = $this->hotquestion->cm->id; $options['action'] = 'download'; $url = new moodle_url('/mod/hotquestion/view.php', $options); - $toolbuttons[] = html_writer::link($url, $this->pix_icon('a/download_all', - get_string('csvexport', 'hotquestion')), - array('class' => 'toolbutton')); + $toolbuttons[] = html_writer::link($url, $this->pix_icon('a/download_all' + , get_string('csvexport', 'hotquestion')) + , array('class' => 'toolbutton')); } // Print prev/next round toolbuttons. @@ -93,36 +94,32 @@ public function toolbar($shownew = true) { $roundp = $this->hotquestion->get_prevround()->id; $roundn = ''; $url = new moodle_url('/mod/hotquestion/view.php', array('id' => $this->hotquestion->cm->id, 'round' => $roundp)); - $toolbuttons[] = html_writer::link($url, $this->pix_icon('t/collapsed_rtl', - get_string('previousround', 'hotquestion')), - array('class' => 'toolbutton')); + $toolbuttons[] = html_writer::link($url, $this->pix_icon('t/collapsed_rtl' + , get_string('previousround', 'hotquestion')) + , array('class' => 'toolbutton')); } else { - $toolbuttons[] = html_writer::tag('span', $this->pix_icon('t/collapsed_empty_rtl', ''), - array('class' => 'dis_toolbutton')); + $toolbuttons[] = html_writer::tag('span', $this->pix_icon('t/collapsed_empty_rtl', '') + , array('class' => 'dis_toolbutton')); } // 20200215 Text added to show x of n display in toolbar. if (($this->hotquestion->get_roundcount() != null) && ($this->hotquestion->get_currentroundx() != null)) { $cx = $this->hotquestion->get_currentroundx(); // Showing round x of n rounds. X = current round being looked at and n = total number of rounds. - $toolbuttons[] = $cx.get_string('xofn', 'hotquestion'). - $this->hotquestion->get_roundcount(); + $toolbuttons[] = $cx.get_string('xofn', 'hotquestion').$this->hotquestion->get_roundcount(); } else { - $toolbuttons[] = $this->hotquestion->get_roundcount(). - get_string('xofn', 'hotquestion'). - $this->hotquestion->get_roundcount(); + $toolbuttons[] = $this->hotquestion->get_roundcount().get_string('xofn', 'hotquestion') + .$this->hotquestion->get_roundcount(); } if ($this->hotquestion->get_nextround() != null) { $roundn = $this->hotquestion->get_nextround()->id; $roundp = ''; $url = new moodle_url('/mod/hotquestion/view.php', array('id' => $this->hotquestion->cm->id, 'round' => $roundn)); - $toolbuttons[] = html_writer::link($url, $this->pix_icon('t/collapsed', - get_string('nextround', 'hotquestion')), - array('class' => 'toolbutton')); + $toolbuttons[] = html_writer::link($url, $this->pix_icon('t/collapsed' + , get_string('nextround', 'hotquestion')), array('class' => 'toolbutton')); } else { - $toolbuttons[] = html_writer::tag('span', $this->pix_icon('t/collapsed_empty', ''), - array('class' => 'dis_toolbutton')); + $toolbuttons[] = html_writer::tag('span', $this->pix_icon('t/collapsed_empty', ''), array('class' => 'dis_toolbutton')); } // Print new round toolbutton. @@ -170,9 +167,7 @@ public function toolbar($shownew = true) { // Print refresh toolbutton. $url = new moodle_url('/mod/hotquestion/view.php', array('id' => $this->hotquestion->cm->id)); - $toolbuttons[] = html_writer::link($url, $this->pix_icon('t/reload', - get_string('reload')), - array('class' => 'toolbutton')); + $toolbuttons[] = html_writer::link($url, $this->pix_icon('t/reload', get_string('reload')), array('class' => 'toolbutton')); // Return all available toolbuttons. $output .= html_writer::alist($toolbuttons, array('id' => 'toolbar')); @@ -234,51 +229,50 @@ public function questions($allowvote = true) { // Admin, manager and teachers headings for questions, priority, heat, remove and approved headings. if (has_capability('mod/hotquestion:manageentries', $context)) { - // 20200512 Changed from fixed string to new questionlabel column setting. - $table->head = array($this->hotquestion->instance->questionlabel); + // 20210924 Changed to format_text questionlabel column setting. + $table->head = array(format_text($this->hotquestion->instance->questionlabel, $format = FORMAT_MOODLE, $options = null, $courseid_do_not_use = null)); // Check teacher priority column visibilty settings. if ($teacherpriorityvisibility) { // Priority column is visible, so show the label. - // 20200512 Changed from fixed string to new prioritylable column setting. - $table->head[] .= $this->hotquestion->instance->teacherprioritylabel; + // 20210924 Changed to format_text prioritylabel column setting. + $table->head[] .= format_text($this->hotquestion->instance->teacherprioritylabel, $format = FORMAT_MOODLE, $options = null, $courseid_do_not_use = null); } else { // Priority column is not visible, so replace label with a space. $table->head[] .= ' '; } // Check heat column visibilty settings for teachers. if ($heatvisibility) { - // 20200512 Changed from fixed string to new heatlabel column setting. + // 20210924 Changed to format_text heatlabel column setting. // 20200526 Show heatlimit setting and how many heat/votes remain for current user. - $table->head[] .= $this->hotquestion->instance->heatlabel + $table->head[] .= format_text($this->hotquestion->instance->heatlabel, $format = FORMAT_MOODLE, $options = null, $courseid_do_not_use = null) .' '.$this->hotquestion->instance->heatlimit .'/'.$temp; - } else { // Heat column is not visible, so replace label with a space. $table->head[] .= ' '; } - // 20200512 Changed from fixed string to new removelabel column setting. - $table->head[] .= $this->hotquestion->instance->removelabel; - // 20200512 Changed from fixed string to new approvallabel column setting. - $table->head[] .= $this->hotquestion->instance->approvallabel; + // 20210924 Changed to format_text removelabel column setting. + $table->head[] .= format_text($this->hotquestion->instance->removelabel, $format = FORMAT_MOODLE, $options = null, $courseid_do_not_use = null); + // 20210924 Changed to format_text approvallabel column setting. + $table->head[] .= format_text($this->hotquestion->instance->approvallabel, $format = FORMAT_MOODLE, $options = null, $courseid_do_not_use = null); } else { // Students only see headings for questions, priority, and heat columns. - // 20200512 Changed from fixed string to new questionlabel column setting. - $table->head = array($this->hotquestion->instance->questionlabel); + // 20210924 Changed to format_text questionlabel column setting. + $table->head = array(format_text($this->hotquestion->instance->questionlabel, $format = FORMAT_MOODLE, $options = null, $courseid_do_not_use = null)); // Check teacher priority column visibilty settings. if ($teacherpriorityvisibility) { - // 20200512 Changed from fixed string to new prioritylabel column setting. + // 20210924 Changed to format_text prioritylabel column setting. // Priority column is visible, so show the label. - $table->head[] .= $this->hotquestion->instance->teacherprioritylabel; + $table->head[] .= format_text($this->hotquestion->instance->teacherprioritylabel, $format = FORMAT_MOODLE, $options = null, $courseid_do_not_use = null); } else { // Priority column is not visible, so replace label with a space. $table->head[] .= ' '; } // Check heat column visibilty settings for students. if ($heatvisibility) { - // 20200512 Changed from fixed string to new heatlabel column setting. + // 20210924 Changed to format_text heatlabel column setting. // Heat column is visible, so show the label. - $table->head[] .= $this->hotquestion->instance->heatlabel + $table->head[] .= format_text($this->hotquestion->instance->heatlabel, $format = FORMAT_MOODLE, $options = null, $courseid_do_not_use = null) .' '.$this->hotquestion->instance->heatlimit .'/'.$temp; } else { @@ -320,11 +314,11 @@ public function questions($allowvote = true) { , format_time(time() - $question->time)).')'; // 20201217 Added capability to hide authors name from students. if (!$authorinfohide || (has_capability('mod/hotquestion:manageentries', $context))) { - $info = '
'.get_string('authorinfo', 'hotquestion', $a).'
'; + $authorinfo = '
'.get_string('authorinfo', 'hotquestion', $a).'
'; } else { - $info = '
'.get_string('authorinfohide', 'hotquestion', $a).'
'; + $authorinfo = '
'.get_string('authorinfohide', 'hotquestion', $a).'
'; } - $line[] = $content.$info; + $line[] = $content.$authorinfo; // Get current priority value to show. $tpriority = $question->tpriority; // Get current heat total to show. diff --git a/upgrade.txt b/upgrade.txt index e9e8cc6..2824f1d 100644 --- a/upgrade.txt +++ b/upgrade.txt @@ -1,3 +1,14 @@ +=== 4.0.1 === +20210516 Hot Question_695 - Invalid get_string() identifier: 'hotquestion:rate'. + Added the missing string. +20210516 Hot Question_723 - Invalid get_string() identifier: 'hotquestion:comment'. + Added the missing string. +20210823 Hot Question_751 - user_picture::fields() is deprecated. Please use the + \core_user\fields API instead. For compatibility, added an if check to use the new + code for Moodle > 3.0 the old code for 3.0 and below. +20211001 Hot Question_752 - need to format_text of the submit directions. Changed the + code to include format_text, in mod_form.php down around line 236. + === 4.0.0 === 20210321 Hot Question_561 See about using editor text area to allow for formatting and emoji's. Got it working in just a couple of hours, mostly looking for the diff --git a/version.php b/version.php index 55f9ced..9c41d4c 100644 --- a/version.php +++ b/version.php @@ -29,9 +29,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2021032300; // The current module version (Date: YYYYMMDDXX). +$plugin->version = 2021100100; // The current module version (Date: YYYYMMDDXX). $plugin->requires = 2014111000; // Requires Moodle 2.8 version. $plugin->cron = 0; // Period for cron to check this module (secs). $plugin->component = 'mod_hotquestion'; $plugin->maturity = MATURITY_STABLE; -$plugin->release = "4.0.0 (Build: 2021032300)"; // User-friendly version number. +$plugin->release = "4.0.1 (Build: 2021100100)"; // User-friendly version number.