643 Commits

Author SHA1 Message Date
Mark Nelson
5ca04d0ef1 MDL-18375 calendar: fixed issue when resaving the year in the datetime field causing the year to decrease
For example, a user may create a date/time profile field and set the 'Start year'
field to '2012'. Another user, using the Hijri calendar, may edit the name of
this field. They visit the settings page and in this case the date '1/1/2012'
is converted to '7/2/1433' in Hijri. So, the year '1433' is then displayed.
The user then changes the name of this field and saves the form. This is where
the issue occurs, as the date '1/1/1433' is converted into Gregorian, which
converts to the year '26/09/2011', so the year '2011' is saved in the DB, not
'2012'.
2013-09-05 18:32:16 +08:00
Mark Nelson
deed22ea39 MDL-18375 calendar: removed usage of the calendar type in the usergetdate function
The usergetdate function is not only used to display dates, it is also passed
to the function make_timestamp. This means users using another calendar type
other than Gregorian will generate incorrect timestamps which may be saved in
the DB or used to populate the date_selector and date_time_selector elements.
For example, when creating an assignment using another calendar type other
than Gregorian, the mod_form.php file calls $this->apply_admin_defaults()
which uses the function usergetmidnight to set the "Allow submissions from"
date to today's date and the "Due date" field to 7 days in the future. The
usergetmidnight function calls usergetdate which is then passed to
make_timestamp. Since the usergetdate function was using the calendar
type's timestamp_to_date_array function the date being passed to
make_timestamp was not in Gregorian. So, when using the hijri calendar the
year 1434 was being passed which was generating a large negative number as
the timestamp which was then used to populate the date fields.
2013-09-05 18:32:16 +08:00
Mark Nelson
6eafa4ddba MDL-18375 calendar: changed the name of the function factory to be more descriptive 2013-09-05 18:32:16 +08:00
Mark Nelson
2aefba53a5 MDL-18375 calendar: added condition to ensure calendar type exists before loading 2013-09-05 18:32:16 +08:00
Mark Nelson
df01e4c748 MDL-18375 calendar: PHPDoc tidy up as well as some other minor changes 2013-09-05 18:32:16 +08:00
Mark Nelson
f59ab4adc8 MDL-18375 calendar: renamed the userdate/usergetdate functions and changed them to abstract
Renamed the userdate/usergetdate functions in the calendar type to be more
descriptive and made them abstract to ensure developers implement this
functionality in their calendar type.

Also tidied up PHPDocs for these functions.
2013-09-05 18:32:16 +08:00
Mark Nelson
0ae36d6cfc MDL-18375 calendar: created a test calendar type to use for PHPUnit tests and added tests 2013-09-05 18:32:16 +08:00
Mark Nelson
022745acd2 MDL-18375 calendar: implemented the usage of the recently introduced automatic class loading 2013-09-05 18:32:16 +08:00
Mark Nelson
2f00e1b245 MDL-18375 calendar: huge refactor of the initial patch
1) Moved the calendar types location to a sub-folder in the calendar directory.
2) Removed/moved language strings.
3) Removed calendar types that should be downloaded as plugins.
4) Removed a Non-English language pack for the Gregorian calendar type that
should be downloaded separately.
5) Removed custom files responsible for checking for updates and uninstalling
calendar types, which should be done by core.
6) Removed JS from the calendar_month block as there is no non-JS alternative
provided and the JS written does not make use of the YUI library to ensure
multiple browser support.
7) Removed code from the base class responsible for creating timestamps that
are saved in the DB.
8) Added PHPDocs.

Note: In the original patch we are editing core functions responsible for saving
time in the database in the calendar base class. This is very dangerous, we do
not want to touch these functions as it could cause a complete fubar of the
database. There are places we are forcing the use of the gregorian calendar as
we are passing dates generated by the PHP date function, where as sometimes
we pass dates from usergetdate (which was being overwritten to return the
date specific to the calendar). We can not expect third party modules to
change the calendar type depending on the format they pass to these functions.
2013-09-05 18:30:05 +08:00
Shamim Rezaie
6dd59aabfa MDL-18375 calendar: added multiple calendar support
Conflicts:

	course/edit_form.php
	lib/db/install.xml
	lib/form/dateselector.php
	lib/form/datetimeselector.php
	lib/setup.php
2013-09-05 18:30:05 +08:00
Ankit Agarwal
ee74a2a19e MDL-41485 calendar: Replace value of action buttons on managesubscription page with int 2013-08-29 14:55:43 +08:00
Damyon Wiese
74df2951d1 Revert "MDL-39876 Change get_record('course') calls to get_course"
This reverts commit ab7632b74c331540c90229bf03d13aa2e6bdd9be.
2013-08-21 13:42:30 +08:00
Sam Hemelryk
6eee89bc8f Merge branch 'MDL-39876-master' of git://github.com/sammarshallou/moodle
Conflicts:
	course/lib.php
2013-08-21 12:08:46 +12:00
Sam Hemelryk
ead9cce340 Merge branch 'MDL-41157-master' of git://github.com/danpoltawski/moodle 2013-08-21 10:48:02 +12:00
sam marshall
ab7632b74c MDL-39876 Change get_record('course') calls to get_course 2013-08-15 11:31:20 +01:00
Dan Poltawski
d20b0aa567 MDL-41157 calendar: improve calendar_get_course_cached
The function get_course() introduced in 2.5.1 will use $COURSE and
$SITE to avoid an uncessary DB query, simplifying the logic of this
function and improving perf.
2013-08-14 11:05:27 +08:00
Dan Poltawski
3607961d8f MDL-41157 calendar: add unit tests for calendar_get_course_cached 2013-08-14 11:05:27 +08:00
Dan Poltawski
f37c923d14 MDL-19171 fix trailing whitespace 2013-08-13 10:06:34 +08:00
Dan Poltawski
41e337dd82 Merge branch 'MDL-19171' of https://github.com/bostelm/moodle 2013-08-13 09:57:52 +08:00
Henning Bostelmann
f6a5ffe802 MDL-19171 Calendar: show course links in more places 2013-08-08 17:55:01 +01:00
Petr Škoda
8252b7c291 MDL-40901 standardise core test case class and file names
This finally allows us to type only the class name when executing individual core test cases.
2013-08-04 22:10:31 +02:00
Eloy Lafuente (stronk7)
fb1788c598 Merge branch 'MDL-40424-master' of git://github.com/FMCorz/moodle
Conflicts:
	admin/oacleanup.php
2013-07-17 01:21:51 +02:00
Mary Evans
3ca6cd9665 MDL-40652 Calendar: Changed pagelayout from 'standard' to 'base' in calendar/export.php. 2013-07-14 15:01:50 +01:00
Frederic Massart
2e4c0c9181 MDL-40424 libraries: Deprecate context_instance_preload_sql() 2013-07-12 17:41:49 +08:00
Marina Glancy
f64998fab3 Merge branch 'MDL-39020-master' of git://github.com/ankitagarwal/moodle 2013-07-09 16:32:16 +10:00
Ankit Agarwal
0601e0eef6 MDL-40402 libraries: Replace get_system_context() with context_system::instance() in core 2013-07-04 15:41:06 +08:00
Ankit Agarwal
9dadb59064 MDL-39020 phpunit: Rename incorrect filename
Rename externallib_tests.php to externallib_test.php
Fix failing unit tests
2013-07-01 10:32:28 +08:00
Mary Evans
310845b92d MDL-38896 theme_bootstrapbase: Abbreviated weekdays in calendar/renderer.php + added @media css rule for calendar view. 2013-04-26 14:01:52 +01:00
Damyon Wiese
986adc066c MDL-39092 Yuilib - remove more -coverage.js files
Also slight tweak to the readme for someone who does not know shifter.
2013-04-15 09:02:11 +08:00
Ankit Agarwal
8aba76fddf MDL-37562 calendar: Updating upgrade.txt to mention calendar_update_subscription() 2013-04-08 15:03:31 +08:00
Ankit Agarwal
ab37339d09 MDL-37562 calendar: Remove all hardcoded updating of calendar subscriptions, use calendar_update_subscription() instead 2013-04-08 15:03:31 +08:00
Ankit Agarwal
5ae4e15344 MDL-37562 calendar: Adding unit tests for calendar_update_subscription() 2013-04-08 15:03:31 +08:00
Ankit Agarwal
1f7981e079 MDL-37562 calendar: Adding a api calendar_update_subscription() to update calendar events 2013-04-08 13:45:24 +08:00
Eloy Lafuente (stronk7)
dbc5692fc5 Merge branch 'MDL-38883-master' of git://github.com/danpoltawski/moodle 2013-04-05 02:48:37 +02:00
Dan Poltawski
d60ee78a5f MDL-38883 calendar: fix missing setType
Also remove duplicate sesskey definition (this is done by formslib
internally)
2013-04-04 17:17:37 +08:00
Andrew Robert Nicols
5e8dddc167 MDL-38666 JavaScript: Migrate moodle-calendar-evantmanager to use Shifter 2013-03-24 18:42:38 +00:00
Tim Hunt
658b9372ee MDL-38212 cron: display time and memory usage before each task.
This helps diagnose problems.

Also, call gc_collect_cycles between tasks, which may reduce the
frequency of out-of-memory errors.
2013-03-08 10:24:41 +00:00
Rajesh Taneja
9fd0cb9cb1 MDL-37338 Calendar: User will not see calendar subscription, which he/she can't edit
Signed-off-by: Rajesh Taneja <rajesh@moodle.com>
2013-03-04 01:49:02 +01:00
Dan Poltawski
85ef4d45ca Merge branch 'MDL-25853-master' of git://github.com/FMCorz/moodle 2013-02-04 10:12:54 +08:00
Frederic Massart
769c73ae6c MDL-25853 calendar: Fixed broken previous/next links 2013-01-30 08:59:11 +08:00
Eloy Lafuente (stronk7)
38e4fa58d5 MDL-37101 donot use donot. 2013-01-29 15:24:59 +01:00
Eloy Lafuente (stronk7)
0ed03cc295 Merge branch 'MDL-37101-master' of git://github.com/ankitagarwal/moodle
Conflicts:
	calendar/tests/externallib_tests.php
2013-01-29 15:19:11 +01:00
Aparup Banerjee
46112c0277 Merge branch 'MDL-37100-master' of git://github.com/ankitagarwal/moodle
Conflicts:
	version.php
2013-01-23 14:57:45 +08:00
Sam Hemelryk
8af97c2c2e Merge branch 'wip-MDL-35826-master' of git://github.com/phalacee/moodle
Conflicts:
	calendar/upgrade.txt
2013-01-23 10:03:42 +13:00
Ankit Agarwal
e6a1f8c102 MDL-37100 webservices: Adding warnings and cleaning up get_calendar_events() api 2013-01-22 13:54:49 +08:00
Ankit Agarwal
15c0b1ccef MDL-37101 phpunit: phpunit tests for ws api core_calendar_create_calendar_events 2013-01-22 13:53:23 +08:00
Ankit Agarwal
494a6389eb MDL-37101 webservices:Implement ws api core_calendar_create_calendar_events 2013-01-22 13:53:22 +08:00
Jason Fowler
512edd65d8 MDL-35826 - Calendar - Creating a caption containing the month name for mini-calendars 2013-01-22 13:51:09 +08:00
Sam Hemelryk
36546841f1 Merge branch 'MDL-36621-master' of git://github.com/ankitagarwal/moodle
Conflicts:
	calendar/lib.php
	lib/db/caches.php
	version.php
2013-01-22 16:35:03 +13:00
Ankit Agarwal
261a41f16d MDL-37100 webservices: Adding warnings and cleaning up get_calendar_events() api 2013-01-21 11:05:50 +08:00