diff --git a/classes/local/results.php b/classes/local/results.php index d303efd..8df6498 100644 --- a/classes/local/results.php +++ b/classes/local/results.php @@ -297,11 +297,11 @@ public static function hotquestion_display_question_comments($question, $cm, $co $context = context_module::instance($cm->id); $cmt = new stdClass(); $cmt->component = 'mod_hotquestion'; - $cmt->context = $context; - $cmt->course = $course; - $cmt->cm = $cm; - $cmt->area = 'hotquestion_questions'; - $cmt->itemid = $question->id; + $cmt->context = $context; + $cmt->course = $course; + $cmt->cm = $cm; + $cmt->area = 'hotquestion_questions'; + $cmt->itemid = $question->id; $cmt->showcount = true; $comment = new comment($cmt); $html = $comment->output(true); diff --git a/classes/output/viewgrades.php b/classes/output/viewgrades.php index ec90e86..ee4d154 100644 --- a/classes/output/viewgrades.php +++ b/classes/output/viewgrades.php @@ -399,7 +399,7 @@ public function query_db($pagesize, $useinitialsbar=true) { $this->sql->where .= ' AND '.$wsql; $this->sql->params = array_merge($this->sql->params, $wparams); - $this->totalrows = $DB->count_records_sql($this->countsql, $this->countparams); + $this->totalrows = $DB->count_records_sql($this->countsql, $this->countparams); } if ($this->totalrows > $pagesize) { diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index 02321cd..063af6f 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -163,7 +163,7 @@ public static function get_users_in_context(userlist $userlist) { $params = [ 'modid' => $modid, 'contextlevel' => CONTEXT_MODULE, - 'contextid' => $context->id, + 'contextid' => $context->id, ]; // Find users with hotquestion_question entries. diff --git a/db/upgrade.php b/db/upgrade.php index 809686a..5b112ca 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -84,7 +84,7 @@ function xmldb_hotquestion_upgrade($oldversion=0) { $rec->module = 'hotquestion'; $rec->action = 'add'; $rec->mtable = 'hotquestion'; - $rec->filed = 'name'; + $rec->filed = 'name'; // Insert the add action in log_display. $result = $DB->insert_record('log_display', $rec); // Now the update action. @@ -542,21 +542,6 @@ function xmldb_hotquestion_upgrade($oldversion=0) { $dbman->change_field_notnull($table, $field); $dbman->change_field_default($table, $field); - // The tpriority should always be 0 or higher. We want to find all records where this is not the case. - // Get all the hotquestion_question records. - $sql = "SELECT hqq.* - FROM {hotquestion_questions} AS hqq - WHERE hqq.id > 0"; - $tprioritystofix = $DB->get_records_sql($sql, null); - // Find all the records with null for each hotquestion teacher priority. - foreach ($tprioritystofix as $tprioritytofix) { - if (!isset($tprioritytofix->tpriority)) { - // Replace the null with 0 so the redefine will not fail. - $tprioritytofix->tpriority = 0; - $DB->update_record('hotquestion_questions', $tprioritytofix); - }; - }; - // Redefine field tpriority to be added to hotquestion_questions. $table = new xmldb_table('hotquestion_questions'); $field = new xmldb_field('tpriority', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'approved'); diff --git a/index.php b/index.php index 4cdee87..43d2831 100644 --- a/index.php +++ b/index.php @@ -64,17 +64,17 @@ // Table data. $table = new html_table(); -$table->head = array(); +$table->head = array(); $table->align = array(); if ($usesections) { - $table->head[] = get_string('sectionname', 'format_'.$course->format); + $table->head[] = get_string('sectionname', 'format_'.$course->format); $table->align[] = 'left'; } -$table->head[] = get_string('name'); +$table->head[] = get_string('name'); $table->align[] = 'left'; -$table->head[] = get_string('description'); +$table->head[] = get_string('description'); $table->align[] = 'left'; $currentsection = ''; diff --git a/lib.php b/lib.php index f7f71ec..33f324f 100644 --- a/lib.php +++ b/lib.php @@ -86,9 +86,9 @@ function hotquestion_update_instance($hotquestion) { $hotquestion->timeclose = 0; } - $cmid = $hotquestion->coursemodule; + $cmid = $hotquestion->coursemodule; $cmidnumber = $hotquestion->cmidnumber; - $courseid = $hotquestion->course; + $courseid = $hotquestion->course; $hotquestion->id = $hotquestion->instance; @@ -279,8 +279,8 @@ function hotquestion_print_recent_activity($course, $viewfullnames, $timestart) $newentries = $DB->get_records_sql($sql, $dbparams); $modinfo = get_fast_modinfo($course); - $show = array(); - $grader = array(); + $show = array(); + $grader = array(); $showrecententries = get_config('hotquestion', 'showrecentactivity'); foreach ($newentries as $anentry) { @@ -733,7 +733,7 @@ function hotquestion_update_grades($hotquestion, $userid=0, $nullifnone=true) { } else if ($userid && $nullifnone) { $grade = new stdClass(); - $grade->userid = $userid; + $grade->userid = $userid; $grade->rawgrade = null; hotquestion_grade_item_update($hotquestion, $grade); @@ -761,8 +761,8 @@ function hotquestion_grade_item_update($hotquestion, $grades=null) { if (isset($hotquestion->grade) && $hotquestion->grade > 0) { $item['gradetype'] = GRADE_TYPE_VALUE; - $item['grademax'] = $hotquestion->grade; - $item['grademin'] = 0; + $item['grademax'] = $hotquestion->grade; + $item['grademin'] = 0; } else if (isset($hotquestion->grade) && $hotquestion->grade < 0) { $item['gradetype'] = GRADE_TYPE_SCALE; $item['scaleid'] = -$hotquestion->grade; diff --git a/locallib.php b/locallib.php index efbede0..d3c5832 100644 --- a/locallib.php +++ b/locallib.php @@ -78,9 +78,9 @@ class mod_hotquestion { */ public function __construct($cmid, $roundid = -1) { global $DB; - $this->cm = get_coursemodule_from_id('hotquestion', $cmid, 0, false, MUST_EXIST); - $this->course = $DB->get_record('course', array('id' => $this->cm->course), '*', MUST_EXIST); - $this->instance = $DB->get_record('hotquestion', array('id' => $this->cm->instance), '*', MUST_EXIST); + $this->cm = get_coursemodule_from_id('hotquestion', $cmid, 0, false, MUST_EXIST); + $this->course = $DB->get_record('course', array('id' => $this->cm->course), '*', MUST_EXIST); + $this->instance = $DB->get_record('hotquestion', array('id' => $this->cm->instance), '*', MUST_EXIST); $this->set_currentround($roundid); // Contrib by ecastro ULPGC, for grades callbacks. diff --git a/renderer.php b/renderer.php index 3f817ed..8884096 100644 --- a/renderer.php +++ b/renderer.php @@ -531,7 +531,7 @@ public function questions($allowvote = true) { */ public function hotquestion_inaccessible($message) { global $CFG; - $output = $this->output->box_start('generalbox boxaligncenter'); + $output = $this->output->box_start('generalbox boxaligncenter'); $output .= $this->output->box_start('center'); $output .= (get_string('notavailable', 'hotquestion')); $output .= $message; diff --git a/upgrade.txt b/upgrade.txt index 2b16f2f..85d0a4d 100644 --- a/upgrade.txt +++ b/upgrade.txt @@ -9,10 +9,7 @@ This files describes changes in the Hot Question code. 20220821 HotQuestion_911 - Need to see about including grades in the Export tool. 20230120 HotQuestion_995 - The grade table needs more info included in the download. -=== 4.1.6 === pending release of Moodle 4.1.6 -20221027 Hot Question_943 - Feature request #58 - 4.0 hotquestion upgrade fails. The - fix is to search for any hotquestion_question teacher priority of null, and change - it to 0, then proceed with the upgrade. +=== 4.1.6 === 20230420 release of Moodle 4.1.6 20230407 HotQuestion_1031v - Invalid event functions defined in \mod_hotquestion\event\course_module_viewed. Searched all the HQ files and deleted all the deprecated add_to_log code. diff --git a/version.php b/version.php index 1db5249..3553a6e 100644 --- a/version.php +++ b/version.php @@ -29,9 +29,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2023040700; // The current module version (Date: YYYYMMDDXX). -$plugin->requires = 2021051700; // Requires Moodle 3.11 version. -$plugin->cron = 0; // Period for cron to check this module (secs). +$plugin->version = 2023040700; // The current module version (Date: YYYYMMDDXX). +$plugin->requires = 2021051700; // Requires Moodle 3.11 version. +$plugin->cron = 0; // Period for cron to check this module (secs). $plugin->component = 'mod_hotquestion'; -$plugin->maturity = MATURITY_STABLE; -$plugin->release = "4.1.6 (Build: 2023040700)"; // User-friendly version number. +$plugin->maturity = MATURITY_STABLE; +$plugin->release = "4.1.6 (Build: 2023040700)"; // User-friendly version number. diff --git a/view.php b/view.php index 542cbad..bb7fab2 100644 --- a/view.php +++ b/view.php @@ -38,7 +38,7 @@ $id = required_param('id', PARAM_INT); // Course_module ID. $ajax = optional_param('ajax', 0, PARAM_BOOL); // Asychronous form request. -$action = optional_param('action', '', PARAM_ACTION); // Action(vote, newround). +$action = optional_param('action', '', PARAM_ACTION); // Action(vote, newround). $roundid = optional_param('round', -1, PARAM_INT); // Round id. $group = optional_param('group', -1, PARAM_INT); // Choose the current group.