Skip to content

Revert "New feature: restricted time for participation for moodleoverflow forums" #206

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
php: ['8.3']
moodle-branch: ['MOODLE_405_STABLE']
moodle-branch: ['MOODLE_404_STABLE']
database: ['pgsql']

steps:
Expand Down Expand Up @@ -111,17 +111,17 @@ jobs:
fail-fast: false
matrix:
php: ['8.0', '8.1', '8.2', '8.3']
moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE', 'MOODLE_405_STABLE']
moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE', 'MOODLE_404_STABLE']
database: ['mariadb', 'pgsql']
exclude:
- php: '8.0'
moodle-branch: 'MOODLE_404_STABLE'
- php: '8.0'
moodle-branch: 'MOODLE_405_STABLE'
- php: '8.2'
moodle-branch: 'MOODLE_401_STABLE'
- php: '8.3'
moodle-branch: 'MOODLE_401_STABLE'
- php: '8.3'
moodle-branch: 'MOODLE_402_STABLE'
- php: '8.3'
moodle-branch: 'MOODLE_403_STABLE'
include:
Expand Down
25 changes: 11 additions & 14 deletions backup/moodle2/backup_moodleoverflow_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,41 +39,35 @@ class backup_moodleoverflow_activity_structure_step extends backup_activity_stru
* @return backup_nested_element
*/
protected function define_structure() {

// To know if we are including userinfo.
$userinfo = $this->get_setting_value('userinfo');

// Define the root element describing the moodleoverflow instance.
$moodleoverflow = new backup_nested_element('moodleoverflow', ['id'], [
'name', 'intro', 'introformat', 'maxbytes', 'maxattachments', 'timecreated', 'timemodified',
'forcesubscribe', 'trackingtype', 'ratingpreference', 'coursewidereputation', 'allowrating',
'allowreputation', 'allownegativereputation', 'grademaxgrade', 'gradescalefactor', 'gradecat',
'anonymous', 'allowmultiplemarks', 'la_starttime', 'la_endtime', ]);
'name', 'intro', 'introformat', 'maxbytes', 'maxattachments', 'timecreated', 'timemodified', 'forcesubscribe',
'trackingtype', 'ratingpreference', 'coursewidereputation', 'allowrating', 'allowreputation', 'allownegativereputation',
'grademaxgrade', 'gradescalefactor', 'gradecat', 'anonymous', 'allowmultiplemarks', ]);

// Define each element separated.
$discussions = new backup_nested_element('discussions');
$discussion = new backup_nested_element('discussion', ['id'], [
'name', 'firstpost', 'userid', 'timestart', 'timemodified', 'usermodified', ]);

$posts = new backup_nested_element('posts');
$post = new backup_nested_element('post', ['id'], [
'parent', 'userid', 'created', 'modified',
'message', 'messageformat', 'attachment', 'mailed', 'reviewed', 'timereviewed', ]);
$post = new backup_nested_element('post', ['id'], ['parent', 'userid', 'created', 'modified', 'message',
'messageformat', 'attachment', 'mailed', 'reviewed', 'timereviewed', ]);

$ratings = new backup_nested_element('ratings');
$rating = new backup_nested_element('rating', ['id'], [
'userid', 'rating', 'firstrated', 'lastchanged', ]);
$rating = new backup_nested_element('rating', ['id'], ['userid', 'rating', 'firstrated', 'lastchanged']);

$discussionsubs = new backup_nested_element('discuss_subs');
$discussionsub = new backup_nested_element('discuss_sub', ['id'], [
'userid', 'preference', ]);
$discussionsub = new backup_nested_element('discuss_sub', ['id'], ['userid', 'preference']);

$subscriptions = new backup_nested_element('subscriptions');
$subscription = new backup_nested_element('subscription', ['id'], ['userid']);

$readposts = new backup_nested_element('readposts');
$read = new backup_nested_element('read', ['id'], [
'userid', 'discussionid', 'postid', 'firstread', 'lastread', ]);
$read = new backup_nested_element('read', ['id'], ['userid', 'discussionid', 'postid', 'firstread', 'lastread']);

$grades = new backup_nested_element('grades');
$grade = new backup_nested_element('grade', ['id'], ['userid', 'grade']);
Expand All @@ -100,6 +94,9 @@ protected function define_structure() {
$moodleoverflow->add_child($readposts);
$readposts->add_child($read);

$moodleoverflow->add_child($grades);
$grades->add_child($grade);

$moodleoverflow->add_child($tracking);
$tracking->add_child($track);

Expand Down
68 changes: 0 additions & 68 deletions classes/output/helpicon.php

This file was deleted.

4 changes: 0 additions & 4 deletions classes/tables/userstats_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
require_once($CFG->dirroot . '/mod/moodleoverflow/lib.php');
require_once($CFG->dirroot . '/mod/moodleoverflow/locallib.php');
require_once($CFG->libdir . '/tablelib.php');
use mod_moodleoverflow\output\helpicon;

/**
* Table listing all user statistics of a course
Expand Down Expand Up @@ -153,9 +152,6 @@ public function get_usertable() {
*/
public function set_helpactivity() {
global $CFG;
$htmlclass = 'helpactivityclass btn btn-link';
$content = get_string('helpamountofactivity', 'moodleoverflow');
$helpobject = new helpicon($htmlclass, $content);
$this->helpactivity = new \stdClass();
$this->helpactivity->iconurl = $CFG->wwwroot . '/pix/a/help.png';
$this->helpactivity->icon = \html_writer::img($this->helpactivity->iconurl,
Expand Down
2 changes: 0 additions & 2 deletions db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
<FIELD NAME="anonymous" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="needsreview" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="allowmultiplemarks" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="la_starttime" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="la_endtime" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
Expand Down
17 changes: 0 additions & 17 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,23 +292,6 @@ function xmldb_moodleoverflow_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2023040400, 'moodleoverflow');
}

if ($oldversion < 2024061700) {
// Define table moodleoverflow to be edited.
$table = new xmldb_table('moodleoverflow');

// Create the field fot the start time for the limited answer mode.
$field = new xmldb_field('la_starttime', XMLDB_TYPE_INTEGER, '10', null, null, null, 0, 'allowmultiplemarks');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Create the field for the end time for the limited answer mode.
$field = new xmldb_field('la_endtime', XMLDB_TYPE_INTEGER, '10', null, null, null, 0, 'la_starttime');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2024061700, 'moodleoverflow');
}

if ($oldversion < 2024072600) {
require_once($CFG->dirroot . '/mod/moodleoverflow/db/upgradelib.php');

Expand Down
4 changes: 1 addition & 3 deletions discussion.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
if ($marksetting->allowmultiplemarks == 1) {
$multiplemarks = true;
}
// Setting of limitedanswer. Limitedanswertime saves the timestamp, until the limitedanswer is on (0 if off).
$limitedanswersetting = $DB->get_record('moodleoverflow', ['id' => $moodleoverflow->id], 'la_starttime, la_endtime');

// Get the related coursemodule and its context.
if (!$cm = get_coursemodule_from_instance('moodleoverflow', $moodleoverflow->id, $course->id)) {
Expand Down Expand Up @@ -158,7 +156,7 @@

echo '<div id="moodleoverflow-posts"><div id="moodleoverflow-root">';

moodleoverflow_print_discussion($course, $cm, $moodleoverflow, $discussion, $post, $multiplemarks, $limitedanswersetting);
moodleoverflow_print_discussion($course, $cm, $moodleoverflow, $discussion, $post, $multiplemarks);
echo '</div></div>';

echo $OUTPUT->footer();
11 changes: 0 additions & 11 deletions lang/en/moodleoverflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,7 @@
$string['invalidpostid'] = 'Invalid post ID - {$a}';
$string['invalidratingid'] = 'The submitted rating is neither an upvote nor a downvote.';
$string['jump_to_next_post_needing_review'] = 'Jump to next post needing to be reviewed.';
$string['la_endtime'] = 'End time students can answer';
$string['la_endtime_help'] = 'Students can not answer to qustions after the set up date';
$string['la_starttime'] = 'Start time students can answer';
$string['la_starttime_help'] = 'Students can not answer to questions until the set up date';
$string['lastpost'] = 'Last post';
$string['limitedanswer_helpicon_teacher'] = 'This can be changed in the settings of the Moodleoverflow.';
$string['limitedanswer_info_endtime'] = 'Posts can not be answered after {$a->limitedanswerdate}.';
$string['limitedanswer_info_start'] = 'This Moodleoverflow is in a limited answer mode.';
$string['limitedanswer_info_starttime'] = 'Posts can not be answered until {$a->limitedanswerdate}.';
$string['limitedanswerheading'] = 'Limited Answer Mode';
$string['limitedanswerwarning_answers'] = 'There are already answered posts in this Moodleoverflow.';
$string['limitedanswerwarning_conclusion'] = 'Activating or changing limited answer mode might confuse users.';
$string['mailindexlink'] = 'Change your forum preferences: {$a}';
$string['manydiscussions'] = 'Discussions per page';
$string['markallread'] = 'Mark all posts in this discussion as read';
Expand Down
Loading
Loading