Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-43129

Add time alongside date for database activity when restricting access to view only

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_24_STABLE

      Description

      In the database activity the "available from" and "read only from" admin settings only allow you to input a date, which differs from most Moodle restriction fields as there are no settings to specify a time within that date - which means that the restriction occurs at midnight rather than being able to choose a time.

      I asked on the Moodle forums about this (https://moodle.org/mod/forum/discuss.php?d=244778#p1061449) and Itamar Tzadok came back with a suggested code tweak that could be used to switch from date_selector to date_time_selector. Unfortunately our IT procedures mean I can't alter the core code so would need to wait until a change filtered through into core - so I'm putting in a request for this enhancement.
      I've included Itamar's proposed fix here to keep the information handy.

      Thanks, Gordon

      In mod/data/mod_form.php around line 29, change

      $mform->addElement('date_selector', 'timeavailablefrom', get_string('availablefromdate', 'data'), array('optional'=>true));

      $mform->addElement('date_selector', 'timeavailableto', get_string('availabletodate', 'data'), array('optional'=>true));

      $mform->addElement('date_selector', 'timeviewfrom', get_string('viewfromdate', 'data'), array('optional'=>true));

      $mform->addElement('date_selector', 'timeviewto', get_string('viewtodate', 'data'), array('optional'=>true));

      to

      $mform->addElement('date_time_selector', 'timeavailablefrom', get_string('availablefromdate', 'data'), array('optional'=>true));

      $mform->addElement('date_time_selector', 'timeavailableto', get_string('availabletodate', 'data'), array('optional'=>true));

      $mform->addElement('date_time_selector', 'timeviewfrom', get_string('viewfromdate', 'data'), array('optional'=>true));

      $mform->addElement('date_time_selector', 'timeviewto', get_string('viewtodate', 'data'), array('optional'=>true));

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: