Compare commits

...

144 Commits

Author SHA1 Message Date
Sam Hemelryk f2867a8672 Moodle 2.3.1 release 2012-07-06 11:27:47 +12:00
Sam Hemelryk 62e9e694b7 weekly release 2.3+ 2012-07-06 10:04:54 +12:00
AMOS bot b24e6ed930 Automatically generated installer lang files 2012-07-06 09:53:08 +12:00
AMOS bot 50b1caaf86 Automatically generated installer lang files 2012-07-06 09:53:08 +12:00
AMOS bot 2ddf3ffcd2 Automatically generated installer lang files 2012-07-06 09:53:08 +12:00
Eloy Lafuente (stronk7) b73a7519c4 Revert "MDL-33303 Filepicker: resized to match HTML editor and made resizable"
This reverts commit e5c2bbd0f7.
2012-07-05 23:22:05 +02:00
David Balch 2425229c88 MDL-34063 XHTML files should use the HTML icon, not the markup icon 2012-07-05 18:34:55 +02:00
Eloy Lafuente (stronk7) 353580b0e3 Merge branch 'MDL-33453-reference' of git://github.com/mudrd8mz/moodle into MOODLE_23_STABLE 2012-07-05 17:07:22 +02:00
Eloy Lafuente (stronk7) 4539b33788 Revert "MDL-30912 - lib - A tidy up of the submit url jump functions for greater ease with accessability."
This reverts commit a1a00aeee7.
2012-07-05 16:10:37 +02:00
Marina Glancy 9b47ec7bb3 MDL-33746 make folder view look like filemanager tree view 2012-07-05 14:36:28 +02:00
Tim Hunt b9c20952a3 MDL-34065 questions: also fix two typos in comments.
Amended to change 2 accordin => according
2012-07-05 13:50:21 +02:00
Tim Hunt e819ff4263 MDL-34065 lib: improve two debugging messages.
If the string passed to get_string is empty, say that. Don't say that it
contains illegal characters.

When relying on the __call magic in plugin_renderer_base, when the
method cannot be found, include the right class name in the error
message.
2012-07-05 13:50:14 +02:00
Tim Hunt b20b1c32bf MDL-34145 postgres driver: fix get_tables perf on <= 9.0
The query of the information_schema view seems to be painfully slow on
older versions of postgres (2000ms instead of 20ms). Therefore, it is
worth detecting that case, and using a more postgres specific feedback.
This is particularly important for 2.3+ unit tests.

Thanks to Petr Skoda for his help with this.
2012-07-05 03:41:08 +02:00
Sam Hemelryk 1e9130ae6e MDL-33770 webservices: Fixed error with core_group_create_groups when no enrolment key provided 2012-07-05 09:22:35 +12:00
Tim Hunt c57fa60f3d MDL-32062 question engine: fixup tests that this change broke.
The test data was wrong, and was triggering the work-around code that
MDL-32062 introduced. I fixed the test data.

Also, I fixed one of the tests, that had been broken.
2012-07-04 19:24:48 +08:00
Dan Poltawski 617d260dd7 MDL-34035 - fix typo in comment
Thanks Sam!
2012-07-04 10:39:48 +08:00
Tim Hunt b86a48c5b9 MDL-34035 help links: allow other types of URL for plugins.
For third-parth plugins, in can be helpful if the 'More help' links in
help pop-ups (the ones that come from $string['..._link'] string in the
language file) can go to other places.

This change support two other sorts of URL in addition to the standard
'course/editing' type of link that goes to MoodelDocs.

You can use absolute URLs, starting http:// or https:///

You can use a link starting %%WWWROOT%%, and that token is replaced by
$CFG->wwwroot to make the link.
2012-07-04 10:39:42 +08:00
Barbara Ramiro a2c2ab3e1a MDL-33542, MDL-33542 Select dialogue details aligned
And loading gif smaller
2012-07-04 10:25:09 +08:00
Eloy Lafuente (stronk7) bbe378a63e Merge branch 'w27_MDL-33876_m23_delenrol' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-04 04:16:05 +02:00
Marina Glancy 9d5ced06c1 MDL-34047 repository URL downloader must say that it returns only images 2012-07-04 09:51:51 +08:00
Sam Hemelryk 6019d2b2f3 Merge branch 'MDL-32614_23' of git://github.com/stronk7/moodle into MOODLE_23_STABLE 2012-07-04 13:15:03 +12:00
Eloy Lafuente (stronk7) ccef7fe8d0 MDL-32614 lti: on restore, clean any typeid to convert the tool to selfcontained.
This is known to be imperfect, awaiting for MDL-34161 to fix the whole thing. Also,
unrelated, there are some basiclti => lti replacements.
2012-07-04 02:15:02 +02:00
Chris Scribner f2b7928df7 MDL-32614: Removing code which disassociated LTI instances from their tool types upon restore. 2012-07-04 02:14:56 +02:00
Dan Poltawski 9f6f18d2c2 MDL-31692 mod_lti - ensure that various mforms are used properly
* typesettings.php and instructor_edit_tool_type.php are tided
   up properly to ensure proper use for form data
* An incorrect PARAM type is corrected for typename
2012-07-04 10:08:13 +12:00
Sam Hemelryk 848fc30a2d Merge branch 'MDL-32062_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-04 09:53:51 +12:00
sam marshall 8530aac4a8 MDL-33466: Group restriction should hide activity even with 'show availability' option
This is a modified version of fix by Luke Tucker at NetSpot - thanks.
2012-07-04 09:38:08 +12:00
Jonathan Harker 3bcca35591 MDL-27125 better manage file handles when downloading multiple files.
Based on Dongsheng Cai's branch: s11_MDL-27125_curl_file_handler_master
2012-07-04 09:33:12 +12:00
Kevin Wiliarty e3f4094ac8 MDL-33749 follow redirects for URL downloader 2012-07-04 08:34:55 +12:00
Sam Hemelryk 7df86db31d Merge branch 'wip-mdl-32787-m23' of git://github.com/rajeshtaneja/moodle into MOODLE_23_STABLE 2012-07-04 08:26:03 +12:00
Eloy Lafuente (stronk7) b41f914927 Merge branch 'wip-MDL-33303-m23' of git://github.com/samhemelryk/moodle into MOODLE_23_STABLE 2012-07-03 16:18:41 +02:00
sam marshall a5f68fb2c2 MDL-33426 Completion: Multilang activity names wrong in alt/title 2012-07-03 16:08:57 +02:00
Rajesh Taneja 28f23328c5 MDL-32787 user: rule required for custom profile fields applies to all users editing own profile 2012-07-03 13:48:18 +08:00
Frederic Massart 3e1648723f MDL-33828 Portfolio: prevent notices while exporting to portfolios 2012-07-03 16:35:48 +12:00
sam marshall 60a72a03b2 MDL-33937 Paged course view: Allows view of sections that are not visible 2012-07-03 12:30:10 +08:00
Dan Poltawski 741543e9a7 Merge branch 'master_MDL-33938' of git://github.com/danmarsden/moodle into MOODLE_23_STABLE
Conflicts:
	mod/scorm/db/upgrade.php
2012-07-03 12:18:29 +08:00
Adrian Greeve a1a00aeee7 MDL-30912 - lib - A tidy up of the submit url jump functions for greater ease with accessability. 2012-07-03 12:12:19 +08:00
Frederic Massart 9152878ed3 MDL-30903 Accessibility: user profile page uses table headers 2012-07-03 11:51:19 +08:00
Dan Poltawski 81b2147092 Merge branch 'MDL-34008_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-03 11:47:23 +08:00
Dan Poltawski e570ee4b63 Merge branch 'w27_MDL-34036_m23_bulkrole' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-03 11:40:14 +08:00
Sam Hemelryk 0afd953daf Merge branch 'w27_MDL-34115_m23_arrayofarrayssort' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-03 15:15:18 +12:00
Dan Poltawski f224fd9498 Merge branch 'MDL-30883_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-03 11:01:44 +08:00
Jason Fowler 69b2bab32e MDL-33957 - Installation - Fixing field lengths so they are long enough for data entry, and don't distort page rendering 2012-07-03 14:58:55 +12:00
Dan Poltawski f95e28e0ff Merge branch 'w27_MDL-34123_m23_newpasslang' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-03 10:39:17 +08:00
Marina Glancy f5cd2c6ef1 MDL-33837 picking file from server files should not copy 'Main file' property 2012-07-03 10:24:43 +08:00
Sam Hemelryk 10ff22d6f6 Merge branch 'MDL-33987_M23' of git://github.com/lazydaisy/moodle into MOODLE_23_STABLE 2012-07-03 14:11:40 +12:00
ISHIKAWA Takayuki d0d407f0bb MDL-33757 gradebook: Adding support to sort userlist by email address 2012-07-03 09:45:26 +08:00
Damyon Wiese 8ad459ed58 MDL-33499: Display final grade on the grading form with a link to the grader report
AMOS BEGIN
 CPY [currentgrade,mod_assignment],[currentgrade,mod_assign]
AMOS END
2012-07-03 02:28:49 +02:00
Eloy Lafuente (stronk7) cf5b51af0e Merge branch 'wip-MDL-33521-m23' of git://github.com/samhemelryk/moodle into MOODLE_23_STABLE 2012-07-03 01:59:22 +02:00
Jerome Mouneyrac 18c264790a MDL-33770 Web service: create_groups should not require enrolmentkey 2012-07-03 11:49:30 +12:00
Frederic Massart 7523da44fc MDL-33814 Output renderers: table cell objects are only created when needed 2012-07-03 11:36:43 +12:00
Frederic Massart bd9ecafba9 MDL-33796 Glossary: removed unused missing string 2012-07-03 01:05:19 +02:00
Davo Smith 5200c254a1 MDL-34029 update mod/upgrade.txt to include course drag and drop upload 2012-07-03 10:55:48 +12:00
Dan Poltawski 3d43075cfd MDL-9214 - improve comment for custom login instructions 2012-07-03 10:47:21 +12:00
Dan Poltawski 5df543a60e MDL-32286 - fix ambigious english string 2012-07-03 10:42:57 +12:00
Dan Poltawski bed1c4a943 MDL-33990 - yui2: remove 2 uncessary requirements
We no longer use yui2 logger and connection in set_user_prefs
2012-07-03 10:37:10 +12:00
Sam Hemelryk 66ff4c0a06 MDL-34014 cssoptimiser: Fixed some aweful spelling 2012-07-03 10:34:13 +12:00
Dan Poltawski 9ea8065f1c MDL-34014 lang - fix CSS optimiser spelling errors 2012-07-03 10:32:45 +12:00
Dan Poltawski eadad29dc9 MDL-34022 lang - the html editor supports all browsers we support
So remove misleading 'some browers only'
2012-07-03 10:30:38 +12:00
Dan Poltawski e068b3dbe3 MDL-34033 lang - ammend configenableajax
Now better reflects its functionality.
2012-07-03 10:27:57 +12:00
Damyon Wiese 5809f6912b MDL-33848: Prevent file listings in the assignment module having an ugly border 2012-07-03 10:21:19 +12:00
Matthew G. Switlik 815aecf6c7 MDL-28151 resource: prevent cropping of large images 2012-07-03 10:14:04 +12:00
Tim Hunt 15d8babd1a MDL-23813 glossary filter: add missing YUI dependency
Fix found by Huy Hoang. I am just making a commit.
2012-07-02 23:52:48 +02:00
Aparup Banerjee a78e4e9147 MDL-23254 Authentication : used httpswwwroot as root url during authentication procedure where $PAGE->https_required() is specified. 2012-07-03 09:42:42 +12:00
Dan Poltawski d9edd25111 MDL-34081 dml: mssql driver was using case insensitve sql 2012-07-02 21:08:18 +02:00
Eloy Lafuente (stronk7) 1a76bbe2e4 MDL-34121 bump versions to efectively get the upgrade performed.
Conflicts:
	version.php
2012-07-02 18:18:22 +02:00
Eloy Lafuente (stronk7) af63cc85df Merge branch 'w27_MDL-34121_m23_killbackupmess' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-02 18:16:54 +02:00
Marina Glancy dff8438e50 MDL-33948 mod_forum correctly passes files options to file_save_draft_area_files() 2012-07-02 17:44:43 +08:00
Marina Glancy ec3fe6e123 MDL-33948 file_save_draft_area_files() validates if references are allowed and allows unlimited file size 2012-07-02 17:44:38 +08:00
Andrew Robert Nicols 770cee9696 MDL-33916 Add unit tests to ensure that is_enrolled returns correctly 2012-07-02 17:36:55 +08:00
Andrew Robert Nicols 1db89f5e6a MDL-33916 Ensure that capabilities are checked for cached user enrolments 2012-07-02 17:36:51 +08:00
Dan Poltawski 5c1b768aec MDL-31802 - navigation: add a comment about session reduction 2012-07-02 17:30:21 +08:00
Dan Poltawski f2b4305c8e Merge branch 'MDL-31802_23' of git://github.com/aolley/moodle into MOODLE_23_STABLE 2012-07-02 17:24:56 +08:00
Marina Glancy 502ecc4c9f MDL-34117 Correctly pass accepted_types to dnduploader 2012-07-02 17:10:02 +08:00
Dan Poltawski 34c10b84fb Merge branch 'w27_MDL-34120_m23_delpass' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-02 16:48:28 +08:00
Dan Poltawski f09dcd4b6d Merge branch 'w27_MDL-34125_m23_tablename' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-02 16:46:27 +08:00
Tim Hunt 2b1b2017a6 MDL-34109 quiz cron: timelimit are timeclose of 0 are special.
If the timelimit or timeclose of a quiz are 0, this means 'no
restriction', rather than '1970' or '0 seconds'. We need to handle these
special cases correctly in the code that looks for quiz attempts that
might be in the wrong state.
2012-07-02 16:44:35 +08:00
Tim Hunt 592443f4e1 MDL-34109 quiz cron: change whitespace before applying the fix.
This commit just changes the white-space, but does not change any of the
actual code. This is so that the commit I am about to make, which will
change the code, will be easier to understand.
2012-07-02 16:44:29 +08:00
Dan Poltawski dabab94b6e Merge branch 'w27_MDL-34045_m23_idnumber' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-02 16:34:17 +08:00
Dan Poltawski 039089f3aa Merge branch 'MDL-34025_m23' of https://github.com/markn86/moodle into MOODLE_23_STABLE 2012-07-02 16:28:12 +08:00
Dan Poltawski 9cb942820c Merge branch 'MDL-33924_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-02 16:19:19 +08:00
Dan Marsden 0ba1ee1dd2 MDL-33914 SCORM show scrollbar on TOC if too long. 2012-07-02 16:14:23 +08:00
Dan Marsden 7debccbdee MDL-33835 Marking Guide - set currentfocus var to the first criteria comment to avoid JS errors. 2012-07-02 16:10:26 +08:00
Dan Poltawski 9a211c853d Merge branch 'MDL-33780_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE 2012-07-02 16:07:32 +08:00
Marina Glancy ed8cab855e MDL-33721 show loading icon after file has been selected in filepicker, prevent clicking select button twice 2012-07-02 16:00:21 +08:00
Dan Poltawski 6253f69246 Merge branch 'm23_MDL-33053_AICC_flattened_TOC' of git://github.com/scara/moodle into MOODLE_23_STABLE 2012-07-02 15:50:18 +08:00
Dan Poltawski 49ac5deff6 Merge branch 'MDL-32605-m23' of git://github.com/ankitagarwal/moodle into MOODLE_23_STABLE 2012-07-02 15:45:59 +08:00
Andrew Davis 6737eda426 MDL-25476 messages: switched some notification emails to come from the support contact instead of admin 2012-07-02 15:41:29 +08:00
Frederic Massart c7132d7c93 MDL-9073 Glossary: uncategorised entries are printable 2012-07-02 15:34:06 +08:00
Kanika Goyal d9b9bfd288 MDL-31203 mod_forum: advanced search posts must be newer older than date, reverts date 2012-07-02 15:24:10 +08:00
Rossiani Wijaya ec70cf6ef1 fixed the ->spacer <br> param 2012-07-02 15:20:43 +08:00
Mark Nielsen a6b0b36cdc fixed undefined variable 2012-07-02 15:20:37 +08:00
Dan Poltawski 3e839bd513 Merge branch 'MDL-31987_assignment_m23' of git://github.com/rwijaya/moodle into MOODLE_23_STABLE 2012-07-02 15:12:47 +08:00
Dan Poltawski 8633142f53 Merge branch 'MDL-34019-pluginlib-notice' of git://github.com/mudrd8mz/moodle into MOODLE_23_STABLE 2012-07-02 15:02:37 +08:00
Tim Hunt 564b878840 MDL-34054 quiz reports: missing context.
quiz_report_should_show_grades needs to know the context, so pass it
through.
2012-07-02 14:57:29 +08:00
Dan Poltawski c3f59e043c MDL-33995 - unit tests: fix class name collision 2012-07-02 14:52:57 +08:00
Rossiani Wijaya 4b0e6f38fa MDL-31987 Assignment module: fixed upgrade version 2012-07-02 14:51:47 +08:00
Dan Poltawski fb978df0f0 MDL-31987 Assignment module: fix sql for postgres. 2012-07-02 14:49:29 +08:00
Rossiani Wijaya 45353da409 MDL-31987 Assignment module: Assignment count submissions correctly.
For advanced upload assignment, store file count of each submission
into assignment_submissions.numfiles

When counting submissions, if the assignment is open and tracking
drafts, only submissions which has send for marking are counted.
Otherwise, submissions which has numfiles > 0 are counted.

Also change a hardcoded 'submitted' to ASSIGNMENT_STATUS_SUBMITTED.

This patch was originally written by: Sunner Sun <sunner@gmail.com>.

I made some modifation to fixed count_real_submissions() query (ref: MDL-32207) in /mod/assignment/type/upload/assignment.class.php file
2012-07-02 14:49:29 +08:00
Jerome Mouneyrac 08641906e1 MDL-33995 Course external PHPunit test + externallib_testcase helper class 2012-07-02 14:13:44 +08:00
Jerome Mouneyrac 6b5ce20c16 MDL-33776 Web services: get_categories - subcategories should be checked against visible/theme keys 2012-07-02 14:13:38 +08:00
Dan Marsden 800fb7533e MDL-33978 SCORM activity completion - don't tiggere completion update state on creation of SCORM 2012-07-02 13:44:35 +08:00
Andrew Davis 789c8b8194 MDL-33686 Repositories: we were accessing a non-existent variable and thus never displaying the maximum number of attachments 2012-07-02 14:53:50 +12:00
Andreas Grabs e9aa190a37 MDL-33932_master - added array_unique() 2012-07-02 14:32:09 +12:00
Andreas Grabs 786ad3511c MDL-33627 - feedback block now show all feedbacks 2012-07-02 14:06:42 +12:00
Sam Hemelryk abfc9e2512 MDL-33521 css: Fixed invalid CSS in core CSS and plugin styles.css files 2012-07-02 11:34:53 +12:00
Frederic Massart e5c2bbd0f7 MDL-33303 Filepicker: resized to match HTML editor and made resizable 2012-07-02 11:34:27 +12:00
Eloy Lafuente (stronk7) 1494f20da3 weekly release 2.3+ 2012-07-02 00:54:05 +02:00
Eloy Lafuente (stronk7) 4fa4a727b4 Merge branch 'MDL-34119_M23' of git://github.com/lazydaisy/moodle into MOODLE_23_STABLE 2012-07-02 00:30:28 +02:00
Sam Hemelryk 4be710795a Merge branch 'MDL-34044-23' of git://github.com/srynot4sale/moodle into MOODLE_23_STABLE 2012-07-02 08:22:35 +12:00
Eloy Lafuente (stronk7) 9ea40f27a0 Merge branch 'w27_MDL-34130_m23_recordsettests' of git://github.com/skodak/moodle into MOODLE_23_STABLE 2012-07-01 22:01:22 +02:00
Petr Škoda 19ba134d3b MDL-34130 prevent some warning in PHPStorm 2012-07-01 21:50:56 +02:00
Petr Škoda d0812ba0e6 MDL-34130 test recordset data is static
We do not want recordset results to be affected by subsequent update or delete queries.
2012-07-01 21:40:37 +02:00
Petr Škoda a2b8856558 MDL-34130 add missing rs close
Thanks Eloy!
2012-07-01 21:40:36 +02:00
Petr Škoda a61e8c8ebe MDL-34130 test interaction of recordsets and transactions 2012-07-01 21:40:36 +02:00
Petr Škoda 1cf431a329 MDL-34130 test nested recordset iteration 2012-07-01 21:40:36 +02:00
Petr Škoda 9ee97228bd MDL-34130 fix data inserts in recordset tests 2012-07-01 21:40:36 +02:00
Petr Škoda 43fb824bd2 MDL-34125 fix regression when deleting activity modules
Credit goes to Gordon Bateson.
2012-07-01 10:05:22 +02:00
Eloy Lafuente (stronk7) 9d774c9445 Merge branch 'MDL-32249c-23' of github.com:srynot4sale/moodle into MOODLE_23_STABLE 2012-07-01 02:14:39 +02:00
Sun Zhigang 8b3d60557c MDL-31201 wiki: fix a hardcoded string 2012-06-30 22:01:08 +02:00
Petr Škoda 134affd943 MDL-34123 use user's lang when sending new emails 2012-06-30 20:46:30 +02:00
Petr Škoda 5df5bcba99 MDL-34036 fix course role user selector 2012-06-30 15:40:30 +02:00
Petr Škoda 93fd7cb10c MDL-34121 drop unused backup tables that were supposed to be dropped long ago
The backup/restore leftovers that referenced these will be dropped in 2.4
2012-06-30 14:00:52 +02:00
Mary Evans 3705a88629 MDL-34119_M23 theme_splash: Added colourswitcher.js and associated code in layout files and lib.php 2012-06-30 12:02:22 +01:00
Petr Škoda 5cb477c4a1 MDL-34120 do not try to create new passwords for incorrectly deleted users
There is still some code that ignores delete_user() and instead hacks the user table directly, skip the borked user records for now when sending new passwords.
2012-06-30 09:07:18 +02:00
Petr Škoda 4aabce216c MDL-33876 skip deleted users in enrol_database sync 2012-06-30 08:44:55 +02:00
Petr Škoda b273b20a7c MDL-34115 fix sorting in blocks admin UI
Comparison of arrays is not locale aware.
2012-06-30 08:34:02 +02:00
Petr Škoda f8e05deb35 MDL-34045 fix invalid idnumber field type in cohort form 2012-06-30 07:57:51 +02:00
Mary Evans 263e8c144c MDL-34119_M23 theme_splash: removed redundant js call in lib.php. Added lang option to config.php + amended lang output in layout files. Added some css to style langmenu + removed redundant loginicon in pagelayout.css 2012-06-30 00:50:34 +01:00
Aparup Banerjee b574c078a6 MDL-34096 Installation : Added 2.3 upgrade line to db upgrade scripts. 2012-06-29 11:37:01 +08:00
Adam Olley a44c303d63 MDL-31802: Remove section summaries from navigation_cache 2012-06-28 11:03:49 +09:30
Tim Hunt e5ff0d3278 MDL-33924 quiz: incorrect foreign key definition.
Thanks to Jean-Michel Vedrine for spotting this.≈
2012-06-27 08:26:26 +01:00
Mark Nelson faca708484 MDL-34025 - quiz secure window: fix popup closing 2012-06-27 14:31:03 +08:00
Ankit Agarwal fc14c79fc9 MDL-32605 calendar: Fixing the missing parameter for get_string call 2012-06-27 13:34:39 +08:00
Aaron Barnes 2670a3a684 MDL-34044 completion: Fix regression caused by MDL-26626 2012-06-27 11:54:41 +12:00
David Mudrák d81d6ea2c3 MDL-33453 Make it clear what search_references() and search_references_count() are good for
Initially it was not clear enough that these two methods are supposed to
be used for looking for references to a stored_file only. So the docs
comments are improved and unittests added to illustrate the usage.

The patch also removes the unittest for get_references_by_storedfile()
as its usage is already covered in other test methods.
2012-06-26 16:28:30 +02:00
Tim Hunt b0cf55f145 MDL-34008 formslib: repeat_elements replace {no} for submits & buttons 2012-06-26 10:38:50 +01:00
Tim Hunt 5af6c9676e MDL-33780 question import: strip UTF8 BOM
Previously, if there was a byte-order mark at the start of the file, the
import would just break, which was silly. Much better to just strip it
off.
2012-06-26 10:34:19 +01:00
Tim Hunt 225e058685 MDL-30883 question flags: aria attributes for accessibility
Also, update code to use html_writer, and fix pointer style when not
editable.
2012-06-26 10:31:36 +01:00
Tim Hunt 3d348a3cc7 MDL-32062 question engine: fix re-grading attempts from 2.0
The code to upgrade attempts from before Moodle 2.0 to 2.1 created
attempt data that was not exactly the same as a new attempt created in
2.1+. This did not matter very much - revew and the quiz reports all
worked OK - but it broke on re-grade.

These changes detect the problem data in the re-grade code, an apply a
work-around so that the re-grade gives the correct result.
2012-06-26 10:11:37 +01:00
David Mudrák 896f9ae83b MDL-34019 Fix response item key name 2012-06-26 09:12:35 +02:00
Mary Evans 11824b0461 MDL-33987_M23 theme_anomaly: amended some css values to style dock better also removed exclude parent theme stylesheet as it refered to a none existant file in base theme. 2012-06-26 03:40:37 +01:00
Aaron Barnes 9b57d5bc38 MDL-32249 completion: Make grade criteria more consistent
Also, round course grades and remove hardcoded string.

Note: This patch also removes the ability to update the course grade
from the completion interface
2012-06-26 14:12:53 +12:00
Dan Marsden e0d90c54c0 MDL-33938 SCORM use consistant naming for maxattempt setting - match setting name with db field name to help when matching default settings 2012-06-22 21:51:04 +12:00
Matteo Scaramuccia 8ac8aae4f4 MDL-33053 AICC: Incorrect Table Of Content hierarchy using "structured" AICC
courses
[Fix] 'scorm_scoes' doesn't contain all the entries described in the DES file
[Fix] HTMLizing the parent relationship, described in the CST file,
      fails: it considers 'index = 0' (found) equals to 'false' (not found)
2012-05-22 00:47:01 +02:00
207 changed files with 2270 additions and 621 deletions
+15 -8
View File
@@ -131,12 +131,25 @@
$table->setup();
$tablerows = array();
// Sort blocks using current locale.
$blocknames = array();
foreach ($blocks as $blockid=>$block) {
$blockname = $block->name;
if (file_exists("$CFG->dirroot/blocks/$blockname/block_$blockname.php")) {
$blocknames[$blockid] = get_string('pluginname', 'block_'.$blockname);
} else {
$blocknames[$blockid] = $blockname;
}
}
collatorlib::asort($blocknames);
foreach ($blocknames as $blockid=>$strblockname) {
$block = $blocks[$blockid];
$blockname = $block->name;
if (!file_exists("$CFG->dirroot/blocks/$blockname/block_$blockname.php")) {
$blockobject = false;
$strblockname = '<span class="notifyproblem">'.$blockname.' ('.get_string('missingfromdisk').')</span>';
$strblockname = '<span class="notifyproblem">'.$strblockname.' ('.get_string('missingfromdisk').')</span>';
$plugin = new stdClass();
$plugin->version = $block->version;
@@ -151,7 +164,6 @@
$incompatible[] = $block;
continue;
}
$strblockname = get_string('pluginname', 'block_'.$blockname);
}
$delete = '<a href="blocks.php?delete='.$blockid.'&amp;sesskey='.sesskey().'">'.$strdelete.'</a>';
@@ -222,12 +234,7 @@
$delete,
$settings
);
$tablerows[] = array(strip_tags($strblockname), $row); // first element will be used for sorting
}
collatorlib::asort($tablerows);
foreach ($tablerows as $row) {
$table->add_data($row[1]);
$table->add_data($row);
}
$table->print_html();
+4
View File
@@ -30,5 +30,9 @@ function xmldb_tool_customlang_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+4 -4
View File
@@ -3,7 +3,7 @@
width: 60%;
margin: auto;
padding: 1em;
border: 1px black solid;
border: 1px solid black;
-moz-border-radius: 6px;
}
.path-admin-tool-health dl.healthissues {
@@ -35,15 +35,15 @@
.path-admin-tool-health dl.healthissues dd {
margin: 0px;
padding: 1em;
border: 1px black solid;
border: 1px solid black;
}
.path-admin-tool-health dl.healthissues dt {
font-weight: bold;
border-bottom: none;
border-bottom: 0;
padding-bottom: 0.5em;
}
.path-admin-tool-health dl.healthissues dd {
border-top: none;
border-top: 0;
padding-top: 0.5em;
margin-bottom: 10px;
}
+3 -2
View File
@@ -33,8 +33,9 @@ $PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_heading($site->fullname);
echo $OUTPUT->header();
// $PAGE->https_required() up above takes care of what $CFG->httpswwwroot should be.
$msg = '<p>'.get_string('ntlmsso_attempting', 'auth_ldap').'</p>'
. '<img width="1", height="1" '
. ' src="' . $CFG->wwwroot . '/auth/ldap/ntlmsso_magic.php?sesskey='
. ' src="' . $CFG->httpswwwroot . '/auth/ldap/ntlmsso_magic.php?sesskey='
. $sesskey . '" />';
redirect($CFG->wwwroot . '/auth/ldap/ntlmsso_finish.php', $msg, 3);
redirect($CFG->httpswwwroot . '/auth/ldap/ntlmsso_finish.php', $msg, 3);
+2 -1
View File
@@ -29,7 +29,8 @@ $file = $CFG->dirroot.'/pix/spacer.gif';
if ($authplugin->ntlmsso_magic($sesskey) && file_exists($file)) {
if (!empty($authplugin->config->ntlmsso_ie_fastpath)) {
if (check_browser_version('MSIE')) {
redirect($CFG->wwwroot.'/auth/ldap/ntlmsso_finish.php');
// $PAGE->https_required() up above takes care of what $CFG->httpswwwroot should be.
redirect($CFG->httpswwwroot.'/auth/ldap/ntlmsso_finish.php');
}
}
+4
View File
@@ -33,5 +33,9 @@ function xmldb_auth_manual_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+4
View File
@@ -34,5 +34,9 @@ function xmldb_auth_mnet_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+4 -4
View File
@@ -44,17 +44,17 @@ $PAGE->https_required();
// Redirect to SessionInitiator with entityID as argument
if (isset($IdPs[$selectedIdP][1]) && !empty($IdPs[$selectedIdP][1])) {
// For Shibbolet 1.x Service Providers
header('Location: '.$IdPs[$selectedIdP][1].'?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
header('Location: '.$IdPs[$selectedIdP][1].'?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php'));
// For Shibbolet 2.x Service Providers
// header('Location: '.$IdPs[$selectedIdP][1].'?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
// header('Location: '.$IdPs[$selectedIdP][1].'?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php'));
} else {
// For Shibbolet 1.x Service Providers
header('Location: /Shibboleth.sso?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
header('Location: /Shibboleth.sso?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php'));
// For Shibboleth 2.x Service Providers
// header('Location: /Shibboleth.sso/DS?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
// header('Location: /Shibboleth.sso/DS?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->httpswwwroot.'/auth/shibboleth/index.php'));
}
} elseif (isset($_POST['idp']) && !isset($IdPs[$_POST['idp']])) {
$errormsg = get_string('auth_shibboleth_errormsg', 'auth_shibboleth');
+4
View File
@@ -46,5 +46,9 @@
function xmldb_block_community_upgrade($oldversion) {
global $CFG, $DB;
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+1 -1
View File
@@ -173,7 +173,7 @@
bottom:0;
right:0;
opacity:0.35;
filter:alpha(opacity:35);
filter:alpha(opacity=35);
background:#000;
}
@@ -171,7 +171,7 @@ class block_completionstatus extends block_base {
$a = new stdClass();
$a->first = $prerequisites_complete;
$a->second = count($prerequisites);
$shtml .= get_string('firstofsecond', 'block_completionstatus', $a);
$phtml .= get_string('firstofsecond', 'block_completionstatus', $a);
$phtml .= '</td></tr>';
$shtml = $phtml . $shtml;
+9 -9
View File
@@ -4,7 +4,7 @@ if (is_file($CFG->dirroot.'/mod/feedback/lib.php')) {
define('FEEDBACK_BLOCK_LIB_IS_OK', true);
}
class block_feedback extends block_base {
class block_feedback extends block_list {
function init() {
$this->title = get_string('feedback', 'block_feedback');
@@ -21,10 +21,13 @@ class block_feedback extends block_base {
return $this->content;
}
$this->content = new stdClass;
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
if (!defined('FEEDBACK_BLOCK_LIB_IS_OK')) {
$this->content = new stdClass;
$this->content->text = get_string('missing_feedback_module', 'block_feedback');
$this->content->footer = '';
$this->content->items = array(get_string('missing_feedback_module', 'block_feedback'));
return $this->content;
}
@@ -33,9 +36,7 @@ class block_feedback extends block_base {
$courseid = SITEID;
}
$this->content = new stdClass;
$this->content->text = '';
$this->content->footer = '';
$icon = '<img src="'.$OUTPUT->pix_url('icon', 'feedback') . '" class="icon" alt="" />';
if (empty($this->instance->pageid)) {
@@ -47,8 +48,7 @@ class block_feedback extends block_base {
foreach ($feedbacks as $feedback) {
$url = new moodle_url($baseurl);
$url->params(array('id'=>$feedback->cmid, 'courseid'=>$courseid));
$icon = '<img src="'.$OUTPUT->pix_url('icon', 'feedback') . '" class="icon" alt="" />&nbsp;';
$this->content->text = ' <a href="'.$url->out().'">'.$icon.$feedback->name.'</a>';
$this->content->items[] = '<a href="'.$url->out().'">'.$icon.$feedback->name.'</a>';
}
}
+4
View File
@@ -32,5 +32,9 @@
function xmldb_block_html_upgrade($oldversion) {
global $CFG, $DB;
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+4
View File
@@ -58,5 +58,9 @@ function xmldb_block_navigation_upgrade($oldversion, $block) {
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+4
View File
@@ -58,5 +58,9 @@ function xmldb_block_settings_upgrade($oldversion, $block) {
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+1 -1
View File
@@ -108,7 +108,7 @@ $repeatspan = '';
if (!empty($event->eventrepeats) && $event->eventrepeats > 0) {
$url = new moodle_url(CALENDAR_URL.'delete.php', array('id'=>$event->repeatid, 'confirm'=>true, 'repeats'=>true));
$buttons .= $OUTPUT->single_button($url, get_string('deleteall'));
$repeatspan = '<br /><br /><span>'.get_string('youcandeleteallrepeats', 'calendar').'</span>';
$repeatspan = '<br /><br /><span>'.get_string('youcandeleteallrepeats', 'calendar', $event->eventrepeats).'</span>';
}
// And add the cancel button
+1 -1
View File
@@ -49,7 +49,7 @@ class cohort_edit_form extends moodleform {
$mform->addElement('select', 'contextid', get_string('context', 'role'), $options);
$mform->addElement('text', 'idnumber', get_string('idnumber', 'cohort'), 'maxlength="254" size="50"');
$mform->setType('name', PARAM_RAW); // idnumbers are plain text, must not be changed
$mform->setType('idnumber', PARAM_RAW); // idnumbers are plain text, must not be changed
$mform->addElement('editor', 'description_editor', get_string('description', 'cohort'), null, $editoroptions);
$mform->setType('description_editor', PARAM_RAW);
-10
View File
@@ -141,16 +141,6 @@ if ($form->is_cancelled()){
$aggregation->setMethod($data->role_aggregation);
$aggregation->save();
// Update course total passing grade
if (!empty($data->criteria_grade)) {
if ($grade_item = grade_category::fetch_course_category($course->id)->grade_item) {
$grade_item->gradepass = $data->criteria_grade_value;
if (method_exists($grade_item, 'update')) {
$grade_item->update('course/completion.php');
}
}
}
add_to_log($course->id, 'course', 'completion updated', 'completion.php?id='.$course->id);
$url = new moodle_url('/course/view.php', array('id' => $course->id));
+4 -1
View File
@@ -179,10 +179,13 @@ class course_completion_form extends moodleform {
$criteria->config_form_display($mform);
// Completion on course grade
$mform->addElement('header', 'grade', get_string('grade'));
$mform->addElement('header', 'grade', get_string('coursegrade', 'completion'));
// Grade enable and passing grade
$course_grade = $DB->get_field('grade_items', 'gradepass', array('courseid' => $course->id, 'itemtype' => 'course'));
if (!$course_grade) {
$course_grade = '0.00000';
}
$criteria = new completion_criteria_grade($params);
$criteria->config_form_display($mform, $course_grade);
+18 -5
View File
@@ -904,9 +904,10 @@ class core_course_external extends external_api {
'"parent" (int) the parent category id,'.
'"idnumber" (string) category idnumber'.
' - user must have \'moodle/category:manage\' to search on idnumber,'.
'"visible" (int) whether the category is visible or not'.
'"visible" (int) whether the returned categories must be visible or hidden. If the key is not passed,
then the function return all categories that the user can see.'.
' - user must have \'moodle/category:manage\' or \'moodle/category:viewhiddencategories\' to search on visible,'.
'"theme" (string) category theme'.
'"theme" (string) only return the categories having this theme'.
' - user must have \'moodle/category:manage\' to search on theme'),
'value' => new external_value(PARAM_RAW, 'the value to match')
)
@@ -1017,10 +1018,22 @@ class core_course_external extends external_api {
if ($categories and !empty($params['addsubcategories'])) {
$newcategories = array();
// Check if we required visible/theme checks.
$additionalselect = '';
$additionalparams = array();
if (isset($conditions['visible'])) {
$additionalselect .= ' AND visible = :visible';
$additionalparams['visible'] = $conditions['visible'];
}
if (isset($conditions['theme'])) {
$additionalselect .= ' AND theme= :theme';
$additionalparams['theme'] = $conditions['theme'];
}
foreach ($categories as $category) {
$sqllike = $DB->sql_like('path', ':path');
$sqlparams = array('path' => $category->path.'/%'); // It will NOT include the specified category.
$subcategories = $DB->get_records_select('course_categories', $sqllike, $sqlparams);
$sqlselect = $DB->sql_like('path', ':path') . $additionalselect;
$sqlparams = array('path' => $category->path.'/%') + $additionalparams; // It will NOT include the specified category.
$subcategories = $DB->get_records_select('course_categories', $sqlselect, $sqlparams);
$newcategories = $newcategories + $subcategories; // Both arrays have integer as keys.
}
$categories = $categories + $newcategories;
+5 -5
View File
@@ -1470,9 +1470,8 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
// 2. the activity has dates set which do not include current, or
// 3. the activity has any other conditions set (regardless of whether
// current user meets them)
$canviewhidden = has_capability(
'moodle/course:viewhiddenactivities',
get_context_instance(CONTEXT_MODULE, $mod->id));
$modcontext = context_module::instance($mod->id);
$canviewhidden = has_capability('moodle/course:viewhiddenactivities', $modcontext);
$accessiblebutdim = false;
if ($canviewhidden) {
$accessiblebutdim = !$mod->visible;
@@ -1684,9 +1683,10 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
}
if ($completionicon) {
$imgsrc = $OUTPUT->pix_url('i/completion-'.$completionicon);
$imgalt = s(get_string('completion-alt-'.$completionicon, 'completion', $mod->name));
$formattedname = format_string($mod->name, true, array('context' => $modcontext));
$imgalt = get_string('completion-alt-' . $completionicon, 'completion', $formattedname);
if ($completion == COMPLETION_TRACKING_MANUAL && !$isediting) {
$imgtitle = s(get_string('completion-title-'.$completionicon, 'completion', $mod->name));
$imgtitle = get_string('completion-title-' . $completionicon, 'completion', $formattedname);
$newstate =
$completiondata->completionstate==COMPLETION_COMPLETE
? COMPLETION_INCOMPLETE
+570
View File
@@ -0,0 +1,570 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* External course functions unit tests
*
* @package core_course
* @category external
* @copyright 2012 Jerome Mouneyrac
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/webservice/tests/helpers.php');
/**
* External course functions unit tests
*
* @package core_course
* @category external
* @copyright 2012 Jerome Mouneyrac
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_course_external_testcase extends externallib_advanced_testcase {
/**
* Tests set up
*/
protected function setUp() {
global $CFG;
require_once($CFG->dirroot . '/course/externallib.php');
}
/**
* Test create_categories
*/
public function test_create_categories() {
global $DB;
$this->resetAfterTest(true);
// Set the required capabilities by the external function
$contextid = context_system::instance()->id;
$roleid = $this->assignUserCapability('moodle/category:manage', $contextid);
// Create base categories.
$category1 = new stdClass();
$category1->name = 'Root Test Category 1';
$category2 = new stdClass();
$category2->name = 'Root Test Category 2';
$category2->idnumber = 'rootcattest2';
$category2->desc = 'Description for root test category 1';
$category2->theme = 'base';
$categories = array(
array('name' => $category1->name, 'parent' => 0),
array('name' => $category2->name, 'parent' => 0, 'idnumber' => $category2->idnumber,
'description' => $category2->desc, 'theme' => $category2->theme)
);
$createdcats = core_course_external::create_categories($categories);
// Initially confirm that base data was inserted correctly.
$this->assertEquals($category1->name, $createdcats[0]['name']);
$this->assertEquals($category2->name, $createdcats[1]['name']);
// Save the ids.
$category1->id = $createdcats[0]['id'];
$category2->id = $createdcats[1]['id'];
// Create on sub category.
$category3 = new stdClass();
$category3->name = 'Sub Root Test Category 3';
$subcategories = array(
array('name' => $category3->name, 'parent' => $category1->id)
);
$createdsubcats = core_course_external::create_categories($subcategories);
// Confirm that sub categories were inserted correctly.
$this->assertEquals($category3->name, $createdsubcats[0]['name']);
// Save the ids.
$category3->id = $createdsubcats[0]['id'];
// Calling the ws function should provide a new sortorder to give category1,
// category2, category3. New course categories are ordered by id not name.
$category1 = $DB->get_record('course_categories', array('id' => $category1->id));
$category2 = $DB->get_record('course_categories', array('id' => $category2->id));
$category3 = $DB->get_record('course_categories', array('id' => $category3->id));
$this->assertGreaterThanOrEqual($category1->sortorder, $category3->sortorder);
$this->assertGreaterThanOrEqual($category2->sortorder, $category3->sortorder);
// Call without required capability
$this->unassignUserCapability('moodle/category:manage', $contextid, $roleid);
$this->setExpectedException('required_capability_exception');
$createdsubcats = core_course_external::create_categories($subcategories);
}
/**
* Test delete categories
*/
public function test_delete_categories() {
global $DB;
$this->resetAfterTest(true);
// Set the required capabilities by the external function
$contextid = context_system::instance()->id;
$roleid = $this->assignUserCapability('moodle/category:manage', $contextid);
$category1 = self::getDataGenerator()->create_category();
$category2 = self::getDataGenerator()->create_category(
array('parent' => $category1->id));
$category3 = self::getDataGenerator()->create_category();
$category4 = self::getDataGenerator()->create_category(
array('parent' => $category3->id));
$category5 = self::getDataGenerator()->create_category(
array('parent' => $category4->id));
//delete category 1 and 2 + delete category 4, category 5 moved under category 3
core_course_external::delete_categories(array(
array('id' => $category1->id, 'recursive' => 1),
array('id' => $category4->id)
));
//check $category 1 and 2 are deleted
$notdeletedcount = $DB->count_records_select('course_categories',
'id IN ( ' . $category1->id . ',' . $category2->id . ',' . $category4->id . ')');
$this->assertEquals(0, $notdeletedcount);
//check that $category5 as $category3 for parent
$dbcategory5 = $DB->get_record('course_categories', array('id' => $category5->id));
$this->assertEquals($dbcategory5->path, $category3->path . '/' . $category5->id);
// Call without required capability
$this->unassignUserCapability('moodle/category:manage', $contextid, $roleid);
$this->setExpectedException('required_capability_exception');
$createdsubcats = core_course_external::delete_categories(
array(array('id' => $category3->id)));
}
/**
* Test get categories
*/
public function test_get_categories() {
global $DB;
$this->resetAfterTest(true);
$category1data['idnumber'] = 'idnumbercat1';
$category1data['name'] = 'Category 1 for PHPunit test';
$category1data['description'] = 'Category 1 description';
$category1data['descriptionformat'] = FORMAT_MOODLE;
$category1 = self::getDataGenerator()->create_category($category1data);
$category2 = self::getDataGenerator()->create_category(
array('parent' => $category1->id));
$category6 = self::getDataGenerator()->create_category(
array('parent' => $category1->id, 'visible' => 0));
$category3 = self::getDataGenerator()->create_category();
$category4 = self::getDataGenerator()->create_category(
array('parent' => $category3->id));
$category5 = self::getDataGenerator()->create_category(
array('parent' => $category4->id));
// Set the required capabilities by the external function.
$context = context_system::instance();
$roleid = $this->assignUserCapability('moodle/category:manage', $context->id);
// Retrieve category1 + sub-categories except not visible ones
$categories = core_course_external::get_categories(array(
array('key' => 'id', 'value' => $category1->id),
array('key' => 'visible', 'value' => 1)), 1);
// Check we retrieve the good total number of categories.
$this->assertEquals(2, count($categories));
// Check the return values
$this->assertEquals($categories[0]['id'], $category1->id);
$this->assertEquals($categories[0]['idnumber'], $category1->idnumber);
$this->assertEquals($categories[0]['name'], $category1->name);
$this->assertEquals($categories[0]['description'], $category1->description);
$this->assertEquals($categories[0]['descriptionformat'], FORMAT_HTML);
// Check different params.
$categories = core_course_external::get_categories(array(
array('key' => 'id', 'value' => $category1->id),
array('key' => 'idnumber', 'value' => $category1->idnumber),
array('key' => 'visible', 'value' => 1)), 0);
$this->assertEquals(1, count($categories));
// Retrieve categories from parent.
$categories = core_course_external::get_categories(array(
array('key' => 'parent', 'value' => $category3->id)), 1);
$this->assertEquals(2, count($categories));
// Retrieve all categories.
$categories = core_course_external::get_categories();
$this->assertEquals($DB->count_records('course_categories'), count($categories));
// Call without required capability (it will fail cause of the search on idnumber).
$this->unassignUserCapability('moodle/category:manage', $context->id, $roleid);
$this->setExpectedException('moodle_exception');
$categories = core_course_external::get_categories(array(
array('key' => 'id', 'value' => $category1->id),
array('key' => 'idnumber', 'value' => $category1->idnumber),
array('key' => 'visible', 'value' => 1)), 0);
}
/**
* Test update_categories
*/
public function test_update_categories() {
global $DB;
$this->resetAfterTest(true);
// Set the required capabilities by the external function
$contextid = context_system::instance()->id;
$roleid = $this->assignUserCapability('moodle/category:manage', $contextid);
// Create base categories.
$category1data['idnumber'] = 'idnumbercat1';
$category1data['name'] = 'Category 1 for PHPunit test';
$category1data['description'] = 'Category 1 description';
$category1data['descriptionformat'] = FORMAT_MOODLE;
$category1 = self::getDataGenerator()->create_category($category1data);
$category2 = self::getDataGenerator()->create_category(
array('parent' => $category1->id));
$category3 = self::getDataGenerator()->create_category();
$category4 = self::getDataGenerator()->create_category(
array('parent' => $category3->id));
$category5 = self::getDataGenerator()->create_category(
array('parent' => $category4->id));
// We update all category1 attribut.
// Then we move cat4 and cat5 parent: cat3 => cat1
$categories = array(
array('id' => $category1->id,
'name' => $category1->name . '_updated',
'idnumber' => $category1->idnumber . '_updated',
'description' => $category1->description . '_updated',
'descriptionformat' => FORMAT_HTML,
'theme' => $category1->theme),
array('id' => $category4->id, 'parent' => $category1->id));
core_course_external::update_categories($categories);
// Check the values were updated.
$dbcategories = $DB->get_records_select('course_categories',
'id IN (' . $category1->id . ',' . $category2->id . ',' . $category2->id
. ',' . $category3->id . ',' . $category4->id . ',' . $category5->id .')');
$this->assertEquals($category1->name . '_updated',
$dbcategories[$category1->id]->name);
$this->assertEquals($category1->idnumber . '_updated',
$dbcategories[$category1->id]->idnumber);
$this->assertEquals($category1->description . '_updated',
$dbcategories[$category1->id]->description);
$this->assertEquals(FORMAT_HTML, $dbcategories[$category1->id]->descriptionformat);
// Check that category4 and category5 have been properly moved.
$this->assertEquals('/' . $category1->id . '/' . $category4->id,
$dbcategories[$category4->id]->path);
$this->assertEquals('/' . $category1->id . '/' . $category4->id . '/' . $category5->id,
$dbcategories[$category5->id]->path);
// Call without required capability.
$this->unassignUserCapability('moodle/category:manage', $contextid, $roleid);
$this->setExpectedException('required_capability_exception');
core_course_external::update_categories($categories);
}
/**
* Test create_courses
*/
public function test_create_courses() {
global $DB;
$this->resetAfterTest(true);
// Set the required capabilities by the external function
$contextid = context_system::instance()->id;
$roleid = $this->assignUserCapability('moodle/course:create', $contextid);
$this->assignUserCapability('moodle/course:visibility', $contextid, $roleid);
$category = self::getDataGenerator()->create_category();
// Create base categories.
$course1['fullname'] = 'Test course 1';
$course1['shortname'] = 'Testcourse1';
$course1['categoryid'] = $category->id;
$course2['fullname'] = 'Test course 2';
$course2['shortname'] = 'Testcourse2';
$course2['categoryid'] = $category->id;
$course2['idnumber'] = 'testcourse2idnumber';
$course2['summary'] = 'Description for course 2';
$course2['summaryformat'] = FORMAT_MOODLE;
$course2['format'] = 'weeks';
$course2['showgrades'] = 1;
$course2['newsitems'] = 3;
$course2['startdate'] = 32882306400; // 01/01/3012
$course2['numsections'] = 4;
$course2['maxbytes'] = 100000;
$course2['showreports'] = 1;
$course2['visible'] = 0;
$course2['hiddensections'] = 0;
$course2['groupmode'] = 0;
$course2['groupmodeforce'] = 0;
$course2['defaultgroupingid'] = 0;
$course2['enablecompletion'] = 1;
$course2['completionstartonenrol'] = 1;
$course2['completionnotify'] = 1;
$course2['lang'] = 'en';
$course2['forcetheme'] = 'base';
$courses = array($course1, $course2);
$createdcourses = core_course_external::create_courses($courses);
// Check that right number of courses were created.
$this->assertEquals(2, count($createdcourses));
// Check that the courses were correctly created.
foreach ($createdcourses as $createdcourse) {
$dbcourse = $DB->get_record('course', array('id' => $createdcourse['id']));
if ($createdcourse['shortname'] == $course2['shortname']) {
$this->assertEquals($dbcourse->fullname, $course2['fullname']);
$this->assertEquals($dbcourse->shortname, $course2['shortname']);
$this->assertEquals($dbcourse->category, $course2['categoryid']);
$this->assertEquals($dbcourse->idnumber, $course2['idnumber']);
$this->assertEquals($dbcourse->summary, $course2['summary']);
$this->assertEquals($dbcourse->summaryformat, $course2['summaryformat']);
$this->assertEquals($dbcourse->format, $course2['format']);
$this->assertEquals($dbcourse->showgrades, $course2['showgrades']);
$this->assertEquals($dbcourse->newsitems, $course2['newsitems']);
$this->assertEquals($dbcourse->startdate, $course2['startdate']);
$this->assertEquals($dbcourse->numsections, $course2['numsections']);
$this->assertEquals($dbcourse->maxbytes, $course2['maxbytes']);
$this->assertEquals($dbcourse->showreports, $course2['showreports']);
$this->assertEquals($dbcourse->visible, $course2['visible']);
$this->assertEquals($dbcourse->hiddensections, $course2['hiddensections']);
$this->assertEquals($dbcourse->groupmode, $course2['groupmode']);
$this->assertEquals($dbcourse->groupmodeforce, $course2['groupmodeforce']);
$this->assertEquals($dbcourse->defaultgroupingid, $course2['defaultgroupingid']);
$this->assertEquals($dbcourse->completionnotify, $course2['completionnotify']);
$this->assertEquals($dbcourse->lang, $course2['lang']);
if (!empty($CFG->allowcoursethemes)) {
$this->assertEquals($dbcourse->theme, $course2['forcetheme']);
}
if (completion_info::is_enabled_for_site()) {
$this->assertEquals($dbcourse->enablecompletion, $course2['enabledcompletion']);
$this->assertEquals($dbcourse->completionstartonenrol, $course2['completionstartonenrol']);
} else {
$this->assertEquals($dbcourse->enablecompletion, 0);
$this->assertEquals($dbcourse->completionstartonenrol, 0);
}
} else if ($createdcourse['shortname'] == $course1['shortname']) {
$courseconfig = get_config('moodlecourse');
$this->assertEquals($dbcourse->fullname, $course1['fullname']);
$this->assertEquals($dbcourse->shortname, $course1['shortname']);
$this->assertEquals($dbcourse->category, $course1['categoryid']);
$this->assertEquals($dbcourse->summaryformat, FORMAT_HTML);
$this->assertEquals($dbcourse->format, $courseconfig->format);
$this->assertEquals($dbcourse->showgrades, $courseconfig->showgrades);
$this->assertEquals($dbcourse->newsitems, $courseconfig->newsitems);
$this->assertEquals($dbcourse->numsections, $courseconfig->numsections);
$this->assertEquals($dbcourse->maxbytes, $courseconfig->maxbytes);
$this->assertEquals($dbcourse->showreports, $courseconfig->showreports);
$this->assertEquals($dbcourse->hiddensections, $courseconfig->hiddensections);
$this->assertEquals($dbcourse->groupmode, $courseconfig->groupmode);
$this->assertEquals($dbcourse->groupmodeforce, $courseconfig->groupmodeforce);
$this->assertEquals($dbcourse->defaultgroupingid, 0);
} else {
throw moodle_exception('Unexpected shortname');
}
}
// Call without required capability
$this->unassignUserCapability('moodle/course:create', $contextid, $roleid);
$this->setExpectedException('required_capability_exception');
$createdsubcats = core_course_external::create_courses($courses);
}
/**
* Test delete_courses
*/
public function test_delete_courses() {
global $DB, $USER;
$this->resetAfterTest(true);
// Admin can delete a course.
$this->setAdminUser();
// Validate_context() will fail as the email is not set by $this->setAdminUser().
$USER->email = 'emailtopass@contextvalidation.me';
$course1 = self::getDataGenerator()->create_course();
$course2 = self::getDataGenerator()->create_course();
$course3 = self::getDataGenerator()->create_course();
// Delete courses.
core_course_external::delete_courses(array($course1->id, $course2->id));
// Check $course 1 and 2 are deleted.
$notdeletedcount = $DB->count_records_select('course',
'id IN ( ' . $course1->id . ',' . $course2->id . ')');
$this->assertEquals(0, $notdeletedcount);
// Fail when the user is not allow to access the course (enrolled) or is not admin.
$this->setGuestUser();
$this->setExpectedException('require_login_exception');
$createdsubcats = core_course_external::delete_courses(array($course3->id));
}
/**
* Test get_courses
*/
public function test_get_courses () {
global $DB;
$this->resetAfterTest(true);
$coursedata['idnumber'] = 'idnumbercourse1';
$coursedata['fullname'] = 'Course 1 for PHPunit test';
$coursedata['summary'] = 'Course 1 description';
$coursedata['summaryformat'] = FORMAT_MOODLE;
$course1 = self::getDataGenerator()->create_course($coursedata);
$course2 = self::getDataGenerator()->create_course();
$course3 = self::getDataGenerator()->create_course();
// Set the required capabilities by the external function.
$context = context_system::instance();
$roleid = $this->assignUserCapability('moodle/course:view', $context->id);
$this->assignUserCapability('moodle/course:update',
context_course::instance($course1->id)->id, $roleid);
$this->assignUserCapability('moodle/course:update',
context_course::instance($course2->id)->id, $roleid);
$this->assignUserCapability('moodle/course:update',
context_course::instance($course3->id)->id, $roleid);
$courses = core_course_external::get_courses(array('ids' =>
array($course1->id, $course2->id)));
// Check we retrieve the good total number of categories.
$this->assertEquals(2, count($courses));
// Check the return values for course 1
$dbcourse = $DB->get_record('course', array('id' => $course1->id));
$this->assertEquals($courses[0]['id'], $dbcourse->id);
$this->assertEquals($courses[0]['idnumber'], $coursedata['idnumber']);
$this->assertEquals($courses[0]['fullname'], $coursedata['fullname']);
$this->assertEquals($courses[0]['summary'], $coursedata['summary']);
$this->assertEquals($courses[0]['summaryformat'], FORMAT_HTML);
$this->assertEquals($courses[0]['shortname'], $dbcourse->shortname);
$this->assertEquals($courses[0]['categoryid'], $dbcourse->category);
$this->assertEquals($courses[0]['format'], $dbcourse->format);
$this->assertEquals($courses[0]['showgrades'], $dbcourse->showgrades);
$this->assertEquals($courses[0]['newsitems'], $dbcourse->newsitems);
$this->assertEquals($courses[0]['startdate'], $dbcourse->startdate);
$this->assertEquals($courses[0]['numsections'], $dbcourse->numsections);
$this->assertEquals($courses[0]['maxbytes'], $dbcourse->maxbytes);
$this->assertEquals($courses[0]['showreports'], $dbcourse->showreports);
$this->assertEquals($courses[0]['visible'], $dbcourse->visible);
$this->assertEquals($courses[0]['hiddensections'], $dbcourse->hiddensections);
$this->assertEquals($courses[0]['groupmode'], $dbcourse->groupmode);
$this->assertEquals($courses[0]['groupmodeforce'], $dbcourse->groupmodeforce);
$this->assertEquals($courses[0]['defaultgroupingid'], $dbcourse->defaultgroupingid);
$this->assertEquals($courses[0]['completionnotify'], $dbcourse->completionnotify);
$this->assertEquals($courses[0]['lang'], $dbcourse->lang);
$this->assertEquals($courses[0]['forcetheme'], $dbcourse->theme);
$this->assertEquals($courses[0]['completionstartonenrol'], $dbcourse->completionstartonenrol);
$this->assertEquals($courses[0]['enablecompletion'], $dbcourse->enablecompletion);
$this->assertEquals($courses[0]['completionstartonenrol'], $dbcourse->completionstartonenrol);
// Get all courses in the DB
$courses = core_course_external::get_courses(array());
$this->assertEquals($DB->count_records('course'), count($courses));
}
/**
* Test get_course_contents
*/
public function test_get_course_contents() {
$this->resetAfterTest(true);
$course = self::getDataGenerator()->create_course();
$forum = $this->getDataGenerator()->create_module('forum', array('course'=>$course->id));
$forumcm = get_coursemodule_from_id('forum', $forum->cmid);
$forumcontext = context_module::instance($forum->cmid);
$data = $this->getDataGenerator()->create_module('data', array('assessed'=>1, 'scale'=>100, 'course'=>$course->id));
$datacontext = context_module::instance($data->cmid);
$datacm = get_coursemodule_from_instance('page', $data->id);
$page = $this->getDataGenerator()->create_module('page', array('course'=>$course->id));
$pagecontext = context_module::instance($page->cmid);
$pagecm = get_coursemodule_from_instance('page', $page->id);
// Set the required capabilities by the external function.
$context = context_course::instance($course->id);
$roleid = $this->assignUserCapability('moodle/course:view', $context->id);
$this->assignUserCapability('moodle/course:update', $context->id, $roleid);
$courses = core_course_external::get_course_contents($course->id, array());
// Check that the course has the 3 created modules
$this->assertEquals(3, count($courses[0]['modules']));
}
/**
* Test duplicate_course
*/
public function test_duplicate_course() {
$this->resetAfterTest(true);
// Create one course with three modules.
$course = self::getDataGenerator()->create_course();
$forum = $this->getDataGenerator()->create_module('forum', array('course'=>$course->id));
$forumcm = get_coursemodule_from_id('forum', $forum->cmid);
$forumcontext = context_module::instance($forum->cmid);
$data = $this->getDataGenerator()->create_module('data', array('assessed'=>1, 'scale'=>100, 'course'=>$course->id));
$datacontext = context_module::instance($data->cmid);
$datacm = get_coursemodule_from_instance('page', $data->id);
$page = $this->getDataGenerator()->create_module('page', array('course'=>$course->id));
$pagecontext = context_module::instance($page->cmid);
$pagecm = get_coursemodule_from_instance('page', $page->id);
// Set the required capabilities by the external function.
$coursecontext = context_course::instance($course->id);
$categorycontext = context_coursecat::instance($course->category);
$roleid = $this->assignUserCapability('moodle/course:create', $categorycontext->id);
$this->assignUserCapability('moodle/course:view', $categorycontext->id, $roleid);
$this->assignUserCapability('moodle/restore:restorecourse', $categorycontext->id, $roleid);
$this->assignUserCapability('moodle/backup:backupcourse', $coursecontext->id, $roleid);
$this->assignUserCapability('moodle/backup:configure', $coursecontext->id, $roleid);
// Optional capabilities to copy user data.
$this->assignUserCapability('moodle/backup:userinfo', $coursecontext->id, $roleid);
$this->assignUserCapability('moodle/restore:userinfo', $categorycontext->id, $roleid);
$newcourse['fullname'] = 'Course duplicate';
$newcourse['shortname'] = 'courseduplicate';
$newcourse['categoryid'] = $course->category;
$newcourse['visible'] = true;
$newcourse['options'][] = array('name' => 'users', 'value' => true);
$duplicate = core_course_external::duplicate_course($course->id, $newcourse['fullname'],
$newcourse['shortname'], $newcourse['categoryid'], $newcourse['visible'], $newcourse['options']);
// Check that the course has been duplicated.
$this->assertEquals($newcourse['shortname'], $duplicate['shortname']);
}
}
+12 -2
View File
@@ -99,8 +99,18 @@
$infoid = $course->id;
if(!empty($section)) {
$loglabel = 'view section';
$sectionparams = array('course' => $course->id, 'section' => $section);
$coursesections = $DB->get_record('course_sections', $sectionparams, 'id', MUST_EXIST);
// Get section details and check it exists.
$modinfo = get_fast_modinfo($course);
$coursesections = $modinfo->get_section_info($section, MUST_EXIST);
// Check user is allowed to see it.
if (!$coursesections->uservisible) {
// Note: We actually already know they don't have this capability
// or uservisible would have been true; this is just to get the
// correct error message shown.
require_capability('moodle/course:viewhiddensections', $context);
}
$infoid = $coursesections->id;
$logparam .= '&sectionid='. $infoid;
}
+4
View File
@@ -26,5 +26,9 @@ function xmldb_enrol_authorize_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+4
View File
@@ -30,5 +30,9 @@ function xmldb_enrol_database_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+2 -1
View File
@@ -445,8 +445,9 @@ class enrol_database_plugin extends enrol_plugin {
$sql = $this->db_get_sql($table, array($coursefield=>$course->mapping), $sqlfields);
if ($rs = $extdb->Execute($sql)) {
if (!$rs->EOF) {
$usersearch = array('deleted' => 0);
if ($localuserfield === 'username') {
$usersearch = array('mnethostid'=>$CFG->mnet_localhost_id, 'deleted' =>0);
$usersearch['mnethostid'] = $CFG->mnet_localhost_id;
}
while ($fields = $rs->FetchRow()) {
$fields = array_change_key_case($fields, CASE_LOWER);
+4
View File
@@ -32,5 +32,9 @@ function xmldb_enrol_flatfile_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+4
View File
@@ -40,6 +40,10 @@ function xmldb_enrol_guest_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2011112901, 'enrol', 'guest');
}
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+4
View File
@@ -31,6 +31,10 @@ function xmldb_enrol_imsenterprise_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+4
View File
@@ -32,5 +32,9 @@ function xmldb_enrol_mnet_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+4
View File
@@ -47,5 +47,9 @@ function xmldb_enrol_paypal_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+1 -1
View File
@@ -291,7 +291,7 @@ class enrol_self_plugin extends enrol_plugin {
if ($rusers) {
$contact = reset($rusers);
} else {
$contact = get_admin();
$contact = generate_email_supportuser();
}
//directly emailing welcome message rather than using messaging
+10 -14
View File
@@ -219,7 +219,7 @@ class core_files_renderer extends plugin_renderer_base {
<div class="filemanager-container" >
<div class="fm-content-wrapper">
<div class="fp-content"></div>
<div class="fm-empty-container <!--mdl-align-->">
<div class="fm-empty-container">
<span class="dndupload-message">'.$strdndenabledinbox.'<br/><span class="dndupload-arrow"></span></span>
</div>
<div class="dndupload-target">'.$strdroptoupload.'<br/><span class="dndupload-arrow"></span></div>
@@ -368,8 +368,7 @@ class core_files_renderer extends plugin_renderer_base {
$rv = '
<div class="filemanager fp-select">
<div class="fp-select-loading">
<img src="'.$this->pix_url('i/loading').'" />
<p>'.get_string('loading', 'repository').'</p>
<img src="'.$this->pix_url('i/loading_small').'" />
</div>
<form>
<button class="{!}fp-file-download">'.get_string('download').'</button>
@@ -455,10 +454,10 @@ class core_files_renderer extends plugin_renderer_base {
*/
private function fm_print_restrictions($fm) {
$maxbytes = display_size($fm->options->maxbytes);
if (empty($options->maxfiles) || $options->maxfiles == -1) {
if (empty($fm->options->maxfiles) || $fm->options->maxfiles == -1) {
$maxsize = get_string('maxfilesize', 'moodle', $maxbytes);
} else {
$strparam = (object)array('size' => $maxbytes, 'attachments' => $options->maxfiles);
$strparam = (object)array('size' => $maxbytes, 'attachments' => $fm->options->maxfiles);
$maxsize = get_string('maxsizeandattachments', 'moodle', $strparam);
}
// TODO MDL-32020 also should say about 'File types accepted'
@@ -622,8 +621,7 @@ class core_files_renderer extends plugin_renderer_base {
<div class="{!}fp-nextpage">
<div class="fp-nextpage-link"><a href="#">'.get_string('more').'</a></div>
<div class="fp-nextpage-loading">
<img src="'.$this->pix_url('i/loading').'" />
<p>'.get_string('loading', 'repository').'</p>
<img src="'.$this->pix_url('i/loading_small').'" />
</div>
</div>';
return preg_replace('/\{\!\}/', '', $rv);
@@ -661,19 +659,18 @@ class core_files_renderer extends plugin_renderer_base {
$rv = '
<div class="file-picker fp-select">
<div class="fp-select-loading">
<img src="'.$this->pix_url('i/loading').'" />
<p>'.get_string('loading', 'repository').'</p>
<img src="'.$this->pix_url('i/loading_small').'" />
</div>
<form>
<table>
<tr class="{!}fp-linktype-2">
<td></td>
<td class="mdl-right"></td>
<td class="mdl-left"><input type="radio"/><label>&nbsp;'.get_string('makefileinternal', 'repository').'</label></td></tr>
<tr class="{!}fp-linktype-1">
<td></td>
<td class="mdl-right"></td>
<td class="mdl-left"><input type="radio"/><label>&nbsp;'.get_string('makefilelink', 'repository').'</label></td></tr>
<tr class="{!}fp-linktype-4">
<td></td>
<td class="mdl-right"></td>
<td class="mdl-left"><input type="radio"/><label>&nbsp;'.get_string('makefilereference', 'repository').'</label></td></tr>
<tr class="{!}fp-saveas">
<td class="mdl-right"><label>'.get_string('saveas', 'repository').'</label>:</td>
@@ -759,8 +756,7 @@ class core_files_renderer extends plugin_renderer_base {
return '
<div class="fp-content-loading">
<div class="fp-content-center">
<img src="'.$this->pix_url('i/loading').'" />
<p>'.get_string('loading', 'repository').'</p>
<img src="'.$this->pix_url('i/loading_small').'" />
</div>
</div>';
}
+1 -1
View File
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2012061700;
$plugin->version = 2012061701;
$plugin->requires = 2012061700; // Requires this Moodle version
$plugin->component= 'filter_glossary';
+1 -1
View File
@@ -130,4 +130,4 @@ YUI.add('moodle-filter_glossary-autolinker', function(Y) {
return new AUTOLINKER(config);
}
}, '@VERSION@', {requires:['base','node','event-delegate','overlay','moodle-enrol-notification']});
}, '@VERSION@', {requires:['base','node','io-base','json-parse','event-delegate','overlay','moodle-enrol-notification']});
+4
View File
@@ -54,5 +54,9 @@ function xmldb_filter_mediaplugin_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2011121200, 'filter', 'mediaplugin');
}
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+4
View File
@@ -33,5 +33,9 @@ function xmldb_filter_tex_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+1 -1
View File
@@ -4,7 +4,7 @@ M.gradingform_guide = {};
* This function is called for each guide on page.
*/
M.gradingform_guide.init = function(Y, options) {
var currentfocus = null;
var currentfocus = Y.one('.markingguideremark');
Y.all('.markingguideremark').on('blur', function(e) {
currentfocus = e.currentTarget;
+4
View File
@@ -38,5 +38,9 @@ function xmldb_gradingform_rubric_upgrade($oldversion) {
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+3
View File
@@ -411,6 +411,9 @@ class grade_report_grader extends grade_report {
case 'firstname':
$sort = "u.firstname $this->sortorder, u.lastname $this->sortorder";
break;
case 'email':
$sort = "u.email $this->sortorder";
break;
case 'idnumber':
default:
$sort = "u.idnumber $this->sortorder";
+4 -4
View File
@@ -185,7 +185,7 @@ margin-right:10px;
}
table#user-grades .quickfeedback {
border:#000 1px dashed;
border:1px dashed #000;
}
.path-grade-report-grader #siteconfiglink {
@@ -262,7 +262,7 @@ border-width:0 1px 1px;
}
.path-grade-report-grader table td.topleft {
border-bottom:none;
border-bottom:0;
}
table#user-grades td.topleft {
@@ -325,12 +325,12 @@ margin: 10px 10px 0px 10px;
}
.path-grade-report-grader table#quick_edit td.fullname {
border-left:none;
border-left:0;
padding-left:5px;
}
.path-grade-report-grader table#quick_edit td.picture {
border-right:none;
border-right:0;
}
.path-grade-report-grader table#quick_edit td.finalgrade input {
+4 -1
View File
@@ -53,7 +53,7 @@ class core_group_external extends external_api {
'name' => new external_value(PARAM_TEXT, 'multilang compatible name, course unique'),
'description' => new external_value(PARAM_RAW, 'group description text'),
'descriptionformat' => new external_format_value('description', VALUE_DEFAULT),
'enrolmentkey' => new external_value(PARAM_RAW, 'group enrol secret phrase'),
'enrolmentkey' => new external_value(PARAM_RAW, 'group enrol secret phrase', VALUE_OPTIONAL),
)
), 'List of group object. A group has a courseid, a name, a description and an enrolment key.'
)
@@ -105,6 +105,9 @@ class core_group_external extends external_api {
// finally create the group
$group->id = groups_create_group($group, false);
if (!isset($group->enrolmentkey)) {
$group->enrolmentkey = '';
}
$groups[] = (array)$group;
}
+4 -4
View File
@@ -410,21 +410,21 @@ if ($config->stage == INSTALL_DATABASE) {
$disabled = empty($distro->dbhost) ? '' : 'disabled="disabled';
echo '<div class="formrow"><label for="id_dbhost" class="formlabel">'.$strdbhost.'</label>';
echo '<input id="id_dbhost" name="dbhost" '.$disabled.' type="text" value="'.s($config->dbhost).'" size="30" class="forminput" />';
echo '<input id="id_dbhost" name="dbhost" '.$disabled.' type="text" value="'.s($config->dbhost).'" size="50" class="forminput" />';
echo '</div>';
echo '<div class="formrow"><label for="id_dbname" class="formlabel">'.$strdbname.'</label>';
echo '<input id="id_dbname" name="dbname" type="text" value="'.s($config->dbname).'" size="30" class="forminput" />';
echo '<input id="id_dbname" name="dbname" type="text" value="'.s($config->dbname).'" size="50" class="forminput" />';
echo '</div>';
$disabled = empty($distro->dbuser) ? '' : 'disabled="disabled';
echo '<div class="formrow"><label for="id_dbuser" class="formlabel">'.$strdbuser.'</label>';
echo '<input id="id_dbuser" name="dbuser" '.$disabled.' type="text" value="'.s($config->dbuser).'" size="30" class="forminput" />';
echo '<input id="id_dbuser" name="dbuser" '.$disabled.' type="text" value="'.s($config->dbuser).'" size="50" class="forminput" />';
echo '</div>';
echo '<div class="formrow"><label for="id_dbpass" class="formlabel">'.$strdbpass.'</label>';
// no password field here, the password may be visible in config.php if we can not write it to disk
echo '<input id="id_dbpass" name="dbpass" type="text" value="'.s($config->dbpass).'" size="30" class="forminput" />';
echo '<input id="id_dbpass" name="dbpass" type="text" value="'.s($config->dbpass).'" size="50" class="forminput" />';
echo '</div>';
echo '<div class="formrow"><label for="id_prefix" class="formlabel">'.$strprefix.'</label>';
+1 -1
View File
@@ -96,7 +96,7 @@ h2 {
.formrow label.formlabel {
display:block;
float:left;
width: 260px;
width: 160px;
margin-right:5px;
text-align:right;
}
+34
View File
@@ -0,0 +1,34 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle installer
*
* Do not edit this file manually! It contains just a subset of strings
* needed during the very first steps of installation. This file was
* generated automatically by export-installer.php (which is part of AMOS
* {@link http://docs.moodle.org/dev/Languages/AMOS}) using the
* list of strings defined in /install/stringnames.txt.
*
* @package installer
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$string['cannotsavemd5file'] = 'No s\'ha pogut alçar el fitxer md5';
$string['cannotsavezipfile'] = 'No s\'ha pogut alçar el fitxer zip';
+55
View File
@@ -0,0 +1,55 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle installer
*
* Do not edit this file manually! It contains just a subset of strings
* needed during the very first steps of installation. This file was
* generated automatically by export-installer.php (which is part of AMOS
* {@link http://docs.moodle.org/dev/Languages/AMOS}) using the
* list of strings defined in /install/stringnames.txt.
*
* @package installer
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$string['langdownloaderror'] = 'Dissortadament l\'idioma "{$a}" no està instal·lat. La instal·lació prosseguirà en anglés.';
$string['memorylimithelp'] = '<p>El límit de memòria del PHP del vostre servidor actualment està definit en {$a}.</p>
<p>Això pot causar que Moodle tinga problemes de memòria més avant, especialment si teniu molts mòduls habilitats i/o molts usuaris.</p>
<p>És recomanable que configureu el PHP amb un límit superior, com ara 40 MB, sempre que siga possible. Hi ha diverses maneres de fer això:</p>
<ol>
<li>Si podeu, recompileu el PHP amb <i>--enable-memory-limit</i>. Això permetrà que Moodle definisca el límit de memòria per si mateix.</li>
<li>Si teniu accés al fitxer php.ini, podeu canviar el paràmetre <b>memory_limit</b> a 40 MB. Si no hi teniu accés podeu demanar al vostre administrador que ho faça ell.</li>
<li>En alguns servidors PHP podeu crear un fitxer .htaccess dins del directori de Moodle amb esta línia:
<p><blockquote>php_value memory_limit 40M</blockquote></p>
<p>Tanmateix, en alguns servidors això farà que no funcioni <b>cap</b> pàgina PHP (es visualitzaran errors) en el qual cas hauríeu de suprimir el fitxer .htaccess.</p></li>
</ol>';
$string['pathssubdataroot'] = 'Necessiteu un espai on Moodle puga alçar els fitxers penjats. Este directori hauria de tindre permisos de lectura I ESCRIPTURA per a l\'usuari del servidor web (normalment \'nobody\' o \'apache\'), però no cal que siga accessible directament via web. L\'instal·lador provarà de crear-lo si no existeix.';
$string['phpversionhelp'] = '<p>Moodle necessita la versió de PHP 4.1.0 o posterior.</p>
<p>A hores d\'ara esteu utilitzant la versió {$a}.</p>
<p>Vos caldrà actualitzar el PHP o traslladar Moodle a un ordinador amb una versió de PHP més recent.</p>';
$string['welcomep20'] = 'Esteu veient esta pàgina perquè heu instal·lat amb èxit i heu executat el paquet <strong>{$a->packname} {$a->packversion}</strong>. Felicitacions!';
$string['welcomep30'] = 'Esta versió de <strong>{$a->installername}</strong> inclou les aplicacions necessàries per crear un entorn en el qual funcioni <strong>Moodle</strong>:';
$string['welcomep50'] = 'L\'ús de totes les aplicacions d\'este paquet és governat per les seues llicències respectives. El paquet <strong>{$a->installername}</strong> complet és
<a href="http://www.opensource.org/docs/definition_plain.html">codi font obert</a> i es distribueix
sota llicència <a href="http://www.gnu.org/copyleft/gpl.html">GPL</a>.';
$string['welcomep60'] = 'Les pàgines següents vos guiaran per una sèrie de passos fàcils de seguir per configurar <strong>Moodle</strong> en el vostre ordinador. Podeu acceptar els paràmetres per defecte o, opcionalment, modificar-los perquè s\'ajusten a les vostres necessitats.';
+1 -1
View File
@@ -35,7 +35,7 @@ $string['availablelangs'] = 'Lista de línguas disponíveis';
$string['chooselanguagehead'] = 'Escolha uma língua';
$string['chooselanguagesub'] = 'Escolha por favor a língua a usar na instalação. Esta língua será usada por omissão no site, mas pode ser alterada posteriormente.';
$string['clialreadyconfigured'] = 'O ficheiro config.php já existe; por favor execute admin/cli/install_database.php se quiser instalar este sítio.';
$string['clialreadyinstalled'] = 'O ficheiro config.php já existe. Por favor, use o script admin/cli/upgrade.php se quiser atualizar o seu site.';
$string['clialreadyinstalled'] = 'O ficheiro config.php já existe. Por favor, use o script admin/cli/upgrade.php se quiser atualizar o seu sítio.';
$string['cliinstallheader'] = 'Programa de instalação do Moodle {$a} por linha de comandos';
$string['databasehost'] = 'Servidor da base de dados';
$string['databasename'] = 'Nome da base de dados';
+1 -1
View File
@@ -34,7 +34,7 @@ $string['admindirname'] = 'Каталог администратора';
$string['availablelangs'] = 'Доступные языковые пакеты';
$string['chooselanguagehead'] = 'Выберите язык';
$string['chooselanguagesub'] = 'Сейчас необходимо выбрать язык ТОЛЬКО для сообщений во время установки. Язык сайта и пользовательских интерфейсов можно будет указать далее в процессе установки.';
$string['clialreadyinstalled'] = 'Файл config.php уже существует. Если вы хотите обновить сайт, пожалуйста, используйте скрипт admin/cli/upgrade.php.';
$string['clialreadyinstalled'] = 'Файл config.php уже существует. Если Вы хотите обновить сайт, то используйте скрипт admin/cli/upgrade.php.';
$string['cliinstallheader'] = 'Программа установки Moodle {$a} в режиме командной строки';
$string['databasehost'] = 'Сервер баз данных';
$string['databasename'] = 'Название базы данных';
+1 -1
View File
@@ -37,7 +37,7 @@ $string['chooselanguagesub'] = 'Молимо изаберите језик ко
$string['clialreadyconfigured'] = 'Датотека config.php већ постоји. Молимо, користите admin/cli/install_database.php ако желите да инсталирате овај сајт.';
$string['clialreadyinstalled'] = 'Датотека config.php већ постоји. Употребите команду admin/cli/upgrade.php ако желите да надоградите свај сајт.';
$string['cliinstallheader'] = 'Moodle {$a} програм за инсталацију из командне линије';
$string['databasehost'] = 'Сервер базе података :';
$string['databasehost'] = 'Сервер базе података';
$string['databasename'] = 'Име базе података';
$string['databasetypehead'] = 'Изаберите драјвер базе података';
$string['dataroot'] = 'Директоријум података';
+1 -1
View File
@@ -37,7 +37,7 @@ $string['chooselanguagesub'] = 'Molimo izaberite jezik koji će se koristiti tok
$string['clialreadyconfigured'] = 'Datoteka config.php već postoji. Molimo, koristite admin/cli/install_database.php ako želite da instalirate ovaj sajt.';
$string['clialreadyinstalled'] = 'Datoteka config.php već postoji. Upotrebite komandu admin/cli/upgrade.php ako želite da nadogradite svaj sajt.';
$string['cliinstallheader'] = 'Moodle {$a} program za instalaciju iz komandne linije';
$string['databasehost'] = 'Server baze podataka :';
$string['databasehost'] = 'Server baze podataka';
$string['databasename'] = 'Ime baze podataka';
$string['databasetypehead'] = 'Izaberite drajver baze podataka';
$string['dataroot'] = 'Direktorijum podataka';
+1
View File
@@ -30,5 +30,6 @@
defined('MOODLE_INTERNAL') || die();
$string['parentlanguage'] = '';
$string['thisdirection'] = 'ltr';
$string['thislanguage'] = '简体中文';
+2 -2
View File
@@ -189,7 +189,7 @@ $string['configdoctonewwindow'] = 'If you enable this, then links to Moodle Docs
$string['configeditordictionary'] = 'This value will be used if aspell doesn\'t have dictionary for users own language.';
$string['configeditorfontlist'] = 'Select the fonts that should appear in the editor\'s drop-down list.';
$string['configemailchangeconfirmation'] = 'Require an email confirmation step when users change their email address in their profile.';
$string['configenableajax'] = 'This setting allows you to control the use of AJAX (advanced client/server interfaces using Javascript) across the whole site. With this setting enabled users can still make a choice in their profile, otherwise AJAX is disabled for everybody.';
$string['configenableajax'] = 'This setting controls the use of AJAX across the site. AJAX is required for certain functionality such as drag and drop.';
$string['configenablecalendarexport'] = 'Enable exporting or subscribing to calendars.';
$string['configenablecomments'] = 'Enable comments';
$string['configenablecourserequests'] = 'This will allow any user to request a course be created.';
@@ -468,7 +468,7 @@ $string['enablecalendarexport'] = 'Enable calendar export';
$string['enablecomments'] = 'Enable comments';
$string['enablecourserequests'] = 'Enable course requests';
$string['enablecssoptimiser'] = 'Enable CSS optimiser';
$string['enablecssoptimiser_desc'] = 'When enabled CSS will be run through an optimisation process before being cached. The optimiser processes the CSS removing duplicate rules and styles, as well as white space removeable and reformatting. Please note turning this on at the same time as theme designer mode is aweful for performance but will help theme designers create optimised CSS.';
$string['enablecssoptimiser_desc'] = 'When enabled CSS will be run through an optimisation process before being cached. The optimiser processes the CSS removing duplicate rules and styles, as well as white space removable and reformatting. Please note turning this on at the same time as theme designer mode is awful for performance but will help theme designers create optimised CSS.';
$string['enabledevicedetection'] = 'Enable device detection';
$string['enablegravatar'] = 'Enable Gravatar';
$string['enablegravatar_help'] = 'When enabled Moodle will attempt to fetch a user profile picture from Gravatar if the user has not uploaded an image.';
+1 -1
View File
@@ -38,7 +38,7 @@ $string['auth_changepasswordhelp_expl'] = 'Display lost password help to users w
$string['auth_changepasswordurl'] = 'Change password URL';
$string['auth_changepasswordurl_expl'] = 'Specify the url to send users who have lost their {$a} password. Set <strong>Use standard Change Password page</strong> to <strong>No</strong>.';
$string['auth_changingemailaddress'] = 'You have requested a change of email address, from {$a->oldemail} to {$a->newemail}. For security reasons, we are sending you an email message at the new address to confirm that it belongs to you. Your email address will be updated as soon as you open the URL sent to you in that message.';
$string['authinstructions'] = 'Here you can provide instructions for your users, so they know which username and password they should be using. The text you enter here will appear on the login page. If you leave this blank then no instructions will be printed.';
$string['authinstructions'] = 'Leave this blank for the default login instructions to be displayed on the login page. If you want to provide custom login instructions, enter them here.';
$string['auth_invalidnewemailkey'] = 'Error: if you are trying to confirm a change of email address, you may have made a mistake in copying the URL we sent you by email. Please copy the address and try again.';
$string['auth_multiplehosts'] = 'Multiple hosts OR addresses can be specified (eg host1.com;host2.com;host3.com) or (eg xxx.xxx.xxx.xxx;xxx.xxx.xxx.xxx)';
$string['auth_outofnewemailupdateattempts'] = 'You have run out of allowed attempts to update your email address. Your update request has been cancelled.';
+3 -1
View File
@@ -110,6 +110,7 @@ $string['courseprerequisites']='Course prerequisites';
$string['coursesavailable']='Courses available';
$string['coursesavailableexplaination']='<i>Course completion criteria must be set for a course to appear in this list</i>';
$string['criteria']='Criteria';
$string['criteriagradenote'] = 'Please note that updating the required grade here will not update the current course pass grade.';
$string['criteriagroup']='Criteria group';
$string['criteriarequiredall']='All criteria below are required';
$string['criteriarequiredany']='Any criteria below are required';
@@ -124,6 +125,8 @@ $string['datepassed']='Date passed';
$string['daysafterenrolment']='Days after enrolment';
$string['durationafterenrolment']='Duration after enrolment';
$string['fraction']='Fraction';
$string['gradexrequired']='{$a} required';
$string['graderequired']='Grade required';
$string['inprogress']='In progress';
$string['manualcompletionby']='Manual completion by';
$string['manualselfcompletion']='Manual self completion';
@@ -136,7 +139,6 @@ $string['nocriteriaset']='No completion criteria set for this course';
$string['notenroled']='You are not enrolled in this course';
$string['notyetstarted']='Not yet started';
$string['overallcriteriaaggregation']='Overall criteria type aggregation';
$string['passinggrade']='Passing grade';
$string['pending']='Pending';
$string['periodpostenrolment']='Period post enrolment';
$string['prerequisites']='Prerequisites';
+2 -2
View File
@@ -838,7 +838,7 @@ $string['home'] = 'Home';
$string['hour'] = 'hour';
$string['hours'] = 'hours';
$string['howtomakethemes'] = 'How to make new themes';
$string['htmleditor'] = 'Use HTML editor (some browsers only)';
$string['htmleditor'] = 'Use HTML editor';
$string['htmleditoravailable'] = 'The HTML editor is available';
$string['htmleditordisabled'] = 'You have disabled the HTML editor in your user profile';
$string['htmleditordisabledadmin'] = 'The administrator has disabled the HTML editor on this site';
@@ -1710,7 +1710,7 @@ $string['uploadcantwrite'] = 'Failed to write file to disk';
$string['uploadedfile'] = 'File uploaded successfully';
$string['uploadedfileto'] = 'Uploaded {$a->file} to {$a->directory}';
$string['uploadedfiletoobig'] = 'Sorry, but that file is too big (limit is {$a} bytes)';
$string['uploadextension'] = 'File upload stopped by extension';
$string['uploadextension'] = 'File upload stopped by a PHP extension';
$string['uploadfailednotrecovering'] = 'Your file upload has failed because there was a problem with one of the files, {$a->name}.<br /> Here is a log of the problems:<br />{$a->problem}<br />Not recovering.';
$string['uploadfilelog'] = 'Upload log for file {$a}';
$string['uploadformlimit'] = 'Uploaded file {$a} exceeded the maximum size limit set by the form';
+3
View File
@@ -1961,6 +1961,9 @@ function is_enrolled(context $context, $user = null, $withcapability = '', $only
$coursecontext->reload_if_dirty();
if (isset($USER->enrol['enrolled'][$coursecontext->instanceid])) {
if ($USER->enrol['enrolled'][$coursecontext->instanceid] > time()) {
if ($withcapability and !has_capability($withcapability, $context, $userid)) {
return false;
}
return true;
}
}
+1 -1
View File
@@ -452,7 +452,7 @@ function get_used_table_names() {
if ($loaded and $tables = $structure->getTables()) {
foreach($tables as $table) {
$table_names[] = strtolower($table->name);
$table_names[] = strtolower($table->getName());
}
}
}
-3
View File
@@ -36,9 +36,6 @@
function user_preference_allow_ajax_update($name, $paramtype) {
global $USER, $PAGE;
// Make sure that the required JavaScript libraries are loaded.
$PAGE->requires->yui2_lib('connection');
// Record in the session that this user_preference is allowed to updated remotely.
$USER->ajax_updatable_user_prefs[$name] = $paramtype;
}
+14 -11
View File
@@ -62,8 +62,9 @@ class completion_criteria_grade extends completion_criteria {
*/
public function config_form_display(&$mform, $data = null) {
$mform->addElement('checkbox', 'criteria_grade', get_string('enable'));
$mform->addElement('text', 'criteria_grade_value', get_string('passinggrade', 'completion'));
$mform->addElement('text', 'criteria_grade_value', get_string('graderequired', 'completion'));
$mform->setDefault('criteria_grade_value', $data);
$mform->addElement('static', 'criteria_grade_value_note', '', get_string('criteriagradenote', 'completion'));
if ($this->id) {
$mform->setDefault('criteria_grade', 1);
@@ -128,7 +129,7 @@ class completion_criteria_grade extends completion_criteria {
* @return string
*/
public function get_title() {
return get_string('grade');
return get_string('coursegrade', 'completion');
}
/**
@@ -137,7 +138,8 @@ class completion_criteria_grade extends completion_criteria {
* @return string
*/
public function get_title_detailed() {
return (float) $this->gradepass . '% required';
$graderequired = round($this->gradepass, 2).'%';
return get_string('gradexrequired', 'completion', $graderequired);
}
/**
@@ -156,15 +158,16 @@ class completion_criteria_grade extends completion_criteria {
* @return string
*/
public function get_status($completion) {
// Cast as floats to get rid of excess decimal places
$grade = (float) $this->get_grade($completion);
$gradepass = (float) $this->gradepass;
$grade = $this->get_grade($completion);
$graderequired = $this->get_title_detailed();
if ($grade) {
return $grade.'% ('.$gradepass.'% to pass)';
$grade = round($grade, 2).'%';
} else {
return $gradepass.'% to pass';
$grade = get_string('nograde');
}
return $grade.' ('.$graderequired.')';
}
/**
@@ -231,11 +234,11 @@ class completion_criteria_grade extends completion_criteria {
public function get_details($completion) {
$details = array();
$details['type'] = get_string('coursegrade', 'completion');
$details['criteria'] = get_string('passinggrade', 'completion');
$details['requirement'] = ((float)$this->gradepass).'%';
$details['criteria'] = get_string('graderequired', 'completion');
$details['requirement'] = round($this->gradepass, 2).'%';
$details['status'] = '';
$grade = (float)$this->get_grade($completion);
$grade = round($this->get_grade($completion), 2);
if ($grade) {
$details['status'] = $grade.'%';
}
+3 -3
View File
@@ -208,11 +208,11 @@ function cron_run() {
if ($DB->count_records('user_preferences', array('name'=>'create_password', 'value'=>'1'))) {
mtrace('Creating passwords for new users...');
$newusers = $DB->get_recordset_sql("SELECT u.id as id, u.email, u.firstname,
u.lastname, u.username,
u.lastname, u.username, u.lang,
p.id as prefid
FROM {user} u
JOIN {user_preferences} p ON u.id=p.userid
WHERE p.name='create_password' AND p.value='1' AND u.email !='' AND u.suspended = 0 AND u.auth != 'nologin'");
WHERE p.name='create_password' AND p.value='1' AND u.email !='' AND u.suspended = 0 AND u.auth != 'nologin' AND u.deleted = 0");
// note: we can not send emails to suspended accounts
foreach ($newusers as $newuser) {
@@ -709,7 +709,7 @@ function notify_login_failures() {
mtrace('Emailing admins about '. $count .' failed login attempts');
foreach ($recip as $admin) {
//emailing the admins directly rather than putting these through the messaging system
email_to_user($admin,get_admin(), $subject, $body);
email_to_user($admin, generate_email_supportuser(), $subject, $body);
}
}
+1 -1
View File
@@ -171,7 +171,7 @@ function css_send_cached_css($csspath, $etag) {
*
* This function takes a raw CSS string, optimises it if required, and then
* serves it.
* Turning both themedesignermode and CSS optimiser on at the same time is aweful
* Turning both themedesignermode and CSS optimiser on at the same time is awful
* for performance because of the optimiser running here. However it was done so
* that theme designers could utilise the optimised output during development to
* help them optimise their CSS... not that they should write lazy CSS.
+2 -30
View File
@@ -2410,7 +2410,7 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="repository_instance_config" COMMENT="The config for intances" PREVIOUS="repository_instances" NEXT="backup_files">
<TABLE NAME="repository_instance_config" COMMENT="The config for intances" PREVIOUS="repository_instances" NEXT="backup_courses">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="instanceid"/>
<FIELD NAME="instanceid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="name"/>
@@ -2421,35 +2421,7 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="backup_files" COMMENT="To store and recode ids to user and course files" PREVIOUS="repository_instance_config" NEXT="backup_ids">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="backup_code"/>
<FIELD NAME="backup_code" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="file_type"/>
<FIELD NAME="file_type" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false" PREVIOUS="backup_code" NEXT="path"/>
<FIELD NAME="path" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="file_type" NEXT="old_id"/>
<FIELD NAME="old_id" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="path" NEXT="new_id"/>
<FIELD NAME="new_id" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="old_id"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="backup_code-file_type-path"/>
<KEY NAME="backup_code-file_type-path" TYPE="unique" FIELDS="backup_code, file_type, path" PREVIOUS="primary"/>
</KEYS>
</TABLE>
<TABLE NAME="backup_ids" COMMENT="To store and convert ids in backup/restore" PREVIOUS="backup_files" NEXT="backup_courses">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="backup_code"/>
<FIELD NAME="backup_code" TYPE="int" LENGTH="12" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="table_name"/>
<FIELD NAME="table_name" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" PREVIOUS="backup_code" NEXT="old_id"/>
<FIELD NAME="old_id" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="table_name" NEXT="new_id"/>
<FIELD NAME="new_id" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="old_id" NEXT="info"/>
<FIELD NAME="info" TYPE="text" NOTNULL="true" SEQUENCE="false" PREVIOUS="new_id"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="backup_code-table_name-old_id"/>
<KEY NAME="backup_code-table_name-old_id" TYPE="unique" FIELDS="backup_code, table_name, old_id" PREVIOUS="primary"/>
</KEYS>
</TABLE>
<TABLE NAME="backup_courses" COMMENT="To store every course backup status" PREVIOUS="backup_ids" NEXT="block">
<TABLE NAME="backup_courses" COMMENT="To store every course backup status" PREVIOUS="repository_instance_config" NEXT="block">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="courseid"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="laststarttime"/>
+28
View File
@@ -872,5 +872,33 @@ function xmldb_main_upgrade($oldversion) {
}
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
if ($oldversion < 2012062500.02) {
// Drop some old backup tables, not used anymore
// Define table backup_files to be dropped
$table = new xmldb_table('backup_files');
// Conditionally launch drop table for backup_files
if ($dbman->table_exists($table)) {
$dbman->drop_table($table);
}
// Define table backup_ids to be dropped
$table = new xmldb_table('backup_ids');
// Conditionally launch drop table for backup_ids
if ($dbman->table_exists($table)) {
$dbman->drop_table($table);
}
// Main savepoint reached
upgrade_main_savepoint(true, 2012062500.02);
}
return true;
}
+3 -3
View File
@@ -331,7 +331,7 @@ class mssql_native_moodle_database extends moodle_database {
}
$this->tables = array();
$sql = "SELECT table_name
FROM information_schema.tables
FROM INFORMATION_SCHEMA.TABLES
WHERE table_name LIKE '$this->prefix%'
AND table_type = 'BASE TABLE'";
$this->query_start($sql, null, SQL_QUERY_AUX);
@@ -426,7 +426,7 @@ class mssql_native_moodle_database extends moodle_database {
columnproperty(object_id(quotename(table_schema) + '.' +
quotename(table_name)), column_name, 'IsIdentity') AS auto_increment,
column_default AS default_value
FROM information_schema.columns
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = '{" . $table . "}'
ORDER BY ordinal_position";
} else { // temp table, get metadata from tempdb schema
@@ -439,7 +439,7 @@ class mssql_native_moodle_database extends moodle_database {
columnproperty(object_id(quotename(table_schema) + '.' +
quotename(table_name)), column_name, 'IsIdentity') AS auto_increment,
column_default AS default_value
FROM tempdb.information_schema.columns
FROM tempdb.INFORMATION_SCHEMA.COLUMNS
JOIN tempdb..sysobjects ON name = table_name
WHERE id = object_id('tempdb..{" . $table . "}')
ORDER BY ordinal_position";
+15 -6
View File
@@ -292,12 +292,21 @@ class pgsql_native_moodle_database extends moodle_database {
}
$this->tables = array();
$prefix = str_replace('_', '|_', $this->prefix);
// Get them from information_schema instead of catalog as far as
// we want to get only own session temp objects (catalog returns all)
$sql = "SELECT table_name
FROM information_schema.tables
WHERE table_name LIKE '$prefix%' ESCAPE '|'
AND table_type IN ('BASE TABLE', 'LOCAL TEMPORARY')";
if ($this->is_min_version('9.1')) {
// Use ANSI standard information_schema in recent versions where it is fast enough.
$sql = "SELECT table_name
FROM information_schema.tables
WHERE table_name LIKE '$prefix%' ESCAPE '|'
AND table_type IN ('BASE TABLE', 'LOCAL TEMPORARY')";
} else {
// information_schema is horribly slow in <= 9.0, so use pg internals.
// Note the pg_is_other_temp_schema. We only want temp objects from our own session.
$sql = "SELECT c.relname
FROM pg_class c
WHERE c.relname LIKE '$prefix%' ESCAPE '|'
AND c.relkind = 'r'
AND NOT pg_is_other_temp_schema(c.relnamespace)";
}
$this->query_start($sql, null, SQL_QUERY_AUX);
$result = pg_query($this->pgsql, $sql);
$this->query_end($result);
+120 -14
View File
@@ -308,6 +308,7 @@ class dml_testcase extends database_driver_testcase {
function test_fix_sql_params() {
$DB = $this->tdb;
$prefix = $DB->get_prefix();
$table = $this->get_test_table();
$tablename = $table->getName();
@@ -315,13 +316,13 @@ class dml_testcase extends database_driver_testcase {
// Correct table placeholder substitution
$sql = "SELECT * FROM {{$tablename}}";
$sqlarray = $DB->fix_sql_params($sql);
$this->assertEquals("SELECT * FROM {$DB->get_prefix()}".$tablename, $sqlarray[0]);
$this->assertEquals("SELECT * FROM {$prefix}".$tablename, $sqlarray[0]);
// Conversions of all param types
$sql = array();
$sql[SQL_PARAMS_NAMED] = "SELECT * FROM {$DB->get_prefix()}testtable WHERE name = :param1, course = :param2";
$sql[SQL_PARAMS_QM] = "SELECT * FROM {$DB->get_prefix()}testtable WHERE name = ?, course = ?";
$sql[SQL_PARAMS_DOLLAR] = "SELECT * FROM {$DB->get_prefix()}testtable WHERE name = \$1, course = \$2";
$sql[SQL_PARAMS_NAMED] = "SELECT * FROM {$prefix}testtable WHERE name = :param1, course = :param2";
$sql[SQL_PARAMS_QM] = "SELECT * FROM {$prefix}testtable WHERE name = ?, course = ?";
$sql[SQL_PARAMS_DOLLAR] = "SELECT * FROM {$prefix}testtable WHERE name = \$1, course = \$2";
$params = array();
$params[SQL_PARAMS_NAMED] = array('param1'=>'first record', 'param2'=>1);
@@ -921,12 +922,12 @@ class dml_testcase extends database_driver_testcase {
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$dbman->create_table($table);
$data = array(array('id' => 1, 'course' => 3, 'name' => 'record1', 'onetext'=>'abc'),
array('id' => 2, 'course' => 3, 'name' => 'record2', 'onetext'=>'abcd'),
array('id' => 3, 'course' => 5, 'name' => 'record3', 'onetext'=>'abcde'));
$data = array(array('course' => 3, 'name' => 'record1', 'onetext'=>'abc'),
array('course' => 3, 'name' => 'record2', 'onetext'=>'abcd'),
array('course' => 5, 'name' => 'record3', 'onetext'=>'abcde'));
foreach ($data as $record) {
$DB->insert_record($tablename, $record);
foreach ($data as $key=>$record) {
$data[$key]['id'] = $DB->insert_record($tablename, $record);
}
// standard recordset iteration
@@ -990,11 +991,79 @@ class dml_testcase extends database_driver_testcase {
$this->assertEquals($e->errorcode, 'textconditionsnotallowed');
}
// Test nested iteration.
$rs1 = $DB->get_recordset($tablename);
$i = 0;
foreach($rs1 as $record1) {
$rs2 = $DB->get_recordset($tablename);
$i++;
$j = 0;
foreach($rs2 as $record2) {
$j++;
}
$rs2->close();
$this->assertEquals($j, count($data));
}
$rs1->close();
$this->assertEquals($i, count($data));
// notes:
// * limits are tested in test_get_recordset_sql()
// * where_clause() is used internally and is tested in test_get_records()
}
public function test_get_recordset_static() {
$DB = $this->tdb;
$dbman = $DB->get_manager();
$table = $this->get_test_table();
$tablename = $table->getName();
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('course', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$dbman->create_table($table);
$DB->insert_record($tablename, array('course' => 1));
$DB->insert_record($tablename, array('course' => 2));
$DB->insert_record($tablename, array('course' => 3));
$DB->insert_record($tablename, array('course' => 4));
$rs = $DB->get_recordset($tablename, array(), 'id');
$DB->set_field($tablename, 'course', 666, array('course'=>1));
$DB->delete_records($tablename, array('course'=>2));
$i = 0;
foreach($rs as $record) {
$i++;
$this->assertEquals($i, $record->course);
}
$rs->close();
$this->assertEquals(4, $i);
// Now repeat with limits because it may use different code.
$DB->delete_records($tablename, array());
$DB->insert_record($tablename, array('course' => 1));
$DB->insert_record($tablename, array('course' => 2));
$DB->insert_record($tablename, array('course' => 3));
$DB->insert_record($tablename, array('course' => 4));
$rs = $DB->get_recordset($tablename, array(), 'id', '*', 0, 3);
$DB->set_field($tablename, 'course', 666, array('course'=>1));
$DB->delete_records($tablename, array('course'=>2));
$i = 0;
foreach($rs as $record) {
$i++;
$this->assertEquals($i, $record->course);
}
$rs->close();
$this->assertEquals(3, $i);
}
public function test_get_recordset_iterator_keys() {
$DB = $this->tdb;
$dbman = $DB->get_manager();
@@ -1009,11 +1078,11 @@ class dml_testcase extends database_driver_testcase {
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$dbman->create_table($table);
$data = array(array('id'=> 1, 'course' => 3, 'name' => 'record1'),
array('id'=> 2, 'course' => 3, 'name' => 'record2'),
array('id'=> 3, 'course' => 5, 'name' => 'record3'));
foreach ($data as $record) {
$DB->insert_record($tablename, $record);
$data = array(array('course' => 3, 'name' => 'record1'),
array('course' => 3, 'name' => 'record2'),
array('course' => 5, 'name' => 'record3'));
foreach ($data as $key=>$record) {
$data[$key]['id'] = $DB->insert_record($tablename, $record);
}
// Test repeated numeric keys are returned ok
@@ -4128,6 +4197,43 @@ class dml_testcase extends database_driver_testcase {
$this->assertEquals(0, $DB->count_records($tablename)); // finally rolled back
$DB->delete_records($tablename);
// Test interactions of recordset and transactions - this causes problems in SQL Server.
$table2 = $this->get_test_table('2');
$tablename2 = $table2->getName();
$table2->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table2->add_field('course', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
$table2->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$dbman->create_table($table2);
$DB->insert_record($tablename, array('course'=>1));
$DB->insert_record($tablename, array('course'=>2));
$DB->insert_record($tablename, array('course'=>3));
$DB->insert_record($tablename2, array('course'=>5));
$DB->insert_record($tablename2, array('course'=>6));
$DB->insert_record($tablename2, array('course'=>7));
$DB->insert_record($tablename2, array('course'=>8));
$rs1 = $DB->get_recordset($tablename);
$i = 0;
foreach ($rs1 as $record1) {
$i++;
$rs2 = $DB->get_recordset($tablename2);
$j = 0;
foreach ($rs2 as $record2) {
$t = $DB->start_delegated_transaction();
$DB->set_field($tablename, 'course', $record1->course+1, array('id'=>$record1->id));
$DB->set_field($tablename2, 'course', $record2->course+1, array('id'=>$record2->id));
$t->allow_commit();
$j++;
}
$rs2->close();
$this->assertEquals(4, $j);
}
$rs1->close();
$this->assertEquals(3, $i);
}
function test_transactions_forbidden() {
+56 -10
View File
@@ -721,9 +721,16 @@ function file_save_draft_area_files($draftitemid, $contextid, $component, $filea
if (!isset($options['maxfiles'])) {
$options['maxfiles'] = -1; // unlimited
}
if (!isset($options['maxbytes'])) {
if (!isset($options['maxbytes']) || $options['maxbytes'] == USER_CAN_IGNORE_FILE_SIZE_LIMITS) {
$options['maxbytes'] = 0; // unlimited
}
$allowreferences = true;
if (isset($options['return_types']) && !($options['return_types'] & FILE_REFERENCE)) {
// we assume that if $options['return_types'] is NOT specified, we DO allow references.
// this is not exactly right. BUT there are many places in code where filemanager options
// are not passed to file_save_draft_area_files()
$allowreferences = false;
}
$draftfiles = $fs->get_area_files($usercontext->id, 'user', 'draft', $draftitemid, 'id');
$oldfiles = $fs->get_area_files($contextid, $component, $filearea, $itemid, 'id');
@@ -755,6 +762,9 @@ function file_save_draft_area_files($draftitemid, $contextid, $component, $filea
}
if ($file->is_external_file()) {
if (!$allowreferences) {
continue;
}
$repoid = $file->get_repository_id();
if (!empty($repoid)) {
$file_record['repositoryid'] = $repoid;
@@ -856,6 +866,9 @@ function file_save_draft_area_files($draftitemid, $contextid, $component, $filea
}
if ($file->is_external_file()) {
if (!$allowreferences) {
continue;
}
$repoid = $file->get_repository_id();
if (!empty($repoid)) {
$file_record['repositoryid'] = $repoid;
@@ -1405,7 +1418,7 @@ function &get_mimetypes_array() {
'hqx' => array ('type'=>'application/mac-binhex40', 'icon'=>'archive', 'groups'=>array('archive'), 'string'=>'archive'),
'htc' => array ('type'=>'text/x-component', 'icon'=>'markup'),
'html' => array ('type'=>'text/html', 'icon'=>'html', 'groups'=>array('web_file')),
'xhtml'=> array ('type'=>'application/xhtml+xml', 'icon'=>'markup', 'groups'=>array('web_file')),
'xhtml'=> array ('type'=>'application/xhtml+xml', 'icon'=>'html', 'groups'=>array('web_file')),
'htm' => array ('type'=>'text/html', 'icon'=>'html', 'groups'=>array('web_file')),
'ico' => array ('type'=>'image/vnd.microsoft.icon', 'icon'=>'image', 'groups'=>array('image'), 'string'=>'image'),
'ics' => array ('type'=>'text/calendar', 'icon'=>'text'),
@@ -2993,14 +3006,36 @@ class curl {
* Calls {@link multi()} with specific download headers
*
* <code>
* $c = new curl;
* $c = new curl();
* $file1 = fopen('a', 'wb');
* $file2 = fopen('b', 'wb');
* $c->download(array(
* array('url'=>'http://localhost/', 'file'=>fopen('a', 'wb')),
* array('url'=>'http://localhost/20/', 'file'=>fopen('b', 'wb'))
* array('url'=>'http://localhost/', 'file'=>$file1),
* array('url'=>'http://localhost/20/', 'file'=>$file2)
* ));
* fclose($file1);
* fclose($file2);
* </code>
*
* or
*
* <code>
* $c = new curl();
* $c->download(array(
* array('url'=>'http://localhost/', 'filepath'=>'/tmp/file1.tmp'),
* array('url'=>'http://localhost/20/', 'filepath'=>'/tmp/file2.tmp')
* ));
* </code>
*
* @param array $requests An array of files to request
* @param array $requests An array of files to request {
* url => url to download the file [required]
* file => file handler, or
* filepath => file path
* }
* If 'file' and 'filepath' parameters are both specified in one request, the
* open file handle in the 'file' parameter will take precedence and 'filepath'
* will be ignored.
*
* @param array $options An array of options to set
* @return array An array of results
*/
@@ -3024,11 +3059,15 @@ class curl {
$results = array();
$main = curl_multi_init();
for ($i = 0; $i < $count; $i++) {
$url = $requests[$i];
foreach($url as $n=>$v){
$options[$n] = $url[$n];
if (!empty($requests[$i]['filepath']) and empty($requests[$i]['file'])) {
// open file
$requests[$i]['file'] = fopen($requests[$i]['filepath'], 'w');
$requests[$i]['auto-handle'] = true;
}
$handles[$i] = curl_init($url['url']);
foreach($requests[$i] as $n=>$v){
$options[$n] = $v;
}
$handles[$i] = curl_init($requests[$i]['url']);
$this->apply_opt($handles[$i], $options);
curl_multi_add_handle($main, $handles[$i]);
}
@@ -3045,6 +3084,13 @@ class curl {
curl_multi_remove_handle($main, $handles[$i]);
}
curl_multi_close($main);
for ($i = 0; $i < $count; $i++) {
if (!empty($requests[$i]['filepath']) and !empty($requests[$i]['auto-handle'])) {
// close file handler if file is opened in this function
fclose($requests[$i]['file']);
}
}
return $results;
}
+24 -3
View File
@@ -1656,6 +1656,7 @@ class file_storage {
*
* @param string $str
* @param bool $cleanparams if set to true, array elements will be passed through {@link clean_param()}
* @throws file_reference_exception if the $str does not have the expected format
* @return array
*/
public static function unpack_reference($str, $cleanparams = false) {
@@ -1681,7 +1682,13 @@ class file_storage {
}
/**
* Returns all aliases that link to an external file identified by the given reference
* Returns all aliases that refer to some stored_file via the given reference
*
* All repositories that provide access to a stored_file are expected to use
* {@link self::pack_reference()}. This method can't be used if the given reference
* does not use this format or if you are looking for references to an external file
* (for example it can't be used to search for all aliases that refer to a given
* Dropbox or Box.net file).
*
* Aliases in user draft areas are excluded from the returned list.
*
@@ -1695,6 +1702,10 @@ class file_storage {
throw new coding_exception('NULL is not a valid reference to an external file');
}
// Give {@link self::unpack_reference()} a chance to throw exception if the
// reference is not in a valid format.
self::unpack_reference($reference);
$referencehash = sha1($reference);
$sql = "SELECT ".self::instance_sql_fields('f', 'r')."
@@ -1714,7 +1725,13 @@ class file_storage {
}
/**
* Returns the number of aliases that link to an external file identified by the given reference
* Returns the number of aliases that refer to some stored_file via the given reference
*
* All repositories that provide access to a stored_file are expected to use
* {@link self::pack_reference()}. This method can't be used if the given reference
* does not use this format or if you are looking for references to an external file
* (for example it can't be used to count aliases that refer to a given Dropbox or
* Box.net file).
*
* Aliases in user draft areas are not counted.
*
@@ -1728,6 +1745,10 @@ class file_storage {
throw new coding_exception('NULL is not a valid reference to an external file');
}
// Give {@link self::unpack_reference()} a chance to throw exception if the
// reference is not in a valid format.
self::unpack_reference($reference);
$referencehash = sha1($reference);
$sql = "SELECT COUNT(f.id)
@@ -1737,7 +1758,7 @@ class file_storage {
WHERE r.referencehash = ?
AND (f.component <> ? OR f.filearea <> ?)";
return $DB->count_records_sql($sql, array($referencehash, 'user', 'draft'));
return (int)$DB->count_records_sql($sql, array($referencehash, 'user', 'draft'));
}
/**
+67 -17
View File
@@ -400,16 +400,6 @@ class filestoragelib_testcase extends advanced_testcase {
$this->assertFalse($doesntexist);
}
public function test_get_references_by_storedfile() {
$user = $this->setup_three_private_files();
$fs = get_file_storage();
$areafiles = $fs->get_area_files($user->ctxid, 'user', 'private');
$testfile = reset($areafiles);
$references = $fs->get_references_by_storedfile($testfile);
// TODO MDL-33368 Verify result!!
}
public function test_get_external_files() {
$user = $this->setup_three_private_files();
$fs = get_file_storage();
@@ -583,15 +573,75 @@ class filestoragelib_testcase extends advanced_testcase {
}
public function test_search_references() {
$user = $this->setup_three_private_files();
$fs = get_file_storage();
$references = $fs->search_references('testsearch');
// TODO MDL-33368 Verify result!!
}
$repos = repository::get_instances(array('type'=>'user'));
$repo = reset($repos);
public function test_search_references_count() {
$fs = get_file_storage();
$references = $fs->search_references_count('testsearch');
// TODO MDL-33368 Verify result!!
$alias1 = array(
'contextid' => $user->ctxid,
'component' => 'user',
'filearea' => 'private',
'itemid' => 0,
'filepath' => '/aliases/',
'filename' => 'alias-to-1.txt'
);
$alias2 = array(
'contextid' => $user->ctxid,
'component' => 'user',
'filearea' => 'private',
'itemid' => 0,
'filepath' => '/aliases/',
'filename' => 'another-alias-to-1.txt'
);
$reference = file_storage::pack_reference(array(
'contextid' => $user->ctxid,
'component' => 'user',
'filearea' => 'private',
'itemid' => 0,
'filepath' => '/',
'filename' => '1.txt'
));
// There are no aliases now.
$result = $fs->search_references($reference);
$this->assertEquals(array(), $result);
$result = $fs->search_references_count($reference);
$this->assertSame($result, 0);
// Create two aliases and make sure they are returned.
$fs->create_file_from_reference($alias1, $repo->id, $reference);
$fs->create_file_from_reference($alias2, $repo->id, $reference);
$result = $fs->search_references($reference);
$this->assertTrue(is_array($result));
$this->assertEquals(count($result), 2);
foreach ($result as $alias) {
$this->assertTrue($alias instanceof stored_file);
}
$result = $fs->search_references_count($reference);
$this->assertSame($result, 2);
// The method can't be used for references to files outside the filepool
$exceptionthrown = false;
try {
$fs->search_references('http://dl.dropbox.com/download/1234567/naked-dougiamas.jpg');
} catch (file_reference_exception $e) {
$exceptionthrown = true;
}
$this->assertTrue($exceptionthrown);
$exceptionthrown = false;
try {
$fs->search_references_count('http://dl.dropbox.com/download/1234567/naked-dougiamas.jpg');
} catch (file_reference_exception $e) {
$exceptionthrown = true;
}
$this->assertTrue($exceptionthrown);
}
public function test_delete_area_files() {
+1 -1
View File
@@ -975,7 +975,7 @@ M.form_filemanager.init = function(Y, options) {
var manager = new FileManagerHelper(options);
var dndoptions = {
filemanager: manager,
acceptedtypes: options.accepted_types,
acceptedtypes: options.filepicker.accepted_types,
clientid: options.client_id,
author: options.author,
maxfiles: options.maxfiles,
+3
View File
@@ -944,6 +944,9 @@ abstract class moodleform {
$value = $elementclone->_text;
$elementclone->setValue(str_replace('{no}', ($i+1), $value));
} else if (is_a($elementclone, 'HTML_QuickForm_submit') || is_a($elementclone, 'HTML_QuickForm_button')) {
$elementclone->setValue(str_replace('{no}', ($i+1), $elementclone->getValue()));
} else {
$value=$elementclone->getLabel();
$elementclone->setLabel(str_replace('{no}', ($i+1), $value));
+18 -4
View File
@@ -202,9 +202,17 @@ class course_modinfo extends stdClass {
/**
* Gets data about specific numbered section.
* @param int $sectionnumber Number (not id) of section
* @return section_info Information for numbered section
* @param int $strictness Use MUST_EXIST to throw exception if it doesn't
* @return section_info Information for numbered section or null if not found
*/
public function get_section_info($sectionnumber) {
public function get_section_info($sectionnumber, $strictness = IGNORE_MISSING) {
if (!array_key_exists($sectionnumber, $this->sectioninfo)) {
if ($strictness === MUST_EXIST) {
throw new moodle_exception('sectionnotexist');
} else {
return null;
}
}
return $this->sectioninfo[$sectionnumber];
}
@@ -1078,18 +1086,24 @@ class cm_info extends stdClass {
$modcontext = get_context_instance(CONTEXT_MODULE, $this->id);
$userid = $this->modinfo->get_user_id();
$this->uservisible = true;
// Check visibility/availability conditions.
if ((!$this->visible or !$this->available) and
!has_capability('moodle/course:viewhiddenactivities', $modcontext, $userid)) {
// If the activity is hidden or unavailable, and you don't have viewhiddenactivities,
// set it so that user can't see or access it
// set it so that user can't see or access it.
$this->uservisible = false;
} else if (!empty($CFG->enablegroupmembersonly) and !empty($this->groupmembersonly)
}
// Check group membership. The grouping option makes the activity
// completely invisible as it does not apply to the user at all.
if (!empty($CFG->enablegroupmembersonly) and !empty($this->groupmembersonly)
and !has_capability('moodle/site:accessallgroups', $modcontext, $userid)) {
// If the activity has 'group members only' and you don't have accessallgroups...
$groups = $this->modinfo->get_groups($this->groupingid);
if (empty($groups)) {
// ...and you don't belong to a group, then set it so you can't see/access it
$this->uservisible = false;
// Ensure activity is completely hidden from user.
$this->showavailability = 0;
}
}
}
+1 -1
View File
@@ -7179,7 +7179,7 @@ function get_string($identifier, $component = '', $a = NULL, $lazyload = false)
$identifier = clean_param($identifier, PARAM_STRINGID);
if (empty($identifier)) {
throw new coding_exception('Invalid string identifier. Most probably some illegal character is part of the string identifier. Please fix your get_string() call and string definition');
throw new coding_exception('Invalid string identifier. The identifier cannot be empty. Please fix your get_string() call.');
}
// There is now a forth argument again, this time it is a boolean however so
+3
View File
@@ -1924,6 +1924,9 @@ class global_navigation extends navigation_node {
$activities = array();
foreach ($sections as $key => $section) {
// Clone and unset summary to prevent $SESSION bloat (MDL-31802).
$sections[$key] = clone($section);
unset($sections[$key]->summary);
$sections[$key]->hasactivites = false;
if (!array_key_exists($section->section, $modinfo->sections)) {
continue;
+4 -3
View File
@@ -1577,9 +1577,10 @@ class html_writer {
if (!($row instanceof html_table_row)) {
$newrow = new html_table_row();
foreach ($row as $item) {
$cell = new html_table_cell();
$cell->text = $item;
foreach ($row as $cell) {
if (!($cell instanceof html_table_cell)) {
$cell = new html_table_cell($cell);
}
$newrow->cells[] = $cell;
}
$row = $newrow;
+2 -2
View File
@@ -228,12 +228,12 @@ class plugin_renderer_base extends renderer_base {
*/
public function __call($method, $arguments) {
if (method_exists('renderer_base', $method)) {
throw new coding_exception('Protected method called against '.__CLASS__.' :: '.$method);
throw new coding_exception('Protected method called against '.get_class($this).' :: '.$method);
}
if (method_exists($this->output, $method)) {
return call_user_func_array(array($this->output, $method), $arguments);
} else {
throw new coding_exception('Unknown method called against '.__CLASS__.' :: '.$method);
throw new coding_exception('Unknown method called against '.get_class($this).' :: '.$method);
}
}
}
-1
View File
@@ -326,7 +326,6 @@ class page_requirements_manager {
);
if (debugging('', DEBUG_DEVELOPER)) {
$this->M_cfg['developerdebug'] = true;
$this->yui2_lib('logger');
}
// accessibility stuff
+1 -1
View File
@@ -811,7 +811,7 @@ class available_update_checker {
}
if (empty($response['forbranch']) or $response['forbranch'] !== moodle_major_version(true)) {
throw new available_update_checker_exception('err_response_target_version', $response['target']);
throw new available_update_checker_exception('err_response_target_version', $response['forbranch']);
}
}
+12 -9
View File
@@ -722,15 +722,18 @@ class portfolio_exporter {
if ($this->get('user')->id != $USER->id) { // make sure it belongs to the right user
throw new portfolio_exception('notyours', 'portfolio');
}
if (!$readonly && $this->get('instance') && !$this->get('instance')->allows_multiple_exports()
&& ($already = portfolio_existing_exports($this->get('user')->id, $this->get('instance')->get('plugin')))
&& array_shift(array_keys($already)) != $this->get('id')
) {
$a = (object)array(
'plugin' => $this->get('instance')->get('plugin'),
'link' => $CFG->wwwroot . '/user/portfoliologs.php',
);
throw new portfolio_exception('nomultipleexports', 'portfolio', '', $a);
if (!$readonly && $this->get('instance') && !$this->get('instance')->allows_multiple_exports()) {
$already = portfolio_existing_exports($this->get('user')->id, $this->get('instance')->get('plugin'));
$already = array_keys($already);
if (array_shift($already) != $this->get('id')) {
$a = (object)array(
'plugin' => $this->get('instance')->get('plugin'),
'link' => $CFG->wwwroot . '/user/portfoliologs.php',
);
throw new portfolio_exception('nomultipleexports', 'portfolio', '', $a);
}
}
if (!$this->caller->check_permissions()) { // recall the caller permission check
throw new portfolio_caller_exception('nopermissions', 'portfolio', $this->caller->get_return_url());
+37 -8
View File
@@ -565,20 +565,49 @@ function get_exception_info($ex) {
}
/**
* Returns the Moodle Docs URL in the users language
* Returns the Moodle Docs URL in the users language for a given 'More help' link.
*
* @global object
* @param string $path the end of the URL.
* @return string The MoodleDocs URL in the user's language. for example {@link http://docs.moodle.org/en/ http://docs.moodle.org/en/$path}
* There are three cases:
*
* 1. In the normal case, $path will be a short relative path 'component/thing',
* like 'mod/folder/view' 'group/import'. This gets turned into an link to
* MoodleDocs in the user's language, and for the appropriate Moodle version.
* E.g. 'group/import' may become 'http://docs.moodle.org/2x/en/group/import'.
* The 'http://docs.moodle.org' bit comes from $CFG->docroot.
*
* This is the only option that should be used in standard Moodle code. The other
* two options have been implemented because they are useful for third-party plugins.
*
* 2. $path may be an absolute URL, starting http:// or https://. In this case,
* the link is used as is.
*
* 3. $path may start %%WWWROOT%%, in which case that is replaced by
* $CFG->wwwroot to make the link.
*
* @param string $path the place to link to. See above for details.
* @return string The MoodleDocs URL in the user's language. for example @link http://docs.moodle.org/2x/en/$path}
*/
function get_docs_url($path=null) {
function get_docs_url($path = null) {
global $CFG;
// Absolute URLs are used unmodified.
if (substr($path, 0, 7) === 'http://' || substr($path, 0, 8) === 'https://') {
return $path;
}
// Paths starting %%WWWROOT%% have that replaced by $CFG->wwwroot.
if (substr($path, 0, 11) === '%%WWWROOT%%') {
return $CFG->wwwroot . substr($path, 11);
}
// Otherwise we do the normal case, and construct a MoodleDocs URL relative to $CFG->docroot.
// Check that $CFG->branch has been set up, during installation it won't be.
if (empty($CFG->branch)) {
// It's not there yet so look at version.php
// It's not there yet so look at version.php.
include($CFG->dirroot.'/version.php');
} else {
// We can use $CFG->branch and avoid having to include version.php
// We can use $CFG->branch and avoid having to include version.php.
$branch = $CFG->branch;
}
// ensure branch is valid.
@@ -592,7 +621,7 @@ function get_docs_url($path=null) {
if (!empty($CFG->docroot)) {
return $CFG->docroot . '/' . $branch . '/' . current_language() . '/' . $path;
} else {
return 'http://docs.moodle.org/'. $branch . '/en/' . $path;
return 'http://docs.moodle.org/'. $branch . '/' . current_language() . '/' . $path;
}
}
+53
View File
@@ -147,6 +147,59 @@ class accesslib_testcase extends advanced_testcase {
}
}
/**
* Test if user is enrolled in a course
* @return void
*/
public function test_is_enrolled() {
global $DB;
// Generate data
$user = $this->getDataGenerator()->create_user();
$course = $this->getDataGenerator()->create_course();
$coursecontext = context_course::instance($course->id);
$role = $DB->get_record('role', array('shortname'=>'student'));
// There should be a manual enrolment as part of the default install
$plugin = enrol_get_plugin('manual');
$instance = $DB->get_record('enrol', array(
'courseid' => $course->id,
'enrol' => 'manual',
));
$this->assertNotEquals($instance, false);
// Enrol the user in the course
$plugin->enrol_user($instance, $user->id, $role->id);
// We'll test with the mod/assign:submit capability
$capability= 'mod/assign:submit';
$this->assertTrue($DB->record_exists('capabilities', array('name' => $capability)));
// Switch to our user
$this->setUser($user);
// Ensure that the user has the capability first
$this->assertTrue(has_capability($capability, $coursecontext, $user->id));
// We first test whether the user is enrolled on the course as this
// seeds the cache, then we test for the capability
$this->assertTrue(is_enrolled($coursecontext, $user, '', true));
$this->assertTrue(is_enrolled($coursecontext, $user, $capability));
// Prevent the capability for this user role
assign_capability($capability, CAP_PROHIBIT, $role->id, $coursecontext);
$coursecontext->mark_dirty();
$this->assertFalse(has_capability($capability, $coursecontext, $user->id));
// Again, we seed the cache first by checking initial enrolment,
// and then we test the actual capability
$this->assertTrue(is_enrolled($coursecontext, $user, '', true));
$this->assertFalse(is_enrolled($coursecontext, $user, $capability));
// We need variable states to be reset for the next test
$this->resetAfterTest(true);
}
/**
* Test logged in test.
* @return void
+74
View File
@@ -0,0 +1,74 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for setuplib.php
*
* @package core_phpunit
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Unit tests for setuplib.php
*
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_setuplib_testcase extends basic_testcase {
/**
* Test get_docs_url_standard in the normal case when we should link to Moodle docs.
*/
public function test_get_docs_url_standard() {
global $CFG;
if (empty($CFG->docroot)) {
$docroot = 'http://docs.moodle.org/';
} else {
$docroot = $CFG->docroot;
}
$this->assertRegExp('~^' . preg_quote($docroot, '') . '/2\d/' . current_language() . '/course/editing$~',
get_docs_url('course/editing'));
}
/**
* Test get_docs_url_standard in the special case of an absolute HTTP URL.
*/
public function test_get_docs_url_http() {
$url = 'http://moodle.org/';
$this->assertEquals($url, get_docs_url($url));
}
/**
* Test get_docs_url_standard in the special case of an absolute HTTPS URL.
*/
public function test_get_docs_url_https() {
$url = 'https://moodle.org/';
$this->assertEquals($url, get_docs_url($url));
}
/**
* Test get_docs_url_standard in the special case of a link relative to wwwroot.
*/
public function test_get_docs_url_wwwroot() {
global $CFG;
$this->assertEquals($CFG->wwwroot . '/lib/tests/setuplib_test.php',
get_docs_url('%%WWWROOT%%/lib/tests/setuplib_test.php'));
}
}
+6
View File
@@ -471,6 +471,12 @@ class collatorlib_testcase extends basic_testcase {
$this->assertSame(array_keys($arr), array(0, 'b', 1));
$this->assertTrue($result);
// test sorting of array of arrays - first element should be used for actual comparison
$arr = array(0=>array('bb', 'z'), 1=>array('ab', 'a'), 2=>array('zz', 'x'));
$result = collatorlib::asort($arr, collatorlib::SORT_REGULAR);
$this->assertSame(array_keys($arr), array(1, 0, 2));
$this->assertTrue($result);
$arr = array('a' => 'áb', 'b' => 'ab', 1 => 'aa', 0=>'cc', 'x' => 'Áb',);
$result = collatorlib::asort($arr);
$this->assertSame(array_values($arr), array('aa', 'ab', 'áb', 'Áb', 'cc'), $this->error);
+1 -1
View File
@@ -616,7 +616,7 @@ class textlib {
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class collatorlib {
/** @const compare items as strings, equivalent to Collator::SORT_REGULAR */
/** @const compare items using general PHP comparison, equivalent to Collator::SORT_REGULAR, this may bot be locale aware! */
const SORT_REGULAR = 0;
/** @const compare items as strings, equivalent to Collator::SORT_STRING */
+4
View File
@@ -36,6 +36,10 @@ function xmldb_message_email_upgrade($oldversion) {
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+4
View File
@@ -36,6 +36,10 @@ function xmldb_message_jabber_upgrade($oldversion) {
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+4
View File
@@ -36,6 +36,10 @@ function xmldb_message_popup_upgrade($oldversion) {
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+4
View File
@@ -47,6 +47,10 @@ function xmldb_assign_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2012051700, 'assign');
}
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
@@ -29,6 +29,10 @@
*/
function xmldb_assignfeedback_comments_upgrade($oldversion) {
// do the upgrades
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+4
View File
@@ -29,6 +29,10 @@
*/
function xmldb_assignfeedback_file_upgrade($oldversion) {
// do the upgrades
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+1
View File
@@ -74,6 +74,7 @@ $string['couldnotconvertsubmission'] = 'Could not convert assignment submission
$string['couldnotcreatecoursemodule'] = 'Could not create course module.';
$string['couldnotcreatenewassignmentinstance'] = 'Could not create new assignment instance.';
$string['couldnotfindassignmenttoupgrade'] = 'Could not find old assignment instance to upgrade.';
$string['currentgrade'] = 'Current grade in gradebook';
$string['defaultplugins'] = 'Default assignment settings';
$string['defaultplugins_help'] = 'These settings define the defaults for all new assignments.';
$string['deletepluginareyousure'] = 'Delete assignment plugin {$a}: are you sure?';
+10
View File
@@ -2898,6 +2898,16 @@ class assign {
}
}
if (has_all_capabilities(array('gradereport/grader:view', 'moodle/grade:viewall'), $this->get_course_context())) {
$grade = $this->output->action_link(new moodle_url('/grade/report/grader/index.php',
array('id'=>$this->get_course()->id)),
$gradinginfo->items[0]->grades[$userid]->str_grade);
} else {
$grade = $gradinginfo->items[0]->grades[$userid]->str_grade;
}
$mform->addElement('static', 'finalgrade', get_string('currentgrade', 'assign').':' ,$grade);
$mform->addElement('static', 'progress', '', get_string('gradingstudentprogress', 'assign', array('index'=>$rownum+1, 'count'=>count($useridlist))));
// plugins
+3 -1
View File
@@ -45,6 +45,9 @@ class assign_portfolio_caller extends portfolio_module_caller_base {
/** @var int callback arg - the id of submission we export */
protected $sid;
/** @var string component of the submission files we export*/
protected $component;
/** @var string callback arg - the area of submission files we export */
protected $area;
@@ -60,7 +63,6 @@ class assign_portfolio_caller extends portfolio_module_caller_base {
/** @var string callback arg - the name of the editor field we export */
protected $editor;
/**
* callback arg for a single file export
*/
+2
View File
@@ -21,6 +21,8 @@ div.gradingsummary .generaltable {
width: 100%;
}
#page-mod-assign-view table.generaltable table td { border: 0px none; }
.gradingsummarytable,
.feedbacktable,
.lockedsubmission,
@@ -28,6 +28,10 @@
* @return bool
*/
function xmldb_assignsubmission_comments_upgrade($oldversion) {
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
@@ -28,6 +28,10 @@
* @return bool
*/
function xmldb_assignsubmission_file_upgrade($oldversion) {
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
@@ -28,6 +28,10 @@
* @return bool
*/
function xmldb_assignsubmission_onlinetext_upgrade($oldversion) {
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
return true;
}
+40
View File
@@ -29,6 +29,46 @@ function xmldb_assignment_upgrade($oldversion) {
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
if ($oldversion < 2012061701) {
// Fixed/updated numfiles field in assignment_submissions table to count the actual
// number of files has been uploaded when sendformarking is disabled
upgrade_set_timeout(600); // increase excution time for in large sites
$fs = get_file_storage();
// Fetch the moduleid for use in the course_modules table
$moduleid = $DB->get_field('modules', 'id', array('name' => 'assignment'), MUST_EXIST);
$selectcount = 'SELECT COUNT(s.id) ';
$select = 'SELECT s.id, cm.id AS cmid ';
$query = 'FROM {assignment_submissions} s
JOIN {assignment} a ON a.id = s.assignment
JOIN {course_modules} cm ON a.id = cm.instance AND cm.module = :moduleid
WHERE assignmenttype = :assignmenttype';
$params = array('moduleid' => $moduleid, 'assignmenttype' => 'upload');
$countsubmissions = $DB->count_records_sql($selectcount.$query, $params);
$submissions = $DB->get_recordset_sql($select.$query, $params);
$pbar = new progress_bar('assignmentupgradenumfiles', 500, true);
$i = 0;
foreach ($submissions as $sub) {
$i++;
if ($context = context_module::instance($sub->cmid)) {
$sub->numfiles = count($fs->get_area_files($context->id, 'mod_assignment', 'submission', $sub->id, 'sortorder', false));
$DB->update_record('assignment_submissions', $sub);
}
$pbar->update($i, $countsubmissions, "Counting files of submissions ($i/$countsubmissions)");
}
$submissions->close();
// assignment savepoint reached
upgrade_mod_savepoint(true, 2012061701, 'assignment');
}
return true;
}
@@ -395,8 +395,8 @@ class assignment_upload extends assignment_base {
/**
* Counts all complete (real) assignment submissions by enrolled students. This overrides assignment_base::count_real_submissions().
* This is necessary for advanced file uploads where we need to check that the data2 field is equal to "submitted" to determine
* if a submission is complete.
* This is necessary for tracked advanced file uploads where we need to check that the data2 field is equal to ASSIGNMENT_STATUS_SUBMITTED
* to determine if a submission is complete.
*
* @param int $groupid (optional) If nonzero then count is restricted to this group
* @return int The number of submissions
@@ -411,13 +411,19 @@ class assignment_upload extends assignment_base {
list($enroledsql, $params) = get_enrolled_sql($context, 'mod/assignment:view', $groupid);
$params['assignmentid'] = $this->cm->instance;
// Get ids of users enrolled in the given course.
$query = '';
if ($this->drafts_tracked() and $this->isopen()) {
$query = ' AND ' . $DB->sql_compare_text('s.data2') . " = '" . ASSIGNMENT_STATUS_SUBMITTED . "'";
} else {
// Count on submissions with files actually uploaded
$query = " AND s.numfiles > 0";
}
return $DB->count_records_sql("SELECT COUNT('x')
FROM {assignment_submissions} s
LEFT JOIN {assignment} a ON a.id = s.assignment
INNER JOIN ($enroledsql) u ON u.id = s.userid
WHERE s.assignment = :assignmentid AND
s.data2 = 'submitted'", $params);
WHERE s.assignment = :assignmentid" .
$query, $params);
}
function print_responsefiles($userid, $return=false) {
@@ -581,6 +587,7 @@ class assignment_upload extends assignment_base {
$formdata = file_postupdate_standard_filemanager($formdata, 'files', $options, $this->context, 'mod_assignment', 'submission', $submission->id);
$updates = new stdClass();
$updates->id = $submission->id;
$updates->numfiles = count($fs->get_area_files($this->context->id, 'mod_assignment', 'submission', $submission->id, 'sortorder', false));
$updates->timemodified = time();
$DB->update_record('assignment_submissions', $updates);
add_to_log($this->course->id, 'assignment', 'upload',
+1 -1
View File
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$module->version = 2012061700; // The current module version (Date: YYYYMMDDXX)
$module->version = 2012061701; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2012061700; // Requires this Moodle version
$module->component = 'mod_assignment'; // Full name of the plugin (used for diagnostics)
$module->cron = 60;

Some files were not shown because too many files have changed in this diff Show More