diff --git a/classes/event/comment_created.php b/classes/event/comment_created.php index 305c9a9..53445cf 100644 --- a/classes/event/comment_created.php +++ b/classes/event/comment_created.php @@ -33,7 +33,7 @@ * @copyright 2013 Rajesh Taneja * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class comment_deleted extends \core\event\comment_deleted { +class comment_created extends \core\event\comment_created { /** * Get URL related to the action. * @@ -49,7 +49,7 @@ public function get_url() { * @return string */ public function get_description() { - return "The user with id '$this->userid' created the comment with id '$this->objectid' from the hotquestion activity with " . - "course module id '$this->contextinstanceid'."; + return "The user with id '$this->userid' created the comment with id '$this->objectid' from the hotquestion " . + "activity with course module id '$this->contextinstanceid'."; } } diff --git a/classes/local/results.php b/classes/local/results.php index 9e6bbd8..c66dbc1 100644 --- a/classes/local/results.php +++ b/classes/local/results.php @@ -277,35 +277,11 @@ public static function hotquestion_get_question_comment_count($question, $cm, $c // 20210313 Not in use yet. Part of future development. global $DB; - $debug['In results.php CP8a entering function hotquestion_get_question_comment_count $question: '] = $question; - $debug['In results.php CP8b showing $cm: '] = $cm; - $debug['In results.php CP8c showing $course: '] = $course; - - //$context = context_module::instance($cm->id); - - //$debug['In results.php CP8d showing $context: '] = $context; - $debug['In results.php CP8d showing itemid: '] = $question->id; - $debug['In results.php CP8d showing commentarea: '] = 'hotquestion_questions'; - //$debug['In results.php CP8d showing $context->id: '] = $context->id; - - - $debug['In results.php CP8DB showing $DB->count_records: '] = ($DB->count_records('comments', array('itemid' => $question->id, - 'commentarea' => 'hotquestion_questions', - 'contextid' => $cm->id))) ; - - if ($count = $DB->count_records('comments', array('itemid' => $question->id, 'commentarea' => 'hotquestion_questions', 'contextid' => $cm->id))) { - $debug['In results.php CP8e showing $count: '] = $count; - print_object($debug); - return $count; } else { - $debug['In results.php CP8f showing $count: '] = $count; - - print_object($debug); - return 0; } } @@ -322,11 +298,9 @@ public static function hotquestion_display_question_comments($question, $cm, $co // 20210313 Not in use yet. Part of future development. global $CFG, $USER, $OUTPUT, $DB; $html = ''; - - if ($question->approved) { + if (($question->approved) || (has_capability('mod/hotquestion:manageentries', $context))) { // Get question comments and display the comment box. $context = context_module::instance($cm->id); - //require_once($CFG->dirroot.'/comment/lib.php'); $cmt = new stdClass(); $cmt->component = 'mod_hotquestion'; $cmt->context = $context; @@ -336,44 +310,11 @@ public static function hotquestion_display_question_comments($question, $cm, $co $cmt->itemid = $question->id; $cmt->showcount = true; $comment = new comment($cmt); - - $debug['In results.php tracking comments dev cp 6data showing $course->id: '] = $course->id; - $debug['In results.php tracking comments dev cp 6data showing $cmt->component: '] = $cmt->component; - $debug['In results.php tracking comments dev cp 6data showing $cmt->context: '] = $cmt->context; - $debug['In results.php tracking comments dev cp 6data showing $cmt->course: '] = $cmt->course; - $debug['In results.php tracking comments dev cp 6data showing $cmt->cm: '] = $cmt->cm; - $debug['In results.php tracking comments dev cp 6data showing $cmt->area: '] = $cmt->area; - $debug['In results.php tracking comments dev cp 6data showing $cmt->itemid: '] = $cmt->itemid; - - // 20220215 All three of these show the comment interface, but it is non-responsive, at the moment. - //$html = html_writer::tag('div', $comment->output(true), array('class' => 'hotquestion-comments')); $html = $comment->output(true); - // This third one, shows the comment in the wrong place. Still non-responsive. - //$html = $comment->output(false); - - - //$debug['In results.php tracking comments dev cp 6A showing $cmt: '] = $cmt; - //$debug['In results.php tracking comments dev cp 6A showing $html: '] = $html; - - - // 20220216 Thought about putting comments_viewed event here, but changed my mind. - // When this is excuted you are NOT viewing the comments. - // The interface is on the page, but it is closed and you cannot read any comments. - - } else { - //$html = html_writer::tag('div', get_string("nocommentuntilapproved", "pcast"), array('class' => 'pcast-episode-notice')); - $html = html_writer::tag('div', get_string("nocommentuntilapproved", "hotquestion")); -//print_object('///////////////////////////////////////////////////////////////////////////////////////'); - - $debug['In results.php tracking comments dev cp 6B showing $html: '] = $html; - - } - - $debug['In results.php tracking comments dev cp 6C showing $html: '] = $html; - //print_object($debug); + $html = html_writer::tag('div', get_string("nocommentuntilapproved", "hotquestion")); + } return $html; - //return $comment; } /** @@ -397,7 +338,7 @@ public static function hotquestion_comment_permissions($commentparam) { return array('ask' => true, 'view' => true); } - /** + /** * Return the editor and attachment options when creating a Hot Question question. * * @param stdClass $course Course object. @@ -456,7 +397,6 @@ public static function add_new_question($fromform) { // If approval is required, then mark as not approved so only teachers can see it. $data->approved = 0; } - // ...$context = context_module::instance($this->cm->id);... $context = context_module::instance($fromform->cm->id); // If marked anonymous and anonymous is allowed then change from actual userid to guest. if (isset($fromform->anonymous) && $fromform->anonymous && $fromform->instance->anonymouspost) { diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index 1302ccd..349871f 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -311,11 +311,6 @@ public static function delete_data_for_user(approved_contextlist $contextlist) { $DB->delete_records_select('hotquestion_votes', "id $isql AND userid = :userid", $params); $params = ['instanceid' => $cm->instance, 'userid' => $userid]; $DB->delete_records_select('hotquestion_questions', 'hotquestion = :instanceid AND userid = :userid', $params); - - - - //$DB->delete_records('hotquestion_questions', ['hotquestion' => $instanceid, 'userid' => $userid]); - //$DB->delete_records('hotquestion_votes', ['voter' => $userid]); } } } diff --git a/db/access.php b/db/access.php index b3664dc..91daf60 100644 --- a/db/access.php +++ b/db/access.php @@ -51,7 +51,6 @@ $capabilities = array( 'mod/hotquestion:manageentries' => array( - 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => array( @@ -115,7 +114,6 @@ ) ), 'mod/hotquestion:rate' => array( - 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => array( @@ -127,7 +125,6 @@ 'mod/hotquestion:comment' => array( 'riskbitmask' => RISK_SPAM, - 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => array( diff --git a/db/upgrade.php b/db/upgrade.php index 193fb46..73a5493 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -275,7 +275,7 @@ function xmldb_hotquestion_upgrade($oldversion=0) { upgrade_mod_savepoint(true, 2020121700, 'hotquestion'); } - if ($oldversion < 2022021500) { + if ($oldversion < 2022041000) { // Define field scale to be added to hotquestion. $table = new xmldb_table('hotquestion'); @@ -339,7 +339,7 @@ function xmldb_hotquestion_upgrade($oldversion=0) { } // Hotquestion savepoint reached. - upgrade_mod_savepoint(true, 2022021500, 'hotquestion'); + upgrade_mod_savepoint(true, 2022041000, 'hotquestion'); } return $result; } diff --git a/lib.php b/lib.php index 1db5855..97e1d30 100644 --- a/lib.php +++ b/lib.php @@ -491,7 +491,7 @@ function hotquestion_comment_validate($commentparam) { } $context = context_module::instance($cm->id); - if ($hotquestion->approval and !$record->approved and !has_capability('mod/hotquestion:approve', $context)) { + if ($hotquestion->approval and !$record->approved and !has_capability('mod/hotquestion:manageentries', $context)) { throw new comment_exception('notapproved', 'hotquestion'); } // Validate context id. @@ -501,7 +501,7 @@ function hotquestion_comment_validate($commentparam) { // Validation for comment deletion. if (!empty($commentparam->commentid)) { if ($comment = $DB->get_record('comments', array('id' => $commentparam->commentid))) { - if ($comment->commentarea != 'hotquestion_episode') { + if ($comment->commentarea != 'hotquestion_questions') { throw new comment_exception('invalidcommentarea'); } if ($comment->contextid != $commentparam->context->id) { @@ -514,10 +514,6 @@ function hotquestion_comment_validate($commentparam) { throw new comment_exception('invalidcommentid'); } } - $debug['lib.php Tracking hotquestion_comment_validate exit: '] = 'Returning true validation in function in HQ lib.php file!'; - - //print_object($debug); - return true; } @@ -539,10 +535,6 @@ function hotquestion_comment_validate($commentparam) { * @return array */ function hotquestion_comment_permissions($commentparam) { -//print_object('///////////////////////////////////////////////////////////////////////'); -//print_object('In Hot Question lib.php file at line 504 checking comment permissions.'); -//print_object(array('post' => true, 'view' => true)); -//print_object('///////////////////////////////////////////////////////////////////////'); return array('post' => true, 'view' => true); } diff --git a/mod_form.php b/mod_form.php index 7f57800..83cc46e 100644 --- a/mod_form.php +++ b/mod_form.php @@ -186,23 +186,14 @@ public function definition() { $mform->addHelpButton('removelabel', 'inputapprovallabel', 'hotquestion'); $mform->addRule('removelabel', null, 'required', null, 'client'); $mform->addRule('removelabel', get_string('maximumchars', '', 20), 'maxlength', 20, 'client'); -/* - $mform->addElement('selectyesno', 'allowcomments', get_string('allowcomments', 'hotquestion')); - $mform->setDefault('allowcomments', $hotquestionconfig->allowcomments); - $mform->addHelpButton('allowcomments', 'allowcomments', 'hotquestion'); - if (empty($CFG->usecomments)) { - $mform->hardFreeze('comments'); - $mform->setConstant('comments', 0); - } -*/ - // Allow comments. + + // 20220410 Allow comments. if ($hotquestionconfig->allowcomments) { $mform->addElement('selectyesno', 'comments', get_string('allowcomments', 'hotquestion')); $mform->addHelpButton('comments', 'allowcomments', 'hotquestion'); $mform->setDefault('comments', 0); } - // Availability. $mform->addElement('header', 'availabilityhdr', get_string('availability')); diff --git a/module.js b/module.js deleted file mode 100644 index 416e013..0000000 --- a/module.js +++ /dev/null @@ -1,149 +0,0 @@ -// This file is part of Moodle - http://moodle.org/ -// -// Moodle is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Moodle is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Moodle. If not, see . - -/** - * Handle submitting question and voting action of hotquestion - * using Ajax of YUI. - * - * @package mod_hotquestion - * @copyright 2011 Sun Zhigang - * @copyright 2016 onwards AL Rachels drachels@drachels.com - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -var trim; - -M.modHotquestion = {}; - -M.modHotquestion.Y = {}; - -M.modHotquestion.questionbox = {}; -M.modHotquestion.submitbutton = {}; - -M.modHotquestion.init = function(Y) { - M.modHotquestion.Y = Y; - - // Init question box. - M.modHotquestion.questionbox = Y.one('#id_question'); - M.modHotquestion.questionbox.on('valueChange', M.modHotquestion.questionchanged); - - // Init submit button. - M.modHotquestion.submitbutton = Y.one('#id_submitbutton'); - if (M.modHotquestion.getquestion() == '') { - M.modHotquestion.submitbutton.set('disabled', 'disabled'); - } - Y.on("submit", M.modHotquestion.submit, '#mform1'); - - // Bind toolbar buttons. - Y.on('click', M.modHotquestion.refresh, '.hotquestion_vote'); - Y.on('click', M.modHotquestion.refresh, '.toolbutton'); - - // Bind io events. - Y.on('io:success', M.modHotquestion.iocomplete); - Y.on('io:failure', M.modHotquestion.iofailure); -}; - -M.modHotquestion.iocomplete = function(transactionid, response, arguments) { - var Y = M.modHotquestion.Y; - - // Update questions. - var contentdiv = Y.one('#questions_list'); - contentdiv.set("innerHTML", response.responseText); - - // Clean up form if this is a submit IO. - if (arguments.caller == 'submit') { - M.modHotquestion.questionbox.set('value', ''); - M.modHotquestion.questionbox.removeAttribute('disabled'); - M.modHotquestion.submitbutton.set('disabled', 'disabled'); - } - - // Rebind buttons. - Y.on('click', M.modHotquestion.refresh, '.hotquestion_vote'); - Y.on('click', M.modHotquestion.refresh, '.toolbutton'); -}; - -M.modHotquestion.iofailure = function(transactionid, response, arguments) { - M.modHotquestion.submitbutton.removeAttribute('disabled'); - M.modHotquestion.questionbox.removeAttribute('disabled'); - alert(M.str.hotquestion.connectionerror); -}; - -M.modHotquestion.refresh = function(e) { - e.preventDefault(); - - var data = e.currentTarget.get('href').split('?', 2)[1]; - data += '&ajax=1'; - var cfg = { - method: "GET", - data: data, - arguments: { - caller: 'refresh', - } - }; - - var request = M.modHotquestion.Y.io('view.php', cfg); -}; - -M.modHotquestion.getquestion = function() { - var question = M.modHotquestion.questionbox.get('value'); - return trim(question); -}; - -M.modHotquestion.questionchanged = function(e) { - var question = M.modHotquestion.getquestion(); - var submitbutton = M.modHotquestion.submitbutton; - if (question == '') { - submitbutton.set('disabled', 'disabled'); - } else { - submitbutton.removeAttribute('disabled'); - } -}; - -M.modHotquestion.submit = function(e) { - e.preventDefault(); - - var question = M.modHotquestion.getquestion(); - if (question == '') { - return; // Ignore empty question. - } - - // To avoid multiple clicks and editing. - M.modHotquestion.submitbutton.set('disabled', 'disabled'); - M.modHotquestion.questionbox.set('disabled', 'disabled'); - - // Get all input components. - var inputs = M.modHotquestion.Y.all('#mform1 input'); - - // Construct post data. - var data = ''; - inputs.each(function(node, index, nodelist) { - if (node.get('type') != 'checkbox') { - data += node.get('name') + '=' + node.get('value') + '&'; - } else { - data += node.get('name') + '=' + node.get('checked') + '&'; - } - }); - data += 'question=' + question + '&'; - data += 'ajax=1'; - - var cfg = { - method: "POST", - data: data, - arguments: { - caller: 'submit', - } - }; - var request = M.modHotquestion.Y.io('view.php', cfg); -}; \ No newline at end of file diff --git a/renderer.php b/renderer.php index e142815..d249c8c 100644 --- a/renderer.php +++ b/renderer.php @@ -351,37 +351,24 @@ public function questions($allowvote = true) { $authorinfo = '
'.get_string('authorinfohide', 'hotquestion', $a).'
'; } - // Add rating and comments here. - // print_object('Printing the $question.'); - // print_object($question); - $debug = array(); - - //if (!$question->approved) { - $comment = ''; - $debug['In renderer.php tracking comments dev cp 5a showing $comment is blank: '] = $comment; - - //} else { - - // 20210306 Generate comment box using API. - if (($this->hotquestion->instance->comments) && ($question->approved)) { - list($context, $course, $cm) = get_context_info_array($context->id); - // Initialize and then check to see how many comments for this question. - require_once($CFG->dirroot . '/comment/lib.php'); - comment::init(); - - $comment = results::hotquestion_display_question_comments($question, $cm, $context, $course); - - $debug['In renderer.php tracking comments dev cp 5b showing $comment: '] = $comment; - } - //} - - //print_object($debug); - + // 20220410 Add rating and comments here. + $comment = ''; + // 20210306 Generate comment box using API. + // 20220410 Got it working. + if ((($this->hotquestion->instance->comments) + && ($question->approved)) + || (($this->hotquestion->instance->comments) + && (has_capability('mod/hotquestion:manageentries', $context)))) { + list($context, $course, $cm) = get_context_info_array($context->id); + // Initialize and then check to see how many comments for this question. + require_once($CFG->dirroot . '/comment/lib.php'); + comment::init(); + $comment = results::hotquestion_display_question_comments($question, $cm, $context, $course); + } // Rating and comments should go in next line after authorinfo. $line[] = $content.$authorinfo.$comment; - // Get current priority value to show. $tpriority = $question->tpriority; // Get current heat total to show. diff --git a/tests/behat/Add Hot Question Activity.feature b/tests/behat/Add Hot Question Activity.feature new file mode 100644 index 0000000..b38e54e --- /dev/null +++ b/tests/behat/Add Hot Question Activity.feature @@ -0,0 +1,41 @@ +@mod @mod_hotquestion +Feature: Add HotQuestion activity + In order to allow work effectively + As a teacher + I need to be able to create HotQuestion activities + + Scenario: Add a hotquestion activity and complete the activity as a student + Given the following "users" exist: + | username | firstname | lastname | email | + | teacher1 | Teacher | 1 | teacher1@example.com | + | student1 | Student | 1 | student1@example.com | + And the following "courses" exist: + | fullname | shortname | category | + | Course 1 | C1 | 0 | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + And I log in as "teacher1" + And I am on "Course 1" course homepage with editing mode on + And I add a "Hot Question" to section "1" and I fill the form with: + | Activity Name | Test Hot Question name | + | Description | Test Hot Question Description | + And I log out + When I log in as "student1" + And I am on "Course 1" course homepage + And I follow "Test hotquestion name" + And I set the following fields to these values: + | Submit your question here: | First question | + And I press "Click to post" + And I set the following fields to these values: + | Submit your question here: | Second question | + And I set the field "Display as anonymous" to "1" + And I press "Click to post" + # Admin User verifies his posts are logged. + And I navigate to "Logs" in current page administration + Then I should see "Admin User" in the "#report_log_r1_c1" "css_element" + And I should see "Added a question" in the "#report_log_r1_c5" "css_element" + And I should see "Admin User" in the "#report_log_r4_c1" "css_element" + And I should see "Added a question" in the "#report_log_r4_c5" "css_element" + Then I log out diff --git a/upgrade.txt b/upgrade.txt index f1a250f..1e9c69f 100644 --- a/upgrade.txt +++ b/upgrade.txt @@ -1,6 +1,12 @@ This files describes changes in the Hot Question code. -=== 4.0.2 === +=== 4.0.3 === released - pending +20220220 HotQuestion_484 - Need to update GDPR Code. Made changes as needed until + the code ran without errors when I ran: php adhoc_task.php --execute. As of + 20220410 I have added comments so they need to be included in the GDPR Code. + + +=== 4.0.2 === released 20220410 20211029 Merged pull request #51 made by Vidalia. 20211029 Ran codechecker.php. 20211029 HotQuestion_758 - According to codechececker.php underscores in functions need @@ -27,14 +33,11 @@ This files describes changes in the Hot Question code. 20211103 HotQuestion_766 - Line 69: Function print_error() has been deprecated; in view.php. Switched to using the throw new moodle_exception(). Already have the needed language string. -20211104 HotQuestion_487 - Need to implement Comments. Restarted dev work on this. - There is a proposal to greatly change comments at: - https://docs.moodle.org/dev/Rewrite_Comment_API. This will need to be watched! +20211104 HotQuestion_487 - Need to implement Comments. Finally got this working + by deleting module.js and all references to it in view.php. 20211219 HotQuestion_790 - Would be nice to have, View all Hot Questions link on view.php page. Added code for an href link to view.php file about line 290. Also had to add one new string, viewallhotquestions. -20220220 HotQuestion_484 - Need to update GDPR Code. Made changes as needed until - the code ran without errors when I ran: php adhoc_task.php --execute. 20220225 Merged pull request #52 made by ehsan42. Entered info into another behat ticket, HotQuestion_486 - Need to update Behat tests for new remove confirmation. @@ -44,7 +47,11 @@ This files describes changes in the Hot Question code. 20220321 Hot Question_834 - Need new hotquestion_supports($feature) for Moodle 4.0. Created two versions of the switch ($feature), and added a branch check to control which is used. The first switch includes the needed new feature, - while the second, does not. + while the second, does not. +20220410 Hot Question_841 - The file module.js is no longer needed so it and + all references to it need removal. Removed the file and all references to it. +20220410 Ran codechecker.php. + === 4.0.1 === 20210516 Hot Question_695 - Invalid get_string() identifier: 'hotquestion:rate'. diff --git a/version.php b/version.php index b2d6d46..87a5639 100644 --- a/version.php +++ b/version.php @@ -29,9 +29,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2022021501; // The current module version (Date: YYYYMMDDXX). +$plugin->version = 2022041000; // 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.2 (Build: 2022021501)"; // User-friendly version number. +$plugin->release = "4.0.2 (Build: 2022041000)"; // User-friendly version number. diff --git a/view.php b/view.php index 3ac3e9d..73ad27c 100644 --- a/view.php +++ b/view.php @@ -53,17 +53,11 @@ // Confirm login. require_login($hq->course, true, $hq->cm); -//require_once($CFG->dirroot . '/comment/lib.php'); -//comment::init(); - $context = context_module::instance($hq->cm->id); $entriesmanager = has_capability('mod/hotquestion:manageentries', $context); $canask = has_capability('mod/hotquestion:ask', $context); -//require_once($CFG->dirroot . '/comment/lib.php'); -//comment::init(); - if (!$entriesmanager && !$canask) { throw new moodle_exception(get_string('accessdenied', 'hotquestion')); } @@ -96,17 +90,6 @@ $PAGE->set_context($context); $PAGE->set_cm($hq->cm); $PAGE->add_body_class('hotquestion'); - $jsmodule = array( - 'name' => 'mod_hotquestion', - 'fullpath' => '/mod/hotquestion/module.js', - 'requires' => array('base', 'io', 'node', 'event-valuechange'), - 'strings' => array( - array('invalidquestion', 'hotquestion'), - array('connectionerror', 'hotquestion') - ) - ); - - $PAGE->requires->js_init_call('M.mod_hotquestion.init', null, true, $jsmodule); } require_capability('mod/hotquestion:view', $context); @@ -115,50 +98,6 @@ $output = $PAGE->get_renderer('mod_hotquestion'); $output->init($hq); -// print_object('spacer 1'); -// print_object('spacer 2'); -// print_object('spacer 3'); -// print_object('spacer 4x'); -// print_object('Printing $hq'); -// print_object($hq); -// die; - -/////////////////////////////////// -// put data processing here???? -// $data->id = $cm->id; -/* -list ($editoroptions, $attachmentoptions) = results::hotquestion_get_editor_and_attachment_options($course, - $context, - $entry); - -$data = file_prepare_standard_editor($data, - 'text', - $editoroptions, - $context, - 'mod_hotquestion', - 'entry', - $data->entryid); -$data = file_prepare_standard_filemanager($data, - 'attachment', - $attachmentoptions, - $context, - 'mod_hotquestion', - 'attachment', - $data->entryid); - -// 20201119 Added $hotquestion->editdates setting. -$form = new hotquestion_form(null, array( - 'current' => $data, - 'cm' => $cm, - 'hotquestion' => $hotquestion->editdates, - 'editoroptions' => $editoroptions, - 'attachmentoptions' => $attachmentoptions -)); -*/ - - -/////////////////////////////////// - // Process submitted question. if (has_capability('mod/hotquestion:ask', $context)) { $mform = new hotquestion_form(null, array($hq->instance->anonymouspost, $hq->cm)); @@ -184,20 +123,12 @@ $newentry->tpriority = 0; $newentry->submitbutton = $fromform->submitbutton; - // print_object('Printing $newentry'); - // print_object($newentry); - // print_object('Printing $fromform'); - // print_object($fromform); - // die; - if (!$hq->add_new_question($fromform)) { // Returns 1 if valid question submitted. redirect('view.php?id='.$hq->cm->id, get_string('invalidquestion', 'hotquestion')); } if (!$ajax) { redirect('view.php?id='.$hq->cm->id, get_string('questionsubmitted', 'hotquestion')); } - //print_object('Printing $fromform'); - //print_object($fromform); die; } } @@ -309,7 +240,7 @@ // is a member of more than one group, or has access to all groups). groups_print_activity_menu($cm, $CFG->wwwroot.'/mod/hotquestion/view.php?id='.$cm->id); - // Print the text box for typing submissions in. + // Print the textarea box for typing submissions in. if (has_capability('mod/hotquestion:ask', $context)) { $mform->display(); }