Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

New feature: restricted time for participation for moodleoverflow forums #138

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a24909b
add setting to enable a limited mode
TamaroWalter May 9, 2023
fa24912
Merge branch 'master' into feature/limitedanswermode
TamaroWalter May 22, 2023
3e3c9b2
Update upgrade.php
TamaroWalter May 22, 2023
e1b23c9
answer button functionality updated, new helpicon class
TamaroWalter May 23, 2023
d4960a4
functionality is finished, testing missing
TamaroWalter May 30, 2023
9e9cb7a
code cleaning with code/phpdoc checker
TamaroWalter May 31, 2023
d8f8c85
github workflow error fixed, difference between student and teacher
TamaroWalter May 31, 2023
19616b6
github workflows error fixed
TamaroWalter May 31, 2023
f0bba6e
last workflow errors fixed
TamaroWalter May 31, 2023
5d2247a
workflow errors fixed
TamaroWalter May 31, 2023
499c6bd
workflow behat errors fixed
TamaroWalter May 31, 2023
377364a
Merge branch 'master' into feature/limitedanswermode
TamaroWalter May 28, 2024
01035e8
add global cfg statement
TamaroWalter May 28, 2024
f0ff660
adapt workflow to update branch
TamaroWalter May 28, 2024
438bffe
Merge branch 'update/M4.4' of github.com:learnweb/moodle-mod_moodleov…
TamaroWalter May 28, 2024
76345d9
codecleaning
TamaroWalter May 30, 2024
d5ed8f8
change the version as it has been increased since the last merge
NinaHerrmann Jun 6, 2024
b924e07
merge branches
NinaHerrmann Jun 6, 2024
7bb058c
fixed proken SQL Statement
NinaHerrmann Jun 6, 2024
96d7bcc
behat test for limitedanswer feature
TamaroWalter Jun 11, 2024
52a406c
codecleaning
TamaroWalter Jun 11, 2024
0004695
add limitedanswer time to backup
TamaroWalter Jun 13, 2024
c3c131b
solve merge conflicts
TamaroWalter Jun 13, 2024
01217a6
added a endtime adjusting settings, locallib, post, langfiles
NinaHerrmann Jun 17, 2024
1e22011
adjusted behat
NinaHerrmann Jun 17, 2024
2dc8f65
review
NinaHerrmann Jun 18, 2024
92edcb8
adjusted the mod_form to show warning in case answers exists
NinaHerrmann Jun 18, 2024
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
2 changes: 1 addition & 1 deletion backup/moodle2/backup_moodleoverflow_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected function define_structure() {
'name', 'intro', 'introformat', 'maxbytes', 'maxattachments', 'timecreated', 'timemodified',
'forcesubscribe', 'trackingtype', 'ratingpreference', 'coursewidereputation', 'allowrating',
'allowreputation', 'allownegativereputation', 'grademaxgrade', 'gradescalefactor', 'gradecat',
'anonymous', 'allowmultiplemarks', 'limitedanswer', ]);
'anonymous', 'allowmultiplemarks', 'la_starttime', 'la_endtime', ]);

// Define each element separated.
$discussions = new backup_nested_element('discussions');
Expand Down
3 changes: 2 additions & 1 deletion db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
<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="limitedanswer" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="la_starttime" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a default value (DEFAULT="0"), as later it is checked, if the time is 0 or not

<FIELD NAME="la_endtime" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
Expand Down
14 changes: 14 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,20 @@ function xmldb_moodleoverflow_upgrade($oldversion) {
// Moodleoverflow savepoint reached.
upgrade_mod_savepoint(true, 2024031105, 'moodleoverflow');
}
if ($oldversion < 2024061700) {
// Rename the first setting, to have a start and endtime for the limited answer mode.
$table = new xmldb_table('moodleoverflow');
$field = new xmldb_field('limitedanswer', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'allowmultiplemarks');
if ($dbman->field_exists($table, $field)) {
$dbman->rename_field($table, $field, 'la_starttime');
}
// Create the field for the end time.
$field = new xmldb_field('la_endtime', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'la_starttime');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2024061700, 'moodleoverflow');
}

return true;
}
5 changes: 2 additions & 3 deletions discussion.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@
$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], 'limitedanswer');
$limitedanswertime = $limitedanswersetting->limitedanswer;
$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 @@ -163,7 +162,7 @@

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

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

echo $OUTPUT->footer();
17 changes: 11 additions & 6 deletions lang/en/moodleoverflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,17 @@
$string['allowmultiplemarks'] = 'Multiple marks?';
$string['allowmultiplemarks_help'] = 'A post can be marked as helpful or solved. Within a discussion, only one post can be marked as helpful/solved. Click the checkbox to mark multiple posts as helpful/solved.';
$string['limitedanswerheading'] = 'Limited Answer Mode';
$string['limitedanswer'] = 'Start in a limited answer mode?';
$string['limitedanswerwarning_setup'] = 'You already activated the limited answer mode and it expired. Activating this mode another time is highly NOT recommended.';
$string['limitedanswerwarning_answers'] = 'There are already answered posts in this moodleoverflow. Activating limited answer mode now is highly NOT recommended';
$string['limitedanswer_help'] = 'If a Moodleoverflow starts in limited answer mode, students can not answer to questions until the set up date';
$string['limitedanswer_helpicon_student'] = 'This Moodleoverflow is in a limited answer mode. Posts can not be answered until {$a->limitedanswerdate}';
$string['limitedanswer_helpicon_teacher'] = 'This Moodleoverflow is in a limited answer mode until {$a->limitedanswerdate}. See Settings for more information';
$string['la_starttime'] = 'Start Time students can answer';
$string['la_endtime'] = 'End time students can answer';
$string['limitedanswerwarning_setup'] = 'You already activated the limited answer mode and it expired.';
$string['limitedanswerwarning_answers'] = 'There are already answered posts in this moodleoverflow.';
$string['limitedanswerwarning_conclusion'] = 'Activating limited answer mode might confuse users.';
$string['la_starttime_help'] = 'Students can not answer to questions until the set up date';
$string['la_endtime_help'] = 'Students can not answer to qustions after the set up date';
$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['limitedanswer_info_endtime'] = 'Posts can not be answered after {$a->limitedanswerdate}.';
$string['limitedanswer_helpicon_teacher'] = 'This can be changed in the settings of the Moodleoverflow.';
// Templates.
$string['reputation'] = 'Reputation';
$string['action_remove_upvote'] = 'Click to remove upvote';
Expand Down
Loading
Loading