Compare commits

..

174 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7) ba3e7df265 Moodle release 2.3rc1 2012-06-24 18:37:12 +02:00
Eloy Lafuente (stronk7) 4f1d79538e Fix permissions. 2012-06-24 18:31:09 +02:00
Eloy Lafuente (stronk7) bec3cd5b18 Merge branch 'install_master' of git://github.com/amosbot/moodle 2012-06-24 18:27:53 +02:00
Dan Poltawski 5b7621f78d Merge branch 'MDL-33717_admin_message2' of git://github.com/andyjdavis/moodle 2012-06-22 15:09:46 +08:00
Damyon Wiese 99467a9f7f MDL-33853: Prevent locking an assignment submission from putting a grade of 0 in the gradebook 2012-06-22 11:12:06 +08:00
Sam Hemelryk 31ea84a503 Merge branch 'MDL-32769-master' of git://github.com/ankitagarwal/moodle 2012-06-22 14:40:09 +12:00
Sam Hemelryk cc0823118d Merge branch 'wip-MDL-33931-master' of git://github.com/abgreeve/moodle 2012-06-22 14:25:54 +12:00
Damyon Wiese dd9247adfe MDL-33954: Assignment "submissionreceipthtml" Language change
Add the missing word: "see"
2012-06-22 09:03:18 +08:00
AMOS bot 0773a5161a Automatically generated installer lang files 2012-06-22 00:31:21 +00:00
Sam Hemelryk 088c374a6d Merge branch 'MDL-33430-reference-restore' of git://github.com/mudrd8mz/moodle
Conflicts:
	lib/db/install.xml
	lib/db/upgrade.php
	version.php
2012-06-22 11:56:49 +12:00
Sam Hemelryk 0e5533b607 MDL-32769 completion: Fixed up display of completion information 2012-06-22 10:42:56 +12:00
Sam Hemelryk a273391e4a Merge branch 'MDL-33936-master-1' of git://git.luns.net.uk/moodle 2012-06-22 09:47:13 +12:00
Sam Hemelryk c691963939 Merge branch 'wip-MDL-33928-master' of git://github.com/phalacee/moodle 2012-06-22 09:33:25 +12:00
Sam Hemelryk c5541daf00 Merge branch 'MDL-33915' of git://github.com/danpoltawski/moodle 2012-06-22 09:02:50 +12:00
David Mudrák 7b5f67f77f MDL-33430 Notify user about file aliases failures at the final stage of the restore 2012-06-21 15:22:38 +02:00
David Mudrák ff8734f21d MDL-33430 Give tasks an access to their current plan's results
This in turn provides access to the plan's results for both structure and
execution steps so they can register something useful there.
2012-06-21 12:28:09 +02:00
David Mudrák fb3a57e2d4 MDL-33430 Fix strict standards warning
Only variables should be passed by reference.
2012-06-21 12:28:09 +02:00
Barbara Ramiro 5a322c8cfc MDL-33381 Icon label removed for all file types to make it generic 2012-06-21 18:19:33 +08:00
David Mudrák d129c3608f MDL-33430 Add caching into choose_repository() method
Simply do not repeat expensive search once the restore process decides how
to deal with the given repositoryid or repositorytype.
2012-06-21 12:17:54 +02:00
Aparup Banerjee 7cacb2ef08 Merge branch 'wip-MDL-33297-master' of git://github.com/abgreeve/moodle 2012-06-21 17:34:57 +08:00
Andrew Robert Nicols c397e0c8bc MDL-33936 Detect activity chooser in block_site_main_menu correctly 2012-06-21 09:19:20 +01:00
Ankit Agarwal dce49c1c38 MDL-32769 course: Moving the completion status to a new line 2012-06-21 16:16:48 +08:00
Dan Poltawski 2a67e6f28b MDL-33911 mathslib: add unit test to demonstrate problem 2012-06-21 16:00:45 +08:00
Dan Poltawski 1e485acd7d Merge branch 'MDL-33911' of git://github.com/timhunt/moodle 2012-06-21 16:00:08 +08:00
Adrian Greeve 612aee17b0 MDL-33931 - themes - Change of the base theme to align the submit and cancel buttons with the rest of the mform (15%) 2012-06-21 15:47:02 +08:00
Dan Poltawski 75c8a109e5 Merge branch 'MDL-33878' of git://github.com/netspotau/moodle-mod_assign 2012-06-21 15:21:13 +08:00
Dan Poltawski 22b0514e27 Merge branch 'MDL-33860' of git://github.com/netspotau/moodle-mod_assign 2012-06-21 14:56:07 +08:00
Damyon Wiese caff10a0b0 MDL-33850: Assignment: Change text to "Add submission" before anything has been submitted
AMOS BEGIN
 CPY [addsubmission,mod_assignment],[addsubmission,mod_assign]
AMOS END
2012-06-21 14:48:53 +08:00
Damyon Wiese 7056953a1c MDL-33860: Use get_string for All option in assignment grading table 2012-06-21 14:48:28 +08:00
Ankit Agarwal 68b8cc84af MDL-32769 course: Do not show a completion status of 0/0 2012-06-21 13:29:46 +08:00
Mary Evans 088511ded6 MDL-33785 theme_base: RTL fixes added to style/filemanager.css
Conflicts:

	theme/base/style/filemanager.css
2012-06-21 17:24:07 +12:00
Dan Poltawski 026082b401 MDL-33915 - prevent use of rebuild_course_cache during upgrade
It depends on upgrade changes itself
2012-06-21 11:43:54 +08:00
Jason Fowler 3d24b287be MDL-33928 - Installation - Fixing the size of the host field for database details in the installation stage 2012-06-21 11:18:51 +08:00
Andrew Davis 7db6bb7f61 MDL-33717 files: improved display_size() so that it displays something nice for -1 2012-06-21 10:14:32 +07:00
Dan Poltawski 334de6b691 Merge branch 'MDL-33877' of git://github.com/netspotau/moodle-mod_assign 2012-06-21 10:04:29 +08:00
David Mudrák 2c1426743a MDL-33430 Add process_file_aliases_queue restore step to the final task
This execution step tries to actually restore all aliases that were
stashed in the file aliases queue.
2012-06-21 02:31:26 +02:00
David Mudrák 83b2cc562d MDL-33430 Set newcontextid and newitemid when sending file to the pool 2012-06-21 02:31:18 +02:00
David Mudrák 38ca2f1a83 MDL-33430 Add newcontextid and newitemid to backup_files_template
These new fields will be used to hold the new location of the file once
it is sent to the filepool during the restore.
2012-06-21 02:29:42 +02:00
David Mudrák 4b6b087faf MDL-33430 Do not restore aliases yet, stash them for later processing 2012-06-21 02:29:34 +02:00
Sam Hemelryk 5f17311f52 MDL-27675 mod_feedback: Fixed up white space 2012-06-21 11:40:38 +12:00
David Mudrák 79b810fdc0 MDL-33430 Include repository type in files.xml in MBZ backup file
This is a valuable information needed especially when restoring the MBZ
at another site. The repositoryid itself is not enough there to identify
the type of the repository.
2012-06-21 01:32:25 +02:00
David Mudrák 6feae1d256 MDL-33430 Make file_storage::unpack_reference() more picky on what it gets 2012-06-21 01:32:24 +02:00
Sam Hemelryk d2448b8bd2 Merge branch 'MDL-27675_master' of git://github.com/grabs/moodle 2012-06-21 11:25:07 +12:00
Sam Hemelryk 92e0842978 Merge branch 'MDL-33808' of git://github.com/danpoltawski/moodle 2012-06-21 10:19:05 +12:00
Sam Hemelryk 21cb669f36 Merge branch 'MDL-33845_folder_whitespace' of git://github.com/moodler/moodle 2012-06-21 10:01:49 +12:00
Sam Hemelryk 45d011c896 Merge branch 'MDL-32479_master' of git://github.com/lazydaisy/moodle
Conflicts:
	theme/base/style/core.css
2012-06-21 09:46:32 +12:00
Tim Hunt 4efc3d4096 MDL-33911 lib/evalmath: fix strict syntax notices 2012-06-20 13:48:37 +01:00
Aparup Banerjee c575842ce9 Merge branch 'MDL-33683-master-2' of git://git.luns.net.uk/moodle 2012-06-20 19:36:22 +08:00
Dan Poltawski 5649520d9b Merge branch 'MDL-33891-master-1' of git://git.luns.net.uk/moodle 2012-06-20 17:43:47 +08:00
Andrew Robert Nicols ae86017339 MDL-33683 Determine sectionid for activity chooser at display time
Rather than calculate the sectionid for the activity chooser on page load,
we do so when opening the chooser. This resolves issues where sections have
been moved without swapping all of the section IDs around.
2012-06-20 10:32:10 +01:00
Andrew Robert Nicols dfe15e0ef9 MDL-33891 Ensure that listen events are cancelled correctly when closing the dialogue 2012-06-20 10:18:19 +01:00
Aparup Banerjee 4c7d9eb5c2 Merge branch 'wip-MDL-33811-m23' of git://github.com/samhemelryk/moodle 2012-06-20 17:18:00 +08:00
Aparup Banerjee 01158d86c4 Merge branch 'wip-MDL-33715-m23' of git://github.com/samhemelryk/moodle 2012-06-20 16:57:51 +08:00
Dan Poltawski 73ec069e3b Merge branch 'wip-MDL-33832-master' of git://github.com/marinaglancy/moodle 2012-06-20 16:55:29 +08:00
Aparup Banerjee c949723817 Merge branch 'wip-MDL-33825-m23' of git://github.com/samhemelryk/moodle 2012-06-20 16:50:54 +08:00
Dan Poltawski e3c7845314 Merge branch 'MDL-27156_part2' of git://github.com/andyjdavis/moodle 2012-06-20 16:38:13 +08:00
Andrew Davis 703ffaea05 MDL-27156 repositories: altered a check as the !empty() test on $PAGE->course was always failing for some reason 2012-06-20 15:17:12 +07:00
Marina Glancy 83d2700ec9 MDL-33832 Fixed filling of files.source field
- also supress the error on unserialise (because people already may have broken files.source field)
- also display details about unparseable JSON error
- make source field look the same across repositories
2012-06-20 16:09:37 +08:00
Aparup Banerjee 3262f547fc Merge branch 'MDL-33649-master-2' of git://git.luns.net.uk/moodle 2012-06-20 15:19:18 +08:00
Aparup Banerjee cd29a5822f Merge branch 'MDL-33722-master-wip' of git://git.luns.net.uk/moodle 2012-06-20 14:53:20 +08:00
Aparup Banerjee 7189225b7a Merge branch 'MDL-33728-master-1' of git://git.luns.net.uk/moodle 2012-06-20 14:49:16 +08:00
Aparup Banerjee f65d3d1d18 Merge branch 'MDL-33703-master-3' of git://git.luns.net.uk/moodle 2012-06-20 14:39:58 +08:00
Damyon Wiese 1f417de84a MDL-33877: Prevent duplicate records in grade items table after running assignment upgrade tool
The cause was multiple calls to set_field on the same table. Changed to update_record.
2012-06-20 14:33:33 +08:00
Aparup Banerjee eca0371465 Merge branch 'MDL-33729-master-1' of git://git.luns.net.uk/moodle 2012-06-20 14:28:05 +08:00
Dan Poltawski b1c43c3f64 Merge branch 'w25_MDL-33831_m23_glossestrict' of git://github.com/skodak/moodle 2012-06-20 13:57:26 +08:00
Dan Poltawski a3086f3233 Merge branch 'MDL-33875' of git://github.com/stronk7/moodle 2012-06-20 13:45:49 +08:00
Dan Poltawski 6e471afe8b Merge branch 'wip-MDL-33417-master' of git://github.com/marinaglancy/moodle 2012-06-20 13:42:19 +08:00
Dan Poltawski b19af5b41c Merge branch 'MDL-33862-master-1' of git://git.luns.net.uk/moodle 2012-06-20 13:22:42 +08:00
Damyon Wiese 14c46e24a9 MDL-33878: Assignment - prevent error when removing overridden flag in gradebook
This error only occurs when there is a submission but no grade in the assignment
and the feedback comments plugin is enabled.
2012-06-20 13:11:19 +08:00
Aparup Banerjee 900183ebf7 MDL-33357 theme : mymobile whitespace fixes 2012-06-20 12:49:20 +08:00
Andrew Davis bc8da017b5 MDL-27156 repositories: altered filepicker.php so that users with the ability to ignore course file size restrictions are not incorrectly restricted 2012-06-20 11:27:31 +07:00
Aparup Banerjee b2d1c67e2c MDL-33357 theme : mymobile whitespaces fixup 2012-06-20 12:11:28 +08:00
Aparup Banerjee 23099d5beb Merge branch 'MDL-33357-3' of git://github.com/epsd/moodle 2012-06-20 12:11:07 +08:00
Dan Poltawski d8d2eebb44 Merge branch 'MDL-33773' of git://github.com/netspotau/moodle-mod_assign 2012-06-20 11:25:08 +08:00
Dan Poltawski f14651b6b1 Merge branch 'MDL-27156_part2' of git://github.com/andyjdavis/moodle 2012-06-20 11:17:01 +08:00
Aparup Banerjee e77fe8f020 Merge branch 'MDL-33856-master-1' of git://git.luns.net.uk/moodle 2012-06-20 11:00:38 +08:00
Adrian Greeve 35ca63c166 MDL-33297 - forum - workshop - glossary - data - Updated the check for files to allow students to see files they recently uploaded. 2012-06-20 10:49:18 +08:00
Jason Fowler e85b7e7865 MDL-32290 - Repositories - Fixing missing slash from the URL path 2012-06-20 10:41:58 +08:00
Ankit Agarwal 7c05cd0e1f MDL-32769 course: Adding completion summary to course sections 2012-06-20 09:38:35 +08:00
Eloy Lafuente (stronk7) 4388b63177 MDL-33875 delete category: fix E_STRICT reset() by ref. 2012-06-20 03:31:44 +02:00
AMOS bot 2406894a20 Automatically generated installer lang files 2012-06-20 00:31:14 +00:00
Eloy Lafuente (stronk7) 7128d8fca2 MDL-32003 xmldb: Use action error for filemodified check instead of structure one (protected attr). 2012-06-20 02:04:02 +02:00
Eloy Lafuente (stronk7) cb172822e5 Merge branch 'w25_MDL-32003_m23_dbcleanup' of git://github.com/skodak/moodle 2012-06-20 02:03:47 +02:00
Sam Hemelryk f7dc4a5630 Merge branch 'MDL-3971' of git://github.com/danpoltawski/moodle 2012-06-20 11:39:59 +12:00
Sam Hemelryk 1e3d84785a Merge branch 'wip-mdl-33425' of git://github.com/rajeshtaneja/moodle 2012-06-20 11:32:04 +12:00
Sam Hemelryk a9efc8ddb8 Merge branch 'MDL-32908' of git://github.com/danpoltawski/moodle 2012-06-20 10:31:52 +12:00
Sam Hemelryk ec1ca38996 Merge branch 'MDL-33843' of git://github.com/netspotau/moodle-mod_assign 2012-06-20 09:36:22 +12:00
Sam Hemelryk dae0c90dbd Merge branch 'wip-mdl-33506' of git://github.com/rajeshtaneja/moodle 2012-06-20 09:15:48 +12:00
John Stabinger 256c51fab0 MDL-33357 update mymobile inline for 2.3, attempt 3 2012-06-19 13:44:51 -04:00
Andrew Robert Nicols a51cf9302b MDL-33862 Ensure that a chooserspan exists before trying to set it up 2012-06-19 15:43:14 +01:00
Andrew Robert Nicols baca909631 MDL-33703 Adjust chooser location when changing browser orientation or size 2012-06-19 15:33:07 +01:00
Damyon Wiese d9a88f427d MDL-33773: Make view/grade all submissions a link in assignment module 2012-06-19 22:08:21 +08:00
Dan Poltawski f189c540b9 Merge branch 'MDL-33842_antivirus_message' of git://github.com/davosmith/moodle 2012-06-19 21:52:27 +08:00
Davo Smith 78b4da1963 MDL-33842 Filemanager dndupload - now displays error messages (including antivirus) 2012-06-19 14:27:12 +01:00
Petr Škoda 9bba13089d MDL-33831 fix E_STRICT issues in glossary 2012-06-19 13:57:11 +02:00
Andrew Robert Nicols 61eadb51af MDL-33856 Correct CSS selectors for chooser dialogues in RTL languages 2012-06-19 10:32:32 +01:00
Dan Poltawski 5e3698fda0 Merge branch 'wip-MDL-33661-master' of https://github.com/barbararamiro/moodle
Conflicts:
	theme/base/style/core.css
2012-06-19 16:28:00 +08:00
Aparup Banerjee 4214bc63a8 MDL-31330 fixed whitespace 2012-06-19 16:13:29 +08:00
Aparup Banerjee 9e4d54e15d Merge branch 'wip-MDL-33130-master' of https://github.com/barbararamiro/moodle
Conflicts:
	theme/base/style/core.css
	theme/base/style/filemanager.css
2012-06-19 16:09:43 +08:00
Martin Dougiamas c23170914a MDL-33845 Removed the hideous amounts of whitespace around the folder edit view for canvas theme (and moved Folder CSS together) 2012-06-19 16:08:28 +08:00
Dan Poltawski 139d3639c8 Merge branch 'MDL-33582-master-integration' of git://github.com/FMCorz/moodle 2012-06-19 15:39:03 +08:00
Damyon Wiese 5382eabbec MDL-33843: Remove custom dirty form handling and use default behaviour in assignment 2012-06-19 15:18:07 +08:00
Dan Poltawski a80b5a0cf0 MDL-32908 - drop $USER->ajax
Its not been respected for some time and is just confusing
2012-06-19 15:07:18 +08:00
Aparup Banerjee 1ee9b37880 Merge branch 'wip-MDL-32990-master' of git://github.com/phalacee/moodle 2012-06-19 14:59:48 +08:00
Jason Fowler 9e9382530f MDL-32990 - Repositories - Updating Box.net API calls to use HTTPS 2012-06-19 14:46:44 +08:00
Barbara Ramiro af9c48cbe9 MDL-33130 Filemanager/Filepicker buttons, Activitity Chooser and Quiz revised to look consistent 2012-06-19 14:36:13 +08:00
Dan Poltawski bb046e61b6 Merge branch 'wip-MDL-33423-m23' of git://github.com/samhemelryk/moodle 2012-06-19 14:29:25 +08:00
Aparup Banerjee 36080a2da2 MDL-30337 : removed extra css affecting LTR when it shouldn't. 2012-06-19 14:27:41 +08:00
Dan Poltawski 4bf433b5fb MDL-33121 book - improve a lang string
+ Make a comment match coding style
2012-06-19 14:15:11 +08:00
Dan Poltawski 34741af185 Merge branch 'MDL-33121' of git://github.com/rwijaya/moodle 2012-06-19 14:14:54 +08:00
Dan Poltawski c1ac8fa189 Merge branch 'MDL-33821-master-1' of git://git.luns.net.uk/moodle 2012-06-19 13:27:07 +08:00
Sam Hemelryk 9d7d2b03c8 MDL-33423 filepicker: Fixed visibility problem with loading icon 2012-06-19 16:53:44 +12:00
Dan Poltawski 8655fb96cf MDL-33808 - format title on the repository instance screen 2012-06-19 12:10:56 +08:00
Dan Poltawski a2e6088c7f MDL-33469 repository_picasa: oops, wrong pluginname in string 2012-06-19 11:56:45 +08:00
Dan Poltawski 102f928621 MDL-33808 - incorrect cleaning of repository names 2012-06-19 11:27:04 +08:00
Marina Glancy 1778f310f3 MDL-33417 Show reference icon for files in filepicker 2012-06-19 11:15:51 +08:00
Eloy Lafuente (stronk7) f18ad1b781 Merge branch 'MDL-33523_master' of git://github.com/dmiletic/moodle 2012-06-19 03:09:30 +02:00
Eloy Lafuente (stronk7) 926b08ca4b Merge branch 'MDL-33623' of git://github.com/danpoltawski/moodle 2012-06-19 03:05:52 +02:00
Eloy Lafuente (stronk7) 25c94edb27 Merge branch 'MDL-33469' of git://github.com/danpoltawski/moodle 2012-06-19 03:01:30 +02:00
Eloy Lafuente (stronk7) f98973c2ff Merge branch 'MDL-33294' of git://github.com/danpoltawski/moodle 2012-06-19 02:59:46 +02:00
Eloy Lafuente (stronk7) f2904fe243 Merge branch 'MDL-33724' of git://github.com/danpoltawski/moodle 2012-06-19 02:56:19 +02:00
Sam Hemelryk 2395a7510f MDL-33825 css_optimiser: Fixed bug where !important was being lost for advanced background styles 2012-06-19 12:32:56 +12:00
AMOS bot 2943b459b5 Automatically generated installer lang files 2012-06-19 00:31:15 +00:00
Sam Hemelryk 624ef76c2f MDL-33811 Fixed left over debugging code preventing proper setting of YUI gallery version 2012-06-19 11:26:23 +12:00
Eloy Lafuente (stronk7) e165512d3a Merge branch 'MDL-33778' of git://github.com/timhunt/moodle 2012-06-19 00:54:39 +02:00
Sam Hemelryk 2e7ce603ff MDL-33423 filepicker: Added delay and fade in to loading icon 2012-06-19 10:11:21 +12:00
Sam Hemelryk 514d31c805 MDL-33715 css_optimiser: enablecssoptimiser setting now triggers theme_reset_all_caches when changed 2012-06-19 10:10:20 +12:00
Andrew Robert Nicols 48e6de1c34 MDL-33821 Fix SQL syntax for recent glossary activity 2012-06-18 16:02:02 +01:00
Tim Hunt 72f2e13d04 MDL-33778 quiz statistics: part and class ids can be strings, not just ints. 2012-06-18 14:39:21 +01:00
Dan Poltawski 07384ecc8b Merge branch 'MDL-33818' of git://github.com/timhunt/moodle 2012-06-18 21:33:26 +08:00
Tim Hunt 584ae11a52 MDL-33818 quiz restore: quiz_attempt.state not restoring old MBZ
This field was new in 2.3, so we need to set it when restoring backups
from 2.2 or before, using the same logic as in upgrade.
2012-06-18 14:09:06 +01:00
Andrew Robert Nicols 2de13ef252 MDL-33722 Set z-index for dndupload-status message to prevent it hiding other items 2012-06-18 11:35:58 +01:00
Eloy Lafuente (stronk7) e04a0e32c7 Merge branch 'MDL-33552' of git://github.com/danpoltawski/moodle 2012-06-18 12:31:37 +02:00
Dan Poltawski 6855fec7fd Merge branch 'MDL-33136_dndfilemanager_replace_file' of git://github.com/davosmith/moodle 2012-06-18 17:36:03 +08:00
Aparup Banerjee 44b836d629 Merge branch 'MDL-33175' of git://github.com/danpoltawski/moodle 2012-06-18 17:14:11 +08:00
Rossiani Wijaya 0a5b9e79e3 MDL-33121 Book Module: removing prev/next value from book_preload_chapters and more code cleaning 2012-06-18 16:10:15 +08:00
Davo Smith b8a22d22fe MDL-33136 Dndupload filemanager - moved 'overwrite all' and 'rename all' buttons onto new line 2012-06-18 08:56:39 +01:00
Davo Smith d0b2d44528 MDL-33136 Dndupload filemanager - user asked to rename/overwrite file when droping file with existing name 2012-06-18 08:55:41 +01:00
Andrew Davis 448c2f5b9b MDL-27156 repositories: altered filepicker.php so that users with the ability to ignore course file size restrictions are not incorrectly restricted 2012-06-18 11:33:28 +07:00
Dan Poltawski 8b5039361a MDL-33469 google plugins - string update
Improved strings to try and ensure maximum support for users during
upgrade.
2012-06-18 11:28:27 +08:00
Rajesh Taneja 4e782b32f3 MDL-33425 user: Replaced filepicker with filemanager on edit profile page 2012-06-18 10:19:48 +08:00
Petr Skoda d8bf2a14b6 MDL-32003 last db related phpdocs cleanup commit 2012-06-17 22:56:30 +02:00
Petr Skoda 002252f714 MDL-32003 standardise null case 2012-06-17 22:56:30 +02:00
Petr Skoda 2edc3fecfb MDL-32003 fix broken table ordering and cleanup other xmldb ordering 2012-06-17 22:56:30 +02:00
Petr Skoda aaddfac50c MDL-32003 more xmldb phpdocs and PHP4-ism cleanup 2012-06-17 22:56:30 +02:00
Petr Skoda 85d6dd382e MDL-32003 fix xmldb editor code indentations, phpdocs and PHP4-isms 2012-06-17 22:56:29 +02:00
Petr Skoda a6d9d4efc2 MDL-32003 fix PHP4-isms in core xmldb code 2012-06-17 22:56:29 +02:00
Petr Skoda ef7c3f108a MDL-32003 protect xmldb class internals
Use getters and setters instead!
2012-06-17 22:56:29 +02:00
Petr Skoda 01be2287c7 MDL-32003 drop unused statement constants
These were last used in 2.2 upgrade, not allowed any more.
2012-06-17 22:56:29 +02:00
Petr Skoda 94417438b3 MDL-32003 fix phpdocs in xmldb abstraction 2012-06-17 22:56:28 +02:00
Petr Skoda 5a070f0477 MDL-32003 fix phpdocs in DDL layer 2012-06-17 22:56:28 +02:00
Petr Skoda 00902cd974 MDL-32003 fix phpdocs and use __DIR__ for includes in dml layer
DML layer is not supposed to use $CFG,
it is better to rely on __DIR__ in self-contained libs…
2012-06-17 22:56:28 +02:00
Dan Poltawski dd4502af6b MDL-3971 - mod_forum: contain () in span 2012-06-16 14:21:28 +08:00
Dan Poltawski 15ea1c9105 MDL-33294 - block_blog_recent: fix E_STRICT error
Default object from empty value
2012-06-16 12:46:07 +08:00
Dan Poltawski 7f3b68a892 MDL-33294 - block_blog_tags: fix E_STRICT error
Default object from empty value
2012-06-16 12:45:41 +08:00
Mary Evans 642b1ca325 MDL-32479 theme_base: some RTL fixes for Moodle 2.3 2012-06-15 22:00:03 +01:00
Marina Glancy 52474d7497 MDL-33136 upload dnd files one after another 2012-06-15 14:48:02 +08:00
Darko Miletic 7547946580 MDL-33523: Fixed item C of the issue 2012-06-14 17:12:53 -03:00
Darko Miletic 42642f6c35 MDL-33523: for for missing image (the folder.gif is no longer available) 2012-06-14 12:34:10 -03:00
Andrew Robert Nicols 605f92ca1d MDL-33729 Ensure that the cancel_popup event is correctly called when using the [x] button on a chooser 2012-06-14 14:46:24 +01:00
Andrew Robert Nicols 7db27680f8 MDL-33728 Ensure that chooser dialogues are centred vertically 2012-06-14 10:55:16 +01:00
Dan Poltawski ed8e053e64 MDL-33724 repository_equella: missing string 2012-06-14 17:01:39 +08:00
Frederic Massart 247804bcc2 MDL-33582 Filepicker: set main file button disabled when not required 2012-06-14 15:14:57 +08:00
Dan Poltawski bc1f298b2a MDL-33175 - filemanager: make dndupload icon clickable 2012-06-14 13:25:05 +08:00
Rajesh Taneja d01ebb940d MDL-33506 Filepicker: Search box text will be selected on focus 2012-06-14 13:03:08 +08:00
Andrew Robert Nicols b95b05085c MDL-33649 Hide page scrollbars when a chooser is open
This has the effect of preventing page scrolling which makes the chooser
difficult to use when there are many options or the page is too small.
2012-06-13 10:51:31 +01:00
Barbara Ramiro 64063bdbe2 MDL-33661 Aligned assignment 2.2 and its subtypes 2012-06-13 16:00:03 +08:00
Rossiani Wijaya fb909757a6 MDL-33121 Book Module: Removing unused book_log(), renamed css class and fixed the book_preload_chpaters: next and previous values 2012-06-13 15:42:58 +08:00
Tõnis Tartes 5b7e511ea8 MDL-33121 Book Module: performed minor changes and cleanup for the module 2012-06-13 15:28:07 +08:00
Rossiani Wijaya b15ef0b058 MDL-33121 Book Module: Fixed documentation header 2012-06-13 15:25:23 +08:00
Dan Poltawski c17ec774d7 MDL-33552 - portfolio api E_STRICT fixes
admin_config_form and admin_config_validation are now static
2012-06-12 22:56:42 +08:00
Dan Poltawski 2365213fdb MDL-33623 - course: remove incorrect logic for marker moving 2012-06-11 15:11:10 +08:00
Dan Poltawski 3d8fe4820a MDL-33623 - course: add unit tests for section moving
Including tracking of the course marker updates
2012-06-11 11:46:22 +08:00
Andreas Grabs e7fc2ff42e MDL-27675 - Feedback module abuses data_submitted 2012-06-06 23:17:35 +02:00
1064 changed files with 9664 additions and 8029 deletions
+4 -1
View File
@@ -14,7 +14,10 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$temp->add(new admin_setting_configcheckbox('enablegroupmembersonly', new lang_string('enablegroupmembersonly', 'admin'), new lang_string('configenablegroupmembersonly', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('dndallowtextandlinks', new lang_string('dndallowtextandlinks', 'admin'), new lang_string('configdndallowtextandlinks', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('enablecssoptimiser', new lang_string('enablecssoptimiser','admin'), new lang_string('enablecssoptimiser_desc','admin'), 0));
// The CSS optimiser setting. When changed we need to reset the theme caches in order to ensure they are regenerated through the optimiser.
$enablecssoptimiser = new admin_setting_configcheckbox('enablecssoptimiser', new lang_string('enablecssoptimiser','admin'), new lang_string('enablecssoptimiser_desc','admin'), 0);
$enablecssoptimiser->set_updatedcallback('theme_reset_all_caches');
$temp->add($enablecssoptimiser);
$ADMIN->add('experimental', $temp);
+1 -1
View File
@@ -86,7 +86,7 @@ $today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today),
// array of all valid fields for validation
$STD_FIELDS = array('id', 'firstname', 'lastname', 'username', 'email',
'city', 'country', 'lang', 'timezone', 'mailformat',
'maildisplay', 'maildigest', 'htmleditor', 'ajax', 'autosubscribe',
'maildisplay', 'maildigest', 'htmleditor', 'autosubscribe',
'institution', 'department', 'idnumber', 'skype',
'msn', 'aim', 'yahoo', 'icq', 'phone1', 'phone2', 'address',
'url', 'description', 'descriptionformat', 'password',
-9
View File
@@ -248,15 +248,6 @@ class admin_uploaduser_form2 extends moodleform {
$mform->setType('htmleditor', PARAM_INT);
}
if (empty($CFG->enableajax)) {
$mform->addElement('static', 'ajax', get_string('ajaxuse'), get_string('ajaxno'));
} else {
$choices = array( 0 => get_string('ajaxno'), 1 => get_string('ajaxyes'));
$mform->addElement('select', 'ajax', get_string('ajaxuse'), $choices);
$mform->setDefault('ajax', 1);
}
$mform->setAdvanced('ajax');
$mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="25"');
$mform->setType('city', PARAM_MULTILANG);
if (empty($CFG->defaultcity)) {
+26 -19
View File
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -27,35 +26,35 @@
* Main xmldb action class. It implements all the basic
* functionalities to be shared by each action.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class XMLDBAction {
var $does_generate; //Type of value returned by the invoke method
//ACTION_GENERATE_HTML have contents to show
//set by each specialized invoke
/** @var bool Type of value returned by the invoke method, ACTION_GENERATE_HTML have contents to show, set by each specialized invoke*/
protected $does_generate;
var $title; //Title of the Action (class name, by default)
//set by parent init automatically
/** @var string Title of the Action (class name, by default), set by parent init automatically*/
protected $title;
var $str; //Strings used by the action
//set by each specialized init, calling loadStrings
/** @var string Strings used by the action set by each specialized init, calling loadStrings*/
protected $str;
var $output; //Output of the action
//set by each specialized invoke, get with getOutput
/** @var string Output of the action, set by each specialized invoke, get with getOutput*/
protected $output;
var $errormsg; //Last Error produced. Check when any invoke returns false
//get with getError
/** @var string Last Error produced. Check when any invoke returns false, get with getError*/
protected $errormsg;
var $postaction; //Action to execute at the end of the invoke script
/** @var string Action to execute at the end of the invoke script*/
protected $postaction;
var $sesskey_protected; // Actions must be protected by sesskey mechanism
/** @var bool Actions must be protected by sesskey mechanism*/
protected $sesskey_protected;
/**
* Constructor to keep PHP5 happy
* Constructor
*/
function __construct() {
$this->init();
@@ -76,7 +75,8 @@ class XMLDBAction {
}
/**
* returns the type of output of the file
* Returns the type of output of the file
* @return bool
*/
function getDoesGenerate() {
return $this->does_generate;
@@ -85,6 +85,7 @@ class XMLDBAction {
/**
* getError method, returns the last error string.
* Used if the invoke() methods returns false
* @return string
*/
function getError() {
return $this->errormsg;
@@ -93,6 +94,7 @@ class XMLDBAction {
/**
* getOutput method, returns the output generated by the action.
* Used after execution of the invoke() methods if they return true
* @return string
*/
function getOutput() {
return $this->output;
@@ -101,6 +103,7 @@ class XMLDBAction {
/**
* getPostAction method, returns the action to launch after executing
* another one
* @return string
*/
function getPostAction() {
return $this->postaction;
@@ -109,6 +112,7 @@ class XMLDBAction {
/**
* getTitle method returns the title of the action (that is part
* of the $str array attribute
* @return string
*/
function getTitle() {
return $this->str['title'];
@@ -117,6 +121,7 @@ class XMLDBAction {
/**
* loadStrings method, loads the required strings specified in the
* array parameter
* @params array $strings
*/
function loadStrings($strings) {
// Load some commonly used strings
@@ -162,6 +167,8 @@ class XMLDBAction {
/**
* launch method, used to easily call invoke methods between actions
* @param string $action
* @return mixed
*/
function launch($action) {
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2008 onwards Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -25,14 +24,13 @@
* This is a base class for the various actions that interate over all the
* tables and check some aspect of their definition.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2008 onwards Tim Hunt
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class XMLDBCheckAction extends XMLDBAction {
/**
* This string is displayed with a yes/no choice before the report is run.
* @var string This string is displayed with a yes/no choice before the report is run.
* You must set this to the name of a lang string in xmldb.php before calling init.
*/
protected $introstr = '';
@@ -117,7 +115,7 @@ abstract class XMLDBCheckAction extends XMLDBAction {
// Iterate over $XMLDB->dbdirs, loading their XML data to memory
if ($XMLDB->dbdirs) {
$dbdirs =& $XMLDB->dbdirs;
$dbdirs = $XMLDB->dbdirs;
$o='<ul>';
foreach ($dbdirs as $dbdir) {
// Only if the directory exists
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -25,8 +24,7 @@
* reporting about the ones not physically implemented as BIGINTs
* and providing one SQL script to fix all them. MDL-11038
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -26,8 +25,7 @@
* match those specified in the xml specs
* and providing one SQL script to fix all them.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -30,8 +29,7 @@
* Each 0 in that column will violate the foreign key, but we ignore them.
* If you want a strict check performed, then add &strict=1 to the URL.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -26,8 +25,7 @@
* with the physical DB implementation, reporting about all the missing
* indexes to be created to be 100% ok.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package xmldb-editor
* @package tool_xmldb
* @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -28,7 +28,7 @@
* them by changing to cross-db (CHAR) length semantics.
* See MDL-29322 for more details.
*
* @package xmldb-editor
* @package tool_xmldb
* @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -15,15 +15,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will delete completely one field
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -96,21 +94,21 @@ class delete_field extends XMLDBAction {
// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$editeddir =& $XMLDB->editeddirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
$editeddir = $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
$structure =& $editeddir->xml_file->getStructure();
$structure = $editeddir->xml_file->getStructure();
// Move adjacent fields prev and next attributes
$tables =& $structure->getTables();
$table =& $structure->getTable($tableparam);
$fields =& $table->getFields();
$field =& $table->getField($fieldparam);
$tables = $structure->getTables();
$table = $structure->getTable($tableparam);
$fields = $table->getFields();
$field = $table->getField($fieldparam);
if ($field->getPrevious()) {
$prev =& $table->getField($field->getPrevious());
$prev = $table->getField($field->getPrevious());
$prev->setNext($field->getNext());
}
if ($field->getNext()) {
$next =& $table->getField($field->getNext());
$next = $table->getField($field->getNext());
$next->setPrevious($field->getPrevious());
}
// Remove the field
@@ -121,7 +119,7 @@ class delete_field extends XMLDBAction {
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will delete completely one index
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -96,21 +94,21 @@ class delete_index extends XMLDBAction {
// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$editeddir =& $XMLDB->editeddirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
$editeddir = $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
$structure =& $editeddir->xml_file->getStructure();
$structure = $editeddir->xml_file->getStructure();
// Move adjacent indexes prev and next attributes
$tables =& $structure->getTables();
$table =& $structure->getTable($tableparam);
$indexes =& $table->getIndexes();
$index =& $table->getIndex($indexparam);
$tables = $structure->getTables();
$table = $structure->getTable($tableparam);
$indexes = $table->getIndexes();
$index = $table->getIndex($indexparam);
if ($index->getPrevious()) {
$prev =& $table->getIndex($index->getPrevious());
$prev = $table->getIndex($index->getPrevious());
$prev->setNext($index->getNext());
}
if ($index->getNext()) {
$next =& $table->getIndex($index->getNext());
$next = $table->getIndex($index->getNext());
$next->setPrevious($index->getPrevious());
}
// Remove the index
@@ -121,7 +119,7 @@ class delete_index extends XMLDBAction {
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will delete completely one key
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -96,21 +94,21 @@ class delete_key extends XMLDBAction {
// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$editeddir =& $XMLDB->editeddirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
$editeddir = $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
$structure =& $editeddir->xml_file->getStructure();
$structure = $editeddir->xml_file->getStructure();
// Move adjacent keys prev and next attributes
$tables =& $structure->getTables();
$table =& $structure->getTable($tableparam);
$keys =& $table->getKeys();
$key =& $table->getKey($keyparam);
$tables = $structure->getTables();
$table = $structure->getTable($tableparam);
$keys = $table->getKeys();
$key = $table->getKey($keyparam);
if ($key->getPrevious()) {
$prev =& $table->getKey($key->getPrevious());
$prev = $table->getKey($key->getPrevious());
$prev->setNext($key->getNext());
}
if ($key->getNext()) {
$next =& $table->getKey($key->getNext());
$next = $table->getKey($key->getNext());
$next->setPrevious($key->getPrevious());
}
// Remove the key
@@ -121,7 +119,7 @@ class delete_key extends XMLDBAction {
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will delete completely one table
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -95,10 +93,10 @@ class delete_table extends XMLDBAction {
// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$editeddir =& $XMLDB->editeddirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
$editeddir = $XMLDB->editeddirs[$dirpath];
if ($editeddir) {
$structure =& $editeddir->xml_file->getStructure();
$structure = $editeddir->xml_file->getStructure();
// Remove the table
$structure->deleteTable($tableparam);
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will delete completely one XML file
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -94,7 +92,7 @@ class delete_xml_file extends XMLDBAction {
// Get the original dir and delete the xml file
if (!empty($XMLDB->dbdirs)) {
if (isset($XMLDB->dbdirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
if ($dbdir) {
@unlink($dirpath . '/install.xml');
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will provide the interface for all the edit field actions
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -75,30 +73,30 @@ class edit_field extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
// Fetch request data
$tableparam = required_param('table', PARAM_CLEAN);
if (!$table =& $structure->getTable($tableparam)) {
if (!$table = $structure->getTable($tableparam)) {
$this->errormsg = 'Wrong table specified: ' . $tableparam;
return false;
}
$fieldparam = required_param('field', PARAM_CLEAN);
if (!$field =& $table->getField($fieldparam)) {
if (!$field = $table->getField($fieldparam)) {
// Arriving here from a name change, looking for the new field name
$fieldparam = required_param('name', PARAM_CLEAN);
$field =& $table->getField($fieldparam);
$field = $table->getField($fieldparam);
}
$dbdir =& $XMLDB->dbdirs[$dirpath];
$origstructure =& $dbdir->xml_file->getStructure();
$dbdir = $XMLDB->dbdirs[$dirpath];
$origstructure = $dbdir->xml_file->getStructure();
$o = ''; // Output starts
@@ -136,9 +134,9 @@ class edit_field extends XMLDBAction {
XMLDB_TYPE_CHAR => $field->getXMLDBTypeName(XMLDB_TYPE_CHAR),
XMLDB_TYPE_TEXT => $field->getXMLDBTypeName(XMLDB_TYPE_TEXT),
XMLDB_TYPE_BINARY => $field->getXMLDBTypeName(XMLDB_TYPE_BINARY));
// If current field isnt float, delete such column type to avoid its creation from the interface
// If current field isn't float, delete such column type to avoid its creation from the interface
// Note that float fields are supported completely but it's possible than in a next future
// we delete them completely from Moodle DB, using, exlusively, number(x,y) types
// we delete them completely from Moodle DB, using, exclusively, number(x,y) types
if ($field->getType() != XMLDB_TYPE_FLOAT) {
unset ($typeoptions[XMLDB_TYPE_FLOAT]);
}
@@ -14,8 +14,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -25,8 +24,7 @@
* This class verifies all the data introduced when editing a field for correctness,
* performing changes / displaying errors depending of the results.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -99,10 +97,10 @@ class edit_field_save extends XMLDBAction {
$default = optional_param('default', NULL, PARAM_PATH);
$default = trim($default);
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$table =& $structure->getTable($tableparam);
$field =& $table->getField($fieldparam);
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
$table = $structure->getTable($tableparam);
$field = $table->getField($fieldparam);
$oldhash = $field->getHash();
$errors = array(); // To store all the errors found
@@ -225,12 +223,12 @@ class edit_field_save extends XMLDBAction {
if ($fieldparam != $name) {
$field->setName($name);
if ($field->getPrevious()) {
$prev =& $table->getField($field->getPrevious());
$prev = $table->getField($field->getPrevious());
$prev->setNext($name);
$prev->setChanged(true);
}
if ($field->getNext()) {
$next =& $table->getField($field->getNext());
$next = $table->getField($field->getNext());
$next->setPrevious($name);
$next->setChanged(true);
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,7 +23,7 @@
/**
* This class will provide the interface for all the edit index actions
*
* @package xmldb-editor
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -73,30 +72,30 @@ class edit_index extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
// Fetch request data
$tableparam = required_param('table', PARAM_CLEAN);
if (!$table =& $structure->getTable($tableparam)) {
if (!$table = $structure->getTable($tableparam)) {
$this->errormsg = 'Wrong table specified: ' . $tableparam;
return false;
}
$indexparam = required_param('index', PARAM_CLEAN);
if (!$index =& $table->getIndex($indexparam)) {
if (!$index = $table->getIndex($indexparam)) {
// Arriving here from a name change, looking for the new key name
$indexparam = required_param('name', PARAM_CLEAN);
$index =& $table->getIndex($indexparam);
$index = $table->getIndex($indexparam);
}
$dbdir =& $XMLDB->dbdirs[$dirpath];
$origstructure =& $dbdir->xml_file->getStructure();
$dbdir = $XMLDB->dbdirs[$dirpath];
$origstructure = $dbdir->xml_file->getStructure();
// Add the main form
$o = '<form id="form" action="index.php" method="post">';
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -25,8 +24,7 @@
* This class verifies all the data introduced when editing an index for correctness,
* performing changes / displaying errors depending of the results.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -93,10 +91,10 @@ class edit_index_save extends XMLDBAction {
$fields = required_param('fields', PARAM_CLEAN);
$fields = str_replace(' ', '', trim(strtolower($fields)));
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$table =& $structure->getTable($tableparam);
$index =& $table->getIndex($indexparam);
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
$table = $structure->getTable($tableparam);
$index = $table->getIndex($indexparam);
$oldhash = $index->getHash();
$errors = array(); // To store all the errors found
@@ -182,12 +180,12 @@ class edit_index_save extends XMLDBAction {
if ($indexparam != $name) {
$index->setName($name);
if ($index->getPrevious()) {
$prev =& $table->getIndex($index->getPrevious());
$prev = $table->getIndex($index->getPrevious());
$prev->setNext($name);
$prev->setChanged(true);
}
if ($index->getNext()) {
$next =& $table->getIndex($index->getNext());
$next = $table->getIndex($index->getNext());
$next->setPrevious($name);
$next->setChanged(true);
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will provide the interface for all the edit key actions
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -74,30 +72,30 @@ class edit_key extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
// Fetch request data
$tableparam = required_param('table', PARAM_CLEAN);
if (!$table =& $structure->getTable($tableparam)) {
if (!$table = $structure->getTable($tableparam)) {
$this->errormsg = 'Wrong table specified: ' . $tableparam;
return false;
}
$keyparam = required_param('key', PARAM_CLEAN);
if (!$key =& $table->getKey($keyparam)) {
if (!$key = $table->getKey($keyparam)) {
// Arriving here from a name change, looking for the new key name
$keyparam = required_param('name', PARAM_CLEAN);
$key =& $table->getKey($keyparam);
$key = $table->getKey($keyparam);
}
$dbdir =& $XMLDB->dbdirs[$dirpath];
$origstructure =& $dbdir->xml_file->getStructure();
$dbdir = $XMLDB->dbdirs[$dirpath];
$origstructure = $dbdir->xml_file->getStructure();
// Add the main form
$o = '<form id="form" action="index.php" method="post">';
@@ -14,8 +14,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -25,8 +24,7 @@
* This class verifies all the data introduced when editing a key for correctness,
* performing changes / displaying errors depending of the results.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -106,10 +104,10 @@ class edit_key_save extends XMLDBAction {
$reffields = str_replace(' ', '', trim(strtolower($reffields)));
}
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$table =& $structure->getTable($tableparam);
$key =& $table->getKey($keyparam);
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
$table = $structure->getTable($tableparam);
$key = $table->getKey($keyparam);
$oldhash = $key->getHash();
$errors = array(); // To store all the errors found
@@ -254,16 +252,16 @@ class edit_key_save extends XMLDBAction {
// Continue if we aren't under errors
if (empty($errors)) {
// If there is one name change, do it, changing the prev and next
// atributes of the adjacent fields
// attributes of the adjacent fields
if ($keyparam != $name) {
$key->setName($name);
if ($key->getPrevious()) {
$prev =& $table->getKey($key->getPrevious());
$prev = $table->getKey($key->getPrevious());
$prev->setNext($name);
$prev->setChanged(true);
}
if ($key->getNext()) {
$next =& $table->getKey($key->getNext());
$next = $table->getKey($key->getNext());
$next->setPrevious($name);
$next->setChanged(true);
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -28,8 +27,7 @@
* can be invoked, plus links to PHP code generator, view SQL, rearrange
* elements and so on.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -93,7 +91,7 @@ class edit_table extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
@@ -104,19 +102,19 @@ class edit_table extends XMLDBAction {
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$tableparam = required_param('table', PARAM_CLEAN);
if (!$table =& $structure->getTable($tableparam)) {
if (!$table = $structure->getTable($tableparam)) {
// Arriving here from a name change, looking for the new table name
$tableparam = required_param('name', PARAM_CLEAN);
$table =& $structure->getTable($tableparam);
$table = $structure->getTable($tableparam);
}
$dbdir =& $XMLDB->dbdirs[$dirpath];
$origstructure =& $dbdir->xml_file->getStructure();
$dbdir = $XMLDB->dbdirs[$dirpath];
$origstructure = $dbdir->xml_file->getStructure();
// Add the main form
$o = '<form id="form" action="index.php" method="post">';
@@ -193,7 +191,7 @@ class edit_table extends XMLDBAction {
$table->deleteIndex('changeme');
// Add the fields list
$fields =& $table->getFields();
$fields = $table->getFields();
if (!empty($fields)) {
$o .= '<h3 class="main">' . $this->str['fields'] . '</h3>';
$o .= '<table id="listfields" border="0" cellpadding="5" cellspacing="1" class="boxaligncenter flexible">';
@@ -251,7 +249,7 @@ class edit_table extends XMLDBAction {
$o .= '</table>';
}
// Add the keys list
$keys =& $table->getKeys();
$keys = $table->getKeys();
if (!empty($keys)) {
$o .= '<h3 class="main">' . $this->str['keys'] . '</h3>';
$o .= '<table id="listkeys" border="0" cellpadding="5" cellspacing="1" class="boxaligncenter flexible">';
@@ -304,7 +302,7 @@ class edit_table extends XMLDBAction {
$o .= '</table>';
}
// Add the indexes list
$indexes =& $table->getIndexes();
$indexes = $table->getIndexes();
if (!empty($indexes)) {
$o .= '<h3 class="main">' . $this->str['indexes'] . '</h3>';
$o .= '<table id="listindexes" border="0" cellpadding="5" cellspacing="1" class="boxaligncenter flexible">';
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will save changes in table name and/or comments
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -81,11 +79,11 @@ class edit_table_save extends XMLDBAction {
$comment = required_param('comment', PARAM_CLEAN);
$comment = $comment;
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$table =& $structure->getTable($tableparam);
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
$table = $structure->getTable($tableparam);
$errors = array(); // To store all the errors found
@@ -120,12 +118,12 @@ class edit_table_save extends XMLDBAction {
if ($tableparam != $name) {
$table->setName($name);
if ($table->getPrevious()) {
$prev =& $structure->getTable($table->getPrevious());
$prev = $structure->getTable($table->getPrevious());
$prev->setNext($name);
$prev->setChanged(true);
}
if ($table->getNext()) {
$next =& $structure->getTable($table->getNext());
$next = $structure->getTable($table->getNext());
$next->setPrevious($name);
$next->setChanged(true);
}
@@ -145,7 +143,7 @@ class edit_table_save extends XMLDBAction {
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -27,8 +26,7 @@
* Main page to start editing one XML file. From here it's possible to access
* to tables edition plus PHP code generation and other utilities
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -90,7 +88,7 @@ class edit_xml_file extends XMLDBAction {
// Get the correct dir
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
if ($dbdir) {
// Only if the directory exists and it has been loaded
if (!$dbdir->path_exists || !$dbdir->xml_loaded) {
@@ -105,8 +103,8 @@ class edit_xml_file extends XMLDBAction {
$XMLDB->editeddirs[$dirpath] = unserialize(serialize($dbdir));
}
// Get it
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
// Add the main form
$o = '<form id="form" action="index.php" method="post">';
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will save the changes performed to the comment of one file
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -76,16 +74,16 @@ class edit_xml_file_save extends XMLDBAction {
$comment = $comment;
// Set comment and recalculate hash
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
$structure->setComment($comment);
$structure->calculateHash(true);
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origdir =& $XMLDB->dbdirs[$dirpath];
$origstructure =& $origdir->xml_file->getStructure();
$origdir = $XMLDB->dbdirs[$dirpath];
$origstructure = $origdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -25,8 +24,7 @@
* This class will produce the documentation for all the XMLDB files in the server,
* via XSL, performing the output in HTML format.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will produce XSL documentation for the loaded XML file
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -25,8 +24,7 @@
* This class will will check all the db directories existing under the
* current Moodle installation, sending them to the SESSION->dbdirs array
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will load one XML file to memory if necessary
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -74,7 +72,7 @@ class load_xml_file extends XMLDBAction {
// Get the correct dir
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
if ($dbdir) {
// Set some defaults
$dbdir->xml_exists = false;
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will load every XML file to memory if necessary
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -69,7 +67,7 @@ class load_xml_files extends XMLDBAction {
// Iterate over $XMLDB->dbdirs, loading their XML data to memory
if ($XMLDB->dbdirs) {
$dbdirs =& $XMLDB->dbdirs;
$dbdirs = $XMLDB->dbdirs;
foreach ($dbdirs as $dbdir) {
// Set some defaults
$dbdir->xml_exists = false;
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -27,8 +26,7 @@
* From here, files can be created, edited, saved and deleted, plus some
* extra utilities like displaying docs, xml info and performing various consistency tests
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -60,6 +58,7 @@ class main_view extends XMLDBAction {
'checkbigints' => 'tool_xmldb',
'checkoraclesemantics' => 'tool_xmldb',
'doc' => 'tool_xmldb',
'filemodifiedoutfromeditor' => 'tool_xmldb',
'viewxml' => 'tool_xmldb',
'pendingchangescannotbesavedreload' => 'tool_xmldb'
));
@@ -134,9 +133,9 @@ class main_view extends XMLDBAction {
if (!isset($dbdir->has_changed) && isset($dbdir->xml_loaded)) {
$dbdir->xml_changed = false;
if (isset($XMLDB->editeddirs[$key])) {
$editeddir =& $XMLDB->editeddirs[$key];
$editeddir = $XMLDB->editeddirs[$key];
if (isset($editeddir->xml_file)) {
$structure =& $editeddir->xml_file->getStructure();
$structure = $editeddir->xml_file->getStructure();
if ($structure->hasChanged()) {
$dbdir->xml_changed = true;
$editeddir->xml_changed = true;
@@ -196,10 +195,8 @@ class main_view extends XMLDBAction {
$b .= '<a href="index.php?action=save_xml_file&amp;sesskey=' . sesskey() . '&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $key)) . '&amp;time=' . time() . '&amp;postaction=main_view#lastused">[' . $this->str['save'] . ']</a>';
// Check if the file has been manually edited while being modified in the editor
if ($dbdir->filemtime != filemtime($key . '/install.xml')) {
// File manually modified. Add to errors.
if ($structure =& $dbdir->xml_file->getStructure()) {
$structure->errormsg = 'Warning: File locally modified while using the XMLDB Editor. Saving will overwrite local changes';
}
// File manually modified. Add to action error, will be displayed inline.
$this->errormsg = $this->str['filemodifiedoutfromeditor'];
}
} else {
$b .= '[' . $this->str['save'] . ']';
@@ -267,8 +264,13 @@ class main_view extends XMLDBAction {
$row = ($row + 1) % 2;
// show errors if they exist
if (isset($dbdir->xml_file)) {
if ($structure =& $dbdir->xml_file->getStructure()) {
if ($errors = $structure->getAllErrors()) {
if ($structure = $dbdir->xml_file->getStructure()) {
$errors = !empty($this->errormsg) ? array($this->errormsg) : array();
$structureerrors = $structure->getAllErrors();
if ($structureerrors) {
$errors = array_merge($errors, $structureerrors);
}
if (!empty($errors)) {
if ($hithis) {
$o .= '<tr class="highlight"><td class="error cell" colspan="10">' . implode (', ', $errors) . '</td></tr>';
} else {
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will will move one field up/down
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -69,13 +67,13 @@ class move_updown_field extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$prev = NULL;
@@ -83,20 +81,20 @@ class move_updown_field extends XMLDBAction {
$tableparam = required_param('table', PARAM_CLEAN);
$fieldparam = required_param('field', PARAM_CLEAN);
$direction = required_param('direction', PARAM_ALPHA);
$tables =& $structure->getTables();
$table =& $structure->getTable($tableparam);
$fields =& $table->getFields();
$tables = $structure->getTables();
$table = $structure->getTable($tableparam);
$fields = $table->getFields();
if ($direction == 'down') {
$field =& $table->getField($fieldparam);
$swap =& $table->getField($field->getNext());
$field = $table->getField($fieldparam);
$swap = $table->getField($field->getNext());
} else {
$swap =& $table->getField($fieldparam);
$field =& $table->getField($swap->getPrevious());
$swap = $table->getField($fieldparam);
$field = $table->getField($swap->getPrevious());
}
// Change the field before the pair
if ($field->getPrevious()) {
$prev =& $table->getField($field->getPrevious());
$prev = $table->getField($field->getPrevious());
$prev->setNext($swap->getName());
$swap->setPrevious($prev->getName());
$prev->setChanged(true);
@@ -105,7 +103,7 @@ class move_updown_field extends XMLDBAction {
}
// Change the field after the pair
if ($swap->getNext()) {
$next =& $table->getField($swap->getNext());
$next = $table->getField($swap->getNext());
$next->setPrevious($field->getName());
$field->setNext($next->getName());
$next->setChanged(true);
@@ -124,14 +122,14 @@ class move_updown_field extends XMLDBAction {
$table->setChanged(true);
// Reorder the fields
$table->orderFields($fields);
$table->orderFields();
// Recalculate the hash
$structure->calculateHash(true);
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will will move one index up/down
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -69,13 +67,13 @@ class move_updown_index extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$prev = NULL;
@@ -83,20 +81,20 @@ class move_updown_index extends XMLDBAction {
$tableparam = required_param('table', PARAM_CLEAN);
$indexparam = required_param('index', PARAM_CLEAN);
$direction = required_param('direction', PARAM_ALPHA);
$tables =& $structure->getTables();
$table =& $structure->getTable($tableparam);
$indexes =& $table->getIndexes();
$tables = $structure->getTables();
$table = $structure->getTable($tableparam);
$indexes = $table->getIndexes();
if ($direction == 'down') {
$index =& $table->getIndex($indexparam);
$swap =& $table->getIndex($index->getNext());
$index = $table->getIndex($indexparam);
$swap = $table->getIndex($index->getNext());
} else {
$swap =& $table->getIndex($indexparam);
$index =& $table->getIndex($swap->getPrevious());
$swap = $table->getIndex($indexparam);
$index = $table->getIndex($swap->getPrevious());
}
// Change the index before the pair
if ($index->getPrevious()) {
$prev =& $table->getIndex($index->getPrevious());
$prev = $table->getIndex($index->getPrevious());
$prev->setNext($swap->getName());
$swap->setPrevious($prev->getName());
$prev->setChanged(true);
@@ -105,7 +103,7 @@ class move_updown_index extends XMLDBAction {
}
// Change the field after the pair
if ($swap->getNext()) {
$next =& $table->getIndex($swap->getNext());
$next = $table->getIndex($swap->getNext());
$next->setPrevious($index->getName());
$index->setNext($next->getName());
$next->setChanged(true);
@@ -124,14 +122,14 @@ class move_updown_index extends XMLDBAction {
$table->setChanged(true);
// Reorder the indexes
$table->orderIndexes($indexes);
$table->orderIndexes();
// Recalculate the hash
$structure->calculateHash(true);
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will will move one key up/down
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -69,13 +67,13 @@ class move_updown_key extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$prev = NULL;
@@ -83,20 +81,20 @@ class move_updown_key extends XMLDBAction {
$tableparam = required_param('table', PARAM_CLEAN);
$keyparam = required_param('key', PARAM_CLEAN);
$direction = required_param('direction', PARAM_ALPHA);
$tables =& $structure->getTables();
$table =& $structure->getTable($tableparam);
$keys =& $table->getKeys();
$tables = $structure->getTables();
$table = $structure->getTable($tableparam);
$keys = $table->getKeys();
if ($direction == 'down') {
$key =& $table->getKey($keyparam);
$swap =& $table->getKey($key->getNext());
$key = $table->getKey($keyparam);
$swap = $table->getKey($key->getNext());
} else {
$swap =& $table->getKey($keyparam);
$key =& $table->getKey($swap->getPrevious());
$swap = $table->getKey($keyparam);
$key = $table->getKey($swap->getPrevious());
}
// Change the key before the pair
if ($key->getPrevious()) {
$prev =& $table->getKey($key->getPrevious());
$prev = $table->getKey($key->getPrevious());
$prev->setNext($swap->getName());
$swap->setPrevious($prev->getName());
$prev->setChanged(true);
@@ -105,7 +103,7 @@ class move_updown_key extends XMLDBAction {
}
// Change the key after the pair
if ($swap->getNext()) {
$next =& $table->getKey($swap->getNext());
$next = $table->getKey($swap->getNext());
$next->setPrevious($key->getName());
$key->setNext($next->getName());
$next->setChanged(true);
@@ -124,14 +122,14 @@ class move_updown_key extends XMLDBAction {
$table->setChanged(true);
// Reorder the keys
$table->orderKeys($keys);
$table->orderKeys();
// Recalculate the hash
$structure->calculateHash(true);
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will will move table up/down
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -69,31 +67,31 @@ class move_updown_table extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$prev = NULL;
$next = NULL;
$tableparam = required_param('table', PARAM_CLEAN);
$direction = required_param('direction', PARAM_ALPHA);
$tables =& $structure->getTables();
$tables = $structure->getTables();
if ($direction == 'down') {
$table =& $structure->getTable($tableparam);
$swap =& $structure->getTable($table->getNext());
$table = $structure->getTable($tableparam);
$swap = $structure->getTable($table->getNext());
} else {
$swap =& $structure->getTable($tableparam);
$table =& $structure->getTable($swap->getPrevious());
$swap = $structure->getTable($tableparam);
$table = $structure->getTable($swap->getPrevious());
}
// Change the table before the pair
if ($table->getPrevious()) {
$prev =& $structure->getTable($table->getPrevious());
$prev = $structure->getTable($table->getPrevious());
$prev->setNext($swap->getName());
$swap->setPrevious($prev->getName());
$prev->setChanged(true);
@@ -102,7 +100,7 @@ class move_updown_table extends XMLDBAction {
}
// Change the table after the pair
if ($swap->getNext()) {
$next =& $structure->getTable($swap->getNext());
$next = $structure->getTable($swap->getNext());
$next->setPrevious($table->getName());
$table->setNext($next->getName());
$next->setChanged(true);
@@ -117,15 +115,14 @@ class move_updown_table extends XMLDBAction {
$table->setChanged(true);
// Reorder the structure
$structure->orderTables($tables);
// Send tables back to structure (the order above break refs)
$structure->setTables($tables);
$structure->orderTables();
// Recalculate the hash
$structure->calculateHash(true);
// If the hash has changed from the original one, change the version
// and mark the structure as changed
$origstructure =& $dbdir->xml_file->getStructure();
$origstructure = $dbdir->xml_file->getStructure();
if ($structure->getHash() != $origstructure->getHash()) {
$structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
$structure->setChanged(true);
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will create a new default field to be edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -69,23 +67,23 @@ class new_field extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$tableparam = required_param('table', PARAM_CLEAN);
$table =& $structure->getTable($tableparam);
$table = $structure->getTable($tableparam);
// If the changeme field exists, just get it and continue
$changeme_exists = false;
if ($fields =& $table->getFields()) {
if ($field =& $table->getField('changeme')) {
if ($fields = $table->getFields()) {
if ($field = $table->getField('changeme')) {
$changeme_exists = true;
}
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will create a new default index to be edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -69,23 +67,23 @@ class new_index extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$tableparam = required_param('table', PARAM_CLEAN);
$table =& $structure->getTable($tableparam);
$table = $structure->getTable($tableparam);
// If the changeme index exists, just get it and continue
$changeme_exists = false;
if ($indexes =& $table->getIndexes()) {
if ($index =& $table->getIndex('changeme')) {
if ($indexes = $table->getIndexes()) {
if ($index = $table->getIndex('changeme')) {
$changeme_exists = true;
}
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will create a new default key to be edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -69,23 +67,23 @@ class new_key extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$tableparam = required_param('table', PARAM_CLEAN);
$table =& $structure->getTable($tableparam);
$table = $structure->getTable($tableparam);
// If the changeme key exists, just get it and continue
$changeme_exists = false;
if ($keys =& $table->getKeys()) {
if ($key =& $table->getKey('changeme')) {
if ($keys = $table->getKeys()) {
if ($key = $table->getKey('changeme')) {
$changeme_exists = true;
}
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will create a new default table to be edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -69,19 +67,19 @@ class new_table extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
// If the changeme table exists, just get it and continue
$changeme_exists = false;
if ($tables =& $structure->getTables()) {
if ($table =& $structure->getTable('changeme')) {
if ($tables = $structure->getTables()) {
if ($table = $structure->getTable('changeme')) {
$changeme_exists = true;
}
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -25,8 +24,7 @@
* This class will ask and retrofit all the information from one
* mysql table present in the Moodle DB to one xmldb_table structure
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -72,13 +70,13 @@ class new_table_from_mysql extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$tableparam = optional_param('table', NULL, PARAM_CLEAN);
@@ -98,7 +96,7 @@ class new_table_from_mysql extends XMLDBAction {
}
// Get list of after tables
$aftertables = array();
if ($tables =& $structure->getTables()) {
if ($tables = $structure->getTables()) {
foreach ($tables as $aftertable) {
$aftertables[$aftertable->getName()] = $aftertable->getName();
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will revert changes (delete the editeddb)
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -94,7 +92,7 @@ class revert_changes extends XMLDBAction {
// Get the original dir and delete some elements
if (!empty($XMLDB->dbdirs)) {
if (isset($XMLDB->dbdirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
if ($dbdir) {
unset($dbdir->xml_changed);
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -29,8 +28,7 @@
* is going to continue (unload=false). Else (default) the
* file is unloaded once saved.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -76,18 +74,18 @@ class save_xml_file extends XMLDBAction {
// Get the edited dir
if (!empty($XMLDB->editeddirs)) {
if (isset($XMLDB->editeddirs[$dirpath])) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$editeddir = $XMLDB->editeddirs[$dirpath];
}
}
// Copy the edited dir over the original one
if (!empty($XMLDB->dbdirs)) {
if (isset($XMLDB->dbdirs[$dirpath])) {
$XMLDB->dbdirs[$dirpath] = unserialize(serialize($editeddir));
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
}
}
// Chech for perms
// Check for perms
if (!is_writeable($dirpath . '/install.xml')) {
$this->errormsg = $this->str['filenotwriteable'] . '(' . $dirpath . '/install.xml)';
return false;
@@ -15,15 +15,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -68,13 +66,13 @@ class template extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
// ADD YOUR CODE HERE
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will unload one loaded file completely
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -71,7 +69,7 @@ class unload_xml_file extends XMLDBAction {
// Get the original dir and delete some elements
if (!empty($XMLDB->dbdirs)) {
if (isset($XMLDB->dbdirs[$dirpath])) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
if ($dbdir) {
unset($dbdir->xml_file);
unset($dbdir->xml_loaded);
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will display the XML for one field being edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -75,11 +73,11 @@ class view_field_xml extends XMLDBAction {
// Get the correct dir
if ($select == 'original') {
if (!empty($XMLDB->dbdirs)) {
$base =& $XMLDB->dbdirs[$dirpath];
$base = $XMLDB->dbdirs[$dirpath];
}
} else if ($select == 'edited') {
if (!empty($XMLDB->editeddirs)) {
$base =& $XMLDB->editeddirs[$dirpath];
$base = $XMLDB->editeddirs[$dirpath];
}
} else {
$this->errormsg = 'Cannot access to ' . $select . ' info';
@@ -98,14 +96,14 @@ class view_field_xml extends XMLDBAction {
// Get the structure
if ($result) {
if (!$structure =& $base->xml_file->getStructure()) {
if (!$structure = $base->xml_file->getStructure()) {
$this->errormsg = 'Error retrieving ' . $select . ' structure';
$result = false;
}
}
// Get the tables
if ($result) {
if (!$tables =& $structure->getTables()) {
if (!$tables = $structure->getTables()) {
$this->errormsg = 'Error retrieving ' . $select . ' tables';
$result = false;
}
@@ -117,7 +115,7 @@ class view_field_xml extends XMLDBAction {
}
// Get the fields
if ($result) {
if (!$fields =& $t->getFields()) {
if (!$fields = $t->getFields()) {
$this->errormsg = 'Error retrieving ' . $select . ' fields';
$result = false;
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will display the XML for one index being edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -75,11 +73,11 @@ class view_index_xml extends XMLDBAction {
// Get the correct dir
if ($select == 'original') {
if (!empty($XMLDB->dbdirs)) {
$base =& $XMLDB->dbdirs[$dirpath];
$base = $XMLDB->dbdirs[$dirpath];
}
} else if ($select == 'edited') {
if (!empty($XMLDB->editeddirs)) {
$base =& $XMLDB->editeddirs[$dirpath];
$base = $XMLDB->editeddirs[$dirpath];
}
} else {
$this->errormsg = 'Cannot access to ' . $select . ' info';
@@ -98,26 +96,26 @@ class view_index_xml extends XMLDBAction {
// Get the structure
if ($result) {
if (!$structure =& $base->xml_file->getStructure()) {
if (!$structure = $base->xml_file->getStructure()) {
$this->errormsg = 'Error retrieving ' . $select . ' structure';
$result = false;
}
}
// Get the tables
if ($result) {
if (!$tables =& $structure->getTables()) {
if (!$tables = $structure->getTables()) {
$this->errormsg = 'Error retrieving ' . $select . ' tables';
$result = false;
}
}
// Get the table
if ($result && !$t =& $structure->getTable($table)) {
if ($result && !$t = $structure->getTable($table)) {
$this->errormsg = 'Error retrieving ' . $table . ' table';
$result = false;
}
// Get the indexes
if ($result) {
if (!$indexes =& $t->getIndexes()) {
if (!$indexes = $t->getIndexes()) {
$this->errormsg = 'Error retrieving ' . $select . ' indexes';
$result = false;
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will display the XML for one key being edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -75,11 +73,11 @@ class view_key_xml extends XMLDBAction {
// Get the correct dir
if ($select == 'original') {
if (!empty($XMLDB->dbdirs)) {
$base =& $XMLDB->dbdirs[$dirpath];
$base = $XMLDB->dbdirs[$dirpath];
}
} else if ($select == 'edited') {
if (!empty($XMLDB->editeddirs)) {
$base =& $XMLDB->editeddirs[$dirpath];
$base = $XMLDB->editeddirs[$dirpath];
}
} else {
$this->errormsg = 'Cannot access to ' . $select . ' info';
@@ -98,26 +96,26 @@ class view_key_xml extends XMLDBAction {
// Get the structure
if ($result) {
if (!$structure =& $base->xml_file->getStructure()) {
if (!$structure = $base->xml_file->getStructure()) {
$this->errormsg = 'Error retrieving ' . $select . ' structure';
$result = false;
}
}
// Get the tables
if ($result) {
if (!$tables =& $structure->getTables()) {
if (!$tables = $structure->getTables()) {
$this->errormsg = 'Error retrieving ' . $select . ' tables';
$result = false;
}
}
// Get the table
if ($result && !$t =& $structure->getTable($table)) {
if ($result && !$t = $structure->getTable($table)) {
$this->errormsg = 'Error retrieving ' . $table . ' table';
$result = false;
}
// Get the keys
if ($result) {
if (!$keys =& $t->getKeys()) {
if (!$keys = $t->getKeys()) {
$this->errormsg = 'Error retrieving ' . $select . ' keys';
$result = false;
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -27,8 +26,7 @@
* http://docs.moodle.org/en/Database_reserved_words
* Also, it introspects te DB looking for such words and informing about
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -25,8 +24,7 @@
* This class will show the PHP needed (upgrade block) to perform
* the desired DDL action with the specified table
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -73,16 +71,16 @@ class view_structure_php extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$tables =& $structure->getTables();
$tables = $structure->getTables();
$table = reset($tables);
$defaulttable = null;
if ($table) {
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -25,8 +24,7 @@
* This class will show the SQL generated for the selected RDBMS for
* the entire XMLDB file
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -72,13 +70,13 @@ class view_structure_sql extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
// The back to edit table button
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will display the XML for one structure
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -73,11 +71,11 @@ class view_structure_xml extends XMLDBAction {
// Get the correct dir
if ($select == 'original') {
if (!empty($XMLDB->dbdirs)) {
$base =& $XMLDB->dbdirs[$dirpath];
$base = $XMLDB->dbdirs[$dirpath];
}
} else if ($select == 'edited') {
if (!empty($XMLDB->editeddirs)) {
$base =& $XMLDB->editeddirs[$dirpath];
$base = $XMLDB->editeddirs[$dirpath];
}
} else {
$this->errormsg = 'Cannot access to ' . $select . ' info';
@@ -96,7 +94,7 @@ class view_structure_xml extends XMLDBAction {
// Get the structure
if ($result) {
if (!$structure =& $base->xml_file->getStructure()) {
if (!$structure = $base->xml_file->getStructure()) {
$this->errormsg = 'Error retrieving ' . $select . ' structure';
$result = false;
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -25,8 +24,7 @@
* This class will show the PHP needed (upgrade block) to perform
* the desired DDL action with the specified field/key/index
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -79,18 +77,18 @@ class view_table_php extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
$tableparam = required_param('table', PARAM_PATH);
$table =& $structure->getTable($tableparam);
$table = $structure->getTable($tableparam);
$fields = $table->getFields();
$field = reset($fields);
$defaultfieldkeyindex = null;
@@ -14,8 +14,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -25,8 +24,7 @@
* This class will show the SQL generated for the selected RDBMS for
* one table
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -72,13 +70,13 @@ class view_table_sql extends XMLDBAction {
// Get the correct dirs
if (!empty($XMLDB->dbdirs)) {
$dbdir =& $XMLDB->dbdirs[$dirpath];
$dbdir = $XMLDB->dbdirs[$dirpath];
} else {
return false;
}
if (!empty($XMLDB->editeddirs)) {
$editeddir =& $XMLDB->editeddirs[$dirpath];
$structure =& $editeddir->xml_file->getStructure();
$editeddir = $XMLDB->editeddirs[$dirpath];
$structure = $editeddir->xml_file->getStructure();
}
// Get parameters
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will display the XML for one table being edited
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -74,11 +72,11 @@ class view_table_xml extends XMLDBAction {
// Get the correct dir
if ($select == 'original') {
if (!empty($XMLDB->dbdirs)) {
$base =& $XMLDB->dbdirs[$dirpath];
$base = $XMLDB->dbdirs[$dirpath];
}
} else if ($select == 'edited') {
if (!empty($XMLDB->editeddirs)) {
$base =& $XMLDB->editeddirs[$dirpath];
$base = $XMLDB->editeddirs[$dirpath];
}
} else {
$this->errormsg = 'Cannot access to ' . $select . ' info';
@@ -97,20 +95,20 @@ class view_table_xml extends XMLDBAction {
// Get the structure
if ($result) {
if (!$structure =& $base->xml_file->getStructure()) {
if (!$structure = $base->xml_file->getStructure()) {
$this->errormsg = 'Error retrieving ' . $select . ' structure';
$result = false;
}
}
// Get the tables
if ($result) {
if (!$tables =& $structure->getTables()) {
if (!$tables = $structure->getTables()) {
$this->errormsg = 'Error retrieving ' . $select . ' tables';
$result = false;
}
}
// Get the table
if ($result && !$t =& $structure->getTable($table)) {
if ($result && !$t = $structure->getTable($table)) {
$this->errormsg = 'Error retrieving ' . $table . ' table';
$result = false;
}
@@ -15,8 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -24,8 +23,7 @@
/**
* This class will display one XML file
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -53,6 +51,7 @@ class view_xml extends XMLDBAction {
* Invoke method, every class will have its own
* returns true/false on completion, setting both
* errormsg and output as necessary
* @return mixed
*/
function invoke() {
parent::invoke();
+75 -76
View File
@@ -18,109 +18,108 @@
* This is the main script for the complete XMLDB interface. From here
* all the actions supported will be launched.
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com,
* (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require('../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/ddllib.php');
// Add required XMLDB action classes
require_once('actions/XMLDBAction.class.php');
require_once('actions/XMLDBCheckAction.class.php');
require('../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/ddllib.php');
// Add required XMLDB action classes
require_once('actions/XMLDBAction.class.php');
require_once('actions/XMLDBCheckAction.class.php');
admin_externalpage_setup('toolxmld');
admin_externalpage_setup('toolxmld');
// Add other used libraries
require_once($CFG->libdir . '/xmlize.php');
// Add other used libraries
require_once($CFG->libdir . '/xmlize.php');
// Handle session data
global $XMLDB;
// Handle session data
global $XMLDB;
// State is stored in session - we have to serialise it because the classes are not loaded when creating session
if (!isset($SESSION->xmldb)) {
$XMLDB = new stdClass;
} else {
$XMLDB = unserialize($SESSION->xmldb);
}
// State is stored in session - we have to serialise it because the classes are not loaded when creating session
if (!isset($SESSION->xmldb)) {
$XMLDB = new stdClass;
} else {
$XMLDB = unserialize($SESSION->xmldb);
}
// Some previous checks
$site = get_site();
// Some previous checks
$site = get_site();
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
// Body of the script, based on action, we delegate the work
$action = optional_param ('action', 'main_view', PARAM_ALPHAEXT);
// Body of the script, based on action, we delegate the work
$action = optional_param ('action', 'main_view', PARAM_ALPHAEXT);
// Get the action path and invoke it
$actionsroot = "$CFG->dirroot/$CFG->admin/tool/xmldb/actions";
$actionclass = $action . '.class.php';
$actionpath = "$actionsroot/$action/$actionclass";
// Get the action path and invoke it
$actionsroot = "$CFG->dirroot/$CFG->admin/tool/xmldb/actions";
$actionclass = $action . '.class.php';
$actionpath = "$actionsroot/$action/$actionclass";
// Load and invoke the proper action
if (file_exists($actionpath) && is_readable($actionpath)) {
require_once($actionpath);
if ($xmldb_action = new $action) {
// Invoke it
$result = $xmldb_action->invoke();
// store the result in session
$SESSION->xmldb = serialize($XMLDB);
// Load and invoke the proper action
if (file_exists($actionpath) && is_readable($actionpath)) {
require_once($actionpath);
if ($xmldb_action = new $action) {
// Invoke it
$result = $xmldb_action->invoke();
// store the result in session
$SESSION->xmldb = serialize($XMLDB);
if ($result) {
// Based on getDoesGenerate()
switch ($xmldb_action->getDoesGenerate()) {
case ACTION_GENERATE_HTML:
if ($result) {
// Based on getDoesGenerate()
switch ($xmldb_action->getDoesGenerate()) {
case ACTION_GENERATE_HTML:
$action = optional_param('action', '', PARAM_ALPHAEXT);
$postaction = optional_param('postaction', '', PARAM_ALPHAEXT);
// If the js exists, load it
if ($action) {
$script = $CFG->admin . '/tool/xmldb/actions/' . $action . '/' . $action . '.js';
$action = optional_param('action', '', PARAM_ALPHAEXT);
$postaction = optional_param('postaction', '', PARAM_ALPHAEXT);
// If the js exists, load it
if ($action) {
$script = $CFG->admin . '/tool/xmldb/actions/' . $action . '/' . $action . '.js';
$file = $CFG->dirroot . '/' . $script;
if (file_exists($file) && is_readable($file)) {
$PAGE->requires->js('/'.$script);
} else if ($postaction) {
// Try to load the postaction javascript if exists
$script = $CFG->admin . '/tool/xmldb/actions/' . $postaction . '/' . $postaction . '.js';
$file = $CFG->dirroot . '/' . $script;
if (file_exists($file) && is_readable($file)) {
$PAGE->requires->js('/'.$script);
} else if ($postaction) {
// Try to load the postaction javascript if exists
$script = $CFG->admin . '/tool/xmldb/actions/' . $postaction . '/' . $postaction . '.js';
$file = $CFG->dirroot . '/' . $script;
if (file_exists($file) && is_readable($file)) {
$PAGE->requires->js('/'.$script);
}
}
}
}
// Go with standard admin header
echo $OUTPUT->header();
echo $OUTPUT->heading($xmldb_action->getTitle());
echo $xmldb_action->getOutput();
echo $OUTPUT->footer();
break;
case ACTION_GENERATE_XML:
header('Content-type: application/xhtml+xml; charset=utf-8');
echo $xmldb_action->getOutput();
break;
}
} else {
// TODO: need more detailed error info
print_error('xmldberror');
// Go with standard admin header
echo $OUTPUT->header();
echo $OUTPUT->heading($xmldb_action->getTitle());
echo $xmldb_action->getOutput();
echo $OUTPUT->footer();
break;
case ACTION_GENERATE_XML:
header('Content-type: application/xhtml+xml; charset=utf-8');
echo $xmldb_action->getOutput();
break;
}
} else {
$a = new stdClass();
$a->action = $action;
$a->actionclass = $actionclass;
print_error('cannotinstantiateclass', 'tool_xmldb', '', $a);
// TODO: need more detailed error info
print_error('xmldberror');
}
} else {
print_error('invalidaction');
$a = new stdClass();
$a->action = $action;
$a->actionclass = $actionclass;
print_error('cannotinstantiateclass', 'tool_xmldb', '', $a);
}
} else {
print_error('invalidaction');
}
if ($xmldb_action->getDoesGenerate() != ACTION_GENERATE_XML) {
if (debugging()) {
// print_object($XMLDB);
}
if ($xmldb_action->getDoesGenerate() != ACTION_GENERATE_XML) {
if (debugging()) {
// print_object($XMLDB);
}
}
+2 -2
View File
@@ -17,8 +17,7 @@
/**
* Strings for component 'tool_xmldb', language 'en', branch 'MOODLE_22_STABLE'
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -91,6 +90,7 @@ $string['fields'] = 'Fields';
$string['fieldsnotintable'] = 'Field doesn\'t exist in table';
$string['fieldsusedinindex'] = 'This field is used as index';
$string['fieldsusedinkey'] = 'This field is used as key.';
$string['filemodifiedoutfromeditor'] = 'Warning: File locally modified while using the XMLDB Editor. Saving will overwrite local changes.';
$string['filenotwriteable'] = 'File not writeable';
$string['fkviolationdetails'] = 'Foreign key {$a->keyname} on table {$a->tablename} is violated by {$a->numviolations} out of {$a->numrows} rows.';
$string['floatincorrectdecimals'] = 'Incorrect number of decimals for float field';
+1 -2
View File
@@ -17,8 +17,7 @@
/**
* Link to xmldb editor
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+1 -2
View File
@@ -17,8 +17,7 @@
/**
* Plugin version info
*
* @package tool
* @subpackage xmldb
* @package tool_xmldb
* @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+13 -5
View File
@@ -620,15 +620,23 @@ class cc2moodle {
$array_index++;
if ($item->nodeName == "item") {
$identifierref = '';
if ($item->hasAttribute('identifierref')) {
$identifierref = $item->getAttribute('identifierref');
}
$identifierref = $xpath->query('@identifierref', $item);
$identifierref = !empty($identifierref->item(0)->nodeValue) ? $identifierref->item(0)->nodeValue : '';
$title = $xpath->query('imscc:title', $item);
$title = !empty($title->item(0)->nodeValue) ? $title->item(0)->nodeValue : '';
$title = '';
$titles = $xpath->query('imscc:title', $item);
if ($titles->length > 0) {
$title = $titles->item(0)->nodeValue;
}
$cc_type = $this->get_item_cc_type($identifierref);
$moodle_type = $this->convert_to_moodle_type($cc_type);
//Fix the label issue - MDL-33523
if (empty($identifierref) && empty($title)) {
$moodle_type = TYPE_UNKNOWN;
}
}
elseif ($item->nodeName == "resource") {
+2 -2
View File
@@ -262,14 +262,14 @@ class entities {
if (!empty($labels) && ($labels->length > 0)) {
$tname = 'course_files';
$dpath = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $tname;
$rfpath = 'folder.gif';
$rfpath = 'files.gif';
$fpath = $dpath . DIRECTORY_SEPARATOR . $rfpath;
if (!file_exists($dpath)) {
mkdir($dpath);
}
//copy the folder.gif file
$folder_gif = "{$CFG->dirroot}/pix/f/folder.gif";
$folder_gif = "{$CFG->dirroot}/pix/i/files.gif";
copy($folder_gif, $fpath);
$all_files[] = $rfpath;
}
+3 -3
View File
@@ -62,13 +62,13 @@ class entities11 extends entities {
if (!empty($labels) && ($labels->length > 0)) {
$tname = 'course_files';
$dpath = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $tname;
$rfpath = 'folder.gif';
$fpath = $dpath . DIRECTORY_SEPARATOR . 'folder.gif';
$rfpath = 'files.gif';
$fpath = $dpath . DIRECTORY_SEPARATOR . 'files.gif';
if (!file_exists($dpath)) {
mkdir($dpath);
}
//copy the folder.gif file
$folder_gif = "{$CFG->dirroot}/pix/f/folder.gif";
$folder_gif = "{$CFG->dirroot}/pix/i/files.gif";
copy($folder_gif, $fpath);
$all_files[] = $rfpath;
}
+1 -1
View File
@@ -52,7 +52,7 @@ class cc_label extends entities {
'[#date_now#]');
$title = isset($instance['title']) && !empty($instance['title']) ? $instance['title'] : 'Untitled';
$content = "<img src=\"$@FILEPHP@$$@SLASH@$"."folder.gif\" alt=\"Folder\" title=\"{$title}\" /> {$title}";
$content = "<img src=\"$@FILEPHP@$$@SLASH@$"."files.gif\" alt=\"Folder\" title=\"{$title}\" /> {$title}";
$replace_values = array($instance['instance'],
self::safexml($title),
self::safexml($content),
+8 -7
View File
@@ -1069,7 +1069,7 @@ class backup_users_structure_step extends backup_structure_step {
'lang', 'theme', 'timezone', 'firstaccess',
'lastaccess', 'lastlogin', 'currentlogin',
'mailformat', 'maildigest', 'maildisplay', 'htmleditor',
'ajax', 'autosubscribe', 'trackforums', 'timecreated',
'autosubscribe', 'trackforums', 'timecreated',
'timemodified', 'trustbitmask', 'screenreader');
// Then, the fields potentially needing anonymization
@@ -1404,7 +1404,8 @@ class backup_final_files_structure_step extends backup_structure_step {
'contenthash', 'contextid', 'component', 'filearea', 'itemid',
'filepath', 'filename', 'userid', 'filesize',
'mimetype', 'status', 'timecreated', 'timemodified',
'source', 'author', 'license', 'sortorder', 'reference', 'repositoryid'));
'source', 'author', 'license', 'sortorder',
'repositorytype', 'repositoryid', 'reference'));
// Build the tree
@@ -1412,12 +1413,12 @@ class backup_final_files_structure_step extends backup_structure_step {
// Define sources
$file->set_source_sql("SELECT f.*, r.repositoryid, r.reference
$file->set_source_sql("SELECT f.*, r.type AS repositorytype, fr.repositoryid, fr.reference
FROM {files} f
LEFT JOIN {files_reference} r
ON r.id = f.referencefileid
JOIN {backup_ids_temp} bi
ON f.id = bi.itemid
LEFT JOIN {files_reference} fr ON fr.id = f.referencefileid
LEFT JOIN {repository_instances} ri ON ri.id = fr.repositoryid
LEFT JOIN {repository} r ON r.id = ri.typeid
JOIN {backup_ids_temp} bi ON f.id = bi.itemid
WHERE bi.backupid = ?
AND bi.itemname = 'filefinal'", array(backup::VAR_BACKUPID));
+7 -1
View File
@@ -83,9 +83,15 @@ class restore_final_task extends restore_task {
// executing it to perform some final adjustments of information
// not available when the task was executed.
// This step is always the last one performing modifications on restored information
// Don't add any new step after it. Only cache rebuild and clean are allowed.
// Don't add any new step after it. Only aliases queue, cache rebuild and clean are allowed.
$this->add_step(new restore_execute_after_restore('executing_after_restore'));
// All files were sent to the filepool by now. We need to process
// the aliases yet as they were not actually created but stashed for us instead.
// We execute this step after executing_after_restore so that there can't be no
// more files sent to the filepool after this.
$this->add_step(new restore_process_file_aliases_queue('process_file_aliases_queue'));
// Rebuild course cache to see results, whoah!
$this->add_step(new restore_rebuild_course_cache('rebuild_course_cache'));
+327 -11
View File
@@ -591,22 +591,14 @@ class restore_load_included_files extends restore_structure_step {
}
/**
* Processing functions go here
* Process one <file> element from files.xml
*
* @param array $data one file record including repositoryid and reference
* @param array $data the element data
*/
public function process_file($data) {
$data = (object)$data; // handy
$isreference = !empty($data->repositoryid);
$issamesite = $this->task->is_samesite();
// If it's not samesite, we skip file refernces
if (!$issamesite && $isreference) {
return;
}
// load it if needed:
// - it it is one of the annotated inforef files (course/section/activity/block)
// - it is one "user", "group", "grouping", "grade", "question" or "qtype_xxxx" component file (that aren't sent to inforef ever)
@@ -617,7 +609,6 @@ class restore_load_included_files extends restore_structure_step {
$data->component == 'grouping' || $data->component == 'grade' ||
$data->component == 'question' || substr($data->component, 0, 5) == 'qtype');
if ($isfileref || $iscomponent) {
// Process files
restore_dbops::set_backup_files_record($this->get_restoreid(), $data);
}
}
@@ -3102,6 +3093,331 @@ class restore_create_question_files extends restore_execution_step {
}
}
/**
* Try to restore aliases and references to external files.
*
* The queue of these files was prepared for us in {@link restore_dbops::send_files_to_pool()}.
* We expect that all regular (non-alias) files have already been restored. Make sure
* there is no restore step executed after this one that would call send_files_to_pool() again.
*
* You may notice we have hardcoded support for Server files, Legacy course files
* and user Private files here at the moment. This could be eventually replaced with a set of
* callbacks in the future if needed.
*
* @copyright 2012 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class restore_process_file_aliases_queue extends restore_execution_step {
/** @var array internal cache for {@link choose_repository() */
private $cachereposbyid = array();
/** @var array internal cache for {@link choose_repository() */
private $cachereposbytype = array();
/**
* What to do when this step is executed.
*/
protected function define_execution() {
global $DB;
$this->log('processing file aliases queue', backup::LOG_INFO);
$fs = get_file_storage();
// Load the queue.
$rs = $DB->get_recordset('backup_ids_temp',
array('backupid' => $this->get_restoreid(), 'itemname' => 'file_aliases_queue'),
'', 'info');
// Iterate over aliases in the queue.
foreach ($rs as $record) {
$info = unserialize(base64_decode($record->info));
// Try to pick a repository instance that should serve the alias.
$repository = $this->choose_repository($info);
if (is_null($repository)) {
$this->notify_failure($info, 'unable to find a matching repository instance');
continue;
}
if ($info->oldfile->repositorytype === 'local' or $info->oldfile->repositorytype === 'coursefiles') {
// Aliases to Server files and Legacy course files may refer to a file
// contained in the backup file or to some existing file (if we are on the
// same site).
try {
$reference = file_storage::unpack_reference($info->oldfile->reference);
} catch (Exception $e) {
$this->notify_failure($info, 'invalid reference field format');
continue;
}
// Let's see if the referred source file was also included in the backup.
$candidates = $DB->get_recordset('backup_files_temp', array(
'backupid' => $this->get_restoreid(),
'contextid' => $reference['contextid'],
'component' => $reference['component'],
'filearea' => $reference['filearea'],
'itemid' => $reference['itemid'],
), '', 'info, newcontextid, newitemid');
$source = null;
foreach ($candidates as $candidate) {
$candidateinfo = unserialize(base64_decode($candidate->info));
if ($candidateinfo->filename === $reference['filename']
and $candidateinfo->filepath === $reference['filepath']
and !is_null($candidate->newcontextid)
and !is_null($candidate->newitemid) ) {
$source = $candidateinfo;
$source->contextid = $candidate->newcontextid;
$source->itemid = $candidate->newitemid;
break;
}
}
$candidates->close();
if ($source) {
// We have an alias that refers to another file also included in
// the backup. Let us change the reference field so that it refers
// to the restored copy of the original file.
$reference = file_storage::pack_reference($source);
// Send the new alias to the filepool.
$fs->create_file_from_reference($info->newfile, $repository->id, $reference);
$this->notify_success($info);
continue;
} else {
// This is a reference to some moodle file that was not contained in the backup
// file. If we are restoring to the same site, keep the reference untouched
// and restore the alias as is if the referenced file exists.
if ($this->task->is_samesite()) {
if ($fs->file_exists($reference['contextid'], $reference['component'], $reference['filearea'],
$reference['itemid'], $reference['filepath'], $reference['filename'])) {
$reference = file_storage::pack_reference($reference);
$fs->create_file_from_reference($info->newfile, $repository->id, $reference);
$this->notify_success($info);
continue;
} else {
$this->notify_failure($info, 'referenced file not found');
continue;
}
// If we are at other site, we can't restore this alias.
} else {
$this->notify_failure($info, 'referenced file not included');
continue;
}
}
} else if ($info->oldfile->repositorytype === 'user') {
if ($this->task->is_samesite()) {
// For aliases to user Private files at the same site, we have a chance to check
// if the referenced file still exists.
try {
$reference = file_storage::unpack_reference($info->oldfile->reference);
} catch (Exception $e) {
$this->notify_failure($info, 'invalid reference field format');
continue;
}
if ($fs->file_exists($reference['contextid'], $reference['component'], $reference['filearea'],
$reference['itemid'], $reference['filepath'], $reference['filename'])) {
$reference = file_storage::pack_reference($reference);
$fs->create_file_from_reference($info->newfile, $repository->id, $reference);
$this->notify_success($info);
continue;
} else {
$this->notify_failure($info, 'referenced file not found');
continue;
}
// If we are at other site, we can't restore this alias.
} else {
$this->notify_failure($info, 'restoring at another site');
continue;
}
} else {
// This is a reference to some external file such as in boxnet or dropbox.
// If we are restoring to the same site, keep the reference untouched and
// restore the alias as is.
if ($this->task->is_samesite()) {
$fs->create_file_from_reference($info->newfile, $repository->id, $info->oldfile->reference);
$this->notify_success($info);
continue;
// If we are at other site, we can't restore this alias.
} else {
$this->notify_failure($info, 'restoring at another site');
continue;
}
}
}
$rs->close();
}
/**
* Choose the repository instance that should handle the alias.
*
* At the same site, we can rely on repository instance id and we just
* check it still exists. On other site, try to find matching Server files or
* Legacy course files repository instance. Return null if no matching
* repository instance can be found.
*
* @param stdClass $info
* @return repository|null
*/
private function choose_repository(stdClass $info) {
global $DB, $CFG;
require_once($CFG->dirroot.'/repository/lib.php');
if ($this->task->is_samesite()) {
// We can rely on repository instance id.
if (array_key_exists($info->oldfile->repositoryid, $this->cachereposbyid)) {
return $this->cachereposbyid[$info->oldfile->repositoryid];
}
$this->log('looking for repository instance by id', backup::LOG_DEBUG, $info->oldfile->repositoryid, 1);
try {
$this->cachereposbyid[$info->oldfile->repositoryid] = repository::get_repository_by_id($info->oldfile->repositoryid, SYSCONTEXTID);
return $this->cachereposbyid[$info->oldfile->repositoryid];
} catch (Exception $e) {
$this->cachereposbyid[$info->oldfile->repositoryid] = null;
return null;
}
} else {
// We can rely on repository type only.
if (empty($info->oldfile->repositorytype)) {
return null;
}
if (array_key_exists($info->oldfile->repositorytype, $this->cachereposbytype)) {
return $this->cachereposbytype[$info->oldfile->repositorytype];
}
$this->log('looking for repository instance by type', backup::LOG_DEBUG, $info->oldfile->repositorytype, 1);
// Both Server files and Legacy course files repositories have a single
// instance at the system context to use. Let us try to find it.
if ($info->oldfile->repositorytype === 'local' or $info->oldfile->repositorytype === 'coursefiles') {
$sql = "SELECT ri.id
FROM {repository} r
JOIN {repository_instances} ri ON ri.typeid = r.id
WHERE r.type = ? AND ri.contextid = ?";
$ris = $DB->get_records_sql($sql, array($info->oldfile->repositorytype, SYSCONTEXTID));
if (empty($ris)) {
return null;
}
$repoids = array_keys($ris);
$repoid = reset($repoids);
try {
$this->cachereposbytype[$info->oldfile->repositorytype] = repository::get_repository_by_id($repoid, SYSCONTEXTID);
return $this->cachereposbytype[$info->oldfile->repositorytype];
} catch (Exception $e) {
$this->cachereposbytype[$info->oldfile->repositorytype] = null;
return null;
}
}
$this->cachereposbytype[$info->oldfile->repositorytype] = null;
return null;
}
}
/**
* Let the user know that the given alias was successfully restored
*
* @param stdClass $info
*/
private function notify_success(stdClass $info) {
$filedesc = $this->describe_alias($info);
$this->log('successfully restored alias', backup::LOG_DEBUG, $filedesc, 1);
}
/**
* Let the user know that the given alias can't be restored
*
* @param stdClass $info
* @param string $reason detailed reason to be logged
*/
private function notify_failure(stdClass $info, $reason = '') {
$filedesc = $this->describe_alias($info);
if ($reason) {
$reason = ' ('.$reason.')';
}
$this->log('unable to restore alias'.$reason, backup::LOG_WARNING, $filedesc, 1);
$this->add_result_item('file_aliases_restore_failures', $filedesc);
}
/**
* Return a human readable description of the alias file
*
* @param stdClass $info
* @return string
*/
private function describe_alias(stdClass $info) {
$filedesc = $this->expected_alias_location($info->newfile);
if (!is_null($info->oldfile->source)) {
$filedesc .= ' ('.$info->oldfile->source.')';
}
return $filedesc;
}
/**
* Return the expected location of a file
*
* Please note this may and may not work as a part of URL to pluginfile.php
* (depends on how the given component/filearea deals with the itemid).
*
* @param stdClass $filerecord
* @return string
*/
private function expected_alias_location($filerecord) {
$filedesc = '/'.$filerecord->contextid.'/'.$filerecord->component.'/'.$filerecord->filearea;
if (!is_null($filerecord->itemid)) {
$filedesc .= '/'.$filerecord->itemid;
}
$filedesc .= $filerecord->filepath.$filerecord->filename;
return $filedesc;
}
/**
* Append a value to the given resultset
*
* @param string $name name of the result containing a list of values
* @param mixed $value value to add as another item in that result
*/
private function add_result_item($name, $value) {
$results = $this->task->get_results();
if (isset($results[$name])) {
if (!is_array($results[$name])) {
throw new coding_exception('Unable to append a result item into a non-array structure.');
}
$current = $results[$name];
$current[] = $value;
$this->task->add_result(array($name => $current));
} else {
$this->task->add_result(array($name => array($value)));
}
}
}
/**
* Abstract structure step, to be used by all the activities using core questions stuff
* (like the quiz module), to support qtype plugins, states and sessions
+75 -31
View File
@@ -808,6 +808,17 @@ abstract class restore_dbops {
* Given one component/filearea/context and
* optionally one source itemname to match itemids
* put the corresponding files in the pool
*
* @param string $basepath the full path to the root of unzipped backup file
* @param string $restoreid the restore job's identification
* @param string $component
* @param string $filearea
* @param int $oldcontextid
* @param int $dfltuserid default $file->user if the old one can't be mapped
* @param string|null $itemname
* @param int|null $olditemid
* @param int|null $forcenewcontextid explicit value for the new contextid (skip mapping)
* @param bool $skipparentitemidctxmatch
*/
public static function send_files_to_pool($basepath, $restoreid, $component, $filearea, $oldcontextid, $dfltuserid, $itemname = null, $olditemid = null, $forcenewcontextid = null, $skipparentitemidctxmatch = false) {
global $DB;
@@ -839,17 +850,17 @@ abstract class restore_dbops {
// itemname = null, we are going to match only by context, no need to use itemid (all them are 0)
if ($itemname == null) {
$sql = 'SELECT contextid, component, filearea, itemid, itemid AS newitemid, info
$sql = "SELECT id AS bftid, contextid, component, filearea, itemid, itemid AS newitemid, info
FROM {backup_files_temp}
WHERE backupid = ?
AND contextid = ?
AND component = ?
AND filearea = ?';
AND filearea = ?";
$params = array($restoreid, $oldcontextid, $component, $filearea);
// itemname not null, going to join with backup_ids to perform the old-new mapping of itemids
} else {
$sql = "SELECT f.contextid, f.component, f.filearea, f.itemid, i.newitemid, f.info
$sql = "SELECT f.id AS bftid, f.contextid, f.component, f.filearea, f.itemid, i.newitemid, f.info
FROM {backup_files_temp} f
JOIN {backup_ids_temp} i ON i.backupid = f.backupid
$parentitemctxmatchsql
@@ -872,47 +883,80 @@ abstract class restore_dbops {
foreach ($rs as $rec) {
$file = (object)unserialize(base64_decode($rec->info));
$isreference = !empty($file->repositoryid);
// ignore root dirs (they are created automatically)
if ($file->filepath == '/' && $file->filename == '.') {
continue;
}
// set the best possible user
$mappeduser = self::get_backup_ids_record($restoreid, 'user', $file->userid);
$file->userid = !empty($mappeduser) ? $mappeduser->newitemid : $dfltuserid;
// dir found (and not root one), let's create if
$mappeduserid = !empty($mappeduser) ? $mappeduser->newitemid : $dfltuserid;
// dir found (and not root one), let's create it
if ($file->filename == '.') {
$fs->create_directory($newcontextid, $component, $filearea, $rec->newitemid, $file->filepath, $file->userid);
$fs->create_directory($newcontextid, $component, $filearea, $rec->newitemid, $file->filepath, $mappeduserid);
continue;
}
// arrived here, file found
// Find file in backup pool
$backuppath = $basepath . backup_file_manager::get_backup_content_file_location($file->contenthash);
if (empty($file->repositoryid)) {
// this is a regular file, it must be present in the backup pool
$backuppath = $basepath . backup_file_manager::get_backup_content_file_location($file->contenthash);
if (!file_exists($backuppath) && !$isreference) {
throw new restore_dbops_exception('file_not_found_in_pool', $file);
}
if (!$fs->file_exists($newcontextid, $component, $filearea, $rec->newitemid, $file->filepath, $file->filename)) {
$file_record = array(
'contextid' => $newcontextid,
'component' => $component,
'filearea' => $filearea,
'itemid' => $rec->newitemid,
'filepath' => $file->filepath,
'filename' => $file->filename,
'timecreated' => $file->timecreated,
'timemodified'=> $file->timemodified,
'userid' => $file->userid,
'author' => $file->author,
'license' => $file->license,
'sortorder' => $file->sortorder);
if ($isreference) {
$fs->create_file_from_reference($file_record, $file->repositoryid, $file->reference);
} else {
if (!file_exists($backuppath)) {
throw new restore_dbops_exception('file_not_found_in_pool', $file);
}
// create the file in the filepool if it does not exist yet
if (!$fs->file_exists($newcontextid, $component, $filearea, $rec->newitemid, $file->filepath, $file->filename)) {
$file_record = array(
'contextid' => $newcontextid,
'component' => $component,
'filearea' => $filearea,
'itemid' => $rec->newitemid,
'filepath' => $file->filepath,
'filename' => $file->filename,
'timecreated' => $file->timecreated,
'timemodified'=> $file->timemodified,
'userid' => $mappeduserid,
'author' => $file->author,
'license' => $file->license,
'sortorder' => $file->sortorder
);
$fs->create_file_from_pathname($file_record, $backuppath);
}
// store the the new contextid and the new itemid in case we need to remap
// references to this file later
$DB->update_record('backup_files_temp', array(
'id' => $rec->bftid,
'newcontextid' => $newcontextid,
'newitemid' => $rec->newitemid), true);
} else {
// this is an alias - we can't create it yet so we stash it in a temp
// table and will let the final task to deal with it
if (!$fs->file_exists($newcontextid, $component, $filearea, $rec->newitemid, $file->filepath, $file->filename)) {
$info = new stdClass();
// oldfile holds the raw information stored in MBZ (including reference-related info)
$info->oldfile = $file;
// newfile holds the info for the new file_record with the context, user and itemid mapped
$info->newfile = (object)array(
'contextid' => $newcontextid,
'component' => $component,
'filearea' => $filearea,
'itemid' => $rec->newitemid,
'filepath' => $file->filepath,
'filename' => $file->filename,
'timecreated' => $file->timecreated,
'timemodified'=> $file->timemodified,
'userid' => $mappeduserid,
'author' => $file->author,
'license' => $file->license,
'sortorder' => $file->sortorder
);
restore_dbops::set_backup_ids_record($restoreid, 'file_aliases_queue', $file->id, 0, null, $info);
}
}
}
$rs->close();
+17
View File
@@ -75,10 +75,27 @@ abstract class base_plan implements checksumable, executable {
return $this->tasks;
}
/**
* Add the passed info to the plan results
*
* At the moment we expect an associative array structure to be merged into
* the current results. In the future, some sort of base_result class may
* be introduced.
*
* @param array $result associative array describing a result of a task/step
*/
public function add_result($result) {
if (!is_array($result)) {
throw new coding_exception('Associative array is expected as a parameter of add_result()');
}
$this->results = array_merge($this->results, $result);
}
/**
* Return the results collected via {@link self::add_result()} method
*
* @return array
*/
public function get_results() {
return $this->results;
}
+29 -1
View File
@@ -154,7 +154,7 @@ abstract class base_task implements checksumable, executable, loggable {
// If step returns array, it will be forwarded to plan
// (TODO: shouldn't be array but proper result object)
if (is_array($result) and !empty($result)) {
$this->plan->add_result($result);
$this->add_result($result);
}
}
// Mark as executed if any step has been executed
@@ -191,6 +191,34 @@ abstract class base_task implements checksumable, executable, loggable {
backup_general_helper::array_checksum_recursive($this->steps));
}
/**
* Add the given info to the current plan's results.
*
* @see base_plan::add_result()
* @param array $result associative array describing a result of a task/step
*/
public function add_result($result) {
if (!is_null($this->plan)) {
$this->plan->add_result($result);
} else {
debugging('Attempting to add a result of a task not binded with a plan', DEBUG_DEVELOPER);
}
}
/**
* Return the current plan's results
*
* @return array|null
*/
public function get_results() {
if (!is_null($this->plan)) {
return $this->plan->get_results();
} else {
debugging('Attempting to get results of a task not binded with a plan', DEBUG_DEVELOPER);
return null;
}
}
// Protected API starts here
/**
+14
View File
@@ -757,6 +757,20 @@ class restore_ui_stage_complete extends restore_ui_stage_process {
public function display(core_backup_renderer $renderer) {
$html = '';
if (!empty($this->results['file_aliases_restore_failures'])) {
$html .= $renderer->box_start('generalbox filealiasesfailures');
$html .= $renderer->heading_with_help(get_string('filealiasesrestorefailures', 'core_backup'),
'filealiasesrestorefailures', 'core_backup');
$html .= $renderer->container(get_string('filealiasesrestorefailuresinfo', 'core_backup'));
$html .= $renderer->container_start('aliaseslist');
$html .= html_writer::start_tag('ul');
foreach ($this->results['file_aliases_restore_failures'] as $alias) {
$html .= html_writer::tag('li', s($alias));
}
$html .= html_writer::end_tag('ul');
$html .= $renderer->container_end();
$html .= $renderer->box_end();
}
$html .= $renderer->box_start();
$html .= $renderer->notification(get_string('restoreexecutionsuccess', 'backup'), 'notifysuccess');
$html .= $renderer->continue_button(new moodle_url('/course/view.php', array(
+4
View File
@@ -69,6 +69,10 @@ class block_blog_recent extends block_base {
require_once($CFG->dirroot .'/blog/lib.php');
require_once($CFG->dirroot .'/blog/locallib.php');
if (empty($this->config)) {
$this->config = new stdClass();
}
if (empty($this->config->recentbloginterval)) {
$this->config->recentbloginterval = 8400;
}
+4
View File
@@ -93,6 +93,10 @@ class block_blog_tags extends block_base {
// require the libs and do the work
require_once($CFG->dirroot .'/blog/lib.php');
if (empty($this->config)) {
$this->config = new stdClass();
}
if (empty($this->config->timewithin)) {
$this->config->timewithin = BLOCK_BLOG_TAGS_DEFAULTTIMEWITHIN;
}
+3 -1
View File
@@ -102,8 +102,10 @@ class delete_category_form extends moodleform {
/// Give the options for what to do.
$mform->addElement('select', 'fulldelete', get_string('whattodo'), $options);
if (count($options) == 1) {
$optionkeys = array_keys($options);
$option = reset($optionkeys);
$mform->hardFreeze('fulldelete');
$mform->setConstant('fulldelete', reset(array_keys($options)));
$mform->setConstant('fulldelete', $option);
}
if ($displaylist) {
+26 -2
View File
@@ -296,7 +296,7 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
$o.= html_writer::start_tag('div', array('class' => 'summarytext'));
$o.= $this->format_summary_text($section);
$o.= html_writer::end_tag('div');
$o.= $this->section_activity_summary($section, $mods);
$o.= $this->section_activity_summary($section, $course, $mods);
$o.= $this->section_availability_message($section);
@@ -310,16 +310,21 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
* Generate a summary of the activites in a section
*
* @param stdClass $section The course_section entry from DB
* @param stdClass $course the course record from DB
* @param array $mods course modules indexed by id (from get_all_mods)
* @return string HTML to output.
*/
private function section_activity_summary($section, $mods) {
private function section_activity_summary($section, $course, $mods) {
if (empty($section->sequence)) {
return '';
}
// Generate array with count of activities in this section:
$sectionmods = array();
$total = 0;
$complete = 0;
$cancomplete = isloggedin() && !isguestuser();
$completioninfo = new completion_info($course);
$modsequence = explode(',', $section->sequence);
foreach ($modsequence as $cmid) {
$thismod = $mods[$cmid];
@@ -336,6 +341,13 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
$sectionmods[$thismod->modname]['name'] = $thismod->modplural;
$sectionmods[$thismod->modname]['count'] = 1;
}
if ($cancomplete && $completioninfo->is_enabled($thismod) != COMPLETION_TRACKING_NONE) {
$total++;
$completiondata = $completioninfo->get_data($thismod, true);
if ($completiondata->completionstate == COMPLETION_COMPLETE) {
$complete++;
}
}
}
}
@@ -353,6 +365,18 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
$o.= html_writer::end_tag('span');
}
$o.= html_writer::end_tag('div');
// Output section completion data
if ($total > 0) {
$a = new stdClass;
$a->complete = $complete;
$a->total = $total;
$o.= html_writer::start_tag('div', array('class' => 'section-summary-activities mdl-right'));
$o.= html_writer::tag('span', get_string('progresstotal', 'completion', $a), array('class' => 'activity-count'));
$o.= html_writer::end_tag('div');
}
return $o;
}
+2 -9
View File
@@ -3031,20 +3031,13 @@ function move_section_to($course, $section, $destination) {
}
}
// Adjust destination to reflect the actual section
$moveup = false;
if ($section > $destination) {
$destination++;
$moveup = true;
}
// If we move the highlighted section itself, then just highlight the destination.
// Adjust the higlighted section location if we move something over it either direction.
if ($section == $course->marker) {
course_set_marker($course->id, $destination);
} elseif ($moveup && $section > $course->marker && $course->marker >= $destination) {
} elseif ($section > $course->marker && $course->marker >= $destination) {
course_set_marker($course->id, $course->marker+1);
} elseif (!$moveup && $section < $course->marker && $course->marker <= $destination) {
} elseif ($section < $course->marker && $course->marker <= $destination) {
course_set_marker($course->id, $course->marker-1);
}
+73 -1
View File
@@ -66,7 +66,7 @@ class courselib_testcase extends advanced_testcase {
$this->assertFalse($neworder);
}
public function test_move_section() {
public function test_move_section_down() {
global $DB;
$this->resetAfterTest(true);
@@ -78,6 +78,7 @@ class courselib_testcase extends advanced_testcase {
}
ksort($oldsections);
// Test move section down..
move_section_to($course, 2, 4);
$sections = array();
foreach ($DB->get_records('course_sections', array('course'=>$course->id)) as $section) {
@@ -94,6 +95,77 @@ class courselib_testcase extends advanced_testcase {
$this->assertEquals($oldsections[6], $sections[6]);
}
public function test_move_section_up() {
global $DB;
$this->resetAfterTest(true);
$this->getDataGenerator()->create_course(array('numsections'=>5), array('createsections'=>true));
$course = $this->getDataGenerator()->create_course(array('numsections'=>10), array('createsections'=>true));
$oldsections = array();
foreach ($DB->get_records('course_sections', array('course'=>$course->id)) as $section) {
$oldsections[$section->section] = $section->id;
}
ksort($oldsections);
// Test move section up..
move_section_to($course, 6, 4);
$sections = array();
foreach ($DB->get_records('course_sections', array('course'=>$course->id)) as $section) {
$sections[$section->section] = $section->id;
}
ksort($sections);
$this->assertEquals($oldsections[0], $sections[0]);
$this->assertEquals($oldsections[1], $sections[1]);
$this->assertEquals($oldsections[2], $sections[2]);
$this->assertEquals($oldsections[3], $sections[3]);
$this->assertEquals($oldsections[4], $sections[5]);
$this->assertEquals($oldsections[5], $sections[6]);
$this->assertEquals($oldsections[6], $sections[4]);
}
public function test_move_section_marker() {
global $DB;
$this->resetAfterTest(true);
$this->getDataGenerator()->create_course(array('numsections'=>5), array('createsections'=>true));
$course = $this->getDataGenerator()->create_course(array('numsections'=>10), array('createsections'=>true));
// Set course marker to the section we are going to move..
course_set_marker($course->id, 2);
// Verify that the course marker is set correctly.
$course = $DB->get_record('course', array('id' => $course->id));
$this->assertEquals(2, $course->marker);
// Test move the marked section down..
move_section_to($course, 2, 4);
// Verify that the coruse marker has been moved along with the section..
$course = $DB->get_record('course', array('id' => $course->id));
$this->assertEquals(4, $course->marker);
// Test move the marked section up..
move_section_to($course, 4, 3);
// Verify that the course marker has been moved along with the section..
$course = $DB->get_record('course', array('id' => $course->id));
$this->assertEquals(3, $course->marker);
// Test moving a non-marked section above the marked section..
move_section_to($course, 4, 2);
// Verify that the course marker has been moved down to accomodate..
$course = $DB->get_record('course', array('id' => $course->id));
$this->assertEquals(4, $course->marker);
// Test moving a non-marked section below the marked section..
move_section_to($course, 3, 6);
// Verify that the course marker has been up to accomodate..
$course = $DB->get_record('course', array('id' => $course->id));
$this->assertEquals(3, $course->marker);
}
public function test_get_course_display_name_for_list() {
global $CFG;
$this->resetAfterTest(true);
+22 -14
View File
@@ -81,31 +81,30 @@ YUI.add('moodle-course-modchooser', function(Y) {
// Setup for site topics
Y.one(baseselector).all(CSS.SITETOPIC).each(function(section) {
// The site topic has a sectionid of 1
this._setup_for_section(section, 1);
}, this);
// Setup for the site menu
Y.one(baseselector).all(CSS.SITEMENU).each(function(section) {
// The site menu has a sectionid of 0
this._setup_for_section(section, 0);
this._setup_for_section(section);
}, this);
// Setup for standard course topics
Y.one(baseselector).all(CSS.SECTION).each(function(section) {
// Determine the sectionid for this section
var sectionid = section.get('id').replace('section-', '');
this._setup_for_section(section, sectionid);
this._setup_for_section(section);
}, this);
// Setup for the block site menu
Y.one(baseselector).all(CSS.SITEMENU).each(function(section) {
this._setup_for_section(section);
}, this);
},
_setup_for_section : function(section, sectionid) {
var chooserspan = section.one(CSS.SECTIONMODCHOOSER);
if (!chooserspan) {
return;
}
var chooserlink = Y.Node.create("<a href='#' />");
chooserspan.get('children').each(function(node) {
chooserlink.appendChild(node);
});
chooserspan.insertBefore(chooserlink);
chooserlink.on('click', this.display_mod_chooser, this, sectionid);
chooserlink.on('click', this.display_mod_chooser, this);
},
/**
* Display the module chooser
@@ -114,9 +113,18 @@ YUI.add('moodle-course-modchooser', function(Y) {
* @param secitonid integer The ID of the section triggering the dialogue
* @return void
*/
display_mod_chooser : function (e, sectionid) {
display_mod_chooser : function (e) {
// Set the section for this version of the dialogue
this.sectionid = sectionid;
if (e.target.ancestor(CSS.SITETOPIC)) {
// The site topic has a sectionid of 1
this.sectionid = 1;
} else if (e.target.ancestor(CSS.SECTION)) {
var section = e.target.ancestor(CSS.SECTION);
this.sectionid = section.get('id').replace('section-', '');
} else if (e.target.ancestor(CSS.SITEMENU)) {
// The block site menu has a sectionid of 0
this.sectionid = 0;
}
this.display_chooser(e);
},
toggle_mod_chooser : function(e) {
+76 -41
View File
@@ -303,8 +303,8 @@ class core_files_renderer extends plugin_renderer_base {
$rv = '
<div class="filemanager fp-mkdir-dlg">
<div class="fp-mkdir-dlg-text">'.get_string('newfoldername','repository').'<br/><input type="text" /></div>
<a class="{!}fp-dlg-butcreate fp-panel-button" href="#">'.get_string('makeafolder').'</a>
<a class="{!}fp-dlg-butcancel fp-panel-button" href="#">'.get_string('cancel').'</a>
<button class="{!}fp-dlg-butcreate">'.get_string('makeafolder').'</button>
<button class="{!}fp-dlg-butcancel">'.get_string('cancel').'</button>
</div>';
return preg_replace('/\{\!\}/', '', $rv);
}
@@ -370,12 +370,11 @@ class core_files_renderer extends plugin_renderer_base {
<p>'.get_string('loading', 'repository').'</p>
</div>
<form>
<div><a class="{!}fp-file-download fp-panel-button" href="#">'.get_string('download').'</a>
<a class="{!}fp-file-delete fp-panel-button" href="#">'.get_string('delete').'</a>
<a class="{!}fp-file-setmain fp-panel-button" href="#">'.get_string('setmainfile', 'repository').'</a>
<a class="{!}fp-file-zip fp-panel-button" href="#">'.get_string('zip', 'editor').'</a>
<a class="{!}fp-file-unzip fp-panel-button" href="#">'.get_string('unzip').'</a>
</div>
<button class="{!}fp-file-download">'.get_string('download').'</button>
<button class="{!}fp-file-delete">'.get_string('delete').'</button>
<button class="{!}fp-file-setmain">'.get_string('setmainfile', 'repository').'</button>
<button class="{!}fp-file-zip">'.get_string('zip', 'editor').'</button>
<button class="{!}fp-file-unzip">'.get_string('unzip').'</button>
<div class="fp-hr"></div>
<table>
<tr class="{!}fp-saveas"><td class="mdl-right"><label>'.get_string('name', 'moodle').'</label>:</td>
@@ -391,19 +390,20 @@ class core_files_renderer extends plugin_renderer_base {
<tr class="{!}fp-reflist"><td class="mdl-right"><label>'.get_string('referenceslist', 'repository').'</label>:</td>
<td class="mdl-left"><p class="{!}fp-refcount"></p><span class="fp-reflistloading">'.$icon_progress.' '.$strloading.'</span><ul class="fp-value"></ul></td></tr>
</table>
<div class="fp-select-buttons">
<button class="{!}fp-file-update">'.get_string('update', 'moodle').'</button>
<button class="{!}fp-file-cancel">'.get_string('cancel').'</button>
</div>
</form>
<p class="{!}fp-thumbnail"></p>
<form>
<p class="fp-select-update">
<a class="{!}fp-file-update" href="#"><span>'.get_string('update', 'moodle').'</span></a>
<a class="{!}fp-file-cancel" href="#"><span>'.get_string('cancel').'</span></a>
</p>
</form>
<div class="fp-fileinfo">
<div class="{!}fp-datemodified">'.get_string('lastmodified', 'moodle').': <span class="fp-value"></span></div>
<div class="{!}fp-datecreated">'.get_string('datecreated', 'repository').': <span class="fp-value"></span></div>
<div class="{!}fp-size">'.get_string('size', 'repository').': <span class="fp-value"></span></div>
<div class="{!}fp-dimensions">'.get_string('dimensions', 'repository').': <span class="fp-value"></span></div>
<div class="fp-info">
<div class="fp-hr"></div>
<p class="{!}fp-thumbnail"></p>
<div class="fp-fileinfo">
<div class="{!}fp-datemodified">'.get_string('lastmodified', 'moodle').': <span class="fp-value"></span></div>
<div class="{!}fp-datecreated">'.get_string('datecreated', 'repository').': <span class="fp-value"></span></div>
<div class="{!}fp-size">'.get_string('size', 'repository').': <span class="fp-value"></span></div>
<div class="{!}fp-dimensions">'.get_string('dimensions', 'repository').': <span class="fp-value"></span></div>
</div>
</div>
</div>';
return preg_replace('/\{\!\}/', '', $rv);
@@ -424,8 +424,8 @@ class core_files_renderer extends plugin_renderer_base {
$rv = '
<div class="filemanager fp-dlg">
<div class="{!}fp-dlg-text"></div>
<a class="{!}fp-dlg-butconfirm fp-panel-button" href="#">'.get_string('ok').'</a>
<a class="{!}fp-dlg-butcancel fp-panel-button" href="#">'.get_string('cancel').'</a>
<button class="{!}fp-dlg-butconfirm">'.get_string('delete').'</button>
<button class="{!}fp-dlg-butcancel">'.get_string('cancel').'</button>
</div>';
return preg_replace('/\{\!\}/', '', $rv);
}
@@ -455,11 +455,9 @@ class core_files_renderer extends plugin_renderer_base {
$maxbytes = display_size($fm->options->maxbytes);
if (empty($options->maxfiles) || $options->maxfiles == -1) {
$maxsize = get_string('maxfilesize', 'moodle', $maxbytes);
//$string['maxfilesize'] = 'Maximum size for new files: {$a}';
} else {
$strparam = (object)array('size' => $maxbytes, 'attachments' => $options->maxfiles);
$maxsize = get_string('maxsizeandattachments', 'moodle', $strparam);
//$string['maxsizeandattachments'] = 'Maximum size for new files: {$a->size}, maximum attachments: {$a->attachments}';
}
// TODO MDL-32020 also should say about 'File types accepted'
return '<span>'. $maxsize. '</span>';
@@ -565,7 +563,11 @@ class core_files_renderer extends plugin_renderer_base {
private function fp_js_template_iconfilename() {
$rv = '
<a class="fp-file" href="#" >
<div class="{!}fp-thumbnail"></div>
<div style="position:relative;">
<div class="{!}fp-thumbnail"></div>
<div class="fp-reficons1"></div>
<div class="fp-reficons2"></div>
</div>
<div class="fp-filename-field">
<p class="{!}fp-filename"></p>
</div>
@@ -661,11 +663,6 @@ class core_files_renderer extends plugin_renderer_base {
<p>'.get_string('loading', 'repository').'</p>
</div>
<form>
<div>
<a class="{!}fp-select-confirm fp-panel-button" href="#">'.get_string('getfile', 'repository').'</a>
<a class="{!}fp-select-cancel fp-panel-button" href="#">'.get_string('cancel').'</a>
</div>
<div class="fp-hr"></div>
<table>
<tr class="{!}fp-linktype-2">
<td></td>
@@ -686,16 +683,23 @@ class core_files_renderer extends plugin_renderer_base {
<td class="mdl-right"><label>'.get_string('chooselicense', 'repository').'</label>:</td>
<td class="mdl-left"><select></select></td></tr>
</table>
<div class="fp-select-buttons">
<button class="{!}fp-select-confirm">'.get_string('getfile', 'repository').'</button>
<button class="{!}fp-select-cancel">'.get_string('cancel').'</button>
</div>
</form>
<p class="{!}fp-thumbnail"></p>
<div class="fp-fileinfo">
<div class="{!}fp-datemodified">'.get_string('lastmodified', 'moodle').': <span class="fp-value"></span></div>
<div class="{!}fp-datecreated">'.get_string('datecreated', 'repository').': <span class="fp-value"></span></div>
<div class="{!}fp-size">'.get_string('size', 'repository').': <span class="fp-value"></span></div>
<div class="{!}fp-license">'.get_string('license', 'moodle').': <span class="fp-value"></span></div>
<div class="{!}fp-author">'.get_string('author', 'repository').': <span class="fp-value"></span></div>
<div class="{!}fp-dimensions">'.get_string('dimensions', 'repository').': <span class="fp-value"></span></div>
</div>
<div class="fp-info">
<div class="fp-hr"></div>
<p class="{!}fp-thumbnail"></p>
<div class="fp-fileinfo">
<div class="{!}fp-datemodified">'.get_string('lastmodified', 'moodle').': <span class="fp-value"></span></div>
<div class="{!}fp-datecreated">'.get_string('datecreated', 'repository').': <span class="fp-value"></span></div>
<div class="{!}fp-size">'.get_string('size', 'repository').': <span class="fp-value"></span></div>
<div class="{!}fp-license">'.get_string('license', 'moodle').': <span class="fp-value"></span></div>
<div class="{!}fp-author">'.get_string('author', 'repository').': <span class="fp-value"></span></div>
<div class="{!}fp-dimensions">'.get_string('dimensions', 'repository').': <span class="fp-value"></span></div>
</div>
<div>
</div>';
return preg_replace('/\{\!\}/', '', $rv);
}
@@ -791,7 +795,7 @@ class core_files_renderer extends plugin_renderer_base {
$rv = '
<div class="file-picker fp-msg">
<p class="{!}fp-msg-text"></p>
<a class="{!}fp-msg-butok fp-panel-button" href="#">'.get_string('ok').'</a>
<button class="{!}fp-msg-butok">'.get_string('ok').'</button>
</div>';
return preg_replace('/\{\!\}/', '', $rv);
}
@@ -802,6 +806,34 @@ class core_files_renderer extends plugin_renderer_base {
* Must have one top element, CSS for this element must define width and height of the window;
*
* content of element with class 'fp-dlg-text' will be replaced with dialog text;
* elements with classes 'fp-dlg-butoverwrite', 'fp-dlg-butrename',
* 'fp-dlg-butoverwriteall', 'fp-dlg-butrenameall' and 'fp-dlg-butcancel' will
* hold onclick events;
*
* content of element with class 'fp-dlg-butrename' will be substituted with appropriate string
* (Note that it may have long text)
*
* @return string
*/
private function fp_js_template_processexistingfile() {
$rv = '
<div class="file-picker fp-dlg">
<p class="{!}fp-dlg-text"></p>
<div class="fp-dlg-buttons">
<button class="{!}fp-dlg-butoverwrite">'.get_string('overwrite', 'repository').'</button>
<button class="{!}fp-dlg-butrename"></button>
<button class="{!}fp-dlg-butcancel">'.get_string('cancel').'</button>
</div>
</div>';
return preg_replace('/\{\!\}/', '', $rv);
}
/**
* FilePicker JS template for popup dialogue window asking for action when file with the same name already exists (multiple-file version).
*
* Must have one top element, CSS for this element must define width and height of the window;
*
* content of element with class 'fp-dlg-text' will be replaced with dialog text;
* elements with classes 'fp-dlg-butoverwrite', 'fp-dlg-butrename' and 'fp-dlg-butcancel' will
* hold onclick events;
*
@@ -810,13 +842,16 @@ class core_files_renderer extends plugin_renderer_base {
*
* @return string
*/
private function fp_js_template_processexistingfile() {
private function fp_js_template_processexistingfilemultiple() {
$rv = '
<div class="file-picker fp-dlg">
<p class="{!}fp-dlg-text"></p>
<a class="{!}fp-dlg-butoverwrite fp-panel-button" href="#">'.get_string('overwrite', 'repository').'</a>
<a class="{!}fp-dlg-butcancel fp-panel-button" href="#">'.get_string('cancel').'</a>
<a class="{!}fp-dlg-butrename fp-panel-button" href="#"></a>
<br/>
<a class="{!}fp-dlg-butoverwriteall fp-panel-button" href="#">'.get_string('overwriteall', 'repository').'</a>
<a class="{!}fp-dlg-butrenameall fp-panel-button" href="#">'.get_string('renameall', 'repository').'</a>
</div>';
return preg_replace('/\{\!\}/', '', $rv);
}
+1 -1
View File
@@ -410,7 +410,7 @@ 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="50" class="forminput" />';
echo '<input id="id_dbhost" name="dbhost" '.$disabled.' type="text" value="'.s($config->dbhost).'" size="30" class="forminput" />';
echo '</div>';
echo '<div class="formrow"><label for="id_dbname" class="formlabel">'.$strdbname.'</label>';
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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
+1 -1
View File
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle 2.3dev installer
* Automatically generated strings for Moodle 2.3beta 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

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