Moodle

Database - Viewable from-to is not working

Details

  • Database:
    MySQL
  • Affected Branches:
    MOODLE_18_STABLE

Description

Viewable from-to, the settings shows no reaction, i see a topic in forum here on moodle.org http://moodle.org/mod/forum/discuss.php?d=56412 they have the same problem.

Andy

Activity

Hide
Andy Tagliani added a comment -

More than 6 month ago, i hope i can to demand, is there any solution or not? I check it out in the newest version 1.8.4 and 1.9, the bug or problem is already exist! The PHP-Version is change to 5.2.5

Andy

Show
Andy Tagliani added a comment - More than 6 month ago, i hope i can to demand, is there any solution or not? I check it out in the newest version 1.8.4 and 1.9, the bug or problem is already exist! The PHP-Version is change to 5.2.5 Andy
Hide
Ashley Holman added a comment -

Here's a patch which implements the available/viewable dates for 1.9 and should work on 1.8 too. To apply it:

cd <moodle-base-dir>
patch -p0 < moodle19_data_dates.patch

The dates have been implemented like this:

  • "Viewable" dates control when the entire activity can be viewed. If a user tries to access the activity outside of the viewable date range, they will get a message displaying the viewable from/to dates and will not be able to view or add/edit records.
  • "Available for submission" dates control when records can be added/edited. If the database is accessed when it is not available, records can be viewed and comments can be made, but no adds/edits are permitted.

Note: This patch adds an if() block around some existing code but doesn't indent it, in order to keep the patch file simple and not add a big block of indented lines. If someone wants to commit this, the indentation should be fixed up.

Cheers
Ashley.

Show
Ashley Holman added a comment - Here's a patch which implements the available/viewable dates for 1.9 and should work on 1.8 too. To apply it: cd <moodle-base-dir> patch -p0 < moodle19_data_dates.patch The dates have been implemented like this:
  • "Viewable" dates control when the entire activity can be viewed. If a user tries to access the activity outside of the viewable date range, they will get a message displaying the viewable from/to dates and will not be able to view or add/edit records.
  • "Available for submission" dates control when records can be added/edited. If the database is accessed when it is not available, records can be viewed and comments can be made, but no adds/edits are permitted.
Note: This patch adds an if() block around some existing code but doesn't indent it, in order to keep the patch file simple and not add a big block of indented lines. If someone wants to commit this, the indentation should be fixed up. Cheers Ashley.
Hide
Antonio Piedras Morente added a comment -

This patch works fine, but the dates "Viewable" and "Available for submission" affects editing teacher too.
To solve this, we can add this in the patch:
Changes:
file: /mod/data/view.php
line: if (!$viewable) {
for: if (!$viewable and !has_capability('moodle/legacy:editingteacher', $context)) {

file: /mod/data/edit.php
line: if (!data_isavailable($data)) {
for: if (!data_isavailable($data) and !has_capability('moodle/legacy:editingteacher', $context)) {

Cheers
Antonio

Show
Antonio Piedras Morente added a comment - This patch works fine, but the dates "Viewable" and "Available for submission" affects editing teacher too. To solve this, we can add this in the patch: Changes: file: /mod/data/view.php line: if (!$viewable) { for: if (!$viewable and !has_capability('moodle/legacy:editingteacher', $context)) { file: /mod/data/edit.php line: if (!data_isavailable($data)) { for: if (!data_isavailable($data) and !has_capability('moodle/legacy:editingteacher', $context)) { Cheers Antonio
Hide
Petr Škoda (skodak) added a comment -

hello Robert,
if you find some time could you please evaluate this?

Show
Petr Škoda (skodak) added a comment - hello Robert, if you find some time could you please evaluate this?
Hide
Ashley Holman added a comment -

Hi Petr,

I think this should be OK to commit (along with Antonio's change). I developed this for a university here in Adelaide and they've been using it for a semester and it's working well for them.

Cheers
Ashley

Show
Ashley Holman added a comment - Hi Petr, I think this should be OK to commit (along with Antonio's change). I developed this for a university here in Adelaide and they've been using it for a semester and it's working well for them. Cheers Ashley
Hide
Steve Bond added a comment -

I have incorporated Antonio's corrections into the patch and reposted it here for others' convenience.

Show
Steve Bond added a comment - I have incorporated Antonio's corrections into the patch and reposted it here for others' convenience.
Hide
Helen Foster added a comment -

This issue is again being discussed in the forums http://moodle.org/mod/forum/discuss.php?d=127873

Adding a fix version in the hope that the issue can be resolved soon.

Show
Helen Foster added a comment - This issue is again being discussed in the forums http://moodle.org/mod/forum/discuss.php?d=127873 Adding a fix version in the hope that the issue can be resolved soon.
Hide
Petr Škoda (skodak) added a comment -

I am afraid this will have to wait till 2.0, new features and significant changes in 1.9.x are not expected, sorry

Please do not use legacy caps at all in new code ('moodle/legacy:editingteacher')

Show
Petr Škoda (skodak) added a comment - I am afraid this will have to wait till 2.0, new features and significant changes in 1.9.x are not expected, sorry Please do not use legacy caps at all in new code ('moodle/legacy:editingteacher')
Hide
Steve Bond added a comment -

This is effectively fixed in 2.0 via a change in the terminology and functionality. What was "viewable from/to" is now "read-only from/to". Combining this with the "available from/to" settings and you can achieve the necessary control over availability of the database.

I have updated Moodle docs to clarify how it works:
http://docs.moodle.org/20/en/Database_settings#Available_from.2Fto

Show
Steve Bond added a comment - This is effectively fixed in 2.0 via a change in the terminology and functionality. What was "viewable from/to" is now "read-only from/to". Combining this with the "available from/to" settings and you can achieve the necessary control over availability of the database. I have updated Moodle docs to clarify how it works: http://docs.moodle.org/20/en/Database_settings#Available_from.2Fto

Dates

  • Created:
    Updated: