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

Add the ability to format the years in the new calendar plugin.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.6
    • Component/s: Calendar
    • Labels:
    • Testing Instructions:
      Hide

      Test One ('Date/Time' user profile field works as expected)

      1. Log in as an administrator.
      2. Visit [Administration ► Site administration ► Users ► Accounts ► User profile fields].
      3. Click to add a 'Date/Time' field. Check that no errors are displayed.
      4. Set the 'Short name' and 'name' field to whatever you like.
      5. Set the 'Start year' to 1950.
      6. Set the 'End year' to 2020.
      7. Click to save changes.
      8. Go to [Administration ► My profile settings ► Edit profile] and expand "Other fields". Make sure there are no errors displayed.
      9. Enable the date field and check that the range is from 1950 - 2020.
      10. Save some date.
      11. Head back to the profile page and check that the date saved properly. Make sure there are no errors displayed.

      Test Two (Unit tests don't fail)

      1. Run the following phpunit test: phpunit calendar/tests/calendartype_test.php and ensure that there are no errors.

      Test Three (Year month day configuration)

      • This requires a bit of fooling around with code.
      1. Easiest way to test this is to edit calendar/type/gregorian/classes/structure.php.
      2. find the public function get_date_order().
      3. Change the $dateinfo array to a different order such as:

        $dateinfo['year'] = $this->get_years();
        $dateinfo['month'] = $this->get_months();
        $dateinfo['day'] = $this->get_days();
        

      4. Create or edit a course.
      5. The "Course start date" should be in the order above or to what ever you changed it to.

      Test Four (Check basic calendar functionality still works)

      1. Create a course and change the course start date to some time in the past or the future.
      2. Make sure that the course format is set to "Weekly format".
      3. [Test] Enter the course and ensure that the course sections start from the date that you specified.
      4. [Test] Check a couple of modules (such as assign and quiz) and make sure that the date selectors work, the correct date is used, and that there are no errors.
      Show
      Test One ('Date/Time' user profile field works as expected) Log in as an administrator. Visit [Administration ► Site administration ► Users ► Accounts ► User profile fields] . Click to add a 'Date/Time' field. Check that no errors are displayed. Set the 'Short name' and 'name' field to whatever you like. Set the 'Start year' to 1950. Set the 'End year' to 2020. Click to save changes. Go to [Administration ► My profile settings ► Edit profile] and expand "Other fields". Make sure there are no errors displayed. Enable the date field and check that the range is from 1950 - 2020. Save some date. Head back to the profile page and check that the date saved properly. Make sure there are no errors displayed. Test Two (Unit tests don't fail) Run the following phpunit test: phpunit calendar/tests/calendartype_test.php and ensure that there are no errors. Test Three (Year month day configuration) This requires a bit of fooling around with code. Easiest way to test this is to edit calendar/type/gregorian/classes/structure.php. find the public function get_date_order(). Change the $dateinfo array to a different order such as: $dateinfo['year'] = $this->get_years(); $dateinfo['month'] = $this->get_months(); $dateinfo['day'] = $this->get_days(); Create or edit a course. The "Course start date" should be in the order above or to what ever you changed it to. Test Four (Check basic calendar functionality still works) Create a course and change the course start date to some time in the past or the future. Make sure that the course format is set to "Weekly format". [Test] Enter the course and ensure that the course sections start from the date that you specified. [Test] Check a couple of modules (such as assign and quiz) and make sure that the date selectors work, the correct date is used, and that there are no errors.
    • Affected Branches:
      MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull Master Branch:
      MDL-41664_master
    • Story Points:
      8
    • Sprint:
      BACKEND Sprint 6

      Description

      Currently the calendar plugin only takes a starting year and ending year as information for creating the select box.

      I'm trying to create a Japanese calendar type, and years don't run in this fashion. Additional information also needs to be added about which emperor was ruling during that year.

      I propose a new method get_years(), which works in the same fashion as get_days() and get_months().

      I have also now included the code to change the order of the select boxes used for selecting the date as well.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  18/Nov/13