Compare commits

...

377 Commits

Author SHA1 Message Date
moodler 1d9a81c347 OKAY! THIS IS IT! MOODLE 1.6! 2006-06-19 15:35:50 +00:00
moodler 262ec64be3 New tags file 2006-06-19 15:33:01 +00:00
moodler 4541181369 When the tags block is shown in a course context, then make the
links to blogs stay in the same context.
2006-06-19 14:16:42 +00:00
moodler 4d0036e8be Don't show users tab if you can't go there 2006-06-19 13:51:58 +00:00
moodler 0e83e4f5ca FIxed some missing headers 2006-06-19 13:34:46 +00:00
toyomoyo d40b3e1034 changed © to &#169 to validate better 2006-06-19 03:52:23 +00:00
toyomoyo 72343793f6 give IE a bit more time 2006-06-19 03:29:15 +00:00
moodler d4e8a03c53 Added new class FPDF_Protection (see Bug #5855). Code submitted by chardelle at lifeworkouts dot com, commited by vy-shane at moodle dot com. 2006-06-19 02:39:05 +00:00
moodler 6c979e8a24 Some changes to improve the UTF migration output a little 2006-06-18 10:09:12 +00:00
moodler 794e4a05a3 The forum search form was always wrapping no matter what I tried.
I swapped the textbox and helpbutton around (and got rid of one more table)
2006-06-18 08:20:48 +00:00
moodler d067b2005b Moved the "helplink" CSS span outside the help text and image. No effect on themes. 2006-06-18 08:09:51 +00:00
moodler c6d79e46d9 FIxed up the print_header calls 2006-06-18 07:44:21 +00:00
moodler 2b8a5e83ac Fix for resource parameters for users not logged in 2006-06-16 09:41:41 +00:00
moodler 2a1e7c302c Added check for $CFG->disablemycourses 2006-06-16 04:29:22 +00:00
toyomoyo 59b4825741 fixing centering of tabs on blog page 2006-06-16 02:58:44 +00:00
mjollnir_ 38d0c10e3c participants list last access filter should only show for teachers! I noticed this on moodle.org this morning :| 2006-06-15 21:33:06 +00:00
ethem 50d2685d0e $a->course: course information added. 2006-06-15 14:19:49 +00:00
ethem f187b7f98b $a->course: course information added. 2006-06-15 14:06:53 +00:00
ethem 0726456942 pendingordersemailteacher string added 2006-06-15 13:34:30 +00:00
ethem 1bf6b1cc18 pendingordersemailteacher string added 2006-06-15 13:29:10 +00:00
ethem efbd1fc514 When the number of pending orders expiring are sent to the teachers via email, which one is important? The number of the orders or the total of the amounts. 2006-06-15 12:23:46 +00:00
ethem 9900b2f103 If we enabled manual-capture and teachers can manage payment and teachers can be notified about pending orders expiring,
admins can also chooise that what is the sort of importance of expiring orders? 'Sum of total' or 'Count of orders' are emailed first.
You know that the amount of money is important :)
2006-06-15 10:30:55 +00:00
ethem 2716e73e9e Order by order count. Courses that have many orders are emailed first. 2006-06-15 07:45:18 +00:00
toyomoyo abe51bbed9 fix for 5633 2006-06-15 06:32:26 +00:00
toyomoyo cd09750495 fix for 5814 2006-06-15 03:23:47 +00:00
ethem 3377c60427 Email subject for pending orders expiring. 2006-06-14 16:30:46 +00:00
ethem 5242595975 Email subject for pending orders expiring. 2006-06-14 16:19:23 +00:00
tjhunt 2605a5ba8f Moved constant definitions out of function, so they are not run repeatedly giving lots of warnings. 2006-06-14 15:34:22 +00:00
tjhunt 1aa43ea576 Corrected reference to lang string. 2006-06-14 15:30:55 +00:00
ethem f12b2a7d5d If admin set up 'Teachers can manage the payments of the course' and enabled 'Manual-Capture', course teachers are notified about pending orders expiring. 2006-06-14 11:52:01 +00:00
ethem 834d5863b9 If admin set up 'Teachers can manage the payments of the course' and enabled 'Manual-Capture', course teachers are notified about pending orders expiring. 2006-06-14 11:33:00 +00:00
moodler c8825cfd2d Fix for bug:
Notice: Undefined property: id in /home/moodle/public_html/certificate/mod/forum/discuss.php on line 38

when user is not logged in and want to view a forum of type news.
2006-06-14 08:44:36 +00:00
moodler 380b3b305c Added missing $a to print_error 2006-06-14 03:15:34 +00:00
moodler 2ae294c9d6 Automatic installer.php lang files by installer_builder (20060614) 2006-06-14 02:37:39 +00:00
tjhunt cb82934b8d * Quiz module sometimes left the user staring at a blank page. Now there is an error message. 2006-06-13 18:58:17 +00:00
tjhunt c1c70a909a Bug #5812 - Standard theme font size CSS not sufficiently defensive 2006-06-13 18:52:17 +00:00
ethem 541ba098e7 Link to Payment Management page? 2006-06-13 18:29:28 +00:00
ethem c298a8b8e0 Link to help file 'Order Review'. 2006-06-13 18:02:24 +00:00
ethem 94863d1946 Help file for 'Order Review'. Merged from HEAD 2006-06-13 17:52:58 +00:00
ethem 6b8155d4a8 file orderreview.html was added on branch MOODLE_16_STABLE on 2006-06-13 17:52:58 +0000 2006-06-13 17:51:11 +00:00
ethem d9e4f9eb2a Handle also formatted time 00:30 for settlement time. 2006-06-13 15:59:11 +00:00
ethem d864c083c2 Predict the time of settlement at first time. Probably, admin user set up own country timezone and we can use this time as settlement time.
Function used: get_user_timezone_offset()
2006-06-13 15:24:28 +00:00
tjhunt 80970e2938 Bug #5810 missing ' > 7' in debug test. 2006-06-13 14:36:08 +00:00
vyshane c196e0f3cb Merged from 1.5. Fix for Bug #5767 - Section links block is removed from
course view after settings update.
2006-06-13 07:47:51 +00:00
tjhunt 5a6dba91bb Fix restore notice. 2006-06-12 15:35:28 +00:00
tjhunt 4600286cd2 Bug #5793: remember whether Show all has been clicked in the question bank. 2006-06-12 13:51:11 +00:00
tjhunt 4bbd7130f1 Bug #5790: Answer order for MC qtype not specified. Fix. Thanks to Peter Bulmer. 2006-06-12 11:03:11 +00:00
toyomoyo b862c77e93 proper html for help file 2006-06-12 07:24:24 +00:00
toyomoyo 1a149c0d33 a few mismatches between db and this html 2006-06-12 07:17:59 +00:00
toyomoyo 84f3391271 adding help file 2006-06-12 04:07:27 +00:00
moodler 1f66b55e6e Fixed hardcoded style widths in all formats 2006-06-11 06:47:43 +00:00
moodler 4339f32452 Removing hardcoded style widths and replaced with table widths, which improves page build appearance 2006-06-11 06:42:42 +00:00
stronk7 00b8db5f4f Due to one potential bug in PHP under Win32 (http://bugs.php.net/37775)
the [[cntrl]] pcre class was breaking some chars. Changed to a safer
alternative. Bug 5777.
(http://moodle.org/bugs/bug.php?op=show&bugid=5777)
2006-06-10 23:31:21 +00:00
stronk7 b0bba0e704 Change the moodle_strtolower() function to use textlib services.
Also, mark it as deprecated, code should use text services directly.
Partially, bug 5777. It continues under investigation.
(http://moodle.org/bugs/bug.php?op=show&bugid=5777)
2006-06-10 10:38:27 +00:00
moodler d501331e75 Automatic installer.php lang files by installer_builder (20060610) 2006-06-10 02:36:19 +00:00
moodler ac9ed861a4 Automatic installer.php lang files by installer_builder (20060610) 2006-06-09 18:58:21 +00:00
moodler effa8cd5d1 Automatic installer.php lang files by installer_builder (20060610) 2006-06-09 17:19:42 +00:00
stronk7 3dbdb64c89 The absolutely incredible bug! It was working being wrong! Bug 5775.
(http://moodle.org/bugs/bug.php?op=show&bugid=5775)
2006-06-09 14:21:49 +00:00
ethem 660e6d5f9d Sending email for pending orders expiring string (adminemailexpired) seperated.
Settings moved to adminemailexpsetting.
2006-06-09 11:24:09 +00:00
ethem 277ea82b49 Sending email for pending orders expiring string (adminemailexpired) seperated.
Settings moved to adminemailexpsetting.
2006-06-09 11:18:16 +00:00
ethem dce99d41f4 Show 'name on card' string instead of moodle.php's user string. 2006-06-09 10:56:54 +00:00
ethem 44c4e47a1c Some config sections 'Order Review' moved to
an_teachermanagepay -> Site-Wide Settings
an_emailexpired: -> Email-Sending Settings
an_cutoff: -> Authorize.net Settings
2006-06-09 10:25:24 +00:00
stronk7 ba4f9b230f Moving from lastIP to lastip everywhere. Bug 5763.
(http://moodle.org/bugs/bug.php?op=show&bugid=5763)
2006-06-09 10:00:47 +00:00
stronk7 2ba777cd5a Moving from lastIP to lastip everywhere. Bug 5763.
(http://moodle.org/bugs/bug.php?op=show&bugid=5763)
2006-06-09 09:43:59 +00:00
stronk7 03b40486ca Avoid empty processing both for PLAIN_SQL_UPDATE and PHP_FUNCTION
Merged from HEAD
2006-06-09 09:18:35 +00:00
toyomoyo ea257a167e typo should be 0 not 1 2006-06-09 02:52:05 +00:00
toyomoyo a666b9dbcf disable the blog tag if blog is disabled 2006-06-09 02:44:49 +00:00
bobopinna 986a50e26d change advanced to parameters 2006-06-08 15:35:06 +00:00
bobopinna 625c8a70aa Fixed some language refinements 2006-06-08 15:24:23 +00:00
moodler 66a14b7292 Help content for available tags. 2006-06-08 08:26:50 +00:00
skodak 0a265f0fcd Bug #5663 - errors after changing grade weight 2006-06-08 06:38:08 +00:00
skodak be8137a81b Fixed course searching 2006-06-08 06:23:34 +00:00
vyshane 8bdb6d99a8 Added missing string norecentactivity. 2006-06-08 06:18:06 +00:00
toyomoyo 07c8c52cbf bug fix for 5748 2006-06-08 04:07:24 +00:00
toyomoyo b588ef46f4 changed recordset size to 50 2006-06-08 02:45:48 +00:00
stronk7 cdb048acd7 Solve one issue with skipped courses and email to admin
being set every xx minutes. Bug 5621.
(http://moodle.org/bugs/bug.php?op=show&bugid=5621)
2006-06-07 22:17:31 +00:00
ethem dd9a68560e Unnecesary strings removed. 2006-06-07 18:42:47 +00:00
skodak c731399ff1 Bug #5522 - question/restorelib.php error 2006-06-07 14:56:36 +00:00
skodak c8d483b80c incorrect course number in categories after course delete 2006-06-07 14:04:55 +00:00
vyshane 75775efcf7 Fix for Bug #5131 - RSS Feeds and Moving Discussions. 2006-06-07 08:16:01 +00:00
toyomoyo de8c6852d3 fix for 5720 2006-06-07 06:03:41 +00:00
toyomoyo 36d7c02847 fix for 5720 2006-06-07 05:56:59 +00:00
vyshane 64375cb146 Fixed bug: SCORM module window options were not being saved properly - array
values used instead of keys in scorm_option2text().
2006-06-07 04:34:29 +00:00
toyomoyo 1f7569c38a some javescript progress bar changes, 1) status updates correctly when resuming 2) table numbers is not hardcoded anymore 2006-06-07 04:30:50 +00:00
toyomoyo d636096334 changes are made to facilitate the migration of user table by row. function migrate2utf_user is added. This only affects mysql atm. Please help test and report bugs! 2006-06-07 04:09:37 +00:00
skodak 1f1a9a809c Bug #5659 - Problem with build-in buttons when creating templates 2006-06-06 20:54:16 +00:00
skodak fe19f91525 Bug #5734 - Enrolled students can't access metacourse after unhiding while logged in 2006-06-06 19:00:51 +00:00
tjhunt aea38264b5 Fix notices when you restore a course with an empty forum. 2006-06-06 17:23:42 +00:00
tjhunt 44e2500992 Bug #5559: revised fix - using better CSS class names. 2006-06-06 17:07:58 +00:00
stronk7 ecf140979f Adding two new strings for RESTRICTED tests in environmenlib. 2006-06-06 16:56:16 +00:00
stronk7 9531202c10 Now environmentlib supports RESTRICT sections (to be able to deny
any general test with more detail (the opposite to the BYPASS section)
(http://moodle.org/bugs/bug.php?op=show&bugid=5653)

Merged from MOODLE_15_STABLE
2006-06-06 16:15:35 +00:00
skodak a5436ee747 Bug #5535 - Database module backup error in 1.5.4, patch submitted by Patrick Pollet 2006-06-06 15:11:34 +00:00
bobopinna 826067335c Fixed some regular expression Bug 5041 2006-06-06 14:33:10 +00:00
tjhunt d5306794ec Fix for calculated questions where each one builds on the last. 2006-06-06 14:27:45 +00:00
tjhunt 89905101b7 Fix notices from the quiz module on backup and restore. 2006-06-06 14:13:55 +00:00
tjhunt f6849778a7 Make cron a bit more rebust by changing the way the require is done. 2006-06-06 14:10:33 +00:00
skodak c0f904046c Bug #5678 - Question marks, single quotes in field name cause trouble - cleaning hack ported from clean_filename() 2006-06-06 10:15:49 +00:00
tjhunt 23da79eff2 Fix notice. 2006-06-06 10:10:07 +00:00
skodak 176d1229af Bug #5680 - Fixed duplicate field names 2006-06-06 09:34:23 +00:00
skodak 6aef11722c Bug #5444 - Import PowerPoint - PHP5 clone bug 2006-06-06 08:52:51 +00:00
vyshane 5218d67aca New stats admin report. This shares code with /course/report/stats. Basically
the same report, but in an admin context.
2006-06-06 04:18:16 +00:00
vyshane 9b037d3842 New files with required code after refactoring this report module. 2006-06-06 04:13:44 +00:00
vyshane 6481349eb3 Refactored this report module so that we can also use it from
/admin/reports/stats.
2006-06-06 04:09:31 +00:00
tjhunt 9abb0f813a Bug #5672: Make calculated questions less confusing to create. 2006-06-05 16:56:31 +00:00
tjhunt 914d8f5801 Fixed reference to incorrect language string. 2006-06-05 14:14:12 +00:00
ethem 7a553f06a3 Some cron performance. Run clean-ups and send email daily on settlement date.
an_nextmail config deleted, instead of old config new an_dailysettlement inserted into config_plugins table.
2006-06-05 12:58:16 +00:00
skodak a9fd047eea Bug #5725 - Assignment grading pop up windows do not close, broken by 4976 2006-06-05 12:17:20 +00:00
bobopinna b225c41b53 Fixed a typo 2006-06-05 08:23:34 +00:00
bobopinna 2d0ee29b15 Added class name for IFRAME element 2006-06-05 07:40:18 +00:00
bobopinna 0bfac2fe7a Fixed a modified name for some constants 2006-06-05 07:19:07 +00:00
skodak c7d9b99dae Bug #5715 - error message in messaging - notice lastaccess 2006-06-04 23:10:32 +00:00
skodak f87c87b9ba Bug #5721 - students cannot take quiz when course language set to French 2006-06-04 23:00:00 +00:00
skodak 88c0c27c83 fixed warning when no students graded yet (caused by useless assignment) 2006-06-04 21:34:14 +00:00
stronk7 395c75becd make_default_scale() now searches properly under
both dataroot and dirroot, defaulting to en_utf8. Bug 5719.
(http://moodle.org/bugs/bug.php?op=show&bugid=5719)
2006-06-04 15:17:03 +00:00
stronk7 b02e4ee384 report XXXX actions added. Bug 5714.
(http://moodle.org/bugs/bug.php?op=show&bugid=5714)
2006-06-04 00:35:04 +00:00
stronk7 fae3f45758 course report xxxx actions now are supported on restore. Bug 5714.
(http://moodle.org/bugs/bug.php?op=show&bugid=5714)
2006-06-04 00:00:02 +00:00
skodak 5d46f73a3c Bug #5716 - Impossible to turn off highlighted current topic 2006-06-03 23:46:50 +00:00
stronk7 1ac7d05730 course report xxxx actions must send courseid in the info field. Bug 5714.
(http://moodle.org/bugs/bug.php?op=show&bugid=5714)
2006-06-03 20:33:44 +00:00
stronk7 27f60090f6 And some more (the last) notices out! Bug 5713.
(http://moodle.org/bugs/bug.php?op=show&bugid=5713)
2006-06-03 20:16:19 +00:00
stronk7 28dc928f43 And one more collection of innocent notices avoided. Bug 5712.
(http://moodle.org/bugs/bug.php?op=show&bugid=5712)
2006-06-03 20:00:10 +00:00
skodak 7fe8550e18 clarification for restrict modules option - bug #5688 2006-06-03 19:57:42 +00:00
stronk7 c9aecec6be And another notice in restore out. Bug 5711.
(http://moodle.org/bugs/bug.php?op=show&bugid=5711)
2006-06-03 19:48:50 +00:00
stronk7 69b693dbc9 One less notice. Bug 5710.
(http://moodle.org/bugs/bug.php?op=show&bugid=5710)
2006-06-03 19:44:15 +00:00
stronk7 0803379406 Avoid one notice in backup. Bug 5709.
(http://moodle.org/bugs/bug.php?op=show&bugid=5709&)
2006-06-03 18:59:35 +00:00
stronk7 4eb4b874ba Adding support to the forum user report action
in restore. Bug 3854.
(http://moodle.org/bugs/bug.php?op=show&bugid=3854)
2006-06-03 17:44:05 +00:00
skodak aff589d128 Making sure timelimit is converted to integer before being written to database, otherwise postgreSQL complains. Closing bug 5401; merged from MOODLE_15_STABLE 2006-06-02 16:01:05 +00:00
tjhunt c4c9a5d860 Bug #5559: Move CLOZE qtype hightight colours into CSS insted of hardcoding, so themes can override. 2006-06-02 15:37:10 +00:00
nfreear 805720ebd3 Fix, bug 5614 - added ALT text for link icons (x 5), based on TITLE. 2006-06-02 13:11:38 +00:00
ethem af70ea6a96 Merged from HEAD. 2006-06-02 09:48:27 +00:00
thepurpleblob ae8df5acdf Added CLOZE question support.
Thanks to Joseph Rezeau for this one!
2006-06-02 09:44:13 +00:00
vyshane 1e900c139d Fixed bug: php warnings when there are no users in the selected course. 2006-06-02 07:35:36 +00:00
skodak ef93a24f23 fixed warning and removed ugly hack in attachment path 2006-06-02 06:47:26 +00:00
vyshane 47737013d3 Fix for Bug #5682 - 'Reset template' button in CSS template adds HTML 2006-06-02 04:27:42 +00:00
vyshane 476b3195fa Added missing language string. 2006-06-02 04:19:06 +00:00
toyomoyo ed7ce12186 fix for 5686, include_once course/lib.php in case it doesn't get included when interrupted 2006-06-02 02:53:31 +00:00
stronk7 de78b7e81b Adding propper support for the forum->user report log action. It was
a bit wrong. Code credits go to Petr!
2006-06-01 23:11:55 +00:00
skodak bf48c7abcd fixed problem in restricted modules - mods were accessed using strtolower(translated module name) instead of directory name as usual, it partially worked for English 2006-06-01 19:48:37 +00:00
skodak 26e6e8c048 fixed - unable to disable blocks 2006-06-01 19:12:42 +00:00
ethem d0bdb4d3c9 Documentation for status codes and actions. 2006-06-01 16:05:29 +00:00
skodak 7af4d79611 Bug #5643 - add Yahoo online status to user profile 2006-06-01 15:18:10 +00:00
skodak 49f020ec0c Bug #5684 - frameset page in UTF8 doesn't appear on IE 2006-06-01 14:49:31 +00:00
thepurpleblob a4bb593422 Fixing bugs #5676 and #5677
Text strings not properly escaped in a couple of places.
Conditional check inserted for optional units data in numerical questions.
2006-06-01 10:12:00 +00:00
ethem d799a9aef2 Just some tidy-ups 2006-06-01 08:44:01 +00:00
vyshane 6b611eb82d Fix for Bug #5552 - Filters conf. table looks awful. 2006-06-01 08:08:23 +00:00
ethem 1e04f3179a Just some tidy-ups 2006-06-01 07:38:23 +00:00
skodak ec7418d3ce Bug #5661 - mymoodle redirect problem 2006-06-01 05:39:46 +00:00
vyshane 6d895ae5e9 Fixed missing string 2006-06-01 04:07:23 +00:00
vyshane b194dfbf15 Fix for get_string(), which was not building the path to the language files
for reports correctly.
2006-06-01 03:05:18 +00:00
toyomoyo 278bd07a17 bug fix for 5352, setting ignore_user_abort to false 2006-06-01 02:30:20 +00:00
danmarsden 2aa86d2d33 BUG 5662 - bad check for 1.6 version. 2006-05-31 20:25:37 +00:00
stronk7 74e97cf096 Prevent doubleslashes once and again in paths. Also prevent them when writing config.php 2006-05-31 17:50:42 +00:00
tjhunt d86503c7cf Fix for bug 5379: Item analysis report should not have a hard coded list of question types.
Please test this if you have a moodle install with some unusual question types. Thanks.
2006-05-31 15:53:12 +00:00
julmis ee16e98eb1 Another try to fix IE's problem to load editable iframe. 2006-05-31 11:35:32 +00:00
moodler 800085d9ae Don't show stupid warnings to teachers 2006-05-31 08:24:28 +00:00
toyomoyo c8937fb8ea changepassword obsolete 2006-05-31 07:23:11 +00:00
toyomoyo 08d1ef9d83 changepassword is obsolete 2006-05-31 07:11:16 +00:00
toyomoyo 2fd3511227 changepassword obsolete 2006-05-31 06:57:58 +00:00
toyomoyo 3abe15dd14 change password obsolete 2006-05-31 06:41:55 +00:00
toyomoyo 213b568441 always allow admin to check the force password change box, if using internal_auth 2006-05-31 06:28:07 +00:00
stronk7 91a036b599 Users with messages (and messages) are only included in
SITEID backup. Bug 5658.
(http://moodle.org/bugs/bug.php?op=show&bugid=5658)

Merged from MOODLE_15_STABLE
2006-05-30 16:57:20 +00:00
nfreear 5484222182 Fix bug 5628 (Farsi RTL language), modify '.accesshide' style so top is large negative, not left. 2006-05-30 11:16:52 +00:00
skodak 321a23004b blacklist PHP 5.0.x in installation precheck 2006-05-30 09:49:22 +00:00
skodak 272fecfce4 blacklist PHP 5.0.x in installation precheck 2006-05-30 09:37:26 +00:00
ethem ffccc532c6 If config wwwroot starts with 'https', ignore config loginhttps value.
Dependency: Bug #5647
2006-05-30 08:25:57 +00:00
skodak ad6ae2c4e5 fixed typo - randomsmatch notice bug 5652 2006-05-30 06:27:59 +00:00
toyomoyo 76816913ed fix for 5648, utf-8 migration bug 2006-05-30 02:50:16 +00:00
martinlanghoff 4c74601224 auth/ldap: better handling of empty values from ldap 2006-05-30 00:42:53 +00:00
stronk7 b4c8301258 Bump or I'll forget it. 2006-05-29 22:49:54 +00:00
skodak c446109283 fixed warning from clone($SITE) during site setup 2006-05-29 20:30:07 +00:00
stronk7 b4ab174902 Normalize oracle driver name.
Merged from HEAD.
2006-05-29 17:43:07 +00:00
stronk7 2deb9e2501 Adding environmental checks for 1.7 (mssql and oracle added)
Merged from HEAD
2006-05-29 17:38:48 +00:00
moodler be02c7520a Improved title 2006-05-29 09:55:07 +00:00
moodler 364f1151a6 Updated some "my moodle" strings 2006-05-29 09:39:55 +00:00
moodler fb3a583b2b Improved the appearance of the My Moodle page with some CSS 2006-05-29 09:27:01 +00:00
moodler 83bf9af99e DOn't even show assignments without a due date 2006-05-29 09:20:53 +00:00
moodler a00095da48 FIxed some bugs 2006-05-29 09:09:22 +00:00
moodler 3ed4068ee1 Cleaned up admin reports a little 2006-05-29 09:03:13 +00:00
skodak 949f570992 Bug #5620 - MyMoodle shows bogus Assignment due date 2006-05-29 08:36:52 +00:00
moodler 2bef2c7dca FIxed admin block link for reports 2006-05-29 08:35:33 +00:00
moodler 36e32ba459 Checking in skodak's fixes to help blocks in more contexts (esp MyMoodle) 2006-05-29 08:15:23 +00:00
moodler baa1209e37 Merged from HEAD, better definition of $COURSE 2006-05-29 07:34:55 +00:00
skodak 4878c5a6d2 fixed array warning when editting blocks 2006-05-29 06:03:17 +00:00
skodak 5d4353a158 global $course fix 2006-05-29 05:55:39 +00:00
wildgirl 446088fa5d Updated small MP3 player to handle autoPlay (by Andrew Walker, Alton College) 2006-05-28 20:20:55 +00:00
skodak 33f519119b sanitize submitted numerical values 2006-05-26 11:52:35 +00:00
skodak 7acc6626c5 sanitize submitted numerical values 2006-05-26 11:46:32 +00:00
skodak e616f403eb sanitize submitted numerical values 2006-05-26 11:38:16 +00:00
skodak b51b3dd05c sanitize submitted numerical values 2006-05-26 11:31:16 +00:00
skodak e4fd3f4f06 Bug #5619 - Assignment Feedback mail lacks linefeed 2006-05-26 09:06:05 +00:00
skodak bce3627ed9 Bug #4647 - Undefined property in lib/statslib.php 2006-05-26 08:59:52 +00:00
skodak 567596e8c2 Bug #5456 - Item Analysis fails to calculate results for random question type 2006-05-26 06:54:22 +00:00
skodak f703afe925 Bug #5472 - Download quiz grades in Excel format does not show correct foelds 2006-05-26 06:47:32 +00:00
skodak 6483738028 Bug #5612 - language string missing in blog 2006-05-25 19:23:54 +00:00
skodak 086018ae01 Bug #5582 - sort by numerical field doesn't work properly with decimals 2006-05-25 15:55:55 +00:00
nfreear ae04fba0cd Ongoing fix, bug 5614 - added ALT text for link icons, based on TITLE. 2006-05-25 15:50:19 +00:00
skodak db9529f65f Bug #5416 - sorting by question column in overview report plugin broken - please test 2006-05-25 09:59:06 +00:00
skodak 97ae5efdf0 Bug #5566 - wrong display of student's answers in MATCHING question type 2006-05-25 08:12:30 +00:00
skodak a636a125da Bug #4779 - lib/moodlelib.php: typo 2006-05-25 06:33:01 +00:00
vyshane b3ed98f7ba Changed string to make it more general so we can use it for error message that
is shown when a student tries to add an entry and no fields are defined.
2006-05-25 05:16:43 +00:00
vyshane 46941b6043 Fix for bug: when students try to add an entry while no field is defined, the
foreach barfs on the value of $fields, which is false.
2006-05-25 05:14:53 +00:00
gbateson 670cced63a added blank lines for to improve readability 2006-05-25 05:14:49 +00:00
toyomoyo f6c74641dd backup-restore, utfmigrate for rsstitletemplate field 2006-05-25 02:29:15 +00:00
toyomoyo 3141843a1a dropping backticks 2006-05-25 02:06:44 +00:00
toyomoyo 4da8b58b36 forgot to check this in 2006-05-25 01:43:32 +00:00
gbateson 7c8304a6c9 clarified the wording in point (5) of the "TO USE" section 2006-05-25 00:00:34 +00:00
skodak fee588e503 fixed my yet another bug 2006-05-24 21:53:46 +00:00
skodak 42e2fba317 fixed broken operations in subfolders - result of my recent patching :-( :-( bug #5603 2006-05-24 21:49:25 +00:00
skodak 48c54e90ce Bug #5604 - LDAP error notice when users update profile 2006-05-24 21:11:56 +00:00
skodak dad92a063d fixed warnings on save profile 2006-05-24 21:04:33 +00:00
skodak 9033ed3212 Bug #5587 - Redirect fails after a failed login and proper variable initialisation 2006-05-24 20:54:59 +00:00
skodak 146132bffc fixed bug #5562 I hope 2006-05-24 18:55:41 +00:00
gbateson 331c6f4620 fixed typos in $string['configshowtimes'] 2006-05-24 11:22:07 +00:00
toyomoyo ed501d3e98 added a rsstitle field 2006-05-24 07:01:33 +00:00
toyomoyo d2780b2594 added rsstitletemplate field 2006-05-24 06:14:16 +00:00
toyomoyo 3054f2faf2 renaming reads and writes to statsreads and statswrites 2006-05-24 05:02:09 +00:00
vyshane 3c0fd35102 Fix for undefined property notice when cron.php is run. 2006-05-24 03:06:16 +00:00
stronk7 67e55d7e0b Solving one SQL error in data_get_participants()
plus some improved readability.
2006-05-23 22:30:58 +00:00
stronk7 5b0d565bcd course_modules->deleted and user->guid are now out.
(they disappeared from DB ages ago)
2006-05-23 22:04:50 +00:00
skodak ade83600e1 fix for printing of multiple group pictures bug #5548 2006-05-23 19:16:04 +00:00
skodak b87862b89a fixed bug #5593 - logged in nested in <p> and <div> 2006-05-23 18:58:37 +00:00
skodak 30faf003ba fixed file backup and converted other forgotten "assignments" 2006-05-23 18:37:05 +00:00
skodak c9a53bb206 fixed broken SQL that was throwing errors in backup 2006-05-23 18:14:56 +00:00
skodak 6fb6c9d960 fixed bug 5594 - can not save group details 2006-05-23 17:59:19 +00:00
skodak 5d502dc3e4 fixed warning 2006-05-23 13:32:43 +00:00
skodak 30d36e2f3e fixed incorrect output buffer use - bug #5590 2006-05-23 10:54:43 +00:00
skodak 989e230b3d fixed RSS feeds warning bug #5591 2006-05-23 10:24:40 +00:00
skodak f45b5a05c0 make sure variables are properly cleaned 2006-05-23 09:46:56 +00:00
skodak 48cd99809d proper initialisation of $oldquestionid 2006-05-23 09:31:04 +00:00
skodak 6ebca3c77e removed reliance on register globals 2006-05-23 09:10:23 +00:00
skodak 2e311d898c extra cleaning of variables 2006-05-23 09:00:58 +00:00
stronk7 a87bbde1a1 Allowing also numbers and underscores in sessioncookie.
Merged from MOODLE_15_STABLE
2006-05-22 17:54:13 +00:00
skodak 71777355b1 fixed register globals issues for $sort SC #256 2006-05-22 16:51:56 +00:00
tjhunt 01d50616ee Fix for Bug #5588 - Editing a question after sorting leads to an error. 2006-05-22 15:42:42 +00:00
skodak d44136dee7 fixed bug #5578 - remove login as button for other teachers in course 2006-05-22 13:14:14 +00:00
tjhunt 5c9fe50894 Fix an undefined variable notice. 2006-05-22 13:04:17 +00:00
tjhunt e620c033cb Fix an undefined variable notice. 2006-05-22 11:19:32 +00:00
nfreear d3b5c5f081 Ongoing, fix bug 5400, navbar/breadcrumb TABLE to DIV, to improve semantics. 2006-05-22 09:11:10 +00:00
skodak 6936ef91df fixed bug #5572 missing PARAM_CLEAN 2006-05-22 05:59:06 +00:00
toyomoyo 3f94709321 fix for 5551, can not edit post when set to 1 discussion 2006-05-22 02:38:11 +00:00
gbateson 6428434a5f fixed typo: clck -> click 2006-05-22 00:21:00 +00:00
gbateson 9bb14972af modified CVS URLs to start http://moodle.cvs.sourceforge.net 2006-05-22 00:19:51 +00:00
gbateson 01f3128264 Give Up button modified to send results and set status to abandoned. Microincrement version to 2006052200 (release = v2.1.20) 2006-05-22 00:07:33 +00:00
skodak 3e55705455 fixed register globals issue with $loginasguest 2006-05-21 20:50:50 +00:00
skodak 889209d1fa fixed redirection to https:// for edit profile and change password when loginhttps on 2006-05-21 20:34:31 +00:00
skodak efc346b5ca temporary workaround for bug #5534, html editor now disabled for IE when loginhttps on and wwwroot starts with http:// 2006-05-21 20:20:45 +00:00
skodak 5eb64d447e removed isset 2006-05-21 10:10:54 +00:00
skodak 9446d15749 fixed register globals issue with $text 2006-05-21 08:08:48 +00:00
skodak dc28278d18 proper initialisation of passwordchangeurl 2006-05-21 07:50:21 +00:00
skodak d04f1621e8 proper initialisation of sqlsortkey SC#258 2006-05-21 07:42:05 +00:00
koenr ef38765d91 adding missing </p> and one point 2006-05-20 19:14:13 +00:00
skodak 7c3c8b7249 fixed register globals issues in course/search.php 2006-05-20 18:39:48 +00:00
skodak eb676fdf9a proper initialisation of $focus SC#257 2006-05-20 18:18:30 +00:00
skodak bf55369e5d do not show pending courses button for nonadmins bug #5564 2006-05-20 18:07:25 +00:00
skodak 56a6a9ff49 fixed cleaning of path in custom scripts SC#221 2006-05-20 17:21:44 +00:00
stronk7 91e4976c08 Bump to Beta5 2006-05-20 00:10:13 +00:00
skodak 299560a9fc fixed block width calculation 2006-05-19 21:00:28 +00:00
skodak 23cb8a304c submission in post.php cleanup, fixes for bugs #5530, #5484 and SC#252 2006-05-19 20:15:44 +00:00
skodak 9c71eb42b8 fixed - disabled autologinguest not always respected in require_login() SC#255 2006-05-19 19:10:19 +00:00
nfreear f642809590 Ongoing, fix bug 5400, DIV to H1, to improve semantics. 2006-05-19 13:24:48 +00:00
nfreear 3edb646260 Fix bug 5434 - hardcoded missing Alt text, with a warning comment. 2006-05-19 10:29:08 +00:00
vyshane 7828580904 Fix for Bug #5541 2006-05-19 06:23:16 +00:00
mark-nielsen 2711fbb039 [BugFix] Bug #5405 - made a new function that grades a lesson for a specific user's attempt. This is then used for grad
ing lessons at the end of a lesson, for ongoing score feature and for updating the grade for essay question grading.

This new grading algorithm now enforces the lesson setting Max attempts when custom scoring is turned Off

Changed the reporting of minquestions setting to match the help file.  Now it is question based instead of attempt based
.

Changed the reporting of ongoing score to use the new grade function.
2006-05-19 00:59:22 +00:00
mark-nielsen d226adef8b [BugFix] Bug #5405 - made a new function that grades a lesson for a specific user's attempt. This is then used for grad
ing lessons at the end of a lesson, for ongoing score feature and for updating the grade for essay question grading.

This new grading algorithm now enforces the lesson setting Max attempts when custom scoring is turned Off

Changed the reporting of minquestions setting to match the help file.  Now it is question based instead of attempt based
.

Changed the reporting of ongoing score to use the new grade function.
2006-05-19 00:54:15 +00:00
skodak 88aba6189b deprecated nvl() function similar to optional_variable() - fixed missing global $CFG 2006-05-18 22:10:40 +00:00
skodak e371190c10 deprecated nvl() function similar to optional_variable() 2006-05-18 22:09:25 +00:00
dwoolhead dd3b147a87 Bug 5536 Replaced references to hide by show 2006-05-18 16:10:33 +00:00
ethem 653c70a063 Removed </td>. Help button appears on top :))
Merged from HEAD
2006-05-18 10:04:42 +00:00
ethem bb75ef114c I have just found a cute function called print_checkbox. :)
Merged from HEAD.
2006-05-18 07:58:54 +00:00
skodak f220d982f2 fixed bug #5533, could not choose from file root 2006-05-18 05:46:58 +00:00
martinlanghoff 1db555e84d login: Changing passwords now works when logged in as guest 2006-05-18 00:53:08 +00:00
skodak 2c97ca5d59 admins can now edit user images even when $CFG->disableuserimages = true; see bug #5494 and SC#253 2006-05-17 18:57:18 +00:00
skodak 4a1f1588f0 fixed version number 2006-05-17 18:15:43 +00:00
skodak 2b5c23c82b fixed some warnings and removed ugly hack error_reporting(E_ALL ^ E_NOTICE); that was only hiding warnings in this and other code
I am going to watch forums and bug tracker and fix any other problems that may surface before the release
2006-05-17 18:05:28 +00:00
tjhunt e1b8eb512c Convert tabs to spaces in files where there were only a few rogue tabs. 2006-05-17 16:37:14 +00:00
exe-cutor fca3ef18aa Removed all tabs 2006-05-17 12:37:13 +00:00
exe-cutor d2c77a0dc0 Fixed some typos 2006-05-17 12:33:01 +00:00
tjhunt f76e87652c Fix URL syntax error when slasharguments is off. 2006-05-17 11:29:31 +00:00
tjhunt 108145970d Fix wrong variable name. 2006-05-17 11:28:59 +00:00
ethem d4d1873933 action.php renamed to authorizenetlib.php 2006-05-17 08:12:41 +00:00
martinlanghoff 52a85b5475 moodle16cleanup: lib/db correct prefix, patch by Tim Hunt for bug 5515 2006-05-17 06:26:32 +00:00
martinlanghoff 6f1c69ec02 mod/choice mod/lesson mod/scorm moodle16cleanup: Added notification
for cleanup that may fail if one is starting fresh from moodle 1.5.3+,
previous cleanup before 1.5.3 is not needed
2006-05-17 06:25:46 +00:00
martinlanghoff f184d1610b moodle16cleanup: mod/forum correctly dropping the constraint, so it does
not report an error during upgrade
2006-05-17 06:25:20 +00:00
martinlanghoff 7832d94156 moodle16cleanup: mod/quiz correctly sync the constraints and indexes
which was not changed when it was moved from quiz module to question lib
2006-05-17 06:24:59 +00:00
martinlanghoff 289b648803 moodle16cleanup: mod/quiz uniqueid does not exists, taking upgrade script
from mysql.php ver 2005070202. dropping some unused tables during the
transition from quiz to question lib
2006-05-17 06:24:28 +00:00
martinlanghoff c86c9b30c5 moodle16cleanup: lib/db correctly put the default values, change the
length of log_display.module which is just 20 chars on postgres7.sql
2006-05-17 06:20:52 +00:00
martinlanghoff a722923c62 moodle16cleanup: backup/ set the correct column datatype and default value 2006-05-17 06:20:37 +00:00
martinlanghoff ae3f15fac1 moodle16cleanup: blocks/rss_client set the correct column default value 2006-05-17 06:20:09 +00:00
martinlanghoff d5b0187a32 moodle16cleanup: enrol/authorize not null set which is similar to mysql
and that was upgraded on postgres7.php
2006-05-17 06:19:50 +00:00
martinlanghoff 100aa1d7be moodle16cleanup: mod/hotpot set the correct column datatype and default
value
2006-05-17 06:19:34 +00:00
martinlanghoff 4ff35d69bc moodle16cleanup: mod/lesson drop unused table lesson_essay, set the
correct column datatype and default value
2006-05-17 06:19:17 +00:00
martinlanghoff ec29c403be moodle16cleanup: mod/dialog we need to drop some more dialog module tables 2006-05-17 06:18:43 +00:00
martinlanghoff a576feacb8 moodle16cleanup: mod/scorm drop a weird check constraint that is showing
up after upgrade
2006-05-17 06:18:16 +00:00
martinlanghoff 9c44a6972c moodle16cleanup: mod/scrom set the correct defaults and correctly recreate
the new check constraint
2006-05-17 06:17:53 +00:00
martinlanghoff 1ce5928d35 moodle16cleanup: mod/scorm version column should not be dropped, it must
exist. it was not upgraded as with mysql.php 2005041600
2006-05-17 06:17:32 +00:00
martinlanghoff 35c30e915e moodle16cleanup: mod/wiki synch upgrade script and .sql with mysql
counterpart, drop the not null constraint to sync with postgres7.sql
2006-05-17 06:17:06 +00:00
martinlanghoff f59139d640 moodle16cleanup: mod/forum added notification message 2006-05-17 06:15:48 +00:00
martinlanghoff b4bdcbe535 blocklib: cache (and used cached) block instances properly in $pageblocks
Now blocks_have_content() caches instantiated block objects inside $pageblocks
and blocks_print_blocks() uses them if available. This behaviour now matches
the documentation: blocks instances are created only once, get_content()
may be invoked several times.

A better fix would be to cache the _output_ of the block (the ->content
property) but it may bite us if any block is counting on being called twice.

Discussion at: http://moodle.org/mod/forum/discuss.php?d=45867
2006-05-17 04:51:12 +00:00
skodak b6d175eeb7 I hope this is the last patch for header already printed trouble in error() and redirect() 2006-05-16 20:29:20 +00:00
ethem a7084ab10b confirm_sesskey() implementation for capture,delete,refund and void. I hope it works. :)
Merged from HEAD.
2006-05-16 15:37:06 +00:00
ethem 6a4c28904a Allow showing error message when insert_record fails. 2006-05-16 15:00:08 +00:00
ethem d0e1fd06c5 Manual capture settings for sending email: cron=enabled, an_review=checked, an_capture_day=0, an_emailexpired=1-5
merged from HEAD
2006-05-16 11:40:00 +00:00
nfreear 287a93580b Fix bug 5477 "Strange 'you are here'...", <span> now <h2> in function print_navigation. 2006-05-16 11:31:50 +00:00
ethem 53fedccb0b (Manual capture settings: cron=enabled, an_review=checked, an_capture_day=0)
Merged from HEAD.
2006-05-16 10:46:55 +00:00
thepurpleblob a08ccf0a61 Added note that export now exports all subcategories. 2006-05-16 09:38:03 +00:00
toyomoyo df8baa04c3 forgot to take out comment 2006-05-16 08:22:03 +00:00
toyomoyo 3b0e0d4df4 fix for 5513 2006-05-16 07:57:54 +00:00
vyshane 250ea6271e Fixed bug #5467. Converted newlines to UNIX format, tabs to spaces and removed
extra newlines at the end of php scripts.
2006-05-16 07:04:05 +00:00
vyshane f356fbe45e Fix for grade_drop_lowest (missed from last fix for bug 5354) 2006-05-16 06:57:08 +00:00
vyshane 37f401637b Fixed Bug #5354 - Gradebook [DropXLowest and Exclude] 2006-05-16 05:49:59 +00:00
mark-nielsen 13f944bc55 [BugFix] Bug 5485 - problem with regular expressions with simple analysis 2006-05-16 03:04:44 +00:00
stronk7 3e21f15895 Updated to latest version (1.56). Bug 5165.
(http://moodle.org/bugs/bug.php?op=show&bugid=5165)
2006-05-15 23:29:13 +00:00
danmarsden fc410020b8 Fixes bug 5464 also makes response clearer to students -see:
http://moodle.org/mod/forum/discuss.php?d=45504

also finishes off Bug 662
2006-05-15 23:21:39 +00:00
mjollnir_ 200460b0c8 mod/quiz/view No-longer display final grade when quiz settings forbid it.
Changed view.php so that it checked if there were any attempts with
concealed grades before printing the student's overall score.
Credit: Peter Bulmer <peter.bulmer@catalyst.net.nz>
2006-05-15 21:51:30 +00:00
skodak d1014faf32 fixed problem when set both loginhttps and https in wwwroot, closes bug #5507 and #3848 2006-05-15 21:32:21 +00:00
gustav_delius b692cb65b7 Answers to essay questions are now saved correctly when navigating to another page, fixing bug 4478 2006-05-15 20:27:04 +00:00
mark-nielsen 3f566d8f2e [BugFix] Bug 5505 - function lesson_print_tree now checks for teacher editing priv before printing editing icons. Had to change arguments for this function as well which is the edit in view.php.
lesson.php how checks for teacher editing priv for all actions except for continue.  This is just in case the user hacks the URL.
2006-05-15 19:05:58 +00:00
stronk7 46beca01b3 Avoid [[namesite]] to appear when ADDING site activities.
I sent this on May 8th! :-(
2006-05-15 17:52:39 +00:00
stronk7 0257c6d6b0 Changing session->data to medium text. Bug 5406.
(http://moodle.org/bugs/bug.php?op=show&bugid=5406)

IMPORTANT: I sent this to CVS on May, 8th and changes have dissapear!
           It could be possible than other commits sent near SF crash
           were affected too!
2006-05-15 17:28:02 +00:00
stronk7 b10192c1e4 Changing session->data to medium text. Bug 5406.
(http://moodle.org/bugs/bug.php?op=show&bugid=5406)

IMPORTANT: I sent this to CVS on May, 8th and changes had dissapear!
           It could be possible than other commits sent near SF crash
           were affected too!
2006-05-15 17:26:38 +00:00
skodak 0772879f24 fix my previous incorrect short tag fix, fixed register globals, IP address used as mail user when not logged in 2006-05-15 15:44:36 +00:00
skodak 5563b4e151 fixed short php tags 2006-05-15 15:10:49 +00:00
skodak ffcce04152 changed cleaning of entry title, now matches handling of forum post titles 2006-05-15 15:03:44 +00:00
skodak b374d60430 better cleaning of post title SC#251 revisited 2006-05-15 14:47:09 +00:00
skodak 848e124eab better cleaning of post title SC#251 2006-05-15 14:31:09 +00:00
exe-cutor a53b09c16b Fixed an inconsistent link 2006-05-15 12:18:40 +00:00
toyomoyo 8374432bdb fix for 5493 2006-05-15 02:58:43 +00:00
toyomoyo 18ab64ef11 tidying up constants 2006-05-15 02:56:56 +00:00
toyomoyo e1b6fbf2eb fix for 4404 2006-05-15 02:25:42 +00:00
toyomoyo a37df0735f fix for 5465 2006-05-15 02:01:54 +00:00
skodak 8b0c3b6551 fixed secure forms handling when POST url contained GET parameters (cookieless mode and some other forms) 2006-05-14 20:57:01 +00:00
skodak 5ee7e12e26 fixed bug #5489 - can not edit file, minor bugfixes and whitespace cleanup 2006-05-14 19:08:34 +00:00
skodak f4aaf2f7b5 fixed whitespace and Id tag 2006-05-14 17:21:02 +00:00
skodak c385f70296 I hope final fix for warnings when using error() after print_header() with buffering on, solution was to flush all buffers and reenable SID rewrite when needed. 2006-05-14 17:10:35 +00:00
gbateson 00fe4b8045 microincrement version number to v2.1.19 2006-05-14 08:34:23 +00:00
gustav_delius 0472d056f6 Removing obsolete defaults 2006-05-13 17:04:11 +00:00
gustav_delius 07f8831194 Introduce question_attempts table, closing bug 5468
Fixed incorrect check for whether to update state or insert new one in save_question_session()
Deal with manually graded states correctly during regrading
Increase state sequence number during manual grading
Supplied missing userid to quiz_save_best_grade() during manual grading
2006-05-13 16:41:22 +00:00
ethem a7f53e74f6 Fix: Redirect to order details page 10 seconds later, not home page. 2006-05-13 16:14:36 +00:00
gustav_delius 8a6733ead1 Updated comments and made sure teacher preview gets restarted when changes are saved, fixing bug 5478 2006-05-13 10:34:02 +00:00
ethem e5bafac7d2 *** empty log message *** 2006-05-13 08:55:38 +00:00
ethem f101e4f736 Language direction is important. Changed as: <b>AVS Result:</b> $a 2006-05-13 08:51:12 +00:00
thepurpleblob 53b824ef1f Fixes for bugs #5435 - subcategories were not exported and
#5470 - true/false questions not exported due to internal format
change.
2006-05-13 08:47:57 +00:00
ethem 672007443c More readable coding. Now, I understand everything. :) 2006-05-13 08:30:06 +00:00
ethem 1180c98509 Deleting test transactions are not good. They may be in proggress. Let's update WHERE transid<>'0'. 2006-05-13 05:58:17 +00:00
ethem 337f36b459 Fix: Don't show newly created orders prior to 2 minutes.
They may be still in proggress and these aren't test transacions(transid=0).
We check timecreated field to prevent this.
2006-05-12 19:48:42 +00:00
ethem be1ed90464 Fix: Delete test transactions before update status as AN_STATUS_AUTHCAPTURE. 2006-05-12 18:32:02 +00:00
ethem 55c0d5b8a4 Status: 'New' string. Merged from HEAD. 2006-05-12 17:23:59 +00:00
stronk7 aa912c49e2 Changing session->data to medium text. Bug 5406.
(http://moodle.org/bugs/bug.php?op=show&bugid=5406)
2006-05-08 16:36:40 +00:00
nfreear 8abfee6962 Fixes bug 5412 "Recent Activity block, New Users, markup should be a list" - style and lib.php: print_recent_activity. 2006-05-08 11:24:35 +00:00
thepurpleblob f1068df6c6 Moved some category functions back to questionlib. Original move
caused all sorts of problems.
2006-05-08 10:40:42 +00:00
thepurpleblob 3b438e0db9 Moved some of the category functions back here. Caused much
more grief than I anticipated.
2006-05-08 10:38:03 +00:00
toyomoyo 6d699a924d fix for 5438 2006-05-08 07:07:51 +00:00
vyshane f6de1e03d7 Fix for Bug #5441. Typo was causing an undefined variable notice. 2006-05-08 03:53:49 +00:00
vyshane 0416a3be25 Changed field length to 20 for module field in log table (Bug #5419). 2006-05-08 03:07:27 +00:00
moodler 1e4f7f125b Updated hints about stable versions 2006-05-08 01:47:25 +00:00
stronk7 1b2472e584 glossary print view is now valid XHTML. 2006-05-07 10:48:10 +00:00
stronk7 51aca6a92f Now, when a single forum is restored and no user data was created,
the initial discussion/post is automatically generated. Bug 5418.
(http://moodle.org/bugs/bug.php?op=show&bugid=5418)

Merged from MOODLE_15_STABLE
2006-05-06 16:55:38 +00:00
ethem 04803a039d Admin can setup which credit card types will be accepted. 2006-05-05 18:25:03 +00:00
ethem 8d101bc522 Admin can setup which credit card types will be accepted. 2006-05-05 18:09:38 +00:00
stronk7 474c8d3f00 Now the help link in the admin block points to Docs. Bug 4803.
(http://moodle.org/bugs/bug.php?op=show&bugid=4803)
2006-05-05 17:54:59 +00:00
vyshane e48f4e502d Fix for Bug #5419 - Inconsistency between log_display and log tables. 2006-05-05 08:01:27 +00:00
toyomoyo 00b9ff724b fix for 4478 2006-05-05 06:43:36 +00:00
toyomoyo d5be1194cb fix for 5428 2006-05-05 05:13:12 +00:00
thepurpleblob d3176779c8 htmlentities() replaced by s() 2006-05-04 11:15:11 +00:00
stronk7 8e4485c69b Anything against the ISO-8859-1 word? 2006-05-04 10:38:17 +00:00
toyomoyo e565767d24 fix for 5426, inconsistent prefixes, and lengthened some index to varchar(100) during migration 2006-05-04 09:36:32 +00:00
ethem aca29171b4 Enable 'Authorize.net plugin' and setup cron properly; or uncheck an_review again. 2006-05-04 08:15:29 +00:00
toyomoyo 1710f639ae fix for 3644 2006-05-04 06:56:24 +00:00
moodler 711d6de23f Whoops, proper merge now 2006-05-04 05:47:27 +00:00
moodler fdee3caacb Merged fixes from stable 2006-05-04 04:42:18 +00:00
vyshane 0c19b8fd99 Fix for Bug #4805 2006-05-04 04:25:22 +00:00
toyomoyo 1bad990a14 fix for 5417 2006-05-04 02:22:37 +00:00
stronk7 155a4e17a2 Now more quiz actions are restored properly:
-preview
 -start attempt
 -close attempt
 -continue attempt (too long. See Bug 5419)
Bug 5122
(http://moodle.org/bugs/bug.php?op=show&bugid=5122)
2006-05-03 23:45:55 +00:00
stronk7 11a5d6c147 Fixing some non-production values I left after testing.
Thanks James!
2006-05-03 22:03:06 +00:00
stronk7 ca5b6b6506 XHTML validation. Bug 5332.
(http://moodle.org/bugs/bug.php?op=show&bugid=5332)
2006-05-03 18:20:09 +00:00
urs_hunkler d0fcd925f9 patch: 2 if propertyIsEnumerable blocks added to make HTMLeditor work with the prototype AJAX library 2006-05-03 18:14:42 +00:00
stronk7 b985f62858 1.6 compliance added
Merged from HEAD
2006-05-03 17:57:26 +00:00
stronk7 e793cddc22 Solving some changes in course-view and sections... 2006-05-03 17:47:29 +00:00
314 changed files with 39273 additions and 5715 deletions
+1 -1
View File
@@ -60,7 +60,7 @@
// $CFG->pagepath is used to generate the body and id attributes for the body tag
// of the page. It is also used to generate the link to the Moodle Docs for this view.
$CFG->pagepath = 'block/' . $strblockname . '/config';
$CFG->pagepath = 'block/' . $block->name() . '/config';
print_header($site->shortname.': '.$strblockname.": $strconfiguration", $site->fullname,
"<a href=\"index.php\">$stradmin</a> -> ".
+1 -1
View File
@@ -34,7 +34,7 @@
if (count($err) == 0) {
foreach ($config as $name => $value) {
if ($name == "sessioncookie") {
$value = eregi_replace("[^a-zA-Z]", "", $value);
$value = eregi_replace("[^a-zA-Z0-9_]", "", $value);
}
if ($name == "defaultallowedmodules") {
$value = implode(',',$value);
+1 -1
View File
@@ -26,7 +26,7 @@
chdir(dirname($_SERVER['argv'][0]));
}
require_once("../config.php");
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->dirroot.'/lib/adminlib.php');
if (!$alreadyadmin = isadmin()) {
+26
View File
@@ -34,4 +34,30 @@
</PHP_EXTENSION>
</PHP_EXTENSIONS>
</MOODLE>
<MOODLE version="1.7">
<DATABASE level="required">
<VENDOR name="mysql" version="4.1.16">
<FEEDBACK>
<ON_ERROR message="mysql416required" />
</FEEDBACK>
<BYPASS function="bypass_mysql416_reqs" message="mysql416bypassed" />
</VENDOR>
<VENDOR name="postgres" version="7.4" />
<VENDOR name="mssql" version="8.0" />
<VENDOR name="oracle" version="9.0" />
</DATABASE>
<PHP version="4.3.0" level="required" />
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="optional">
<FEEDBACK>
<ON_CHECK message="iconvrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="optional">
<FEEDBACK>
<ON_CHECK message="mbstringrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
</PHP_EXTENSIONS>
</MOODLE>
</COMPATIBILITY_MATRIX>
+7 -2
View File
@@ -188,10 +188,15 @@
// construct the flexible table ready to display
$table = new flexible_table(FILTER_TABLE);
$table->define_columns(array('name', 'hideshow', 'order', 'settings'));
$table->column_style('hideshow', 'text-align', 'center');
$table->column_style('order', 'text-align', 'center');
$table->column_style('settings', 'text-align', 'center');
$table->define_headers(array($txt->name, $txt->hideshow, $txt->updown, $txt->settings));
$table->define_baseurl("$CFG->wwwroot/admin/filters.php");
$table->set_attribute('id', 'blocks');
$table->set_attribute('class', 'flexible generaltable generalbox');
$table->set_attribute('style', 'margin:auto;');
$table->set_attribute('cellpadding', '5');
$table->setup();
// iterate through filters adding to display table
@@ -202,13 +207,13 @@
// get hide/show link
if (in_array($path, $activefilters)) {
$hideshow = "<a href=\"$myurl&amp;action=hide&amp;filterpath=$upath\">";
$hideshow .= "<img src=\"$img/hide.gif\" alt=\"hide\" /></a>";
$hideshow .= "<img src=\"{$CFG->pixpath}/i/hide.gif\" height=\"16\" width=\"16\" alt=\"hide\" /></a>";
$hidden = false;
$displayname = "<span>$name</span>";
}
else {
$hideshow = "<a href=\"$myurl&amp;action=show&amp;filterpath=$upath\">";
$hideshow .= "<img src=\"$img/show.gif\" alt=\"show\" /></a>";
$hideshow .= "<img src=\"{$CFG->pixpath}/i/show.gif\" height=\"16\" width=\"16\" alt=\"show\" /></a>";
$hidden = true;
$displayname = "<span class=\"dimmed_text\">$name</span>";
}
+1 -1
View File
@@ -186,7 +186,7 @@ $langdir/$currentfile")."</font></p>";
echo "<textarea rows=\"$fileeditorrows\" cols=\"$fileeditorcols\" name=\"filedata\">\n";
if (file_exists("$langdir/$currentfile")) {
echo htmlspecialchars(file_get_contents("$langdir/$currentfile"));
echo htmlspecialchars(file_get_contents("$langdir/$currentfile"));
} else {
echo ($filetemplate);
}
+5 -5
View File
@@ -39,7 +39,7 @@
print_heading($strmanagemodules);
$courseaffected = false;
$coursesaffected = false;
/// If data submitted, then process and store.
@@ -149,10 +149,10 @@
foreach ($modules as $module) {
$strmodulename = get_string("modulename", "$module->name");
// Deal with modules which are lacking the language string
if ($strmodulename == '[[modulename]]') {
$strmodulename = $module->name;
}
// Deal with modules which are lacking the language string
if ($strmodulename == '[[modulename]]') {
$strmodulename = $module->name;
}
$modulebyname[$strmodulename] = $module;
}
ksort($modulebyname);
+4 -11
View File
@@ -93,12 +93,13 @@
foreach ($courses as $c) {
$a = array();
$a[] = '<a href="'.$CFG->wwwroot.'/course/view.php?id='.$c->courseid.'">'.get_field('course','shortname','id',$c->courseid).'</a>';
$a[] = print_numeric_value($c->line1);
$a[] = $c->line1;
if (isset($c->line2)) {
$a[] = print_numeric_value($c->line2);
$a[] = $c->line2;
}
if (isset($c->line3)) {
$a[] = print_numeric_value($c->line3);
$a[] = $c->line3;
}
$table->data[] = $a;
}
@@ -107,12 +108,4 @@
print_footer();
function print_numeric_value($value) {
list($whole, $decimals) = split ('[.,]', $value, 2);
if (intval($decimals) > 0)
return number_format($value,2,".",",");
else
return $value;
}
?>
+44 -1
View File
@@ -5,7 +5,50 @@
}
if (!empty($CFG->enablestats)) {
echo '<a href="'.$CFG->wwwroot.'/admin/report/courseoverview/index.php">'.get_string('courseoverview').'</a>';
$strreports = get_string('reports');
$strcourseoverview = get_string('courseoverview');
print_heading("$strcourseoverview:");
require_once($CFG->dirroot.'/lib/statslib.php');
$report = optional_param('report', STATS_REPORT_ACTIVE_COURSES, PARAM_INT);
$time = optional_param('time', 0, PARAM_INT);
$numcourses = optional_param('numcourses', 20, PARAM_INT);
$course = get_site();
stats_check_uptodate($course->id);
$reportoptions = stats_get_report_options($course->id,STATS_MODE_RANKED);
$tableprefix = $CFG->prefix.'stats_';
$earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend LIMIT 1');
$earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend LIMIT 1');
$earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend LIMIT 1');
if (empty($earliestday)) $earliestday = time();
if (empty($earliestweek)) $earliestweek = time();
if (empty($earliestmonth)) $earliestmonth = time();
$now = stats_get_base_daily();
$lastweekend = stats_get_base_weekly();
$lastmonthend = stats_get_base_monthly();
$timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
$table->width = '*';
$table->align = array('left','left','left','left','left','left');
$table->data[] = array(get_string('statsreporttype'),choose_from_menu($reportoptions,'report',$report,'','','',true),
get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true),
'<input type="text" name="numcourses" size="3" maxlength="2" value="'.$numcourses.'" />',
'<input type="submit" value="'.get_string('view').'" />') ;
echo '<form action="report/courseoverview/index.php" method="post">'."\n";
print_table($table);
echo '</form>';
}
?>
+63
View File
@@ -0,0 +1,63 @@
<?php // $Id$
require_once('../../../config.php');
require_once($CFG->dirroot.'/lib/statslib.php');
require_once($CFG->dirroot.'/course/report/stats/lib.php');
if (empty($CFG->enablestats)) {
error("Stats is not enabled.");
}
$courseid = required_param('course', PARAM_INT);
$report = optional_param('report', 0, PARAM_INT);
$time = optional_param('time', 0, PARAM_INT);
$mode = optional_param('mode', STATS_MODE_GENERAL, PARAM_INT);
$userid = optional_param('userid', 0, PARAM_INT);
if ($report == STATS_REPORT_USER_LOGINS) {
$courseid = SITEID; //override
}
if ($mode == STATS_MODE_RANKED) {
redirect($CFG->wwwroot.'/'.$CFG->admin.'/report.php?time='.$time);
}
if (!$course = get_record("course","id",$courseid)) {
error("That's an invalid course id");
}
if (!empty($userid)) {
if (!$user = get_record('user','id',$userid)) {
error("That's an invalid user id");
}
}
require_login();
if (!isteacher($course->id)) {
error("You need to be a teacher to use this page");
}
add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id);
stats_check_uptodate($course->id);
$strreports = get_string("reports");
$strstats = get_string('stats');
$menu = report_stats_mode_menu($course, $mode, $time);
$crumb = "<a href=\"{$CFG->wwwroot}/admin\">".get_string('administration')."</a> ->
<a href=\"{$CFG->wwwroot}/admin/report.php\">$strreports</a> ->
$strstats";
print_header("$course->shortname: $strstats", "$course->fullname",
$crumb, '', '', true, '&nbsp', $menu);
require_once($CFG->dirroot.'/course/report/stats/report.php');
print_footer();
?>
+12
View File
@@ -0,0 +1,12 @@
<?php //$Id$
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
if (!empty($CFG->enablestats)) {
echo '<p style="text-align:center;">';
echo '<a href="'.$CFG->wwwroot.'/admin/report/stats/index.php?course='.$course->id.'">'.get_string('stats').'</a>';
echo '</p>';
}
?>
+357 -321
View File
@@ -4,7 +4,7 @@
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/environmentlib.php');
require_once($CFG->dirroot.'/course/lib.php');
require_login();
if (!isadmin()) {
@@ -178,8 +178,12 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
//mtrace() and return 0. (showing the current
//table/field/recordid)
global $db, $CFG, $dbtablename, $fieldname, $record;
global $db, $CFG, $dbtablename, $fieldname, $record, $processedrecords;
$debug = ($CFG->debug > 7);
//echo date("H:i:s");
ignore_user_abort(false); // see bug report 5352. This should kill this thread as soon as user aborts.
@set_time_limit(0);
@ob_implicit_flush(true);
@@ -191,8 +195,22 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
$ignoretables = array(); //list of tables to ignore, optional
//one gigantic array to hold all db table information read from all the migrate2utf8.xml file.
require_once($CFG->dirroot.'/lib/xmlize.php');
$xmls = utf_get_xml(1);
$tablestoconvert = 0; // total number of tables to convert
foreach ($xmls as $xml) { ///foreach xml file, we must get a list of tables
$dbtables = $xml['DBMIGRATION']['#']['TABLES'][0]['#']['TABLE']; //real db tables
foreach ($dbtables as $dbtable) {
$tablestoconvert++;
}
}
// progress bar handling
// first let's find out how many tables there are
$done = 0;
print_progress($done, 158, 5, 1);
print_progress($done, $tablestoconvert, 5, 1);
$textlib = textlib_get_instance(); //only 1 reference
@@ -280,17 +298,9 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
$crash->field = $crashdata[1];
$crash->record = $crashdata[2];
print_heading('Resume information :');
echo '<br>Resuming from @ table : '.$crash->table;
echo '<br>Resuming from @ field : '.$crash->field;
echo '<br>Resuming from @ record : '.$crash->record;
notify("Resuming migration from: $crash->table / .$crash->field, Record: $crash->record");
}
require_once($CFG->dirroot.'/lib/xmlize.php');
//one gigantic array to hold all db table information read from all the migrate2utf8.xml file.
$xmls = utf_get_xml(1);
/************************************************************************
* Now we got all our tables in order *
************************************************************************/
@@ -302,7 +312,7 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
foreach ($dbtables as $dbtable) {
$done++;
print_progress($done, 158, 5, 1);
print_progress($done, $tablestoconvert, 5, 1);
$dbtablename = $dbtable['@']['name'];
@@ -315,6 +325,7 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
}
if ($crash && ($dbtablename != $crash->table)) { //resuming from crash
$done++; // need to update progress bar
continue;
}
@@ -322,348 +333,372 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
print_heading("<br><b>Processsing db table ".$dbtablename.'...</b>');
}
if (!empty($dbtable['#']) && ($fields = $dbtable['#']['FIELDS'][0]['#']['FIELD']) and (!in_array($dbtablename, $ignoretables))) {
/**********************************************************
* This is the by pass structure. It allows us to process *
* tables on row basis instead of column/field basis *
* It relies on a single function in migrate2utf8.php *
**********************************************************/
$colnames = array();
$coltypes = array(); //array to hold all column types for the table
$collengths = array(); //array to hold all column lengths for the table
$defaults = array(); //array to hold defaults, if any
//reset holders
$addindexarray = array();
$adduniqueindexarray = array();
$addprimaryarray = array();
/// first, check to see if there's a function for the whole table. By pass point (1)
if (file_exists($CFG->dirroot.'/'.$dir.'/db/migrate2utf8.php')) {
require_once($CFG->dirroot.'/'.$dir.'/db/migrate2utf8.php');
// this is a function to process table on role basis, e.g. user table in moodorg
$tablefunction = 'migrate2utf8_'.$dbtablename;
}
if ($CFG->dbtype=='mysql' && function_exists($tablefunction)) {
$tablefunction($dbtable['#']['FIELDS'][0]['#']['FIELD'], $crash, $debug, $maxrecords); // execute it.
} else {
foreach ($fields as $field){
/******************************************************
* No function for converting whole table, we proceed *
******************************************************/
if (!empty($dbtable['#']) && ($fields = $dbtable['#']['FIELDS'][0]['#']['FIELD']) and (!in_array($dbtablename, $ignoretables))) {
//if in crash state, and field name is not the same as crash field name
$colnames = array();
$coltypes = array(); //array to hold all column types for the table
$collengths = array(); //array to hold all column lengths for the table
$defaults = array(); //array to hold defaults, if any
//reset holders
$addindexarray = array();
$adduniqueindexarray = array();
$addprimaryarray = array();
$fieldname = isset($field['@']['name'])?$field['@']['name']:"";
$method = isset($field['@']['method'])?$field['@']['method']:"";
$type = isset($field['@']['type'])?$field['@']['type']:"";
$length = isset($field['@']['length'])?$field['@']['length']:"";
foreach ($fields as $field){
if ($crash && ($crash->field != $fieldname)) {
continue;
}
//if in crash state, and field name is not the same as crash field name
$dropindex = isset($field['@']['dropindex'])?$field['@']['dropindex']:"";
$addindex = isset($field['@']['addindex'])?$field['@']['addindex']:"";
$adduniqueindex = isset($field['@']['adduniqueindex'])?$field['@']['adduniqueindex']:"";
$fieldname = isset($field['@']['name'])?$field['@']['name']:"";
$method = isset($field['@']['method'])?$field['@']['method']:"";
$type = isset($field['@']['type'])?$field['@']['type']:"";
$length = isset($field['@']['length'])?$field['@']['length']:"";
$dropprimary = isset($field['@']['dropprimary'])?$field['@']['dropprimary']:"";
$addprimary = isset($field['@']['addprimary'])?$field['@']['addprimary']:"";
$default = isset($field['@']['default'])?"'".$field['@']['default']."'":"''";
if ($fieldname != 'dummy') {
$colnames[] = $fieldname;
$coltypes[] = $type;
$collengths[]= $length;
}
if ($debug) {
echo "<br>--><b>processing db field ".$fieldname.'</b>';
echo "<br>---><b>method ".$method.'</b>';
}
if ($CFG->dbtype == 'mysql') {
/* Drop the index, because with index on, you can't change it to longblob */
if ($dropindex){ //drop index if index is varchar, text etc type
$SQL = 'ALTER TABLE '.$prefix.$dbtablename.' DROP INDEX '.$dropindex.';';
$SQL1 = 'ALTER TABLE '.$prefix.$dbtablename.' DROP INDEX '.$CFG->prefix.$dropindex.';'; // see bug 5205
if ($debug) {
$db->debug=999;
}
execute_sql($SQL, false); // see bug 5205
execute_sql($SQL1, false); // see bug 5205
if ($debug) {
$db->debug=0;
}
} else if ($dropprimary) { // drop primary key
$SQL = 'ALTER TABLE '.$prefix.$dbtablename.' DROP PRIMARY KEY;';
if ($debug) {
$db->debug=999;
}
execute_sql($SQL, $debug);
if ($debug) {
$db->debug=0;
}
if ($crash && ($crash->field != $fieldname)) {
continue;
}
/* Change to longblob, serves 2 purposes:
1. column loses encoding, so when we finally change it to unicode,
mysql does not do a double convertion
2. longblobs puts no limit (ok, not really but it's large enough)
to handle most of the problems such as in bug 5194
*/
$SQL = 'ALTER TABLE '.$prefix.$dbtablename;
$SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' LONGBLOB';
$dropindex = isset($field['@']['dropindex'])?$field['@']['dropindex']:"";
$addindex = isset($field['@']['addindex'])?$field['@']['addindex']:"";
$adduniqueindex = isset($field['@']['adduniqueindex'])?$field['@']['adduniqueindex']:"";
$dropprimary = isset($field['@']['dropprimary'])?$field['@']['dropprimary']:"";
$addprimary = isset($field['@']['addprimary'])?$field['@']['addprimary']:"";
$default = isset($field['@']['default'])?"'".$field['@']['default']."'":"''";
/*
if ($length > 0) {
$SQL.='('.$length.') ';
}
$SQL .= ' CHARACTER SET binary NOT NULL DEFAULT '.$default.';';
*/
if ($debug) {
$db->debug=999;
}
if ($fieldname != 'dummy') {
execute_sql($SQL, $debug);
$colnames[] = $fieldname;
$coltypes[] = $type;
$collengths[]= $length;
}
if ($debug) {
$db->debug=0;
echo "<br>--><b>processing db field ".$fieldname.'</b>';
echo "<br>---><b>method ".$method.'</b>';
}
}
$patterns[]='/RECORDID/'; //for preg_replace
$patterns[]='/\{\$CFG\-\>prefix\}/i'; //same here
if ($method == 'PLAIN_SQL_UPDATE') {
$sqldetectuser = $field['#']['SQL_DETECT_USER'][0]['#'];
$sqldetectcourse = $field['#']['SQL_DETECT_COURSE'][0]['#'];
}
else if ($method == 'PHP_FUNCTION') {
$phpfunction = 'migrate2utf8_'.$dbtablename.'_'.$fieldname;
}
///get the total number of records for this field
// could not use count_records because it addes prefix to adodb_logsql
$totalrecords = count_records_sql("select count(*) from {$prefix}$dbtablename");
$counter = 0;
$recordsetsize = 4;
if ($CFG->dbtype == 'mysql') {
if ($crash) { //if resuming from crash
//find the number of records with id smaller than the crash id
$indexSQL = 'SELECT COUNT(*) FROM '.$prefix.$dbtablename.' WHERE id < '.$crash->record;
$counter = count_records_sql($indexSQL);
}
/* Drop the index, because with index on, you can't change it to longblob */
if ($debug) {
echo "<br>Total number of records is ..".$totalrecords;
echo "<br/>Counter is $counter";
}
if ($dropindex){ //drop index if index is varchar, text etc type
$SQL = 'ALTER TABLE '.$prefix.$dbtablename.' DROP INDEX '.$dropindex.';';
$SQL1 = 'ALTER TABLE '.$prefix.$dbtablename.' DROP INDEX '.$CFG->prefix.$dropindex.';'; // see bug 5205
if ($debug) {
$db->debug=999;
}
execute_sql($SQL, false); // see bug 5205
execute_sql($SQL1, false); // see bug 5205
/**************************
* converting each record *
**************************/
while(($counter < $totalrecords) and ($fieldname !='dummy') and ($method!='NO_CONV')) { //while there is still something
$SQL = 'SELECT * FROM '.$prefix.$dbtablename.' ORDER BY id ASC '.sql_paging_limit($counter, $recordsetsize);
if ($records = get_records_sql($SQL)) {
foreach ($records as $record) {
if ($debug) {
$db->debug=0;
}
} else if ($dropprimary) { // drop primary key
$SQL = 'ALTER TABLE '.$prefix.$dbtablename.' DROP PRIMARY KEY;';
if ($debug) {
$db->debug=999;
}
execute_sql($SQL, $debug);
if ($debug) {
$db->debug=0;
}
}
//if we are up this far, either no crash, or crash with same table, field name.
if ($crash){
if ($crash->record != $record->id) { //might set to < just in case record is deleted
continue;
} else {
$crash = 0;
print_heading('recovering from '.$dbtablename.'--'.$fieldname.'--'.$record->id);
/* Change to longblob, serves 2 purposes:
1. column loses encoding, so when we finally change it to unicode,
mysql does not do a double convertion
2. longblobs puts no limit (ok, not really but it's large enough)
to handle most of the problems such as in bug 5194
*/
$SQL = 'ALTER TABLE '.$prefix.$dbtablename;
$SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' LONGBLOB';
/*
if ($length > 0) {
$SQL.='('.$length.') ';
}
$SQL .= ' CHARACTER SET binary NOT NULL DEFAULT '.$default.';';
*/
if ($debug) {
$db->debug=999;
}
if ($fieldname != 'dummy') {
execute_sql($SQL, $debug);
}
if ($debug) {
$db->debug=0;
}
}
$patterns[]='/RECORDID/'; //for preg_replace
$patterns[]='/\{\$CFG\-\>prefix\}/i'; //same here
if ($method == 'PLAIN_SQL_UPDATE') {
$sqldetectuser = $field['#']['SQL_DETECT_USER'][0]['#'];
$sqldetectcourse = $field['#']['SQL_DETECT_COURSE'][0]['#'];
}
else if ($method == 'PHP_FUNCTION') {
$phpfunction = 'migrate2utf8_'.$dbtablename.'_'.$fieldname;
}
///get the total number of records for this field
// could not use count_records because it addes prefix to adodb_logsql
$totalrecords = count_records_sql("select count(*) from {$prefix}$dbtablename");
$counter = 0;
$recordsetsize = 50;
if ($crash) { //if resuming from crash
//find the number of records with id smaller than the crash id
$indexSQL = 'SELECT COUNT(*) FROM '.$prefix.$dbtablename.' WHERE id < '.$crash->record;
$counter = count_records_sql($indexSQL);
}
if ($debug) {
echo "<br>Total number of records is ..".$totalrecords;
echo "<br/>Counter is $counter";
}
/**************************
* converting each record *
**************************/
while(($counter < $totalrecords) and ($fieldname !='dummy') and ($method!='NO_CONV')) { //while there is still something
$SQL = 'SELECT * FROM '.$prefix.$dbtablename.' ORDER BY id ASC '.sql_paging_limit($counter, $recordsetsize);
if ($records = get_records_sql($SQL)) {
foreach ($records as $record) {
//if we are up this far, either no crash, or crash with same table, field name.
if ($crash){
if ($crash->record != $record->id) { //might set to < just in case record is deleted
continue;
} else {
$crash = 0;
}
}
$migrationconfig = get_record('config','name','dbmigration');
$migrationconfig->name = 'dbmigration';
$migrationconfig->value = $dbtablename.'##'.$fieldname.'##'.$record->id;
update_record('config',$migrationconfig);
$replacements = array(); //manual refresh
$replacements[] = $record->id;
$replacements[] = $prefix;
if (!empty($record->{$fieldname})) { //only update if not empty
switch ($method){
case 'PLAIN_SQL_UPDATE': //use the 2 statements to update
if ($debug) {
$db->debug=999;
}
//if global lang is set, we just use that
if ($globallang) {
$fromenc = $globallang;
} else {
$userid = get_record_sql(preg_replace($patterns, $replacements, $sqldetectuser));
$courseid = get_record_sql(preg_replace($patterns, $replacements, $sqldetectcourse));
$sitelang = $CFG->lang;
$courselang = get_course_lang(isset($courseid->course)?$courseid->course:1);
$userlang = get_user_lang(isset($userid->userid)?$userid->userid:1);
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
}
//only update if non utf8
if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
$result = utfconvert($record->{$fieldname}, $fromenc);
$newrecord = new object;
$newrecord->id = $record->id;
$newrecord->{$fieldname} = $result;
migrate2utf8_update_record($dbtablename,$newrecord);
}
if ($debug) {
$db->debug=0;
}
break;
case 'PHP_FUNCTION': //use the default php function to execute
if ($debug) {
$db->debug=999;
}
require_once($CFG->dirroot.'/'.$dir.'/db/migrate2utf8.php');
$phpfunction($record->id);
if ($debug) {
$db->debug=0;
}
break;
default: //no_conv, don't do anything ;-)
break;
}
}
$counter++;
if ($maxrecords) {
if ($processedrecords == $maxrecords) {
notify($maxrecords.' records processed. Migration Process halted');
print_continue('utfdbmigrate.php?confirm=1&amp;maxrecords='.$maxrecords.'&amp;sesskey='.sesskey());
print_footer();
die();
}
}
$processedrecords++;
//print some output once in a while
if (($processedrecords) % 5000 == 0) {
print_progress($done, $tablestoconvert, 5, 1,
'Processing: '.$dbtablename.'/'.$fieldname.' ');
}
}
$migrationconfig = get_record('config','name','dbmigration');
$migrationconfig->name = 'dbmigration';
$migrationconfig->value = $dbtablename.'##'.$fieldname.'##'.$record->id;
update_record('config',$migrationconfig);
$replacements = array(); //manual refresh
$replacements[] = $record->id;
$replacements[] = $prefix;
switch ($method){
case 'PLAIN_SQL_UPDATE': //use the 2 statements to update
if (!empty($record->{$fieldname})) { //only update if not empty
if ($debug) {
$db->debug=999;
}
//if global lang is set, we just use that
if ($globallang) {
$fromenc = $globallang;
} else {
$userid = get_record_sql(preg_replace($patterns, $replacements, $sqldetectuser));
$courseid = get_record_sql(preg_replace($patterns, $replacements, $sqldetectcourse));
$sitelang = $CFG->lang;
$courselang = get_course_lang(isset($courseid->course)?$courseid->course:1);
$userlang = get_user_lang(isset($userid->userid)?$userid->userid:1);
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
}
//only update if non utf8
if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
$result = utfconvert($record->{$fieldname}, $fromenc);
$newrecord = new object;
$newrecord->id = $record->id;
$newrecord->{$fieldname} = $result;
migrate2utf8_update_record($dbtablename,$newrecord);
}
if ($debug) {
$db->debug=0;
}
}
break;
case 'PHP_FUNCTION': //use the default php function to execute
if ($debug) {
$db->debug=999;
}
require_once($CFG->dirroot.'/'.$dir.'/db/migrate2utf8.php');
$phpfunction($record->id);
if ($debug) {
$db->debug=0;
}
break;
default: //no_conv, don't do anything ;-)
break;
}
$counter++;
if ($maxrecords) {
if ($processedrecords == $maxrecords) {
notify($maxrecords.' records processed. Migration Process halted');
print_continue('utfdbmigrate.php?confirm=1&amp;maxrecords='.$maxrecords.'&amp;sesskey='.sesskey());
print_footer();
die();
}
}
$processedrecords++;
//print some output once in a while
if (($processedrecords) % 5000 == 0) {
echo 'Processing...'.$dbtablename.'...'.$fieldname.'...'.$record->id;
}else {
if ($debug) {
notify('no records found!');
}
}
}else {
} //close the while loop
/********************
* Drop index here **
********************/
if ($CFG->dbtype == 'mysql') {
/*********************************
* Change column encoding 2 phase*
*********************************/
/*
$SQL = 'ALTER TABLE '.$CFG->prefix.$dbtablename;
$SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' LONGTEXT';
// if ($length > 0) {
// $SQL.='('.$length.') ';
// }
$SQL .= ' CHARACTER SET binary NOT NULL DEFAULT '.$default.';';
if ($debug) {
notify('no records found!');
$db->debug=999;
}
if ($fieldname != 'dummy') {
execute_sql($SQL, $debug);
}
if ($debug) {
$db->debug=0;
}*/
//phase 2
$SQL = 'ALTER TABLE '.$prefix.$dbtablename;
$SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' '.$type;
if ($length > 0) {
$SQL.='('.$length.') ';
}
$SQL.=' CHARACTER SET utf8 NOT NULL DEFAULT '.$default.';';
if ($debug) {
$db->debug=999;
}
if ($fieldname != 'dummy') {
execute_sql($SQL, $debug);
}
if ($debug) {
$db->debug=0;
}
/********************************************
* build an array to add index back together*
********************************************/
if ($addindex){
$addindexarray[] = $addindex;
} else if ($adduniqueindex) {
$adduniqueindexarray[] = $adduniqueindex;
} else if ($addprimary) {
$addprimaryarray[] = $addprimary;
}
} else {
//posgresql code here
//No we don't need to do anything here
}
}
/********************************
* Adding the index back *
********************************/
$alter = 0;
if ($CFG->dbtype=='mysql'){
$SQL = 'ALTER TABLE '.$prefix.$dbtablename;
if (!empty($addindexarray)) {
foreach ($addindexarray as $aidx){
$SQL .= ' ADD INDEX '.$aidx.',';
$alter++;
}
}
} //close the while loop
/********************
* Drop index here **
********************/
if (!empty($adduniqueindexarray)) {
foreach ($adduniqueindexarray as $auidx){
$SQL .= ' ADD UNIQUE INDEX '.$auidx.',';
$alter++;
}
}
if ($CFG->dbtype == 'mysql') {
if (!empty($addprimaryarray)) {
foreach ($addprimaryarray as $apm){
$SQL .= ' ADD PRIMARY KEY '.$apm.',';
$alter++;
}
}
/*********************************
* Change column encoding 2 phase*
*********************************/
/*
$SQL = 'ALTER TABLE '.$CFG->prefix.$dbtablename;
$SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' LONGTEXT';
// if ($length > 0) {
// $SQL.='('.$length.') ';
// }
$SQL .= ' CHARACTER SET binary NOT NULL DEFAULT '.$default.';';
if ($debug) {
$db->debug=999;
}
if ($fieldname != 'dummy') {
execute_sql($SQL, $debug);
}
if ($debug) {
$db->debug=0;
}*/
//phase 2
$SQL = 'ALTER TABLE '.$prefix.$dbtablename;
$SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' '.$type;
if ($length > 0) {
$SQL.='('.$length.') ';
}
$SQL.=' CHARACTER SET utf8 NOT NULL DEFAULT '.$default.';';
if ($debug) {
$db->debug=999;
}
if ($fieldname != 'dummy') {
execute_sql($SQL, $debug);
}
if ($debug) {
$db->debug=0;
}
/********************************************
* build an array to add index back together*
********************************************/
if ($addindex){
$addindexarray[] = $addindex;
} else if ($adduniqueindex) {
$adduniqueindexarray[] = $adduniqueindex;
} else if ($addprimary) {
$addprimaryarray[] = $addprimary;
}
$SQL = rtrim($SQL, ', ');
$SQL.=';';
} else {
///posgresql code here
///No we don't need to do anything here
//posgresql code here
//No we don't need to do anything here
}
}
/********************************
* Adding the index back *
********************************/
$alter = 0;
if ($CFG->dbtype=='mysql'){
$SQL = 'ALTER TABLE '.$prefix.$dbtablename;
if (!empty($addindexarray)) {
foreach ($addindexarray as $aidx){
$SQL .= ' ADD INDEX '.$aidx.',';
$alter++;
if ($alter) {
if ($debug) {
$db->debug=999;
}
execute_sql($SQL, $debug);
if ($debug) {
$db->debug=0;
}
}
if (!empty($adduniqueindexarray)) {
foreach ($adduniqueindexarray as $auidx){
$SQL .= ' ADD UNIQUE INDEX '.$auidx.',';
$alter++;
}
}
if (!empty($addprimaryarray)) {
foreach ($addprimaryarray as $apm){
$SQL .= ' ADD PRIMARY KEY '.$apm.',';
$alter++;
}
}
$SQL = rtrim($SQL, ', ');
$SQL.=';';
} else {
///posgresql code here
///No we don't need to do anything here
}
if ($alter) {
if ($debug) {
$db->debug=999;
}
execute_sql($SQL, $debug);
if ($debug) {
$db->debug=0;
}
}
} //if there are fields
} //if there are fields
} /// Point 1 - bypass should end here.
/************************************
* now we modify the table encoding *
************************************/
@@ -723,8 +758,8 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
}
//finish the javascript bar
$done=159;
print_progress($done, 158, 5, 1);
$done = $tablestoconvert;
print_progress($done, $tablestoconvert, 5, 1);
//prints the list of langs used in this site
print_simple_box_start('center','50%');
@@ -756,7 +791,8 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here
//set the final flag
migrate2utf8_set_config('unicodedb','true'); //this is the main flag for unicode db
//echo date("H:i:s");
}
@@ -1020,7 +1056,7 @@ function utf_get_xml ($mode=0) { // if mode is 1, do not perform check for scrip
foreach ($enrols as $enrol){
if (file_exists($CFG->dirroot.'/enrol/'.$enrol.'/db/migrate2utf8.xml')) {
$xmls[] = xmlize(file_get_contents($CFG->dirroot.'/enrol/'.$enrol.'/db/migrate2utf8.xml'));
$xmls[] = xmlize(file_get_contents($CFG->dirroot.'/enrol/'.$enrol.'/db/migrate2utf8.xml'));
}
}
+3 -8
View File
@@ -36,14 +36,9 @@
</form>
<?php } ?>
<?php if ($CFG->changepassword or is_internal_auth() ) {
if (is_internal_auth()) {
$changepassword = "forgot_password.php";
$changebuttonname = get_string("senddetails");
} else {
$changepassword = $CFG->changepassword;
$changebuttonname = get_string("passwordrecovery");
}
<?php if (is_internal_auth() ) {
$changepassword = "forgot_password.php";
$changebuttonname = get_string("senddetails");
?>
<hr width="80%" />
<p><?php print_string("forgotten") ?></p>
+3 -9
View File
@@ -18,7 +18,7 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
if (empty($CFG->loginhttps)) {
$wwwroot = $CFG->wwwroot;
} else {
$wwwroot = str_replace('http','https',$CFG->wwwroot);
$wwwroot = str_replace('http:','https:',$CFG->wwwroot);
}
$langmenu = popup_form ("$wwwroot/login/index.php?lang=", $langs, "chooselang", $currlang, "", "", "", true);
}
@@ -109,10 +109,7 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
//Select password change url
if (is_internal_auth() || $CFG->{'auth_'.$USER->auth.'_stdchangepassword'}){
$passwordchangeurl=$CFG->wwwroot.'/login/change_password.php';
} elseif($CFG->changepassword) {
$passwordchangeurl=$CFG->changepassword;
}
// check whether the user should be changing password
if (get_user_preferences('auth_forcepasswordchange', false)){
@@ -219,10 +216,7 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
//Select password change url
if (is_internal_auth() || $CFG->{'auth_'.$USER->auth.'_stdchangepassword'}){
$passwordchangeurl=$CFG->wwwroot.'/login/change_password.php';
} elseif($CFG->changepassword) {
$passwordchangeurl=$CFG->changepassword;
}
}
// check whether the user should be changing password
if (get_user_preferences('auth_forcepasswordchange', false)){
@@ -319,4 +313,4 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
// No footer on this page
?>
?>
+4 -2
View File
@@ -144,7 +144,9 @@ function auth_get_userinfo($username){
$ldapval = $newval;
}
}
$result[$key] = $ldapval;
if (!is_null($ldapval)) {
$result[$key] = $ldapval;
}
}
}
@@ -838,7 +840,7 @@ function auth_user_update($olduser, $newuser) {
if ($user_info_result){
$user_entry = auth_ldap_get_entries($ldapconnection, $user_info_result);
if (count($user_entry)) {
if (count($user_entry) > 1) {
trigger_error("ldap: Strange! More than one user record found in ldap. Only using the first one.");
}
$user_entry = $user_entry[0];
+8 -11
View File
@@ -19,8 +19,8 @@ Changes:
Moodle Configuration with Dual login
-------------------------------------------------------------------------------
1. Protect the file moodle/auth/shibboleth/ directory with Shibboleth.
The page index.php actually logs in a Shibboleth user.
1. Protect the directory moodle/auth/shibboleth/ with Shibboleth.
The page index.php in that directory actually logs in a Shibboleth user.
For Apache you have to define a rule like the following in the Apache config:
--
@@ -63,7 +63,7 @@ Moodle Configuration with Dual login
4. The large text field 'Instructions' must contain a link to the
moodle/auth/shibboleth/index.php file which is protected by
Shibboleth (see step 1) and causes the Shibboleth login procedure to start.
You also could use HTML code in that field, e.g. to create your own
You could also use HTML code in that field, e.g. to create your own
Shibboleth login button.
5. Save the changes for the Shibboleth authentication method.
@@ -79,11 +79,11 @@ described in the dual login section above and do the following steps:
How the Shibboleth authentication works
--------------------------------------------------------------------------------
For a user to get Shibboleth authenticated in Moodle he basically must go to the
To get Shibboleth authenticated in Moodle a user basically must access the
Shibboleth-protected page /auth/shibboleth/index.php. If Shibboleth is the only
authentication method (see 4.a), this happens automatically when a user wants to
login. Otherwise the user has to click on the link on the login page you
provided in step 4.
login in Moodle. Otherwise, the user has to click on the link on the login page
you provided in step 4.
Moodle basically checks whether the Shibboleth attribute that you mapped
as the username is present. This attribute should only be present if a user is
@@ -98,19 +98,16 @@ these are checked by Shibboleth itself. Only users who met these rules
actually can access /auth/shibboleth/index.php and get logged in.
You can use Shibboleth AND another authentication method (it was tested with
manual login). So if there are a few users that don't have a Shibboleth
manual login). So, if there are a few users that don't have a Shibboleth
login, you could create manual accounts for them and they could use the manual
login. For other authentication methods you first have to configure them and
then set Shibboleth as your authentication method. Users can log in only via one
authentication method unless they have two accounts in Moodle.
Users that provide a non-existing login name for non-Shibboleth authentication
methods are automatically redirected to auth/shibboleth/index.php and it is
tried to authenticate them via Shibboleth.
Shibboleth dual login with custom login page
--------------------------------------------------------------------------------
Of course you can create a dual login page that better fits your needs. For this
to work you have to set up the two authentication methods (e.g. 'Manual' and
to work, you have to set up the two authentication methods (e.g. 'Manual' and
'Shibboleth') and specify an alternate login link to your own dual login page.
On that page you basically need a link to the Shibboleth-protected page
('/auth/shibboleth/index.php') for the Shibboleth login and a
+1 -1
View File
@@ -3,7 +3,7 @@
$pluginconfig = get_config('auth/shibboleth');
if (!isset($config->auth_instructions) or empty($pluginconfig->shib_user_attribute)) {
$config->auth_instructions = get_string('auth_shib_instructions', 'auth', $CFG->wwwroot.'/auth/shibboleth/shib-protected.php');
$config->auth_instructions = get_string('auth_shib_instructions', 'auth', $CFG->wwwroot.'/auth/shibboleth/index.php');
}
if (!isset ($pluginconfig->user_attribute)) {
+1 -1
View File
@@ -16,7 +16,7 @@
redirect($urltogo);
}
$pluginconfig = get_config('auth/shibboleth');
// Check whether Shibboleth is configured properly
+2 -2
View File
@@ -65,7 +65,7 @@ function auth_get_userinfo($username) {
function auth_shib_attributes(){
//returns array containg attribute mappings between Moodle and shibboleth
global $CFG;
global $CFG;
$pluginconfig = get_config('auth/shibboleth');
$pluginconfig = (array) $pluginconfig;
@@ -82,6 +82,6 @@ function auth_shib_attributes(){
}
$moodleattributes['username']=$pluginconfig["shib_user_attribute"];
return $moodleattributes;
return $moodleattributes;
}
?>
+3 -1
View File
@@ -117,7 +117,9 @@
//Call the form, depending the step we are
if (!$launch) {
// if we're at the start, clear the cache of prefs
unset($SESSION->backupprefs[$course->id]);
if (isset($SESSION->backupprefs[$course->id])) {
unset($SESSION->backupprefs[$course->id]);
}
include_once("backup_form.html");
} else if ($launch == "check") {
include_once("backup_check.html");
+1 -1
View File
@@ -107,7 +107,7 @@
if (isset($backupprefs->$var) && $backupprefs->$var) {
$var = "backup_".$modname;
//Only if selected
if ($backupprefs->$var == 1) {
if (!empty($backupprefs->$var) and ($backupprefs->$var == 1)) {
//Print the full tr
echo "<tr>";
echo "<td colspan=\"2\">";
+1 -1
View File
@@ -145,7 +145,7 @@
//If we have selected to backup quizzes, backup categories and
//questions structure (step 1). See notes on mod/quiz/backuplib.php
if ($status and $preferences->mods['quiz']->backup) {
if ($status and !empty($preferences->mods['quiz']->backup)) {
echo "<li>".get_string("writingcategoriesandquestions").'</li>';
require_once($CFG->dirroot.'/mod/quiz/backuplib.php');
if (!$status = backup_question_categories($backup_file,$preferences)) {
+18 -11
View File
@@ -98,18 +98,19 @@ function schedule_backup_cron() {
if (!$backup_course) {
mtrace(" ERROR (in backup_courses detection)");
$status = false;
continue;
}
//Now we backup every course with nextstarttime < now
if ($backup_course->nextstarttime > 0 && $backup_course->nextstarttime < $now) {
// Skip backup of unavailable courses that have remained unmodified in a month
$skipped = false;
if (!$course->visible && ($now - $course->timemodified) > 31*24*60*60) { //Hidden + unmodified last month
mtrace(" SKIPPING - hidden+unmodified");
set_field("backup_courses","laststatus","3","courseid",$backup_course->courseid);
$skipped = true;
}
//Now we backup every non skipped course with nextstarttime < now
if (!$skipped && $backup_course->nextstarttime > 0 && $backup_course->nextstarttime < $now) {
//We have to send a email because we have included at least one backup
$emailpending = true;
// Skip backup of unavailable courses that have remained unmodified in a month
if (!$course->visible && ($now - $course->timemodified) > 31) { //Hidden + unmodified last month
//if (!$course->visible && ($now - $course->timemodified) > 31*24*60*60) { //Hidden + unmodified last month
mtrace(" SKIPPING - hidden+unmodified");
set_field("backup_courses","laststatus","3","courseid",$backup_course->courseid);
continue;
}
//Only make the backup if laststatus isn't 2-UNFINISHED (uncontrolled error)
if ($backup_course->laststatus != 2) {
//Set laststarttime
@@ -334,7 +335,7 @@ function schedule_backup_course_configure($course,$starttime = 0) {
$backup_config->backup_sche_coursefiles = 1;
}
if (!isset($backup_config->backup_sche_messages)) {
$backup_config->backup_sche_messages = 1;
$backup_config->backup_sche_messages = 0;
}
if (!isset($backup_config->backup_sche_active)) {
$backup_config->backup_sche_active = 0;
@@ -513,7 +514,13 @@ function schedule_backup_course_configure($course,$starttime = 0) {
//Now calculate the users
if ($status) {
schedule_backup_log($starttime,$course->id," calculating users");
user_check_backup($course->id,$backup_unique_code,$preferences->backup_users,$preferences->backup_messages);
//Decide about include users with messages, based on SITEID
if ($preferences->backup_messages && $preferences->backup_course == SITEID) {
$include_message_users = true;
} else {
$include_message_users = false;
}
user_check_backup($course->id,$backup_unique_code,$preferences->backup_users,$include_message_users);
}
//Now calculate the logs
+4 -5
View File
@@ -460,10 +460,11 @@
function xml_tag_safe_content($content) {
global $CFG;
//If enabled, we strip all the control chars from the text but tabs, newlines and returns
//If enabled, we strip all the control chars (\x0-\x1f) from the text but tabs (\x9),
//newlines (\xa) and returns (\xd). The delete control char (\x7f) is also included.
//because they are forbiden in XML 1.0 specs. The expression below seems to be
//UTF-8 safe too because it simply ignores the rest of characters.
$content = preg_replace("/(?(?=[[:cntrl:]])[^\n\r\t])/is","",$content);
$content = preg_replace("/[\x-\x8\xb-\xc\xe-\x1f\x7f]/is","",$content);
if (!empty($CFG->unicodedb)) {
// Don't perform the conversion. Contents are Unicode.
$content = preg_replace("/\r\n|\r/", "\n", htmlspecialchars($content));
@@ -1001,7 +1002,6 @@
fwrite ($bf,full_tag("TYPE",6,false,$moduletype));
fwrite ($bf,full_tag("INSTANCE",6,false,$course_module[$tok]->instance));
fwrite ($bf,full_tag("ADDED",6,false,$course_module[$tok]->added));
fwrite ($bf,full_tag("DELETED",6,false,$course_module[$tok]->deleted));
fwrite ($bf,full_tag("SCORE",6,false,$course_module[$tok]->score));
fwrite ($bf,full_tag("INDENT",6,false,$course_module[$tok]->indent));
fwrite ($bf,full_tag("VISIBLE",6,false,$course_module[$tok]->visible));
@@ -1048,7 +1048,6 @@
//Output all user data
fwrite ($bf,full_tag("ID",4,false,$user_data->id));
fwrite ($bf,full_tag("AUTH",4,false,$user_data->auth));
fwrite ($bf,full_tag("GUID",4,false,$user_data->guid));
fwrite ($bf,full_tag("CONFIRMED",4,false,$user_data->confirmed));
fwrite ($bf,full_tag("POLICYAGREED",4,false,$user_data->policyagreed));
fwrite ($bf,full_tag("DELETED",4,false,$user_data->deleted));
@@ -1078,7 +1077,7 @@
fwrite ($bf,full_tag("LASTACCESS",4,false,$user_data->lastaccess));
fwrite ($bf,full_tag("LASTLOGIN",4,false,$user_data->lastlogin));
fwrite ($bf,full_tag("CURRENTLOGIN",4,false,$user_data->currentlogin));
fwrite ($bf,full_tag("LASTIP",4,false,$user_data->lastIP));
fwrite ($bf,full_tag("LASTIP",4,false,$user_data->lastip));
fwrite ($bf,full_tag("SECRET",4,false,$user_data->secret));
fwrite ($bf,full_tag("PICTURE",4,false,$user_data->picture));
fwrite ($bf,full_tag("URL",4,false,$user_data->url));
+21
View File
@@ -50,6 +50,27 @@ function backup_upgrade($oldversion=0) {
}
}
if ($oldversion < 2006042801) {
modify_database('', 'ALTER TABLE prefix_backup_log
ALTER COLUMN "time" TYPE integer,
ALTER COLUMN "time" SET DEFAULT 0,
ALTER COLUMN laststarttime TYPE integer,
ALTER COLUMN laststarttime SET DEFAULT 0,
ALTER COLUMN courseid TYPE integer,
ALTER COLUMN courseid SET DEFAULT 0');
modify_database('', 'ALTER TABLE mdl_backup_courses
ALTER COLUMN lastendtime TYPE integer,
ALTER COLUMN lastendtime SET DEFAULT 0,
ALTER COLUMN laststarttime TYPE integer,
ALTER COLUMN laststarttime SET DEFAULT 0,
ALTER COLUMN courseid TYPE integer,
ALTER COLUMN courseid SET DEFAULT 0,
ALTER COLUMN nextstarttime TYPE integer,
ALTER COLUMN nextstarttime SET DEFAULT 0');
}
//Finally, return result
return $result;
+1 -1
View File
@@ -140,7 +140,7 @@
if (!$launch) {
include_once("restore_precheck.html");
} else if ($launch == "form") {
if ($SESSION->restore->importing) {
if (!empty($SESSION->restore->importing)) {
// set up all the config stuff and skip asking the user about it.
restore_setup_for_check($SESSION->restore,$backup_unique_code);
include_once("restore_execute.html");
+2 -2
View File
@@ -45,7 +45,7 @@
$$var = optional_param( $var,0);
$var = "restore_user_info_".$modname;
$$var = optional_param( $var,0);
$instances = $info->mods[$mod->name]->instances;
$instances = !empty($info->mods[$mod->name]->instances) ? $info->mods[$mod->name]->instances : NULL;
if ($instances === NULL) {
continue;
}
@@ -86,7 +86,7 @@
$restore->mods[$modname]->restore=$$var;
$var = "restore_user_info_".$modname;
$restore->mods[$modname]->userinfo=$$var;
$instances = $info->mods[$mod->name]->instances;
$instances = !empty($info->mods[$mod->name]->instances) ? $info->mods[$mod->name]->instances : NULL;
if ($instances === NULL) {
continue;
}
+1 -2
View File
@@ -48,8 +48,7 @@
error ("An error has occurred and the restore could not be completed!");
}
if (!$restore->importing) {
echo $output;
if (empty($restore->importing)) {
//Print final message
print_simple_box(get_string("restorefinished"),"center");
} else {
+33 -12
View File
@@ -889,7 +889,6 @@
$course_module->module = $module->id;
$course_module->section = $newid;
$course_module->added = $mod->added;
$course_module->deleted = $mod->deleted;
$course_module->score = $mod->score;
$course_module->indent = $mod->indent;
$course_module->visible = $mod->visible;
@@ -962,7 +961,7 @@
//Process info about metacourse
if ($status and $info) {
//Process child records
if ($info->childs) {
if (!empty($info->childs)) {
foreach ($info->childs as $child) {
$dbcourse = false;
$dbmetacourse = false;
@@ -994,7 +993,7 @@
sync_metacourse($restore->course_id);
}
//Process parent records
if ($info->parents) {
if (!empty($info->parents)) {
foreach ($info->parents as $parent) {
$dbcourse = false;
$dbmetacourse = false;
@@ -1268,7 +1267,11 @@
$itemid = insert_record('grade_item',$item);
//Now process grade_exceptions
$exceptions = $ite_info['#']['GRADE_EXCEPTIONS']['0']['#']['GRADE_EXCEPTION'];
if (!empty($ite_info['#']['GRADE_EXCEPTIONS'])) {
$exceptions = $ite_info['#']['GRADE_EXCEPTIONS']['0']['#']['GRADE_EXCEPTION'];
} else {
$exceptions = array();
}
//Iterate over exceptions
for($j = 0; $j < sizeof($exceptions); $j++) {
@@ -2732,6 +2735,31 @@
$log->info = "";
$toinsert = true;
break;
case "report log":
$log->url = "report/log/index.php?id=".$log->course;
$log->info = $log->course;
$toinsert = true;
break;
case "report live":
$log->url = "report/log/live.php?id=".$log->course;
$log->info = $log->course;
$toinsert = true;
break;
case "report outline":
$log->url = "report/outline/index.php?id=".$log->course;
$log->info = $log->course;
$toinsert = true;
break;
case "report participation":
$log->url = "report/participation/index.php?id=".$log->course;
$log->info = $log->course;
$toinsert = true;
break;
case "report stats":
$log->url = "report/stats/index.php?id=".$log->course;
$log->info = $log->course;
$toinsert = true;
break;
default:
echo "action (".$log->module."-".$log->action.") unknown. Not restored<br />"; //Debug
break;
@@ -3591,8 +3619,6 @@
$this->info->tempmod->instance;
$this->info->tempsection->mods[$this->info->tempmod->id]->added =
$this->info->tempmod->added;
$this->info->tempsection->mods[$this->info->tempmod->id]->deleted =
$this->info->tempmod->deleted;
$this->info->tempsection->mods[$this->info->tempmod->id]->score =
$this->info->tempmod->score;
$this->info->tempsection->mods[$this->info->tempmod->id]->indent =
@@ -3618,9 +3644,6 @@
case "ADDED":
$this->info->tempmod->added = $this->getContents();
break;
case "DELETED":
$this->info->tempmod->deleted = $this->getContents();
break;
case "SCORE":
$this->info->tempmod->score = $this->getContents();
break;
@@ -3847,9 +3870,6 @@
case "AUTH":
$this->info->tempuser->auth = $this->getContents();
break;
case "GUID":
$this->info->tempuser->guid = $this->getContents();
break;
case "CONFIRMED":
$this->info->tempuser->confirmed = $this->getContents();
break;
@@ -5218,6 +5238,7 @@
if (!defined('RESTORE_SILENTLY')) {
echo '<li>'.get_string('creatingblocks').'</li>';
}
$course_header->blockinfo = !empty($course_header->blockinfo) ? $course_header->blockinfo : NULL;
if (!$status = restore_create_blocks($restore, $info->backup_block_format, $course_header->blockinfo, $xml_file)) {
if (!defined('RESTORE_SILENTLY')) {
notify('Error while creating the course blocks');
+2 -2
View File
@@ -5,6 +5,6 @@
// database (backup_version) to determine whether upgrades should
// be performed (see db/backup_*.php)
$backup_version = 2006042800; // The current version is a date (YYYYMMDDXX)
$backup_version = 2006053000; // The current version is a date (YYYYMMDDXX)
$backup_release = "1.6beta4"; // User-friendly version number
$backup_release = "1.6"; // User-friendly version number
@@ -14,7 +14,9 @@ class block_activity_modules extends block_list {
// data from db if the course format has already fetched them
if(!isset($GLOBALS['modnamesplural']) || !isset($GLOBALS['modnamesused'])) {
require_once($CFG->dirroot.'/course/lib.php');
get_all_mods($this->instance->pageid, $mods, $modnames, $modnamesplural, $modnamesused);
if (!empty($this->instance)) {
get_all_mods($this->instance->pageid, $mods, $modnames, $modnamesplural, $modnamesused);
}
}
else {
$modnamesplural = $GLOBALS['modnamesplural'];
@@ -30,7 +32,7 @@ class block_activity_modules extends block_list {
$this->content->icons = array();
$this->content->footer = '';
if ($modnamesused) {
if (isset($modnamesused) && $modnamesused) {
foreach ($modnamesused as $modname => $modfullname) {
if ($modname != 'label') {
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$this->instance->pageid.'">'.$modnamesplural[$modname].'</a>';
+18 -14
View File
@@ -56,10 +56,8 @@ class block_admin extends block_list {
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/log.gif" alt="" />';
if (!empty($CFG->enablestats)) {
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/report/stats/index.php?course='.SITEID.'">'.get_string('stats').'</a>';
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/stats.gif" alt="" />';
}
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/admin/report.php">'.get_string('reports').'</a>';
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/stats.gif" alt="" />';
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/files/index.php?id='.SITEID.'">'.get_string('sitefiles').'</a>';
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/files.gif" alt="" />';
@@ -92,6 +90,12 @@ class block_admin extends block_list {
return $this->content;
}
if(empty($CFG->loginhttps)) {
$securewwwroot = $CFG->wwwroot;
} else {
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
}
$course = get_record('course', 'id', $this->instance->pageid);
if (isteacher($this->instance->pageid)) {
@@ -111,9 +115,9 @@ class block_admin extends block_list {
$fullname = fullname($USER, true);
$editmyprofile = '<a title="'.$fullname.'" href="'.$CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&amp;course='.$this->instance->pageid.'">'.get_string('editmyprofile').'</a>';
$editmyprofile = '<a title="'.$fullname.'" href="'.$securewwwroot.'/user/edit.php?id='.$USER->id.'&amp;course='.$this->instance->pageid.'">'.get_string('editmyprofile').'</a>';
if (empty($USER->description)) {
//Accessibility: replace non-standard <blink> with CSS (<a> makes title visible in IE).
//Accessibility: replace non-standard <blink> with CSS (<a> makes title visible in IE).
$text = get_string('profile').' '.get_string('missingdescription');
$this->content->items[]= $editmyprofile.' <a title="'.$text.'" class="useredit blink">*<span class="accesshide">'.$text.'</span></a>';
} else {
@@ -186,7 +190,9 @@ class block_admin extends block_list {
$this->content->icons[] = '<img src="'.$CFG->pixpath.'/i/payment.gif" alt="" />';
}
$this->content->items[]='<a href="'.$CFG->wwwroot.'/doc/view.php?id='.$this->instance->pageid.'&amp;file=teacher.html">'.get_string('help').'</a>';
$lang = str_replace('_utf8', '', current_language());
$this->content->items[]='<a href="http://docs.moodle.org/'.$lang.'/Teacher_documentation">'.get_string('help').'</a>';
$this->content->icons[]='<img src="'.$CFG->modpixpath.'/resource/icon.gif" alt="" />';
if ($teacherforum = forum_get_course_forum($this->instance->pageid, 'teacher')) {
@@ -206,10 +212,10 @@ class block_admin extends block_list {
}
$fullname = fullname($USER, true);
$editmyprofile = '<a title="'.$fullname.'" href="'.$CFG->wwwroot.'/user/edit.php?id='.
$editmyprofile = '<a title="'.$fullname.'" href="'.$securewwwroot.'/user/edit.php?id='.
$USER->id.'&amp;course='.$this->instance->pageid.'">'.get_string('editmyprofile').'</a>';
if (empty($USER->description)) {
//Accessibility: replace non-standard <blink> with CSS (<a> makes title visible in IE).
//Accessibility: replace non-standard <blink> with CSS (<a> makes title visible in IE).
$text = get_string('profile').' '.get_string('missingdescription');
$this->content->items[]= $editmyprofile.' <a title="'.$text.'" class="useredit blink">*<span class="accesshide">'.$text.'</span></a>';
} else {
@@ -218,12 +224,10 @@ class block_admin extends block_list {
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
if (is_internal_auth() && !is_restricted_user($USER->username)) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/login/change_password.php?id='.$this->instance->pageid.'">'.get_string('changepassword').'</a>';
$this->content->items[]='<a href="'.$securewwwroot.'/login/change_password.php?id='.$this->instance->pageid.'">'.get_string('changepassword').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
} else if ($CFG->changepassword && !is_restricted_user($USER->username)) {
$this->content->items[]='<a href="'.$CFG->changepassword.'">'.get_string('changepassword').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
}
}
if ($CFG->allowunenroll && !$course->metacourse) {
$this->content->items[]='<a href="unenrol.php?id='.$this->instance->pageid.'">'.get_string('unenrolme', '', $course->shortname).'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" alt="" />';
+8 -8
View File
@@ -1,5 +1,7 @@
<?php //$Id$
require_once($CFG->dirroot .'/blog/lib.php');
class block_blog_menu extends block_base {
function init() {
@@ -15,13 +17,13 @@ class block_blog_menu extends block_base {
$course = SITEID;
}
if ($CFG->bloglevel < 1) {
if ($CFG->bloglevel < BLOG_USER_LEVEL) {
$this->content->text = '';
return $this->content;
}
// don't display menu block if block is set at site level, and user is not logged in
if ($CFG->bloglevel < 5 && !(isloggedin() && !isguest())) {
if ($CFG->bloglevel < BLOG_GLOBAL_LEVEL && !(isloggedin() && !isguest())) {
$this->content->text = '';
return $this->content;
}
@@ -48,15 +50,13 @@ class block_blog_menu extends block_base {
$this->content->text = $output;
return $this->content;
}
require_once($CFG->dirroot .'/blog/lib.php');
//if ( blog_isLoggedIn() && !isguest() ) {
$courseviewlink = '';
$addentrylink = '';
$coursearg = '';
if((isloggedin() && !isguest()) && isset($course) && isset($course->id) && $course->id !=0 && $course->id!=SITEID && $CFG->bloglevel >=3 ) {
if((isloggedin() && !isguest()) && isset($course) && isset($course->id) && $course->id !=0 && $course->id!=SITEID && $CFG->bloglevel >= BLOG_COURSE_LEVEL) {
$coursearg = '&amp;courseid='. $course->id;
// a course is specified
@@ -66,10 +66,10 @@ class block_blog_menu extends block_base {
$blogmodon = false;
if ((isloggedin() && !isguest()) && (isadmin() || !$blogmodon || ($blogmodon && $coursearg != '')) && $CFG->bloglevel >= 1) {
if ((isloggedin() && !isguest()) && (isadmin() || !$blogmodon || ($blogmodon && $coursearg != '')) && $CFG->bloglevel >= BLOG_USER_LEVEL) {
// show Add entry link - user is not admin, moderation is off, or moderation is on and the user is viewing the block within the context of a course
$addentrylink = '<a href="'. $CFG->wwwroot. '/blog/edit.php?userid='. $userBlog->userid . $coursearg .'">'. get_string('addnewentry', 'blog') .'</a><br />';
$addentrylink = '<a href="'. $CFG->wwwroot. '/blog/edit.php?userid='. $userBlog->userid . $coursearg .'">'. get_string('addnewentry', 'blog') .'</a><br />';
// show View my entries link
$addentrylink .= '<a href="'. $CFG->wwwroot .'/blog/index.php?userid='. $userBlog->userid.'">';
@@ -83,7 +83,7 @@ class block_blog_menu extends block_base {
}
// show View site entries link
if ($CFG->bloglevel >= 4) {
if ($CFG->bloglevel >= BLOG_SITE_LEVEL) {
$output .= '<a href="'. $CFG->wwwroot .'/blog/index.php?filtertype=site&amp;">';
$output .= get_string('viewsiteentries', 'blog') .'</a><br />';
}
+11 -13
View File
@@ -4,13 +4,7 @@ define('BLOGDEFAULTTIMEWITHIN', 90);
define('BLOGDEFAULTNUMBEROFTAGS', 20);
define('BLOGDEFAULTSORT', 'text');
if (!defined('BLOG_USER_LEVEL')) {
define ('BLOG_USER_LEVEL', 1);
define ('BLOG_GROUP_LEVEL', 2);
define ('BLOG_COURSE_LEVEL', 3);
define ('BLOG_SITE_LEVEL', 4);
define ('BLOG_GLOBAL_LEVEL', 5);
}
require_once($CFG->dirroot .'/blog/lib.php');
class block_blog_tags extends block_base {
function init() {
@@ -47,7 +41,7 @@ class block_blog_tags extends block_base {
function get_content() {
global $CFG;
global $CFG, $SITE, $COURSE;
if (empty($this->config->timewithin)) {
$this->config->timewithin = BLOGDEFAULTTIMEWITHIN;
@@ -137,17 +131,21 @@ class block_blog_tags extends block_base {
case BLOG_COURSE_LEVEL:
$filtertype = 'course';
global $course; // Need to do this unfortunately for pages like blog pages
if (isset($course->id)) {
$filterselect = $course->id;
if (isset($COURSE->id)) {
$filterselect = $COURSE->id;
} else {
$filterselect = $this->instance->pageid;
}
break;
default:
$filtertype = 'site';
$filterselect = SITEID;
if (isset($COURSE->id) && $COURSE->id != SITEID) {
$filtertype = 'course';
$filterselect = $COURSE->id;
} else {
$filtertype = 'site';
$filterselect = SITEID;
}
break;
}
+4 -10
View File
@@ -11,7 +11,7 @@ class block_calendar_month extends block_base {
}
function get_content() {
global $USER, $CFG, $SESSION;
global $USER, $CFG, $SESSION, $COURSE;
$cal_m = optional_param( 'cal_m', 0, PARAM_INT );
$cal_y = optional_param( 'cal_y', 0, PARAM_INT );
@@ -28,12 +28,7 @@ class block_calendar_month extends block_base {
// [pj] To me it looks like this if would never be needed, but Penny added it
// when committing the /my/ stuff. Reminder to discuss and learn what it's about.
// It definitely needs SOME comment here!
if (!empty($this->instance->pageid)) {
$courseshown = $this->instance->pageid;
}
else {
$courseshown = SITEID;
}
$courseshown = $COURSE->id;
if($courseshown == SITEID) {
// Being displayed at site level. This will cause the filter to fall back to auto-detecting
@@ -58,13 +53,12 @@ class block_calendar_month extends block_base {
$this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
// No filters for now
} elseif (!empty($courseshown)) {
} else {
// For any other course
$this->content->text .= calendar_overlib_html();
$this->content->text .= calendar_top_controls('course', array('id' => $courseshown, 'm' => $cal_m, 'y' => $cal_y));
$this->content->text .= calendar_get_mini($courses, $group, $user, $cal_m, $cal_y);
$course = get_record('course', 'id', $this->instance->pageid);
$this->content->text .= '<div class="filters">'.calendar_filter_controls('course', '', $course).'</div>';
$this->content->text .= '<div class="filters">'.calendar_filter_controls('course', '', $COURSE).'</div>';
}
@@ -7,7 +7,7 @@ class block_calendar_upcoming extends block_base {
}
function get_content() {
global $USER, $CFG, $SESSION;
global $USER, $CFG, $SESSION, $COURSE;
$cal_m = optional_param( 'cal_m', 0, PARAM_INT );
$cal_y = optional_param( 'cal_y', 0, PARAM_INT );
@@ -27,12 +27,7 @@ class block_calendar_upcoming extends block_base {
$this->content->footer = '';
} else {
if (!empty($this->instance->pageid)) {
$courseshown = $this->instance->pageid;
}
else {
$courseshown = SITEID;
}
$courseshown = $COURSE->id;
$this->content->footer = '<br /><a href="'.$CFG->wwwroot.
'/calendar/view.php?view=upcoming&amp;course='.$courseshown.'">'.
get_string('gotocalendar', 'calendar').'</a>...';
+1 -1
View File
@@ -34,7 +34,7 @@ class block_course_list extends block_list {
}
}
if (isset($USER->id) and !(isadmin() and $adminseesall)) { // Just print My Courses
if (empty($CFG->disablemycourses) and isset($USER->id) and !(isadmin() and $adminseesall)) { // Just print My Courses
if ($courses = get_my_courses($USER->id)) {
foreach ($courses as $course) {
if ($course->id == SITEID) {
+7 -11
View File
@@ -7,13 +7,14 @@ class block_course_summary extends block_base {
}
function specialization() {
if($this->instance->pagetype == PAGE_COURSE_VIEW && $this->instance->pageid != SITEID) {
global $COURSE;
if($this->instance->pagetype == PAGE_COURSE_VIEW && $COURSE->id != SITEID) {
$this->title = get_string('coursesummary', 'block_course_summary');
}
}
function get_content() {
global $CFG, $THEME;
global $CFG, $COURSE;
if($this->content !== NULL) {
return $this->content;
@@ -23,19 +24,14 @@ class block_course_summary extends block_base {
return '';
}
if (empty($this->instance->pageid)) {
$this->instance->pageid = SITEID;
}
$course = get_record('course', 'id', $this->instance->pageid);
$this->content = New stdClass;
$options->noclean = true; // Don't clean Javascripts etc
$this->content->text = format_text($course->summary, FORMAT_HTML, $options);
if(isediting($this->instance->pageid)) {
if($this->instance->pageid == SITEID) {
$this->content->text = format_text($COURSE->summary, FORMAT_HTML, $options);
if(isediting($COURSE->id)) {
if($COURSE->id == SITEID) {
$editpage = $CFG->wwwroot.'/'.$CFG->admin.'/site.php';
} else {
$editpage = $CFG->wwwroot.'/course/edit.php?id='.$this->instance->pageid;
$editpage = $CFG->wwwroot.'/course/edit.php?id='.$COURSE->id;
}
$this->content->text .= "<div align=\"right\"><a href=\"$editpage\"><img src=\"$CFG->pixpath/t/edit.gif\" alt=\"\" /></a></div>";
}
+58
View File
@@ -61,6 +61,35 @@ function migrate2utf8_block_instance_configdata($recordid){
return $blah;
} else if ($blocktype -> name == 'glossary_random'){
///find course
if ($globallang) {
$fromenc = $globallang;
} else {
$sitelang = $CFG->lang;
$courselang = get_course_lang($blockinstance->pageid); //Non existing!
$userlang = get_main_teacher_lang($blockinstance->pageid); //N.E.!!
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
}
$blah = unserialize(base64_decode($blockinstance->configdata));
/// We are going to use textlib facilities
/// Convert the text
$blah->title = utfconvert($blah->title, $fromenc, false);
$blah->addentry = utfconvert($blah->addentry, $fromenc, false);
$blah->viewglossary = utfconvert($blah->viewglossary, $fromenc, false);
$blah->invisible = utfconvert($blah->invisible, $fromenc, false);
$blockinstance->configdata = base64_encode(serialize($blah));
migrate2utf8_update_record('block_instance',$blockinstance);
return $blah;
}
}
@@ -127,6 +156,35 @@ global $CFG, $globallang;
return $blah;
} else if ($blocktype -> name == 'glossary_random'){
///find course
if ($globallang) {
$fromenc = $globallang;
} else {
$sitelang = $CFG->lang;
$courselang = get_course_lang($blockpinned->pageid); //Non existing!
$userlang = get_main_teacher_lang($blockpinned->pageid); //N.E.!!
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
}
$blah = unserialize(base64_decode($blockpinned->configdata));
/// We are going to use textlib facilities
/// Convert the text
$blah->title = utfconvert($blah->title, $fromenc, false);
$blah->addentry = utfconvert($blah->addentry, $fromenc, false);
$blah->viewglossary = utfconvert($blah->viewglossary, $fromenc, false);
$blah->invisible = utfconvert($blah->invisible, $fromenc, false);
$blockinstance->configdata = base64_encode(serialize($blah));
migrate2utf8_update_record('block_instance',$blockinstance);
return $blah;
}
}
?>
@@ -13,8 +13,8 @@ class block_glossary_random extends block_base {
}
function specialization() {
global $CFG;
$this->course = get_record('course', 'id', $this->instance->pageid);
global $CFG, $COURSE;
$this->course = $COURSE;
// load userdefined title and make sure it's never empty
if (empty($this->config->title)) {
+6 -6
View File
@@ -12,26 +12,26 @@
<td><input type="text" name="title" size="50" value="<?php p($this->config->title) ?>" /></td>
</tr>
<tr valign=top>
<tr valign=top>
<td align=right><?php print_string("select_glossary","block_glossary_random") ?>:</td>
<td><?php choose_from_menu($glossaries,"glossary",$this->config->glossary) ?></td>
</tr>
<tr valign=top>
<tr valign=top>
<td align=right><?php print_string("refresh","block_glossary_random") ?>:</td>
<td><input type="text" name="refresh" size="5" value="<?php p($this->config->refresh) ?>" /></td>
</tr>
<tr valign=top>
<td align=right><?php print_string("type","block_glossary_random") ?>:</td>
<tr valign=top>
<td align=right><?php print_string("type","block_glossary_random") ?>:</td>
<td><?php
choose_from_menu($type, "type", $this->config->type, "");
helpbutton("",get_string("type","block_glossary_random"),"moodle",true,false,get_string("typehelp","block_glossary_random"));
?></td>
</tr>
<tr valign=top>
<td align=right><?php print_string("showconcept","block_glossary_random") ?>:</td>
<tr valign=top>
<td align=right><?php print_string("showconcept","block_glossary_random") ?>:</td>
<td>
<input type="hidden" name="showconcept" value="0" />
<input type="checkbox" name="showconcept" value="1" <?php if(!empty($this->config->showconcept)) echo 'checked="checked"'; ?> /></td>
+1 -2
View File
@@ -32,13 +32,12 @@ class block_login extends block_base {
$forgot = $wwwroot . '/login/forgot_password.php';
} else {
if (!empty($CFG->{'auth_'.$CFG->auth.'_stdchangepassword'})
|| $CFG->changepassword
|| is_internal_auth() ) {
if (is_internal_auth() || !empty($CFG->{'auth_'.$CFG->auth.'_stdchangepassword'})) {
$forgot = $wwwroot . '/login/forgot_password.php';
}
else {
$forgot = $CFG->changepassword;
$forgot = '';
}
}
}
+9 -14
View File
@@ -7,7 +7,7 @@ class block_news_items extends block_base {
}
function get_content() {
global $CFG, $USER;
global $CFG, $USER, $COURSE;
if ($this->content !== NULL) {
return $this->content;
@@ -22,44 +22,39 @@ class block_news_items extends block_base {
}
if ($this->instance->pageid == 0) {
$this->instance->pageid = SITEID;
}
$course = get_record('course', 'id', $this->instance->pageid);
if ($course->newsitems) { // Create a nice listing of recent postings
if ($COURSE->newsitems) { // Create a nice listing of recent postings
require_once($CFG->dirroot.'/mod/forum/lib.php'); // We'll need this
$text = '';
if (!$forum = forum_get_course_forum($course->id, 'news')) {
if (!$forum = forum_get_course_forum($COURSE->id, 'news')) {
return $this->content;
}
/// First work out whether we can post to this group and if so, include a link
if (isteacheredit($course->id)) { /// Teachers can always post
if (isteacheredit($COURSE->id)) { /// Teachers can always post
$visiblegroups = -1;
$text .= '<div align="center" class="newlink"><a href="'.$CFG->wwwroot.'/mod/forum/post.php?forum='.$forum->id.'">'.
get_string('addanewtopic', 'forum').'</a>...</div>';
} else { /// Check the group situation
$currentgroup = get_current_group($course->id);
$currentgroup = get_current_group($COURSE->id);
if (forum_user_can_post_discussion($forum, $currentgroup)) {
$text .= '<div align="center" class="newlink"><a href="'.$CFG->wwwroot.'/mod/forum/post.php?forum='.$forum->id.'">'.
get_string('addanewtopic', 'forum').'</a>...</div>';
}
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) {
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $COURSE->id)) {
$this->content->text = $text;
return $this->content;
}
$groupmode = groupmode($course, $cm);
$groupmode = groupmode($COURSE, $cm);
/// Decides if current user is allowed to see ALL the current discussions or not
@@ -73,7 +68,7 @@ class block_news_items extends block_base {
/// Get all the recent discussions we're allowed to see
if (! $discussions = forum_get_discussions($forum->id, 'p.modified DESC', 0, false,
$visiblegroups, $course->newsitems) ) {
$visiblegroups, $COURSE->newsitems) ) {
$text .= '('.get_string('nonews', 'forum').')';
$this->content->text = $text;
return $this->content;
@@ -119,7 +114,7 @@ class block_news_items extends block_base {
} else {
$userid = $USER->id;
}
$this->content->footer .= '<br />'.rss_get_link($course->id, $userid, 'forum', $forum->id, $tooltiptext);
$this->content->footer .= '<br />'.rss_get_link($COURSE->id, $userid, 'forum', $forum->id, $tooltiptext);
}
}
+13 -15
View File
@@ -9,7 +9,7 @@ class block_online_users extends block_base {
function has_config() {return true;}
function get_content() {
global $USER, $CFG;
global $USER, $CFG, $COURSE;
if ($this->content !== NULL) {
return $this->content;
@@ -23,8 +23,6 @@ class block_online_users extends block_base {
return $this->content;
}
$course = get_record('course', 'id', $this->instance->pageid);
$timetoshowusers = 300; //Seconds default
if (isset($CFG->block_online_users_timetosee)) {
$timetoshowusers = $CFG->block_online_users_timetosee * 60;
@@ -32,10 +30,10 @@ class block_online_users extends block_base {
$timefrom = time()-$timetoshowusers;
//Calculate if we are in separate groups
$isseparategroups = ($course->groupmode == SEPARATEGROUPS && $course->groupmodeforce && !isteacheredit($this->instance->pageid));
$isseparategroups = ($COURSE->groupmode == SEPARATEGROUPS && $COURSE->groupmodeforce && !isteacheredit($COURSE->id));
//Get the user current group
$currentgroup = $isseparategroups ? get_current_group($this->instance->pageid) : NULL;
$currentgroup = $isseparategroups ? get_current_group($COURSE->id) : NULL;
$groupmembers = "";
$groupselect = "";
@@ -46,11 +44,11 @@ class block_online_users extends block_base {
$groupselect .= " AND u.id = gm.userid AND gm.groupid = '$currentgroup'";
}
if ($this->instance->pageid == SITEID) { // Site-level
if ($COURSE->id == SITEID) { // Site-level
$courseselect = '';
$timeselect = "AND (s.timeaccess > $timefrom OR u.lastaccess > $timefrom)";
} else {
$courseselect = "AND s.course = '".$this->instance->pageid."'";
$courseselect = "AND s.course = '".$COURSE->id."'";
$timeselect = "AND s.timeaccess > $timefrom";
}
@@ -69,7 +67,7 @@ class block_online_users extends block_base {
}
}
if ($this->instance->pageid == SITEID && $CFG->allusersaresitestudents) {
if ($COURSE->id == SITEID && $CFG->allusersaresitestudents) {
if ($siteusers = get_records_sql("SELECT u.id, u.username, u.firstname, u.lastname, u.picture, u.lastaccess
FROM {$CFG->prefix}user u
WHERE u.lastaccess > $timefrom AND u.username <> 'guest'
@@ -88,7 +86,7 @@ class block_online_users extends block_base {
$groupmembers
WHERE u.id = s.userid $courseselect $groupselect $timeselect ";
if (!isteacher($course->id)) {
if (!isteacher($COURSE->id)) {
// Hide hidden teachers from students.
$findteacherssql .= 'AND s.authority > 0 ';
}
@@ -110,14 +108,14 @@ class block_online_users extends block_base {
//Now, we have in users, the list of users to show
//Because they are online
if (!empty($users)) {
//Accessibility: Don't want 'Alt' text for the user picture; DO want it for the envelope/message link (existing lang string).
//Accessibility: Converted <div> to <ul>, inherit existing classes & styles.
$this->content->text .= "<ul class='list'>\n";
//Accessibility: Don't want 'Alt' text for the user picture; DO want it for the envelope/message link (existing lang string).
//Accessibility: Converted <div> to <ul>, inherit existing classes & styles.
$this->content->text .= "<ul class='list'>\n";
foreach ($users as $user) {
$this->content->text .= '<li class="listentry">';
$this->content->text .= '<li class="listentry">';
$timeago = format_time(time() - max($user->timeaccess, $user->lastaccess)); //bruno to calculate correctly on frontpage
$this->content->text .= print_user_picture($user->id, $this->instance->pageid, $user->picture, 16, true).' ';
$this->content->text .= '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$this->instance->pageid.'" title="'.$timeago.'">'.$user->fullname.'</a>';
$this->content->text .= print_user_picture($user->id, $COURSE->id, $user->picture, 16, true).' ';
$this->content->text .= '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$COURSE->id.'" title="'.$timeago.'">'.$user->fullname.'</a>';
if (!empty($USER->id) and ($USER->id != $user->id) and !empty($CFG->messaging) and !isguest()) { // Only when logged in
$this->content->text .= "\n".' <a title="'.get_string('messageselectadd').'" target="message_'.$user->id.'" href="'.$CFG->wwwroot.'/message/discussion.php?id='.$user->id.'" onclick="return openpopup(\'/message/discussion.php?id='.$user->id.'\', \'message_'.$user->id.'\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);">'
.'<img class="icon message" src="'.$CFG->pixpath.'/t/message.gif" alt="'. get_string('messageselectadd') .'" /></a>';
@@ -7,6 +7,7 @@ class block_recent_activity extends block_base {
}
function get_content() {
global $COURSE;
if ($this->content !== NULL) {
return $this->content;
@@ -21,11 +22,9 @@ class block_recent_activity extends block_base {
$this->content->text = '';
$this->content->footer = '';
$course = get_record('course', 'id', $this->instance->pageid);
// Slightly hacky way to do it but...
ob_start();
print_recent_activity($course);
print_recent_activity($COURSE);
$this->content->text = ob_get_contents();
ob_end_clean();
+2 -2
View File
@@ -42,7 +42,7 @@
}
function get_content() {
global $CFG, $editing;
global $CFG, $editing, $COURSE;
require_once($CFG->libdir .'/rsslib.php');
@@ -89,7 +89,7 @@
$isteacher = false;
$this->courseid = SITEID;
if ($this->instance->pagetype == PAGE_COURSE_VIEW) {
$this->courseid = $this->instance->pageid;
$this->courseid = $COURSE->id;
$isteacher = isteacher($this->courseid);
}
@@ -27,6 +27,7 @@ if (isguest()) {
error(get_string('noguestpost', 'forum'), $referrer);
}
$url = optional_param('url','',PARAM_URL);
if (!empty($url)) {
// attempting to replace feed and rss url types with http
@@ -41,7 +42,7 @@ if (!empty($url)) {
$act = optional_param('act', NULL, PARAM_ALPHA);
$rssid = optional_param('rssid', NULL, PARAM_INT);
$id = optional_param('id', SITEID, PARAM_INT);
$url = clean_param($url, PARAM_URL);
//$url = clean_param($url, PARAM_URL);
$preferredtitle = optional_param('preferredtitle', '', PARAM_ALPHA);
if (!defined('MAGPIE_OUTPUT_ENCODING')) {
+6
View File
@@ -12,6 +12,12 @@ function rss_client_upgrade($oldversion) {
table_column('block_rss_client','description','description','text');
}
if ($oldversion < 2005090201) {
modify_database('', 'ALTER TABLE prefix_block_rss_client
ALTER COLUMN title SET DEFAULT \'\',
ALTER COLUMN description SET DEFAULT \'\'');
}
return true;
}
+1 -1
View File
@@ -22,7 +22,7 @@ class block_section_links extends block_base {
}
function applicable_formats() {
return (array('course-view-weeks' => true, 'course-view-topics' => true));
return (array('course-view-weeks' => true, 'course-view-topics' => true, 'course-edit-weeks' => true, 'course-edit-topics' => true));
}
function get_content() {
+1 -1
View File
@@ -5,4 +5,4 @@
// database (blocks_version) to determine whether upgrades should
// be performed (see db/backup_*.php)
$blocks_version = 2005090200; // The current version is a date (YYYYMMDDXX)
$blocks_version = 2005090201; // The current version is a date (YYYYMMDDXX)
-10
View File
@@ -137,16 +137,6 @@ print_simple_box_start("center");
require('edit.html');
print_simple_box_end();
// Janne comment: Let's move this in here
// so IE gets more time to load the
// Page.
if ($usehtmleditor) {
// Janne comment: there are two text fields in form
// so lets try to replace them both with
// HTMLArea editors
use_html_editor();
}
include($CFG->dirroot .'/blog/footer.php');
+11
View File
@@ -21,6 +21,17 @@ if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) {
<?php
// Janne comment: Let's move this in here
// so IE gets more time to load the
// Page.
if (isset($usehtmleditor) && $usehtmleditor) {
// Janne comment: there are two text fields in form
// so lets try to replace them both with
// HTMLArea editors
use_html_editor();
}
if (isset($course) && ($course->id)) {
print_footer($course);
} else {
+25 -22
View File
@@ -15,9 +15,6 @@ $blockid = optional_param('blockid', 0, PARAM_INT);
/// If user has never visited this page before, install 2 blocks for him
blog_check_and_install_blocks();
if (!$site = get_site()) {
redirect($CFG->wwwroot.'/index.php');
}
// now check that they are logged in and allowed into the course (if specified)
if ($courseid != SITEID) {
@@ -26,7 +23,7 @@ if ($courseid != SITEID) {
}
require_login($course->id);
} else {
$course = get_site();
$course = $SITE;
}
// Bounds for block widths within this page
@@ -92,7 +89,7 @@ if ($ME == $CFG->wwwroot.'/blog/edit.php') { /// We are in edit mode, print the
$formHeading = get_string('addnewentry', 'blog');
}
print_header("$site->shortname: $blogstring", "$site->fullname",
print_header("$SITE->shortname: $blogstring", "$SITE->fullname",
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
<a href="'.$CFG->wwwroot.'/blog/index.php?userid='.$user->id.'">'.$blogstring.'</a> -> '. $formHeading,'','',true);
@@ -103,20 +100,20 @@ if ($ME == $CFG->wwwroot.'/blog/edit.php') { /// We are in edit mode, print the
switch ($filtertype) {
case 'site':
if ($tagid || !empty($tag)) {
print_header("$site->shortname: $blogstring", "",
print_header("$SITE->shortname: $blogstring", $SITE->fullname,
'<a href="index.php?filtertype=site">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
} else {
print_header("$site->shortname: $blogstring", "",
print_header("$SITE->shortname: $blogstring", $SITE->fullname,
$blogstring,'','',true,$PAGE->get_extra_header_string());
}
break;
case 'course':
if ($tagid || !empty($tag)) {
print_header_simple("$course->shortname: $blogstring", "",
print_header_simple("$course->shortname: $blogstring", $course->fullname,
'<a href="index.php?filtertype=course&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
} else {
print_header_simple("$course->shortname: $blogstring", "",
print_header_simple("$course->shortname: $blogstring", $course->fullname,
$blogstring,'','',true,$PAGE->get_extra_header_string());
}
break;
@@ -126,11 +123,11 @@ if ($ME == $CFG->wwwroot.'/blog/edit.php') { /// We are in edit mode, print the
$thisgroup = get_record('groups', 'id', $filterselect);
if ($tagid || !empty($tag)) {
print_header_simple("$course->shortname: $blogstring", "$course->fullname",
print_header_simple("$course->shortname: $blogstring", $course->fullname,
'<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&amp;group='.$filterselect.'">'.$thisgroup->name.'</a> ->
<a href="index.php?filtertype=group&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
} else {
print_header_simple("$course->shortname: $blogstring", "$course->fullname",
print_header_simple("$course->shortname: $blogstring", $course->fullname,
'<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&amp;group='.$filterselect.'">'.$thisgroup->name."</a> ->
$blogstring",'','',true,$PAGE->get_extra_header_string());
@@ -144,14 +141,14 @@ if ($ME == $CFG->wwwroot.'/blog/edit.php') { /// We are in edit mode, print the
if (isset($course->id) && $course->id && $course->id != SITEID) {
if ($tagid || !empty($tag)) {
print_header("$course->shortname: $blogstring", "$course->fullname",
print_header("$course->shortname: $blogstring", $course->fullname,
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'">'.$participants.'</a> ->
<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'&amp;course='.$course->id.'">'.fullname($user).'</a> ->
<a href="index.php?courseid='.optional_param('courseid', 0, PARAM_INT).'&amp;filtertype=user&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
} else {
print_header("$course->shortname: $blogstring", "$course->fullname",
print_header("$course->shortname: $blogstring", $course->fullname,
'<a href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> ->
<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'">'.$participants.'</a> ->
<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'&amp;course='.$course->id.'">'.fullname($user).'</a> ->
@@ -163,12 +160,12 @@ if ($ME == $CFG->wwwroot.'/blog/edit.php') { /// We are in edit mode, print the
else {
if ($tagid || !empty($tag)) {
print_header("$site->shortname: $blogstring", "$site->fullname",
print_header("$SITE->shortname: $blogstring", $SITE->fullname,
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
<a href="index.php?filtertype=user&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
} else {
print_header("$site->shortname: $blogstring", "$site->fullname",
print_header("$SITE->shortname: $blogstring", $SITE->fullname,
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
'.$blogstring,'','',true,$PAGE->get_extra_header_string());
@@ -178,7 +175,7 @@ if ($ME == $CFG->wwwroot.'/blog/edit.php') { /// We are in edit mode, print the
break;
default: //user click on add from block
print_header("$site->shortname: $blogstring", "$site->fullname",
print_header("$SITE->shortname: $blogstring", $SITE->fullname,
'<a href="'.$CFG->wwwroot.'/user/view.php?id='.$filterselect.'">'.fullname($user).'</a> ->
<a href="'.$CFG->wwwroot.'/blog/index.php?userid='.$user->id.'">'.$blogstring.'</a> -> '.get_string('addentry','blog'),'','',true,$PAGE->get_extra_header_string());
break;
@@ -186,18 +183,24 @@ if ($ME == $CFG->wwwroot.'/blog/edit.php') { /// We are in edit mode, print the
} /// close switch
// prints the tabs
$currenttab = 'blogs';
$user = $USER;
if (!$course) {
$course = get_record('course','id',optional_param('courseid', SITEID, PARAM_INT));
}
require_once($CFG->dirroot .'/user/tabs.php');
$editing = false;
if ($PAGE->user_allowed_editing()) {
$editing = $PAGE->user_is_editing();
}
// Calculate the preferred width for left, right and center (both center positions will use the same)
$preferred_width_left = optional_param('preferred_width_left', blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), PARAM_INT);
$preferred_width_right = optional_param('preferred_width_right', blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), PARAM_INT);
$preferred_width_left = min($preferred_width_left, BLOCK_L_MAX_WIDTH);
$preferred_width_left = max($preferred_width_left, BLOCK_L_MIN_WIDTH);
$preferred_width_right = min($preferred_width_right, BLOCK_R_MAX_WIDTH);
$preferred_width_right = max($preferred_width_right, BLOCK_R_MIN_WIDTH);
$preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]),
BLOCK_L_MAX_WIDTH);
$preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]),
BLOCK_R_MAX_WIDTH);
// Display the blocks and allow blocklib to handle any block action requested
$pageblocks = blocks_get_by_page($PAGE);
-8
View File
@@ -139,14 +139,6 @@ if ($limit == 'none') {
include($CFG->dirroot .'/blog/header.php');
// prints the tabs
$currenttab = 'blogs';
$user = $USER;
if (!$course) {
$course = get_record('course','id',optional_param('courseid', SITEID, PARAM_INT));
}
require_once($CFG->dirroot .'/user/tabs.php');
$blogpage = optional_param('blogpage',0,PARAM_INT);
blog_print_html_formatted_entries($userid, $postid, $limit, ($blogpage * $limit) ,$filtertype, $filterselect, $tagid, $tag, $filtertype, $filterselect);
+1 -1
View File
@@ -8,7 +8,7 @@
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="<?php print_string("savechanges"); ?>" />
<input type="submit" value="<?php print_string("savechanges"); ?>" />
<input type="button" value="<?php print_string('cancel'); ?>" onclick="javascript:history.go(-1)" /></td>
</tr>
</table>
+2 -2
View File
@@ -29,7 +29,7 @@
/// If data submitted, then process and store.
if ($post = data_submitted()) {
if ($post = data_submitted()) {
$pagesize = optional_param('pagesize', 10, PARAM_INT);
if ($pagesize < 1 ) {
@@ -54,7 +54,7 @@
print_simple_box_start('center', '', '');
include('./preferences.html');
include('./preferences.html');
print_simple_box_end();
print_footer();
+1 -1
View File
@@ -116,7 +116,7 @@
if($form = data_submitted()) {
$form->name = clean_text(strip_tags($form->name,'<lang><span>'));
$form->name = clean_param(strip_tags($form->name,'<lang><span>'), PARAM_CLEAN);
$form->timestart = make_timestamp($form->startyr, $form->startmon, $form->startday, $form->starthr, $form->startmin);
if($form->duration == 1) {
+8 -8
View File
@@ -241,9 +241,9 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
//Accessibility: functionality moved to calendar_get_popup.
if($display->thismonth && $day == $d) {
$popup = calendar_get_popup(true, $events[$eventid]->timestart, $popupcontent);
$popup = calendar_get_popup(true, $events[$eventid]->timestart, $popupcontent);
} else {
$popup = calendar_get_popup(false, $events[$eventid]->timestart, $popupcontent);
$popup = calendar_get_popup(false, $events[$eventid]->timestart, $popupcontent);
}
// Class and cell content
@@ -279,15 +279,15 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y
}
// Special visual fx for today
//Accessibility: hidden text for today, and popup.
//Accessibility: hidden text for today, and popup.
if($display->thismonth && $day == $d) {
$class .= ' today';
$today = get_string('today', 'calendar').' '.userdate(time(), get_string('strftimedayshort'));
if(! isset($eventsbyday[$day])) {
$class .= ' eventnone';
$popup = calendar_get_popup(true, false);
$cell = '<a href="#" '.$popup.'>'.$day.'</a>';
$class .= ' eventnone';
$popup = calendar_get_popup(true, false);
$cell = '<a href="#" '.$popup.'>'.$day.'</a>';
}
$cell = '<span class="accesshide">'.$today.' </span>'.$cell;
}
@@ -327,13 +327,13 @@ function calendar_get_popup($is_today, $event_timestart, $popupcontent='') {
if (false === $event_timestart) {
$popupcaption .= userdate(time(), get_string('strftimedayshort'));
$popupcontent = get_string('eventnone', 'calendar');
} else {
$popupcaption .= get_string('eventsfor', 'calendar', userdate($event_timestart, get_string('strftimedayshort')));
}
$popupcontent = str_replace("'", "\'", htmlspecialchars($popupcontent));
$popup = 'onmouseover="return overlib(\''.$popupcontent.'\', CAPTION, \''.$popupcaption.'\');" onmouseout="return nd();"';
return $popup;
return $popup;
}
function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxevents, $fromtime=0) {
+11 -11
View File
@@ -301,33 +301,33 @@
echo "<td>";
echo '<a title="'.$strsettings.'" href="'.$CFG->wwwroot.'/course/edit.php?id='.
$acourse->id.'">'.
'<img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="" /></a> ';
'<img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.$stredit.'" /></a> ';
echo '<a title="'.$strassignteachers.'" href="'.$CFG->wwwroot.'/course/teacher.php?id='.
$acourse->id.'">'.
'<img src="'.$CFG->pixpath.'/t/user.gif" height="11" width="11" border="0" alt="" /></a> ';
'<img src="'.$CFG->pixpath.'/t/user.gif" height="11" width="11" border="0" alt="'.$strassignteachers.'" /></a> ';
echo '<a title="'.$strdelete.'" href="delete.php?id='.$acourse->id.'">'.
'<img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="" /></a> ';
'<img src="'.$CFG->pixpath.'/t/delete.gif" height="11" width="11" border="0" alt="'.$strdelete.'" /></a> ';
if (!empty($acourse->visible)) {
echo '<a title="'.$strhide.'" href="category.php?id='.$category->id.'&amp;page='.$page.
'&amp;perpage='.$perpage.'&amp;hide='.$acourse->id.'&amp;sesskey='.$USER->sesskey.'">'.
'<img src="'.$CFG->pixpath.'/t/hide.gif" height="11" width="11" border="0" alt="" /></a> ';
'<img src="'.$CFG->pixpath.'/t/hide.gif" height="11" width="11" border="0" alt="'.$strhide.'" /></a> ';
} else {
echo '<a title="'.$strshow.'" href="category.php?id='.$category->id.'&amp;page='.$page.
'&amp;perpage='.$perpage.'&amp;show='.$acourse->id.'&amp;sesskey='.$USER->sesskey.'">'.
'<img src="'.$CFG->pixpath.'/t/show.gif" height="11" width="11" border="0" alt="" /></a> ';
'<img src="'.$CFG->pixpath.'/t/show.gif" height="11" width="11" border="0" alt="'.$strshow.'" /></a> ';
}
echo '<a title="'.$strbackup.'" href="../backup/backup.php?id='.$acourse->id.'">'.
'<img src="'.$CFG->pixpath.'/t/backup.gif" height="11" width="11" border="0" alt="" /></a> ';
'<img src="'.$CFG->pixpath.'/t/backup.gif" height="11" width="11" border="0" alt="'.$strbackup.'" /></a> ';
echo '<a title="'.$strrestore.'" href="../files/index.php?id='.$acourse->id.
'&amp;wdir=/backupdata">'.
'<img src="'.$CFG->pixpath.'/t/restore.gif" height="11" width="11" border="0" alt="" /></a> ';
'<img src="'.$CFG->pixpath.'/t/restore.gif" height="11" width="11" border="0" alt="'.$strrestore.'" /></a> ';
if ($up) {
echo '<a title="'.$strmoveup.'" href="category.php?id='.$category->id.'&amp;page='.$page.
'&amp;perpage='.$perpage.'&amp;moveup='.$acourse->id.'&amp;sesskey='.$USER->sesskey.'">'.
'<img src="'.$CFG->pixpath.'/t/up.gif" height="11" width="11" border="0" alt="" /></a> ';
'<img src="'.$CFG->pixpath.'/t/up.gif" height="11" width="11" border="0" alt="'.$strmoveup.'" /></a> ';
} else {
echo '<img src="'.$CFG->wwwroot.'/pix/spacer.gif" height="11" width="11" border="0" alt="" /> ';
}
@@ -335,7 +335,7 @@
if ($down) {
echo '<a title="'.$strmovedown.'" href="category.php?id='.$category->id.'&amp;page='.$page.
'&amp;perpage='.$perpage.'&amp;movedown='.$acourse->id.'&amp;sesskey='.$USER->sesskey.'">'.
'<img src="'.$CFG->pixpath.'/t/down.gif" height="11" width="11" border="0" alt="" /></a> ';
'<img src="'.$CFG->pixpath.'/t/down.gif" height="11" width="11" border="0" alt="'.$strmovedown.'" /></a> ';
} else {
echo '<img src="'.$CFG->wwwroot.'/pix/spacer.gif" height="11" width="11" border="0" alt="" /> ';
}
@@ -348,9 +348,9 @@
} else if (isteacheredit($acourse->id)) {
echo '<td>';
echo '<a title="'.$strsettings.'" href="'.$CFG->wwwroot.'/course/edit.php?id='.$acourse->id.'">'.
'<img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="" /></a> ';
'<img src="'.$CFG->pixpath.'/t/edit.gif" height="11" width="11" border="0" alt="'.$strsettings.'" /></a> ';
echo '<a title="'.$strassignteachers.'" href="'.$CFG->wwwroot.'/course/teacher.php?id='.$acourse->id.'">'.
'<img src="'.$CFG->pixpath.'/t/user.gif" height="11" width="11" border="0" alt="" /></a> ';
'<img src="'.$CFG->pixpath.'/t/user.gif" height="11" width="11" border="0" alt="'.$strassignteachers.'" /></a> ';
}
echo '</td>';
} else {
+1
View File
@@ -68,6 +68,7 @@
print_heading($strdeletingcourse);
delete_course($course->id);
fix_course_sortorder(); //update course count in catagories
print_heading( get_string("deletedcourse", "", $course->shortname) );
+11 -8
View File
@@ -7,7 +7,8 @@
require_once("lib.php");
require_once("$CFG->dirroot/enrol/enrol.class.php");
$id = required_param('id',PARAM_INT);
$id = required_param('id', PARAM_INT);
$loginasguest = optional_param('loginasguest', 0, PARAM_BOOL);
require_login();
@@ -19,12 +20,6 @@
error("Could not find a site!");
}
/// Check if the course is a meta course
if ($course->metacourse) {
print_header_simple();
notice(get_string('coursenotaccessible'), $CFG->wwwroot);
}
check_for_restricted_user($USER->username);
/// Refreshing enrolment data in the USER session
@@ -47,6 +42,7 @@
/// Double check just in case they are actually enrolled already
/// This might occur if they were enrolled during this session
/// also happens when course is unhidden after student logs in
if ( !empty($USER->student[$course->id]) or !empty($USER->teacher[$course->id]) ) {
@@ -59,6 +55,13 @@
redirect($destination);
}
/// Check if the course is a meta course
/// moved here to fix bug 5734
if ($course->metacourse) {
print_header_simple();
notice(get_string('coursenotaccessible'), $CFG->wwwroot);
}
/// Users can't enroll to site course
if (!$course->category) {
@@ -96,7 +99,7 @@
//User is not enrolled in the course, wants to access course content
//as a guest, and course setting allow unlimited guest access
//Code cribbed from course/loginas.php
if (isset($loginasguest) && ($course->guest==1)) {
if ($loginasguest and ($course->guest==1)) {
$realuser = $USER->id;
$realname = fullname($USER, true);
$USER = guest_user();
+10 -10
View File
@@ -30,7 +30,7 @@ if ($topic != -1) {
}
}
if (isteacher($course->id) and !empty($marker) and confirm_sesskey()) {
if (($marker >=0) and isteacher($course->id) and confirm_sesskey()) {
$course->marker = $marker;
if (! set_field("course", "marker", $marker, "id", $course->id)) {
error("Could not mark that topic for this course");
@@ -63,7 +63,7 @@ echo '<table id="layout-table" cellspacing="0"><tr>';
/// The left column ...
if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) {
echo '<td style="width: '.$preferred_width_left.'px;" id="left-column">';
echo '<td width="'.$preferred_width_left.'" id="left-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
echo '</td>';
}
@@ -283,28 +283,28 @@ while ($section <= $course->numsections) {
if (isediting($course->id)) {
if ($course->marker == $section) { // Show the "light globe" on/off
echo '<a href="view.php?id='.$course->id.'&amp;marker=0&amp;sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strmarkedthistopic.'">'.
'<img src="'.$CFG->pixpath.'/i/marked.gif" vspace="3" height="16" width="16" border="0" alt="" /></a><br />';
'<img src="'.$CFG->pixpath.'/i/marked.gif" vspace="3" height="16" width="16" border="0" alt="'.$strmarkedthistopic.'" /></a><br />';
} else {
echo '<a href="view.php?id='.$course->id.'&amp;marker='.$section.'&amp;sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strmarkthistopic.'">'.
'<img src="'.$CFG->pixpath.'/i/marker.gif" vspace="3" height="16" width="16" border="0" alt="" /></a><br />';
'<img src="'.$CFG->pixpath.'/i/marker.gif" vspace="3" height="16" width="16" border="0" alt="'.$strmarkthistopic.'" /></a><br />';
}
if ($thissection->visible) { // Show the hide/show eye
echo '<a href="view.php?id='.$course->id.'&amp;hide='.$section.'&amp;sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strtopichide.'">'.
'<img src="'.$CFG->pixpath.'/i/hide.gif" vspace="3" height="16" width="16" border="0" alt="" /></a><br />';
'<img src="'.$CFG->pixpath.'/i/hide.gif" vspace="3" height="16" width="16" border="0" alt="'.$strtopichide.'" /></a><br />';
} else {
echo '<a href="view.php?id='.$course->id.'&amp;show='.$section.'&amp;sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strtopichide.'">'.
'<img src="'.$CFG->pixpath.'/i/show.gif" vspace="3" height="16" width="16" border="0" alt="" /></a><br />';
echo '<a href="view.php?id='.$course->id.'&amp;show='.$section.'&amp;sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strtopicshow.'">'.
'<img src="'.$CFG->pixpath.'/i/show.gif" vspace="3" height="16" width="16" border="0" alt="'.$strtopicshow.'" /></a><br />';
}
if ($section > 1) { // Add a arrow to move section up
echo '<a href="view.php?id='.$course->id.'&amp;section='.$section.'&amp;move=-1&amp;sesskey='.$USER->sesskey.'#section-'.($section-1).'" title="'.$strmoveup.'">'.
'<img src="'.$CFG->pixpath.'/t/up.gif" vspace="3" height="11" width="11" border="0" alt="" /></a><br />';
'<img src="'.$CFG->pixpath.'/t/up.gif" vspace="3" height="11" width="11" border="0" alt="'.$strmoveup.'" /></a><br />';
}
if ($section < $course->numsections) { // Add a arrow to move section down
echo '<a href="view.php?id='.$course->id.'&amp;section='.$section.'&amp;move=1&amp;sesskey='.$USER->sesskey.'#section-'.($section+1).'" title="'.$strmovedown.'">'.
'<img src="'.$CFG->pixpath.'/t/down.gif" vspace="3" height="11" width="11" border="0" alt="" /></a><br />';
'<img src="'.$CFG->pixpath.'/t/down.gif" vspace="3" height="11" width="11" border="0" alt="'.$strmovedown.'" /></a><br />';
}
}
@@ -329,7 +329,7 @@ echo '</td>';
// The right column
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) {
echo '<td style="width: '.$preferred_width_right.'px;" id="right-column">';
echo '<td width="'.$preferred_width_right.'" id="right-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
echo '</td>';
}
+2 -2
View File
@@ -25,7 +25,7 @@
echo '<tr>';
if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) {
echo '<td style="width: '.$preferred_width_left.'px;" id="left-column">';
echo '<td width="'.$preferred_width_left.'" id="left-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
echo '</td>';
}
@@ -41,7 +41,7 @@
// The right column
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) {
echo '<td style="width: '.$preferred_width_right.'px;" id="right-column">';
echo '<td width="'.$preferred_width_right.'" id="right-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
echo '</td>';
}
+2 -2
View File
@@ -23,7 +23,7 @@
echo '<tr>';
if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) {
echo '<td style="width: '.$preferred_width_left.'px;" id="left-column">';
echo '<td width="'.$preferred_width_left.'" id="left-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
echo '</td>';
}
@@ -51,7 +51,7 @@
// The right column
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) {
echo '<td style="width: '.$preferred_width_right.'px;" id="right-column">';
echo '<td width="'.$preferred_width_right.'" id="right-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
echo '</td>';
}
+5 -5
View File
@@ -31,7 +31,7 @@
}
}
if ($marker && isteacher($course->id) && confirm_sesskey()) {
if (($marker >=0) && isteacher($course->id) && confirm_sesskey()) {
$course->marker = $marker;
if (! set_field("course", "marker", $marker, "id", $course->id)) {
error("Could not mark that topic for this course");
@@ -64,7 +64,7 @@
/// The left column ...
if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) {
echo '<td style="width: '.$preferred_width_left.'px;" id="left-column">';
echo '<td width="'.$preferred_width_left.'" id="left-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
echo '</td>';
}
@@ -221,8 +221,8 @@
echo '<a href="view.php?id='.$course->id.'&amp;hide='.$section.'&amp;sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strtopichide.'">'.
'<img src="'.$CFG->pixpath.'/i/hide.gif" vspace="3" height="16" width="16" border="0" alt="'.$strtopichide.'" /></a><br />';
} else {
echo '<a href="view.php?id='.$course->id.'&amp;show='.$section.'&amp;sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strtopichide.'">'.
'<img src="'.$CFG->pixpath.'/i/show.gif" vspace="3" height="16" width="16" border="0" alt="'.$strtopichide.'" /></a><br />';
echo '<a href="view.php?id='.$course->id.'&amp;show='.$section.'&amp;sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strtopicshow.'">'.
'<img src="'.$CFG->pixpath.'/i/show.gif" vspace="3" height="16" width="16" border="0" alt="'.$strtopicshow.'" /></a><br />';
}
if ($section > 1) { // Add a arrow to move section up
@@ -257,7 +257,7 @@
// The right column
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) {
echo '<td style="width: '.$preferred_width_right.'px;" id="right-column">';
echo '<td width="'.$preferred_width_right.'" id="right-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
echo '</td>';
}
+4 -4
View File
@@ -55,7 +55,7 @@
/// The left column ...
if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) {
echo '<td style="width: '.$preferred_width_left.'px;" id="left-column">';
echo '<td width="'.$preferred_width_left.'" id="left-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
echo '</td>';
}
@@ -213,8 +213,8 @@
echo '<a href="view.php?id='.$course->id.'&amp;hide='.$section.'&amp;sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strweekhide.'">'.
'<img src="'.$CFG->pixpath.'/i/hide.gif" vspace="3" class="icon hide" alt="'.$strweekhide.'" /></a><br />';
} else {
echo '<a href="view.php?id='.$course->id.'&amp;show='.$section.'&amp;sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strweekhide.'">'.
'<img src="'.$CFG->pixpath.'/i/show.gif" vspace="3" class="icon hide" alt="'.$strweekhide.'" /></a><br />';
echo '<a href="view.php?id='.$course->id.'&amp;show='.$section.'&amp;sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strweekshow.'">'.
'<img src="'.$CFG->pixpath.'/i/show.gif" vspace="3" class="icon hide" alt="'.$strweekshow.'" /></a><br />';
}
if ($section > 1) { // Add a arrow to move section up
echo '<a href="view.php?id='.$course->id.'&amp;section='.$section.'&amp;move=-1&amp;sesskey='.$USER->sesskey.'#section-'.($section-1).'" title="'.$strmoveup.'">'.
@@ -247,7 +247,7 @@
// The right column
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) {
echo '<td style="width: '.$preferred_width_right.'px;" id="right-column">';
echo '<td width="'.$preferred_width_right.'" id="right-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
echo '</td>';
}
+2 -2
View File
@@ -217,8 +217,8 @@
echo '<a href="view.php?id='.$course->id.'&amp;hide='.$section.'&amp;sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strweekhide.'">'.
'<img src="'.$CFG->pixpath.'/i/hide.gif" class="icon hide" alt="'.$strweekhide.'" /></a><br />';
} else {
echo '<a href="view.php?id='.$course->id.'&amp;show='.$section.'&amp;sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strweekhide.'">'.
'<img src="'.$CFG->pixpath.'/i/show.gif" class="icon hide" alt="'.$strweekhide.'" /></a><br />';
echo '<a href="view.php?id='.$course->id.'&amp;show='.$section.'&amp;sesskey='.$USER->sesskey.'#section-'.$section.'" title="'.$strweekshow.'">'.
'<img src="'.$CFG->pixpath.'/i/show.gif" class="icon hide" alt="'.$strweekshow.'" /></a><br />';
}
if ($section > 1) { // Add a arrow to move section up
echo '<a href="view.php?id='.$course->id.'&amp;section='.$section.'&amp;move=-1&amp;sesskey='.$USER->sesskey.'#section-'.($section-1).'" title="'.$strmoveup.'">'.
+1 -1
View File
@@ -57,5 +57,5 @@
<input type="hidden" name="group" value="<?php p($group->id) ?>" />
<input type="hidden" name="id" value="<?php p($course->id) ?>" />
<input type="hidden" name="sesskey" value="<?php sesskey() ?>" />
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
</form>
+2 -2
View File
@@ -15,7 +15,7 @@
$strimport = get_string("importdata");
$tcourseids = '';
if ($teachers = get_records_select('user_teachers', "userid = $USER->id AND editall = 1",'','id,course')) {
foreach ($teachers as $teacher) {
if ($teacher->course != $course->id && $teacher->course != SITEID){
@@ -25,7 +25,7 @@
}
$taught_courses = array();
if (!empty($tcourseids)) {
if (!empty($tcourseids)) {
$tcourseids = substr($tcourseids,0,-1);
$taught_courses = get_records_list('course', 'id', $tcourseids);
}
+1 -1
View File
@@ -53,7 +53,7 @@
}
else {
foreach ($courses as $course) {
echo "<option value=\"$course->id\">".course_format_name($course,60)."</option>\n";
echo "<option value=\"$course->id\">".course_format_name($course,60)."</option>\n";
}
}
}
+6 -6
View File
@@ -59,7 +59,7 @@
if (iscreator()) { // Print link to create a new course
print_single_button("edit.php", NULL, get_string("addnewcourse"), "get");
}
if (!empty($CFG->enablecourserequests)) {
if (isadmin() and !empty($CFG->enablecourserequests)) {
print_single_button('pending.php',NULL, get_string('coursespending'),"get");
}
echo "</center>";
@@ -346,23 +346,23 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
echo "<td nowrap=\"nowrap\">"; /// Print little icons
echo "<a title=\"$str->delete\" href=\"index.php?delete=$category->id&amp;sesskey=$USER->sesskey\"><img".
" src=\"$CFG->pixpath/t/delete.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"\" /></a> ";
" src=\"$CFG->pixpath/t/delete.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"$str->delete\" /></a> ";
if (!empty($category->visible)) {
echo "<a title=\"$str->hide\" href=\"index.php?hide=$category->id&amp;sesskey=$USER->sesskey\"><img".
" src=\"$CFG->pixpath/t/hide.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"\" /></a> ";
" src=\"$CFG->pixpath/t/hide.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"$str->hide\" /></a> ";
} else {
echo "<a title=\"$str->show\" href=\"index.php?show=$category->id&amp;sesskey=$USER->sesskey\"><img".
" src=\"$CFG->pixpath/t/show.gif\" height=\"11\" width=\"11\" border=\"0\"alt=\"\" /></a> ";
" src=\"$CFG->pixpath/t/show.gif\" height=\"11\" width=\"11\" border=\"0\"alt=\"$str->show\" /></a> ";
}
if ($up) {
echo "<a title=\"$str->moveup\" href=\"index.php?moveup=$category->id&amp;sesskey=$USER->sesskey\"><img".
" src=\"$CFG->pixpath/t/up.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"\" /></a> ";
" src=\"$CFG->pixpath/t/up.gif\" height=\"11\" width=\"11\" border=\"0\" alt=\"$str->moveup\" /></a> ";
}
if ($down) {
echo "<a title=\"$str->movedown\" href=\"index.php?movedown=$category->id&amp;sesskey=$USER->sesskey\"><img".
" src=\"$CFG->pixpath/t/down.gif\" height=\"11\" width=\"11\" border=\"0\"alt=\"\" /></a> ";
" src=\"$CFG->pixpath/t/down.gif\" height=\"11\" width=\"11\" border=\"0\"alt=\"$str->movedown\" /></a> ";
}
echo "</td>";
+16 -13
View File
@@ -505,7 +505,7 @@ function print_recent_activity($course) {
echo '<a href="'.$CFG->wwwroot.'/course/recent.php?id='.$course->id.'">'.get_string('recentactivityreport').'</a>';
echo '</div>';
echo "</div>\n";
// Firstly, have there been any new enrolments?
@@ -515,18 +515,21 @@ function print_recent_activity($course) {
$users = get_recent_enrolments($course->id, $timestart);
//Accessibility: new users now appear in an <OL> list.
if ($users) {
echo '<div class="newusers">';
foreach ($users as $user) {
if (! $heading) {
print_headline(get_string("newusers").':', 3);
$heading = true;
$content = true;
}
$fullname = fullname($user, $isteacher);
echo '<span class="name"><a href="'.$CFG->wwwroot."/user/view.php?id=$user->id&amp;course=$course->id\">$fullname</a></span><br />";
if (! $heading) {
print_headline(get_string("newusers").':', 3);
$heading = true;
$content = true;
}
echo '</div>';
echo "<ol class=\"list\">\n";
foreach ($users as $user) {
$fullname = fullname($user, $isteacher);
echo '<li class="name"><a href="'.$CFG->wwwroot."/user/view.php?id=$user->id&amp;course=$course->id\">$fullname</a></li>\n";
}
echo "</ol>\n</div>\n";
}
// Next, have there been any modifications to the course structure?
@@ -944,9 +947,9 @@ function print_section_add_menus($course, $section, $modnames, $vertical=false,
}
// we need to loop through the forms and check to see if we can add them.
foreach ($modnames as $key) {
foreach ($modnames as $key=>$value) {
if (!course_allowed_module($course,$key))
unset($modnames[strtolower($key)]);
unset($modnames[$key]);
}
// this is stupid but labels get put into resource, so if resource is hidden and label is not, we're in trouble.
@@ -1813,7 +1816,7 @@ function course_allowed_module($course,$mod) {
if (is_numeric($mod)) {
$modid = $mod;
} else if (is_string($mod)) {
if ($mod = get_field("modules","id","name",strtolower($mod)))
if ($mod = get_field("modules","id","name",$mod))
$modid = $mod;
}
if (empty($modid)) {
+1 -1
View File
@@ -609,7 +609,7 @@
$sectionname = get_string("name$course->format");
$fullmodulename = get_string("modulename", $module->name);
if ($form->section) {
if ($form->section && $course->format != 'site') {
$heading->what = $fullmodulename;
$heading->to = "$sectionname $form->section";
$pageheading = get_string("addinganewto", "moodle", $heading);
+1 -1
View File
@@ -34,7 +34,7 @@
}
}
add_to_log($course->id, "course", "report log", "report/log/index.php?id=$course->id", $course->fullname);
add_to_log($course->id, "course", "report log", "report/log/index.php?id=$course->id", $course->id);
$strlogs = get_string('logs');
$stradministration = get_string('administration');
+1 -1
View File
@@ -17,7 +17,7 @@
error("Only teachers can view logs");
}
add_to_log($course->id, "course", "report live", "report/log/live.php?id=$course->id", $course->fullname);
add_to_log($course->id, "course", "report live", "report/log/live.php?id=$course->id", $course->id);
session_write_close();
+1 -1
View File
@@ -21,7 +21,7 @@
error("You are not allowed to look at this page");
}
add_to_log($course->id, "course", "report outline", "report/outline/index.php?id=$course->id", $course->fullname);
add_to_log($course->id, "course", "report outline", "report/outline/index.php?id=$course->id", $course->id);
$stractivityreport = get_string("activityreport");
$strparticipants = get_string("participants");
+1 -1
View File
@@ -33,7 +33,7 @@
print_error('mustbeteacher', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
}
add_to_log($course->id, "course", "report participation", "report/participation/index.php?id=$course->id", $course->fullname);
add_to_log($course->id, "course", "report participation", "report/participation/index.php?id=$course->id", $course->id);
$strparticipation = get_string('participationreport');
$strviews = get_string('views');
+15 -182
View File
@@ -2,6 +2,7 @@
require_once('../../../config.php');
require_once($CFG->dirroot.'/lib/statslib.php');
require_once($CFG->dirroot.'/course/report/stats/lib.php');
if (empty($CFG->enablestats)) {
error("Stats is not enabled.");
@@ -36,193 +37,25 @@
error("You need to be a teacher to use this page");
}
add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->fullname);
add_to_log($course->id, "course", "report stats", "report/stats/index.php?course=$course->id", $course->id);
stats_check_uptodate($course->id);
$strreports = get_string("reports");
$strstats = get_string('stats');
$menu = report_stats_mode_menu($course, $mode, $time);
$crumb = "<a href=\"../../view.php?id=$course->id\">$course->shortname</a> ->
<a href=\"../../report.php?id=$course->id\">$strreports</a> ->
$strstats";
print_header("$course->shortname: $strstats", "$course->fullname",
$crumb, '', '', true, '&nbsp', $menu);
$reportoptions = stats_get_report_options($courseid,$mode);
$courses = get_courses('all','c.shortname','c.id,c.shortname,c.fullname');
$courseoptions = array();
foreach ($courses as $c) {
if (isteacher($c->id)) {
$courseoptions[$c->id] = $c->shortname;
}
}
$tableprefix = $CFG->prefix.'stats_';
if ($mode == STATS_MODE_DETAILED) {
$tableprefix = $CFG->prefix.'stats_user_';
}
$earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend LIMIT 1');
$earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend LIMIT 1');
$earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend LIMIT 1');
if (empty($earliestday)) $earliestday = time();
if (empty($earliestweek)) $earliestweek = time();
if (empty($earliestmonth)) $earliestmonth = time();
$now = stats_get_base_daily();
$lastweekend = stats_get_base_weekly();
$lastmonthend = stats_get_base_monthly();
$timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
if (empty($timeoptions)) {
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/view.php?id='.$course->id);
}
$options = array();
$options[STATS_MODE_GENERAL] = get_string('statsmodegeneral');
$options[STATS_MODE_DETAILED] = get_string('statsmodedetailed');
if (isadmin()) {
$options[STATS_MODE_RANKED] = get_string('reports');
}
$menu = choose_from_menu($options,'mode',$mode,'','this.form.submit();',0,true);
$menu = '<form action="index.php" method="post">'."\n"
.'<input type="hidden" name="course" value="'.$course->id.'" />'."\n"
.'<input type="hidden" name="time" value="'.$time.'" />'."\n"
.$menu."\n".'</form>';
print_header("$course->shortname: $strstats", "$course->fullname",
"<a href=\"../../view.php?id=$course->id\">$course->shortname</a> ->
<a href=\"../../report.php?id=$course->id\">$strreports</a> ->
$strstats", '','',true,'&nbsp',$menu);
echo '<form action="index.php" method="post">'."\n"
.'<input type="hidden" name="mode" value="'.$mode.'" />'."\n";
$table->width = '*';
if ($mode == STATS_MODE_DETAILED) {
if (!empty($time)) {
$param = stats_get_parameters($time,null,$course->id,$mode); // we only care about the table and the time string.
$sql = 'SELECT DISTINCT s.userid,s.roleid,u.firstname,u.lastname,u.idnumber FROM '.$CFG->prefix.'stats_user_'.$param->table.' s JOIN '.$CFG->prefix.'user u ON u.id = s.userid '
.'WHERE courseid = '.$course->id.' AND timeend >= '.$param->timeafter . ((!empty($param->stattype)) ? ' AND stattype = \''.$param->stattype.'\'' : '');
if (!isadmin()) {
$sql .= ' AND (s.roleid = 1 OR s.userid = '.$USER->id .")";
}
$sql .= " ORDER BY s.roleid ";
} else {
$sql = 'SELECT s.userid,u.firstname,u.lastname,u.idnumber,1 AS roleid FROM '.$CFG->prefix.'user_students s JOIN '.$CFG->prefix.'user u ON u.id = s.userid WHERE course = '.$course->id;
}
$us = get_records_sql($sql);
$admins = get_admins();
foreach ($us as $u) {
$role = $course->student;
if ($u->roleid == 2) {
$role = $course->teacher;
}
if (array_key_exists($u->userid,$admins)) {
$role = get_string('admin');
}
$users[$u->userid] = $role.' - '.fullname($u,true);
}
if (empty($time)) {
if (isadmin()) {
$sql = 'SELECT t.userid,u.firstname,u.lastname,u.idnumber,1 AS roleid FROM '.$CFG->prefix.'user_teachers t JOIN '.$CFG->prefix.'user u ON u.id = t.userid WHERE course = '.$course->id;
$moreusers = get_records_sql($sql);
foreach ($moreusers as $u) {
$users[$u->userid] = $course->teacher .' - '.fullname($u,true);
}
} else {
$users[$USER->id] = $course->teacher.' - '.fullname($USER,true);
}
}
// make sure we sort so teachers are at the top.
if (strcmp($course->student,$course->teacher) < 0) {
arsort($users);
} else {
asort($users);
}
$table->align = array('left','left','left','left','left','left','left','left');
$table->data[] = array(get_string('course'),choose_from_menu($courseoptions,'course',$course->id,'','','',true),
get_string('users'),choose_from_menu($users,'userid',$userid,'','','',true),
get_string('statsreporttype'),choose_from_menu($reportoptions,'report',$report,'','','',true),
get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true),
'<input type="submit" value="'.get_string('view').'" />') ;
} else {
$table->align = array('left','left','left','left','left','left','left');
$table->data[] = array(get_string('course'),choose_from_menu($courseoptions,'course',$course->id,'','','',true),
get_string('statsreporttype'),choose_from_menu($reportoptions,'report',$report,'','','',true),
get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true),
'<input type="submit" value="'.get_string('view').'" />') ;
}
print_table($table);
echo '</form>';
if (!empty($report) && !empty($time)) {
if ($report == STATS_REPORT_LOGINS && $course->id != SITEID) {
error("This type of report is only available for the site course");
}
$param = stats_get_parameters($time,$report,$course->id,$mode);
if ($mode == STATS_MODE_DETAILED) {
$param->table = 'user_'.$param->table;
}
$sql = 'SELECT timeend,'.$param->fields.' FROM '.$CFG->prefix.'stats_'.$param->table.' WHERE '
.(($course->id == SITEID) ? '' : ' courseid = '.$course->id.' AND ')
.((!empty($userid)) ? ' userid = '.$userid.' AND ' : '')
. ((!empty($param->stattype)) ? ' stattype = \''.$param->stattype.'\' AND ' : '')
.' timeend >= '.$param->timeafter
.$param->extras
.' ORDER BY timeend DESC';
$stats = get_records_sql($sql);
if (empty($stats)) {
error(get_string('statsnodata'.((!empty($user)) ? 'user' : '')),$CFG->wwwroot.'/stats/index.php?course='.$course->id.'&mode='.$mode.'&time='.$time);
}
$stats = stats_fix_zeros($stats,$param->timeafter,$param->table,(!empty($param->line2)));
print_heading($course->shortname.' - '.get_string('statsreport'.$report).((!empty($user)) ? ' '.get_string('statsreportforuser').' ' .fullname($user,true) : ''));
if (empty($CFG->gdversion)) {
echo "(".get_string("gdneed").")";
} else {
if ($mode == STATS_MODE_DETAILED) {
echo '<center><img src="'.$CFG->wwwroot.'/course/report/stats/graph.php?mode='.$mode.'&course='.$course->id.'&time='.$time.'&report='.$report.'&userid='.$userid.'" /></center>';
} else {
echo '<center><img src="'.$CFG->wwwroot.'/course/report/stats/graph.php?mode='.$mode.'&course='.$course->id.'&time='.$time.'&report='.$report.'" /></center>';
}
}
$table = new object();
$table->align = array('left','center','center','center');
$param->table = str_replace('user_','',$param->table);
$table->head = array(get_string('periodending','moodle',$param->table),$param->line1);
if (!empty($param->line2)) {
$table->head[] = $param->line2;
}
$table->head[] = get_string('logs');
foreach ($stats as $stat) {
$a = array(userdate($stat->timeend-(60*60*24),get_string('strftimedate'),$CFG->timezone),$stat->line1);
if (isset($stat->line2)) {
$a[] = $stat->line2;
}
if (empty($CFG->loglifetime) || ($stat->timeend-(60*60*24)) >= (time()-60*60*24*$CFG->loglifetime)) {
$a[] = '<a href="'.$CFG->wwwroot.'/course/report/log/index.php?id='.$course->id.'&chooselog=1&showusers=1&showcourses=1&user='.$userid.'&date='.usergetmidnight($stat->timeend-(60*60*24)).'">'.get_string('course').' ' .get_string('logs').'</a>&nbsp;';
}
$table->data[] = $a;
}
print_table($table);
}
require_once($CFG->dirroot.'/course/report/stats/report.php');
print_footer();
?>
?>
+64
View File
@@ -0,0 +1,64 @@
<?php
/**
* This file is also required by /admin/reports/stats/index.php.
*/
require_once('../../../config.php');
require_once($CFG->dirroot.'/lib/statslib.php');
function report_stats_mode_menu($course, $mode, $time) {
global $CFG;
$reportoptions = stats_get_report_options($course->id, $mode);
$timeoptions = report_stats_timeoptions($mode);
if (empty($timeoptions)) {
error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/view.php?id='.$course->id);
}
$options = array();
$options[STATS_MODE_GENERAL] = get_string('statsmodegeneral');
$options[STATS_MODE_DETAILED] = get_string('statsmodedetailed');
if (isadmin()) {
$options[STATS_MODE_RANKED] = get_string('reports');
}
$menu = choose_from_menu($options,'mode',$mode,'','this.form.submit();',0,true);
$menu = '<form action="index.php" method="post">'."\n"
.'<input type="hidden" name="course" value="'.$course->id.'" />'."\n"
.'<input type="hidden" name="time" value="'.$time.'" />'."\n"
.$menu."\n".'</form>';
return $menu;
}
function report_stats_timeoptions($mode) {
global $CFG;
$tableprefix = $CFG->prefix.'stats_';
if ($mode == STATS_MODE_DETAILED) {
$tableprefix = $CFG->prefix.'stats_user_';
}
$earliestday = get_field_sql('SELECT timeend FROM '.$tableprefix.'daily ORDER BY timeend LIMIT 1');
$earliestweek = get_field_sql('SELECT timeend FROM '.$tableprefix.'weekly ORDER BY timeend LIMIT 1');
$earliestmonth = get_field_sql('SELECT timeend FROM '.$tableprefix.'monthly ORDER BY timeend LIMIT 1');
if (empty($earliestday)) $earliestday = time();
if (empty($earliestweek)) $earliestweek = time();
if (empty($earliestmonth)) $earliestmonth = time();
$now = stats_get_base_daily();
$lastweekend = stats_get_base_weekly();
$lastmonthend = stats_get_base_monthly();
return stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth);
}
?>
+3 -5
View File
@@ -4,11 +4,9 @@
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
echo '<p style="text-align:center;">';
if (!empty($CFG->enablestats)) {
echo '<p style="text-align:center;">';
echo '<a href="'.$CFG->wwwroot.'/course/report/stats/index.php?course='.$course->id.'">'.get_string('stats').'</a>';
} else {
echo '<a href="'.$CFG->wwwroot.'/admin/config.php#configsectionstats">'.get_string('statsoff').'</a>';
echo '</p>';
}
echo '</p>';
?>
?>
+142
View File
@@ -0,0 +1,142 @@
<?php
$courses = get_courses('all','c.shortname','c.id,c.shortname,c.fullname');
$courseoptions = array();
foreach ($courses as $c) {
if (isteacher($c->id)) {
$courseoptions[$c->id] = $c->shortname;
}
}
echo '<form action="index.php" method="post">'."\n"
.'<input type="hidden" name="mode" value="'.$mode.'" />'."\n";
$reportoptions = stats_get_report_options($course->id, $mode);
$timeoptions = report_stats_timeoptions($mode);
$table->width = '*';
if ($mode == STATS_MODE_DETAILED) {
if (!empty($time)) {
$param = stats_get_parameters($time,null,$course->id,$mode); // we only care about the table and the time string.
$sql = 'SELECT DISTINCT s.userid,s.roleid,u.firstname,u.lastname,u.idnumber FROM '.$CFG->prefix.'stats_user_'.$param->table.' s JOIN '.$CFG->prefix.'user u ON u.id = s.userid '
.'WHERE courseid = '.$course->id.' AND timeend >= '.$param->timeafter . ((!empty($param->stattype)) ? ' AND stattype = \''.$param->stattype.'\'' : '');
if (!isadmin()) {
$sql .= ' AND (s.roleid = 1 OR s.userid = '.$USER->id .")";
}
$sql .= " ORDER BY s.roleid ";
} else {
$sql = 'SELECT s.userid,u.firstname,u.lastname,u.idnumber,1 AS roleid FROM '.$CFG->prefix.'user_students s JOIN '.$CFG->prefix.'user u ON u.id = s.userid WHERE course = '.$course->id;
}
if (!$us = get_records_sql($sql)) {
error('Cannot enter detailed view: No users found for this course.');
}
$admins = get_admins();
foreach ($us as $u) {
$role = $course->student;
if ($u->roleid == 2) {
$role = $course->teacher;
}
if (array_key_exists($u->userid,$admins)) {
$role = get_string('admin');
}
$users[$u->userid] = $role.' - '.fullname($u,true);
}
if (empty($time)) {
if (isadmin()) {
$sql = 'SELECT t.userid,u.firstname,u.lastname,u.idnumber,1 AS roleid FROM '.$CFG->prefix.'user_teachers t JOIN '.$CFG->prefix.'user u ON u.id = t.userid WHERE course = '.$course->id;
$moreusers = get_records_sql($sql);
foreach ($moreusers as $u) {
$users[$u->userid] = $course->teacher .' - '.fullname($u,true);
}
} else {
$users[$USER->id] = $course->teacher.' - '.fullname($USER,true);
}
}
// make sure we sort so teachers are at the top.
if (strcmp($course->student,$course->teacher) < 0) {
arsort($users);
} else {
asort($users);
}
$table->align = array('left','left','left','left','left','left','left','left');
$table->data[] = array(get_string('course'),choose_from_menu($courseoptions,'course',$course->id,'','','',true),
get_string('users'),choose_from_menu($users,'userid',$userid,'','','',true),
get_string('statsreporttype'),choose_from_menu($reportoptions,'report',$report,'','','',true),
get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true),
'<input type="submit" value="'.get_string('view').'" />') ;
} else {
$table->align = array('left','left','left','left','left','left','left');
$table->data[] = array(get_string('course'),choose_from_menu($courseoptions,'course',$course->id,'','','',true),
get_string('statsreporttype'),choose_from_menu($reportoptions,'report',$report,'','','',true),
get_string('statstimeperiod'),choose_from_menu($timeoptions,'time',$time,'','','',true),
'<input type="submit" value="'.get_string('view').'" />') ;
}
print_table($table);
echo '</form>';
if (!empty($report) && !empty($time)) {
if ($report == STATS_REPORT_LOGINS && $course->id != SITEID) {
error("This type of report is only available for the site course");
}
$param = stats_get_parameters($time,$report,$course->id,$mode);
if ($mode == STATS_MODE_DETAILED) {
$param->table = 'user_'.$param->table;
}
$sql = 'SELECT timeend,'.$param->fields.' FROM '.$CFG->prefix.'stats_'.$param->table.' WHERE '
.(($course->id == SITEID) ? '' : ' courseid = '.$course->id.' AND ')
.((!empty($userid)) ? ' userid = '.$userid.' AND ' : '')
. ((!empty($param->stattype)) ? ' stattype = \''.$param->stattype.'\' AND ' : '')
.' timeend >= '.$param->timeafter
.$param->extras
.' ORDER BY timeend DESC';
$stats = get_records_sql($sql);
if (empty($stats)) {
error(get_string('statsnodata'.((!empty($user)) ? 'user' : '')),$CFG->wwwroot.'/stats/index.php?course='.$course->id.'&mode='.$mode.'&time='.$time);
}
$stats = stats_fix_zeros($stats,$param->timeafter,$param->table,(!empty($param->line2)));
print_heading($course->shortname.' - '.get_string('statsreport'.$report).((!empty($user)) ? ' '.get_string('statsreportforuser').' ' .fullname($user,true) : ''));
if (empty($CFG->gdversion)) {
echo "(".get_string("gdneed").")";
} else {
if ($mode == STATS_MODE_DETAILED) {
echo '<center><img src="'.$CFG->wwwroot.'/course/report/stats/graph.php?mode='.$mode.'&course='.$course->id.'&time='.$time.'&report='.$report.'&userid='.$userid.'" /></center>';
} else {
echo '<center><img src="'.$CFG->wwwroot.'/course/report/stats/graph.php?mode='.$mode.'&course='.$course->id.'&time='.$time.'&report='.$report.'" /></center>';
}
}
$table = new object();
$table->align = array('left','center','center','center');
$param->table = str_replace('user_','',$param->table);
$table->head = array(get_string('periodending','moodle',$param->table),$param->line1);
if (!empty($param->line2)) {
$table->head[] = $param->line2;
}
$table->head[] = get_string('logs');
foreach ($stats as $stat) {
$a = array(userdate($stat->timeend-(60*60*24),get_string('strftimedate'),$CFG->timezone),$stat->line1);
if (isset($stat->line2)) {
$a[] = $stat->line2;
}
if (empty($CFG->loglifetime) || ($stat->timeend-(60*60*24)) >= (time()-60*60*24*$CFG->loglifetime)) {
$a[] = '<a href="'.$CFG->wwwroot.'/course/report/log/index.php?id='.$course->id.'&chooselog=1&showusers=1&showcourses=1&user='.$userid.'&date='.usergetmidnight($stat->timeend-(60*60*24)).'">'.get_string('course').' ' .get_string('logs').'</a>&nbsp;';
}
$table->data[] = $a;
}
print_table($table);
}
?>
+1 -1
View File
@@ -36,7 +36,7 @@
$form = stripslashes_safe($form);
}
// !! no db access using data from $form beyond this point !!
// !! no db access using data from $form beyond this point !!
}
// print_simple_box(get_string('courserequestintro'),'center');
+1 -4
View File
@@ -43,7 +43,7 @@
$courses = array();
/// If scale data is being submitted, then save it and continue
$focus = "";
$errors = NULL;
if ($action == 'sendform' and confirm_sesskey()) {
@@ -166,9 +166,6 @@
}
//Print out the headers
if (!isset($focus)) {
$focus = "";
}
print_header("$course->shortname: $strscales", "$course->fullname",
"<a href=\"view.php?id=$course->id\">$course->shortname</a>".
" -> <a href=\"scales.php?id=$course->id\">$strscales</a>".
+12 -13
View File
@@ -9,6 +9,9 @@
$page = optional_param('page', 0, PARAM_INT); // which page to show
$perpage = optional_param('perpage', 10, PARAM_INT); // how many per page
$moveto = optional_param('moveto', 0, PARAM_INT); // move to category
$edit = optional_param('edit', -1, PARAM_BOOL);
$hide = optional_param('hide', 0, PARAM_INT);
$show = optional_param('show', 0, PARAM_INT);
$search = trim(strip_tags($search)); // trim & clean raw searched string
@@ -29,23 +32,19 @@
}
if (iscreator()) {
if (isset($_GET['edit']) and confirm_sesskey()) {
if ($edit == "on") {
$USER->categoriessearchediting = true;
} else if ($edit == "off") {
$USER->categoriessearchediting = false;
}
if ($edit !== -1) {
$USER->categoryediting = $edit;
// If the edit mode we are leaving has higher per page than the one we are entering,
// with pages, chances are you will get a no courses found error. So when we are switching
// modes, set page to 0.
$page = 0;
}
$creatorediting = !empty($USER->categoriessearchediting);
$creatorediting = !empty($USER->categoryediting);
$adminediting = (isadmin() and $creatorediting);
} else {
$creatorediting = false;
$adminediting = false;
$creatorediting = false;
}
/// Editing functions
@@ -54,8 +53,8 @@
/// Hide or show a course
if ((isset($hide) or isset($show)) and confirm_sesskey()) {
if (isset($hide)) {
if ($hide or $show and confirm_sesskey()) {
if ($hide) {
$course = get_record("course", "id", $hide);
$visible = 0;
} else {
@@ -162,7 +161,7 @@
echo "<form name=\"movecourses\" action=\"search.php\" method=\"post\">";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\">";
echo "<input type=\"hidden\" name=\"search\" value=\"".s($search)."\">";
echo "<input type=\"hidden\" name=\"search\" value=\"".s($search, true)."\">";
echo "<input type=\"hidden\" name=\"page\" value=\"$page\">";
echo "<input type=\"hidden\" name=\"perpage\" value=\"$perpage\">";
echo "<table align=\"center\" border=0 cellspacing=2 cellpadding=4 class=\"generalbox\"><tr>";
@@ -225,7 +224,7 @@
}
} else {
print_heading(get_string("nocoursesfound", "", s($search)));
print_heading(get_string("nocoursesfound", "", s($search, true)));
}
echo "<br /><br />";
+1 -1
View File
@@ -211,8 +211,8 @@
$user_complete($course, $user, $mod, $instance);
echo "</ul>";
ob_end_clean();
$output = ob_get_contents();
ob_end_clean();
if (str_replace(' ', '', $output) != '<ul></ul>') {
echo $output;
+1 -1
View File
@@ -15,7 +15,7 @@
$studentview = optional_param('studentview', -1, PARAM_BOOL);
$section = optional_param('section', 0, PARAM_INT);
$move = optional_param('move', 0, PARAM_INT);
$marker = optional_param('marker',0 , PARAM_INT);
$marker = optional_param('marker',-1 , PARAM_INT);
if (empty($id) && empty($name) && empty($idnumber)) {
@@ -1,7 +1,7 @@
<?php // $Id$
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
die('Direct access to this script is forbidden.');
}
define('AN_APPROVED', '1');
@@ -156,6 +156,7 @@ function authorizenet_action(&$order, &$message, &$extra, $action=AN_ACTION_NONE
return false;
}
$total = floatval($extra->sum) + floatval($extra->amount);
unset($extra->sum); // this is not used in refunds table.
if (($extra->amount == 0) || ($total > $order->amount)) {
$message = "Can be credited up to original amount.";
return false;
@@ -294,7 +295,7 @@ function authorizenet_action(&$order, &$message, &$extra, $action=AN_ACTION_NONE
if (!empty($CFG->an_avs)) {
$avs = "avs" . strtolower($response[5]);
$stravs = get_string($avs, "enrol_authorize");
$message .= "<br />" . get_string("avsresult", "enrol_authorize") . $stravs;
$message .= "<br />" . get_string("avsresult", "enrol_authorize", $stravs);
}
return false;
}
+77 -31
View File
@@ -15,19 +15,34 @@ if (!isset($frm->an_test)) $frm->an_test = '';
if (!isset($frm->an_review)) $frm->an_review = '';
if (!isset($frm->an_capture_day)) $frm->an_capture_day = '5';
if (!isset($frm->an_emailexpired)) $frm->an_emailexpired = '2';
if (!isset($frm->an_emailexpiredteacher)) $frm->an_emailexpiredteacher = '';
if (!isset($frm->an_sorttype)) $frm->an_sorttype = 'ttl';
if (!isset($frm->an_teachermanagepay)) $frm->an_teachermanagepay = '';
if (isset($CFG->an_cutoff)) {
$frm->an_cutoff_hour = intval($CFG->an_cutoff) / 60;
$frm->an_cutoff_min = intval($CFG->an_cutoff) % 60;
$cutoff = intval($CFG->an_cutoff);
$mins = $cutoff % 60; $hrs = ($cutoff - $mins) / 60;
$frm->an_cutoff_hour = $hrs; $frm->an_cutoff_min = $mins;
}
if (!isset($frm->an_cutoff_hour)) {
$timezone = format_float(get_user_timezone_offset(), 1);
$frm->an_cutoff_hour = intval($timezone);
$frm->an_cutoff_min = (intval(round($timezone)) != intval($timezone)) ? 35 : 5;
}
if (!isset($frm->acceptccs)) {
$frm->acceptccs = array_keys(get_list_of_creditcards());
$CFG->an_acceptccs = implode(',', $frm->acceptccs);
}
if (!isset($frm->an_cutoff_hour)) $frm->an_cutoff_hour = '0';
if (!isset($frm->an_cutoff_min)) $frm->an_cutoff_min = '5';
?>
<table cellspacing="0" cellpadding="5" border="0" align="center">
<tr valign="top">
<td colspan="3" align="right"><a href="../enrol/authorize/index.php"><?php print_string("paymentmanagement", "enrol_authorize") ?></a></td>
</tr>
<tr valign="top"><td colspan="3"><h4><?php print_string("adminauthorizewide", "enrol_authorize") ?></h4></td></tr>
<tr valign="top">
@@ -43,6 +58,13 @@ if (!isset($frm->an_cutoff_min)) $frm->an_cutoff_min = '5';
</td>
</tr>
<tr valign="top">
<td align="right">an_teachermanagepay:</td>
<td><?php print_checkbox('an_teachermanagepay', '1', !empty($frm->an_teachermanagepay)) ?></td>
<td><?php print_string("adminteachermanagepay", "enrol_authorize") ?></td>
</tr>
<?php if (substr($CFG->wwwroot, 0, 5) !== 'https') { /* https && loginhttps */ ?>
<tr valign="top">
<td align="right">loginhttps:</td>
<td><?php echo (empty($CFG->loginhttps) ? "<font color=\"red\"><b>off</b></font>" : "<font color=\"green\">on</font>") ?></td>
@@ -51,6 +73,7 @@ if (!isset($frm->an_cutoff_min)) $frm->an_cutoff_min = '5';
print_string("logindesc", "enrol_authorize", $a)
?></td>
</tr>
<?php } /* end: https && loginhttps */ ?>
<tr valign="top"><td colspan="3"><h4><?php print_string("adminauthorizesettings", "enrol_authorize") ?></h4></td></tr>
@@ -83,20 +106,6 @@ if (!isset($frm->an_cutoff_min)) $frm->an_cutoff_min = '5';
<td><?php print_string("anreferer", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_avs:</td>
<td><input type="checkbox" value="1" name="an_avs" <?php if (!empty($frm->an_avs)) echo "checked=\"true\"" ?> /></td>
<td><?php print_string("adminavs", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_test:</td>
<td><input type="checkbox" value="1" name="an_test" <?php if (!empty($frm->an_test)) echo "checked=\"true\"" ?> /></td>
<td><?php print_string("antestmode", "enrol_authorize") ?></td>
</tr>
<tr valign="top"><td colspan="3"><h4><?php print_string("adminauthorizeccapture", "enrol_authorize") ?></h4></td></tr>
<tr valign="top">
<td align="right">an_cutoff:</td>
<td><?php print_time_selector("an_cutoff_hour","an_cutoff_min",make_timestamp(2000,1,1,$frm->an_cutoff_hour,$frm->an_cutoff_min),5); ?></td>
@@ -104,14 +113,35 @@ if (!isset($frm->an_cutoff_min)) $frm->an_cutoff_min = '5';
</tr>
<tr valign="top">
<td align="right">an_teachermanagepay:</td>
<td><input type="checkbox" value="1" name="an_teachermanagepay" <?php if (!empty($frm->an_teachermanagepay)) echo "checked=\"true\"" ?> /></td>
<td><?php print_string("adminteachermanagepay", "enrol_authorize") ?></td>
<td align="right">an_avs:</td>
<td><?php print_checkbox('an_avs', '1', !empty($frm->an_avs)) ?></td>
<td><?php print_string("adminavs", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_test:</td>
<td><?php print_checkbox('an_test', '1', !empty($frm->an_test)) ?></td>
<td><?php print_string("antestmode", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_acceptccs:</td>
<td><?php
$allccs = get_list_of_creditcards(true);
foreach ($allccs as $key => $val) {
print_checkbox('acceptccs[]', $key, stristr($CFG->an_acceptccs, $key) !== false, $val); echo "<br />\n";
}
?></td>
<td><?php print_string("adminacceptccs", "enrol_authorize") ?></td>
</tr>
<tr valign="top"><td colspan="3"><h4><?php print_string("adminauthorizeccapture", "enrol_authorize") ?>
<?php helpbutton('orderreview', '', 'enrol/authorize'); ?>
</h4></td></tr>
<tr valign="top">
<td align="right">an_review:</td>
<td><input type="checkbox" value="1" name="an_review" <?php if (!empty($frm->an_review)) echo "checked=\"true\"" ?> />
<td><?php print_checkbox('an_review', '1', !empty($frm->an_review)) ?>
<?php helpbutton('review', get_string('adminhelpreviewtitle', 'enrol_authorize'), 'enrol/authorize'); ?></td>
<td><?php print_string("adminreview", "enrol_authorize") ?></td>
</tr>
@@ -123,29 +153,45 @@ if (!isset($frm->an_cutoff_min)) $frm->an_cutoff_min = '5';
<td><?php print_string("reviewday", "enrol_authorize", $frm->an_capture_day) ?></td>
</tr>
<tr valign="top">
<td align="right">an_emailexpired:</td>
<td><input type="text" name="an_emailexpired" size="1" maxlength="1" value="<?php p($frm->an_emailexpired) ?>" /></td>
<td><?php print_string("adminemailexpired", "enrol_authorize", $frm->an_emailexpired) ?></td>
</tr>
<tr valign="top"><td colspan="3"><h4><?php print_string("adminauthorizeemail", "enrol_authorize") ?></h4></td></tr>
<tr valign="top">
<td align="right">an_emailexpired:</td>
<td><input type="text" name="an_emailexpired" size="1" maxlength="1" value="<?php p($frm->an_emailexpired) ?>" /></td>
<td><?php print_string("adminemailexpired", "enrol_authorize", $frm->an_emailexpired) ?><br />
<?php print_string("adminemailexpsetting", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_emailexpiredteacher:</td>
<td><?php print_checkbox('an_emailexpiredteacher', '1', !empty($frm->an_emailexpiredteacher)) ?></td>
<td><?php print_string("adminemailexpiredteacher", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_sorttype:</td>
<td><?php
$sorts = array('ttl' => get_string('adminemailexpiredsortsum', 'enrol_authorize'),
'cnt' => get_string('adminemailexpiredsortcount', 'enrol_authorize'));
choose_from_menu($sorts, "an_sorttype", $frm->an_sorttype, "","", "") ?></td>
<td><?php print_string("adminemailexpiredsort", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">enrol_mailstudents:</td>
<td><input type="checkbox" value=1 name="enrol_mailstudents" <?php if (!empty($frm->enrol_mailstudents)) echo "checked=\"true\"" ?> /></td>
<td><?php print_checkbox('enrol_mailstudents', '1', !empty($frm->enrol_mailstudents)) ?></td>
<td><?php print_string("mailstudents") ?></td>
</tr>
<tr valign="top">
<td align="right">enrol_mailteachers:</td>
<td><input type="checkbox" value=1 name="enrol_mailteachers" <?php if (!empty($frm->enrol_mailteachers)) echo "checked=\"true\"" ?> /></td>
<td><?php print_checkbox('enrol_mailteachers', '1', !empty($frm->enrol_mailteachers)) ?></td>
<td><?php print_string("mailteachers") ?></td>
</tr>
<tr valign="top">
<td align="right">enrol_mailadmins:</td>
<td><input type="checkbox" value=1 name="enrol_mailadmins" <?php if (!empty($frm->enrol_mailadmins)) echo "checked=\"true\"" ?> /></td>
<td><?php print_checkbox('enrol_mailadmins', '1', !empty($frm->enrol_mailadmins)) ?></td>
<td><?php print_string("mailadmins") ?></td>
</tr>
+47 -73
View File
@@ -1,83 +1,57 @@
<?php // $Id$
/**
* New order. No transaction was made.
*/
define('AN_STATUS_NONE', 0x00);
/**
* Authorized.
*/
define('AN_STATUS_AUTH', 0x01);
/**
* Captured.
*/
define('AN_STATUS_CAPTURE', 0x02);
/**
* AN_STATUS_AUTH|AN_STATUS_CAPTURE.
/**#@+
* Order status used in enrol_authorize table.
*
* NONE: New order or order is in progress. TransactionID hasn't received yet.
* AUTH: Authorized/Pending Capture.
* CAPTURE: Captured.
* AUTHCAPTURE: Authorized/Captured
* CREDIT: Refunded.
* VOID: Cancelled.
* EXPIRE: Expired. Orders be expired unless be accepted within 30 days.
* TEST: Tested. It means created in TEST mode and TransactionID is 0.
*/
define('AN_STATUS_NONE', 0x00);
define('AN_STATUS_AUTH', 0x01);
define('AN_STATUS_CAPTURE', 0x02);
define('AN_STATUS_AUTHCAPTURE', 0x03);
define('AN_STATUS_CREDIT', 0x04);
define('AN_STATUS_VOID', 0x08);
define('AN_STATUS_EXPIRE', 0x10);
define('AN_STATUS_TEST', 0x80);
/**#@-*/
/**
* Refunded.
*/
define('AN_STATUS_CREDIT', 0x04);
/**
* Voided.
*/
define('AN_STATUS_VOID', 0x08);
/**
* Expired.
*/
define('AN_STATUS_EXPIRE', 0x10);
/**
* No action.
*/
define('AN_ACTION_NONE', 0x00);
/**
* Used to authorize only, don't capture.
*/
define('AN_ACTION_AUTH_ONLY', 0x01);
/**
* Used to capture, it was authorized before.
*/
define('AN_ACTION_PRIOR_AUTH_CAPTURE', 0x02);
/**
* Used to authorize and capture.
*/
define('AN_ACTION_AUTH_CAPTURE', 0x03);
/**
* Used to return funds to a customer's credit card.
/**#@+
* Actions used in authorizenet_action function.
*
* - Can be credited within 120 days after the original authorization was obtained.
* - Amount can be any amount up to the original amount charged.
* - Captured/pending settlement transactions cannot be credited,
* instead a void must be issued to cancel the settlement.
* NOTE: Assigns a new transactionID to the original transaction.
* SAVE IT, so we can cancel new refund if it is a fault return.
*/
define('AN_ACTION_CREDIT', 0x04);
/**
* Used to cancel an exiting transaction with a status of
* authorized/pending capture, captured/pending settlement or
* settled/refunded.
* NONE: No action. Function always returns false.
* AUTH_ONLY: Used to authorize only, don't capture.
* PRIOR_AUTH_CAPTURE: Used to capture, it was authorized before.
* AUTH_CAPTURE: Used to authorize and capture.
* CREDIT: Used to return funds to a customer's credit card.
* VOID: Used to cancel an exiting pending transaction.
*
* - Void requests effectively cancel the Capture request
* that would start the funds transfer process.
* - Also used to cancel existing transaction with a status of
* settled/refunded. Credited mistakenly, so cancel it
* and return funds to our account.
* Credit rules:
* 1. It can be credited within 120 days after the original authorization was obtained.
* 2. Amount can be any amount up to the original amount charged.
* 3. Captured/pending settlement transactions cannot be credited,
* instead a void must be issued to cancel the settlement.
* NOTE: It assigns a new transactionID to the original transaction.
* We should save it, so admin can cancel new transaction if it is a mistake return.
*
* Void rules:
* 1. These requests effectively cancel the Capture request that would start the funds transfer process.
* 2. It mustn't be settled. Please set up settlement date correctly.
* 3. These transactions can be voided:
* authorized/pending capture, captured/pending settlement, credited/pending settlement
*/
define('AN_ACTION_VOID', 0x08);
define('AN_ACTION_NONE', 0x00);
define('AN_ACTION_AUTH_ONLY', 0x01);
define('AN_ACTION_PRIOR_AUTH_CAPTURE', 0x02);
define('AN_ACTION_AUTH_CAPTURE', 0x03);
define('AN_ACTION_CREDIT', 0x04);
define('AN_ACTION_VOID', 0x08);
/**#@-*/
?>
+10 -5
View File
@@ -19,7 +19,7 @@ function enrol_authorize_upgrade($oldversion=0) {
}
if ($oldversion && $oldversion < 2005071602) {
notify("If you are using the authorize.net enrolment plugin for credit card
notify("If you are using the authorize.net enrolment plugin for credit card
handling, please ensure that you have turned loginhttps ON in Admin >> Variables >> Security.");
}
@@ -29,11 +29,12 @@ function enrol_authorize_upgrade($oldversion=0) {
table_column('enrol_authorize', '', 'timecreated', 'integer', '10', 'unsigned', '0', 'not null', 'status');
table_column('enrol_authorize', '', 'timeupdated', 'integer', '10', 'unsigned', '0', 'not null', 'timecreated');
// status index for speed.
execute_sql(" ALTER TABLE `{$CFG->prefix}enrol_authorize` ADD INDEX status(status) ");
execute_sql("ALTER TABLE `{$CFG->prefix}enrol_authorize` ADD INDEX status(status)");
// defaults.
$timenow = time();
$status = AN_STATUS_AUTH | AN_STATUS_CAPTURE;
execute_sql(" UPDATE {$CFG->prefix}enrol_authorize SET timecreated='$timenow', timeupdated='$timenow', status='$status' ", false);
execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET status='$status' WHERE transid<>'0'", false);
$timenow = time();
execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET timecreated='$timenow', timeupdated='$timenow'", false);
}
if ($oldversion < 2005121200) {
@@ -65,7 +66,7 @@ function enrol_authorize_upgrade($oldversion=0) {
table_column('enrol_authorize', 'timeupdated', 'settletime', 'integer', '10', 'unsigned', '0', 'not null');
$status = AN_STATUS_AUTH | AN_STATUS_CAPTURE;
if ($settlements = get_records_select('enrol_authorize', "status='$status'", '', 'id, settletime')) {
include_once("$CFG->dirroot/enrol/authorize/action.php");
include_once("$CFG->dirroot/enrol/authorize/authorizenetlib.php");
foreach ($settlements as $settlement) {
execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET settletime = '" .
getsettletime($settlement->settletime) . "' WHERE id = '$settlement->id'", false);
@@ -103,6 +104,10 @@ function enrol_authorize_upgrade($oldversion=0) {
table_column('enrol_authorize', 'transid', 'transid', 'integer', '10', 'unsigned', '0', 'not null');
}
if ($oldversion < 2006021501) { // delete an_nextmail record from config_plugins table
delete_records('config_plugins', 'name', 'an_nextmail');
}
return $result;
}
+12 -7
View File
@@ -42,9 +42,10 @@ function enrol_authorize_upgrade($oldversion=0) {
// status index for speed.
modify_database('',"CREATE INDEX prefix_enrol_authorize_status_idx ON prefix_enrol_authorize (status);");
// defaults.
$timenow = time();
$status = AN_STATUS_AUTH | AN_STATUS_CAPTURE;
execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET timecreated='$timenow', timeupdated='$timenow', status='$status'", false);
execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET status='$status' WHERE transid<>'0'", false);
$timenow = time();
execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET timecreated='$timenow', timeupdated='$timenow'", false);
}
if ($oldversion < 2005121200) {
@@ -76,7 +77,7 @@ function enrol_authorize_upgrade($oldversion=0) {
table_column('enrol_authorize', 'timeupdated', 'settletime', 'integer', '10', 'unsigned', '0', 'not null');
$status = AN_STATUS_AUTH | AN_STATUS_CAPTURE;
if ($settlements = get_records_select('enrol_authorize', "status='$status'", '', 'id, settletime')) {
include_once("$CFG->dirroot/enrol/authorize/action.php");
include_once("$CFG->dirroot/enrol/authorize/authorizenetlib.php");
foreach ($settlements as $settlement) {
execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET settletime = '" .
getsettletime($settlement->settletime) . "' WHERE id = '$settlement->id'", false);
@@ -92,10 +93,10 @@ function enrol_authorize_upgrade($oldversion=0) {
}
if ($oldversion < 2006010200) { // rename an_review_day
if (isset($CFG->an_review_day)) {
set_config('an_capture_day', $CFG->an_review_day);
delete_records('config', 'name', 'an_review_day');
}
if (isset($CFG->an_review_day)) {
set_config('an_capture_day', $CFG->an_review_day);
delete_records('config', 'name', 'an_review_day');
}
}
if ($oldversion < 2006020100) { // rename an_cutoff_hour and an_cutoff_min to an_cutoff
@@ -114,6 +115,10 @@ function enrol_authorize_upgrade($oldversion=0) {
table_column('enrol_authorize', 'transid', 'transid', 'integer', '10', 'unsigned', '0', 'not null');
}
if ($oldversion < 2006021501) { // delete an_nextmail record from config_plugins table
delete_records('config_plugins', 'name', 'an_nextmail');
}
return $result;
}
+1 -1
View File
@@ -8,7 +8,7 @@ CREATE TABLE prefix_enrol_authorize (
status integer DEFAULT 0 NOT NULL,
timecreated integer DEFAULT 0 NOT NULL,
settletime integer DEFAULT 0 NOT NULL,
amount varchar(10) DEFAULT '0',
amount varchar(10) DEFAULT '0' NOT NULL,
currency varchar(3) DEFAULT 'USD' NOT NULL
);
+1 -6
View File
@@ -59,12 +59,7 @@ $usercountry = empty($form->cccountry) ? $USER->country : $form->cccountry;
<tr>
<td align="right"><?php print_string("cctype", "enrol_authorize") ?>: </td>
<td align="left"><?php
$CCTYPES = array(
'mcd' => 'Master Card', 'vis' => 'Visa', 'amx' => 'American Express',
'dsc' => 'Discover', 'dnc' => 'Diners Club', 'jcb' => 'JCB',
'swi' => 'Switch', 'dlt' => 'Delta', 'enr' => 'EnRoute'
);
choose_from_menu($CCTYPES, 'cctype', $form->cctype);
choose_from_menu(get_list_of_creditcards(), 'cctype', $form->cctype);
if (!empty($this->ccerrors['cctype'])) { formerr($this->ccerrors['cctype']); }
?>
</td>
+164 -71
View File
@@ -1,7 +1,43 @@
<?php // $Id$
require_once $CFG->dirroot.'/enrol/enrol.class.php';
require_once $CFG->dirroot.'/enrol/authorize/const.php';
require_once($CFG->dirroot.'/enrol/enrol.class.php');
require_once($CFG->dirroot.'/enrol/authorize/const.php');
/**
* get_list_of_creditcards
*
* @param bool $getall
* @return array
*/
function get_list_of_creditcards($getall = false)
{
global $CFG;
$alltypes = array(
'mcd' => 'Master Card',
'vis' => 'Visa',
'amx' => 'American Express',
'dsc' => 'Discover',
'dnc' => 'Diners Club',
'jcb' => 'JCB',
'swi' => 'Switch',
'dlt' => 'Delta',
'enr' => 'EnRoute'
);
if ($getall || empty($CFG->an_acceptccs)) {
return $alltypes;
}
$ret = array();
$ccs = explode(',', $CFG->an_acceptccs);
foreach ($ccs as $key) {
$ret[$key] = $alltypes[$key];
}
return $ret;
}
/**
* enrolment_plugin_authorize
@@ -36,7 +72,7 @@ class enrolment_plugin_authorize
{
global $CFG, $USER, $form;
if ($this->zero_cost($course) || isguest()) {
if ($this->zero_cost($course) or isguest()) {
$manual = enrolment_factory::factory('manual');
$manual->print_entry($course);
return; // No money for guests ;)
@@ -64,11 +100,11 @@ class enrolment_plugin_authorize
if ($course->password) {
print_simple_box(get_string('choosemethod', 'enrol_authorize'), 'center');
$password = '';
include $CFG->dirroot.'/enrol/manual/enrol.html';
include($CFG->dirroot.'/enrol/manual/enrol.html');
}
print_simple_box_start('center');
include $CFG->dirroot.'/enrol/authorize/enrol.html';
include($CFG->dirroot.'/enrol/authorize/enrol.html');
print_simple_box_end();
print_footer();
@@ -83,10 +119,10 @@ class enrolment_plugin_authorize
* @access public
*/
function check_entry($form, $course) {
if ((!empty($form->password)) || isguest() || $this->zero_cost($course)) {
if ((!empty($form->password)) or isguest() or $this->zero_cost($course)) {
$manual = enrolment_factory::factory('manual');
$manual->check_entry($form, $course);
} elseif ((!empty($form->ccsubmit)) && $this->validate_enrol_form($form)) {
} elseif ((!empty($form->ccsubmit)) and $this->validate_enrol_form($form)) {
$this->cc_submit($form, $course);
}
}
@@ -103,7 +139,7 @@ class enrolment_plugin_authorize
function cc_submit($form, $course)
{
global $CFG, $USER, $SESSION;
require_once $CFG->dirroot.'/enrol/authorize/action.php';
require_once('authorizenetlib.php');
$this->prevent_double_paid($course);
@@ -181,6 +217,7 @@ class enrolment_plugin_authorize
if ($an_review) { // review enabled, inform admin and redirect to main page.
if (update_record("enrol_authorize", $order)) {
$a = new stdClass;
$a->url = "$CFG->wwwroot/enrol/authorize/index.php?order=$order->id";
$a->orderid = $order->id;
$a->transid = $order->transid;
@@ -191,6 +228,7 @@ class enrolment_plugin_authorize
$a->user = fullname($USER);
$a->acstatus = ($CFG->an_capture_day > 0) ? get_string('yes') : get_string('no');
$emailmessage = get_string('adminneworder', 'enrol_authorize', $a);
$a = new stdClass;
$a->course = $course->shortname;
$a->orderid = $order->id;
$emailsubject = get_string('adminnewordersubject', 'enrol_authorize', $a);
@@ -224,6 +262,7 @@ class enrolment_plugin_authorize
if (enrol_student($USER->id, $course->id, $timestart, $timeend, 'authorize')) {
$teacher = get_teacher($course->id);
if (!empty($CFG->enrol_mailstudents)) {
$a = new stdClass;
$a->coursename = "$course->fullname";
$a->profileurl = "$CFG->wwwroot/user/view.php?id=$USER->id";
email_to_user($USER,
@@ -232,6 +271,7 @@ class enrolment_plugin_authorize
get_string('welcometocoursetext', '', $a));
}
if (!empty($CFG->enrol_mailteachers)) {
$a = new stdClass;
$a->course = "$course->fullname";
$a->user = fullname($USER);
email_to_user($teacher,
@@ -240,6 +280,7 @@ class enrolment_plugin_authorize
get_string('enrolmentnewuser', '', $a));
}
if (!empty($CFG->enrol_mailadmins)) {
$a = new stdClass;
$a->course = "$course->fullname";
$a->user = fullname($USER);
$admins = get_admins();
@@ -271,36 +312,39 @@ class enrolment_plugin_authorize
function validate_enrol_form($form)
{
global $CFG;
require_once $CFG->dirroot.'/enrol/authorize/ccval.php';
require_once('ccval.php');
$ccexpiremm = intval($form->ccexpiremm);
$ccexpireyyyy = intval($form->ccexpireyyyy);
if (empty($ccexpiremm) || empty($ccexpireyyyy)) {
$this->ccerrors['ccexpire'] = get_string('missingccexpire', 'enrol_authorize');
}
$expdate = sprintf("%02d", $ccexpiremm) . strval($ccexpireyyyy);
$validcc = CCVal($form->cc, $form->cctype, $expdate);
if (!$validcc) {
if ($validcc === 0) {
$this->ccerrors['ccexpire'] = get_string('ccexpired', 'enrol_authorize');
}
else {
$this->ccerrors['cc'] = get_string('ccinvalid', 'enrol_authorize');
}
}
if (empty($form->ccfirstname) || empty($form->cclastname)) {
$this->ccerrors['ccfirstlast'] = get_string('missingfullname');
}
if (empty($form->cc)) {
$this->ccerrors['cc'] = get_string('missingcc', 'enrol_authorize');
}
if (empty($form->ccexpiremm) || empty($form->ccexpireyyyy)) {
$this->ccerrors['ccexpire'] = get_string('missingccexpire', 'enrol_authorize');
}
else {
$expdate = sprintf("%02d", intval($form->ccexpiremm)) . $form->ccexpireyyyy;
$validcc = CCVal($form->cc, $form->cctype, $expdate);
if (!$validcc) {
if ($validcc === 0) {
$this->ccerrors['ccexpire'] = get_string('ccexpired', 'enrol_authorize');
}
else {
$this->ccerrors['cc'] = get_string('ccinvalid', 'enrol_authorize');
}
}
}
if (empty($form->ccfirstname) || empty($form->cclastname)) {
$this->ccerrors['ccfirstlast'] = get_string('missingfullname');
}
if (empty($form->cvv) || !is_numeric($form->cvv)) {
$this->ccerrors['cvv'] = get_string('missingcvv', 'enrol_authorize');
}
if (empty($form->cctype)) {
if (empty($form->cctype) || !in_array($form->cctype, array_keys(get_list_of_creditcards()))) {
$this->ccerrors['cctype'] = get_string('missingcctype', 'enrol_authorize');
}
if (!empty($CFG->an_avs)) {
if (empty($form->ccaddress)) {
$this->ccerrors['ccaddress'] = get_string('missingaddress', 'enrol_authorize');
@@ -412,7 +456,7 @@ class enrolment_plugin_authorize
notify('PHP must be compiled with SSL support (--with-openssl)');
}
if (empty($CFG->loginhttps)) {
if (empty($CFG->loginhttps) and substr($CFG->wwwroot, 0, 5) !== 'https') {
notify('loginhttps must be ON');
}
@@ -428,6 +472,7 @@ class enrolment_plugin_authorize
}
if ($count = count_records('enrol_authorize', 'status', AN_STATUS_AUTH)) {
$a = new stdClass;
$a->count = $count;
$a->url = $CFG->wwwroot."/enrol/authorize/index.php?status=".AN_STATUS_AUTH;
notify(get_string('adminpendingorders', 'enrol_authorize', $a));
@@ -442,7 +487,7 @@ class enrolment_plugin_authorize
}
}
include $CFG->dirroot.'/enrol/authorize/config.html';
include($CFG->dirroot.'/enrol/authorize/config.html');
}
@@ -460,24 +505,29 @@ class enrolment_plugin_authorize
// site settings
set_config('enrol_cost', optional_param('enrol_cost', 5, PARAM_INT));
set_config('enrol_currency', optional_param('enrol_currency', 'USD', PARAM_ALPHA));
set_config('enrol_mailstudents', optional_param('enrol_mailstudents', ''));
set_config('enrol_mailteachers', optional_param('enrol_mailteachers', ''));
set_config('enrol_mailadmins', optional_param('enrol_mailadmins', ''));
set_config('enrol_mailstudents', optional_param('enrol_mailstudents', 0, PARAM_BOOL));
set_config('enrol_mailteachers', optional_param('enrol_mailteachers', 0, PARAM_BOOL));
set_config('enrol_mailadmins', optional_param('enrol_mailadmins', 0, PARAM_BOOL));
// optional authorize.net settings
set_config('an_avs', optional_param('an_avs', ''));
set_config('an_test', optional_param('an_test', ''));
set_config('an_teachermanagepay', optional_param('an_teachermanagepay', ''));
set_config('an_avs', optional_param('an_avs', 0, PARAM_BOOL));
set_config('an_test', optional_param('an_test', 0, PARAM_BOOL));
set_config('an_teachermanagepay', optional_param('an_teachermanagepay', 0, PARAM_BOOL));
set_config('an_referer', optional_param('an_referer', 'http://', PARAM_URL));
$acceptccs = optional_param('acceptccs', array_keys(get_list_of_creditcards()), PARAM_ALPHA);
set_config('an_acceptccs', implode(',', $acceptccs));
$cutoff_hour = optional_param('an_cutoff_hour', 0, PARAM_INT);
$cutoff_min = optional_param('an_cutoff_min', 5, PARAM_INT);
set_config('an_cutoff', $cutoff_hour * 60 + $cutoff_min);
// cron depencies
$reviewval = optional_param('an_review', '');
$reviewval = optional_param('an_review', 0, PARAM_BOOL);
$captureday = optional_param('an_capture_day', 5, PARAM_INT);
$emailexpired = optional_param('an_emailexpired', 2, PARAM_INT);
$emailexpiredteacher = optional_param('an_emailexpiredteacher', 0, PARAM_BOOL);
$sorttype = optional_param('an_sorttype', 'ttl', PARAM_ALPHA);
$captureday = ($captureday > 29) ? 29 : (($captureday < 0) ? 0 : $captureday);
$emailexpired = ($emailexpired > 5) ? 5 : (($emailexpired < 0) ? 0 : $emailexpired);
@@ -492,14 +542,18 @@ class enrolment_plugin_authorize
set_config('an_review', $reviewval);
set_config('an_capture_day', $captureday);
set_config('an_emailexpired', $emailexpired);
set_config('an_emailexpiredteacher', $emailexpiredteacher);
set_config('an_sorttype', $sorttype);
// required fields
$loginval = optional_param('an_login', '');
$tranval = optional_param('an_tran_key', '');
$passwordval = optional_param('an_password', '');
if (empty($CFG->loginhttps) || (!$this->check_openssl_loaded()) ||
empty($loginval) || (empty($tranval) && empty($passwordval))) {
if ((empty($CFG->loginhttps) and substr($CFG->wwwroot, 0, 5) !== 'https') ||
!$this->check_openssl_loaded() ||
empty($loginval) ||
(empty($tranval) and empty($passwordval))) {
return false;
}
@@ -518,16 +572,17 @@ class enrolment_plugin_authorize
* @param mixed $data
* @access private
*/
function email_to_admin($subject, $data) {
$admin = get_admin();
function email_to_admin($subject, $data)
{
$site = get_site();
$admin = get_admin();
$data = (array)$data;
$message = "$site->fullname: Transaction failed.\n\n$subject\n\n";
foreach ($data as $key => $value) {
$message .= "$key => $value\n";
}
email_to_user($admin, $admin, "CC ERROR: ".$subject, $message);
email_to_user($admin, $admin, "Authorize.net ERROR: ".$subject, $message);
}
@@ -544,9 +599,10 @@ class enrolment_plugin_authorize
$status = empty($CFG->an_test) ? AN_STATUS_AUTH : AN_STATUS_NONE;
if ($rec=get_record('enrol_authorize','userid',$USER->id,'courseid',$course->id,'status',$status,'id')) {
$a = new stdClass;
$a->orderid = $rec->id;
$a->url = "$CFG->wwwroot/enrol/authorize/index.php?order=$a->orderid";
redirect($CFG->wwwroot, get_string("paymentpending", "enrol_authorize", $a), '20');
redirect($a->url, get_string("paymentpending", "enrol_authorize", $a), '10');
return;
}
if (isset($SESSION->ccpaid)) {
@@ -574,44 +630,80 @@ class enrolment_plugin_authorize
*/
function cron()
{
global $CFG;
require_once $CFG->dirroot.'/enrol/authorize/action.php';
global $CFG, $SITE;
require_once($CFG->dirroot.'/enrol/authorize/authorizenetlib.php');
$oneday = 86400;
$timenow = time();
$random100 = mt_rand(0, 100);
$timenowsettle = getsettletime($timenow);
$timediff30 = $timenowsettle - (30 * $oneday);
$mconfig = get_config('enrol/authorize');
set_config('an_lastcron', $timenow, 'enrol/authorize');
if ($random100 < 33) {
$select = "(status = '" .AN_STATUS_NONE. "') AND (timecreated < '$timediff30')";
if (intval($mconfig->an_dailysettlement) <= $timenowsettle) {
set_config('an_dailysettlement', $timenowsettle + $oneday, 'enrol/authorize');
// Some clean-up and update
$select = "(status='".AN_STATUS_NONE."') AND (timecreated<'$timediff30')";
delete_records_select('enrol_authorize', $select);
}
elseif ($random100 > 66) {
$select = "(status = '" .AN_STATUS_AUTH. "') AND (timecreated < '$timediff30')";
execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET status = '" .AN_STATUS_EXPIRE. "' WHERE $select", false);
}
else {
$select = "(status='".AN_STATUS_AUTH."') AND (timecreated<'$timediff30')";
execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET status='".AN_STATUS_EXPIRE."' WHERE $select", false);
$timediff60 = $timenowsettle - (60 * $oneday);
$select = "(status = '" .AN_STATUS_EXPIRE. "') AND (timecreated < '$timediff60')";
$select = "(status='".AN_STATUS_EXPIRE."') AND (timecreated<'$timediff60')";
delete_records_select('enrol_authorize', $select);
}
if (!empty($CFG->an_emailexpired) && intval($mconfig->an_nextmail) < $timenowsettle) {
set_config('an_nextmail', $timenowsettle + $oneday + 1, 'enrol/authorize');
$timediffem = $timenowsettle - ((30 - intval($CFG->an_emailexpired)) * $oneday);
$select = "(status = '" . AN_STATUS_AUTH . "') AND " .
"(timecreated < '$timediffem') AND (timecreated > '$timediff30')";
if ($count = count_records_select('enrol_authorize', $select)) {
$a->pending = $count;
$a->days = $CFG->an_emailexpired;
$a->enrolurl = "$CFG->wwwroot/$CFG->admin/users.php";
$a->url = $CFG->wwwroot."/enrol/authorize/index.php?status=".AN_STATUS_AUTH;
$message = get_string('pendingordersemail', 'enrol_authorize', $a);
$adminuser = get_admin();
email_to_user($adminuser, $adminuser, "WARNING: PENDING PAYMENTS", $a);
// Daily warning email for expiring pending orders.
if (!empty($CFG->an_emailexpired)) {
$timediffem = $timenowsettle - ((30 - intval($CFG->an_emailexpired)) * $oneday);
$select = "(status='". AN_STATUS_AUTH ."') AND (timecreated<'$timediffem') AND (timecreated>'$timediff30')";
if ($count = count_records_select('enrol_authorize', $select)) {
$a = new stdClass;
$a->pending = $count;
$a->days = $CFG->an_emailexpired;
$a->course = $SITE->shortname;
$subject = get_string('pendingorderssubject', 'enrol_authorize', $a);
$a = new stdClass;
$a->pending = $count;
$a->days = $CFG->an_emailexpired;
$a->course = $SITE->fullname;
$a->enrolurl = "$CFG->wwwroot/$CFG->admin/users.php";
$a->url = $CFG->wwwroot."/enrol/authorize/index.php?status=".AN_STATUS_AUTH;
$message = get_string('pendingordersemail', 'enrol_authorize', $a);
$adminuser = get_admin();
email_to_user($adminuser, $adminuser, $subject, $message);
if (!empty($CFG->an_teachermanagepay) and !empty($CFG->an_emailexpiredteacher)) {
$sorttype = empty($CFG->an_sorttype) ? 'ttl' : $CFG->an_sorttype;
$sql = "SELECT E.courseid, E.currency, C.fullname, C.shortname, " .
"COUNT(E.courseid) AS cnt, SUM(E.amount) as ttl " .
"FROM {$CFG->prefix}enrol_authorize E " .
"INNER JOIN {$CFG->prefix}course C ON C.id = E.courseid " .
"WHERE $select GROUP BY E.courseid ORDER BY $sorttype DESC";
$message = ''; $subject = ''; $lastcourse = 0;
$courseidandcounts = get_records_sql($sql);
foreach($courseidandcounts as $courseidandcount) {
if ($lastcourse != $courseidandcount->courseid) {
$lastcourse = $courseidandcount->courseid;
$a = new stdClass;
$a->course = $courseidandcount->shortname;
$a->pending = $courseidandcount->cnt;
$a->days = $CFG->an_emailexpired;
$subject = get_string('pendingorderssubject', 'enrol_authorize', $a);
$a = new stdClass;
$a->course = $courseidandcount->fullname;
$a->pending = $courseidandcount->cnt;
$a->currency = $courseidandcount->currency;
$a->sumcost = $courseidandcount->ttl;
$a->days = $CFG->an_emailexpired;
$a->url = $CFG->wwwroot.'/enrol/authorize/index.php?course='.
$lastcourse.'&amp;status='.AN_STATUS_AUTH;
$message = get_string('pendingordersemailteacher', 'enrol_authorize', $a);
}
if ($teachers = get_course_teachers($lastcourse)) {
foreach ($teachers as $teacher) {
email_to_user($teacher, $adminuser, $subject, $message);
}
}
}
}
}
}
}
@@ -715,6 +807,7 @@ class enrolment_plugin_authorize
$teacher = get_teacher($lastcourse);
}
$user = get_record('user', 'id', $order->userid);
$a = new stdClass;
$a->coursename = $order->fullname;
$a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id";
email_to_user($user, $teacher,
+6 -6
View File
@@ -17,18 +17,18 @@
}
/// Load strings. All strings should be defined here. locallib.php uses these strings.
$strs = get_strings(array('user','status','action','delete','time','course','confirm','yes','no','all','none','error'));
$authstrs = get_strings(array('paymentmanagement','orderid','void','capture','refund','delete',
$strs = get_strings(array('status','action','time','course','confirm','yes','no','all','none','error'));
$authstrs = get_strings(array('orderid','nameoncard','void','capture','refund','delete',
'authcaptured','authorizedpendingcapture','capturedpendingsettle','capturedsettled',
'settled','refunded','cancelled','expired','tested',
'transid','settlementdate','notsettled','amount',
'howmuch','captureyes','unenrolstudent'), 'enrol_authorize');
'settled','refunded','cancelled','expired','tested','new',
'transid','settlementdate','notsettled','amount','unenrolstudent'), 'enrol_authorize');
/// Print header
$strpaymentmanagement = get_string('paymentmanagement', 'enrol_authorize');
if (!$course = get_record('course', 'id', $courseid)) {
error('Could not find that course');
}
print_header_simple("$authstrs->paymentmanagement", "", "<a href=\"index.php\">$authstrs->paymentmanagement</a>");
print_header_simple("$strpaymentmanagement", "", "<a href=\"index.php\">$strpaymentmanagement</a>");
/// If orderid is empty, user wants to see all orders
+116 -82
View File
@@ -1,11 +1,11 @@
<?PHP // $Id$
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
die('Direct access to this script is forbidden.');
}
require_once('const.php');
require_once('action.php');
require_once('authorizenetlib.php');
define('ORDER_CAPTURE', 'capture');
define('ORDER_DELETE', 'delete');
@@ -21,12 +21,12 @@ function authorize_print_orders()
global $CFG, $USER;
global $strs, $authstrs;
global $courseid, $userid;
require_once $CFG->libdir.'/tablelib.php';
require_once($CFG->libdir.'/tablelib.php');
$perpage = 10;
$status = optional_param('status', AN_STATUS_NONE, PARAM_INT);
if (!isteacher($courseid)) {
if (! isteacher($courseid)) {
$userid = $USER->id;
}
@@ -36,23 +36,26 @@ function authorize_print_orders()
AN_STATUS_AUTHCAPTURE => $authstrs->authcaptured,
AN_STATUS_CREDIT => $authstrs->refunded,
AN_STATUS_VOID => $authstrs->cancelled,
AN_STATUS_EXPIRE => $authstrs->expired
AN_STATUS_EXPIRE => $authstrs->expired,
AN_STATUS_TEST => $authstrs->tested
);
print_simple_box_start('center', '80%');
echo "$strs->status: ";
echo popup_form($baseurl.'&amp;course='.$courseid.'&amp;status=', $statusmenu, 'statusmenu', $status, '', '', '', true);
if ($courses = get_courses('all', 'c.sortorder ASC', 'c.id,c.fullname,c.enrol')) {
$popupcrs = array();
foreach ($courses as $crs) {
if ($crs->enrol == 'authorize' || (empty($crs->enrol) && $CFG->enrol == 'authorize')) {
$popupcrs[(int)$crs->id] = $crs->fullname;
$popupcrs[intval($crs->id)] = $crs->fullname;
}
}
echo " &nbsp; $strs->course: ";
echo popup_form($baseurl.'&amp;status='.$status.'&amp;course=', $popupcrs, 'coursesmenu', $courseid, '', '', '', true);
if (!empty($popupcrs)) {
print_simple_box_start('center', '100%');
echo "$strs->status: ";
echo popup_form($baseurl.'&amp;course='.$courseid.'&amp;status=',$statusmenu,'statusmenu',$status,'','','',true);
echo " &nbsp; $strs->course: ";
echo popup_form($baseurl.'&amp;status='.$status.'&amp;course=',$popupcrs,'coursesmenu',$courseid,'','','',true);
print_simple_box_end();
}
}
print_simple_box_end();
$table = new flexible_table('enrol-authorize');
$table->set_attribute('width', '100%');
@@ -62,31 +65,38 @@ function authorize_print_orders()
$table->set_attribute('class', 'generaltable generalbox');
$table->define_columns(array('id', 'timecreated', 'userid', 'status', ''));
$table->define_headers(array($authstrs->orderid, $strs->time, $strs->user, $strs->status, $strs->action));
$table->define_headers(array($authstrs->orderid, $strs->time, $authstrs->nameoncard, $strs->status, $strs->action));
$table->define_baseurl($baseurl."&amp;status=$status");
$table->sortable(true);
$table->sortable(true, 'id', SORT_DESC);
$table->pageable(true);
$table->setup();
$select = "SELECT E.id, E.transid, E.courseid, E.userid, E.status, E.ccname, E.timecreated, E.settletime";
$from = " FROM {$CFG->prefix}enrol_authorize E ";
$select = "SELECT E.id, E.transid, E.courseid, E.userid, E.status, E.ccname, E.timecreated, E.settletime ";
$from = "FROM {$CFG->prefix}enrol_authorize E ";
$where = "WHERE (1=1) ";
if ($status > AN_STATUS_NONE) {
if ($status == AN_STATUS_CREDIT) {
$from .= "INNER JOIN {$CFG->prefix}enrol_authorize_refunds R ON E.id = R.orderid ";
$where = "WHERE (E.status = '" . AN_STATUS_AUTHCAPTURE . "') ";
}
else {
$where = "WHERE (E.status = '$status') ";
switch ($status)
{
case AN_STATUS_CREDIT:
$from .= "INNER JOIN {$CFG->prefix}enrol_authorize_refunds R ON E.id = R.orderid ";
$where .= "AND (E.status = '" . AN_STATUS_AUTHCAPTURE . "') ";
break;
case AN_STATUS_TEST:
$newordertime = time() - 120; // -2 minutes. Order may be still in process.
$where .= "AND (E.status = '" . AN_STATUS_NONE . "') AND (E.transid = '0') AND (E.timecreated < $newordertime) ";
break;
default:
$where .= "AND (E.status = '$status') ";
break;
}
}
else {
if (empty($CFG->an_test)) {
$where = "WHERE (E.status != '" . AN_STATUS_NONE . "') ";
}
else {
$where = "WHERE (1=1) ";
$where .= "AND (E.status != '" . AN_STATUS_NONE . "') ";
}
}
@@ -100,9 +110,6 @@ function authorize_print_orders()
if ($sort = $table->get_sql_sort()) {
$sort = ' ORDER BY ' . $sort;
}
else {
$sort = ' ORDER BY id DESC ';
}
$totalcount = count_records_sql('SELECT COUNT(*) ' . $from . $where);
$table->initialbars($totalcount > $perpage);
@@ -124,7 +131,7 @@ function authorize_print_orders()
}
else {
foreach ($actionstatus->actions as $value) {
$actions .= "&nbsp;&nbsp;<a href='index.php?$value=y&amp;order=$record->id'>{$authstrs->$value}</a> ";
$actions .= "&nbsp;&nbsp;<a href='index.php?$value=y&amp;sesskey=$USER->sesskey&amp;order=$record->id'>{$authstrs->$value}</a> ";
}
}
@@ -156,9 +163,10 @@ function authorize_print_order_details($orderno)
$cmdrefund = optional_param(ORDER_REFUND, '', PARAM_ALPHA);
$cmdvoid = optional_param(ORDER_VOID, '', PARAM_ALPHA);
$unenrol = optional_param('unenrol', '', PARAM_ALPHA);
$confirm = optional_param('confirm', '', PARAM_ALPHA);
$unenrol = optional_param('unenrol', 0, PARAM_BOOL);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$table = new stdClass;
$table->width = '100%';
$table->size = array('30%', '70%');
$table->align = array('right', 'left');
@@ -174,13 +182,14 @@ function authorize_print_order_details($orderno)
}
if ($USER->id != $order->userid) { // Current user viewing someone else's order
if (!isteacher($order->courseid)) {
if (! isteacher($order->courseid)) {
error("Students can view their order.");
}
}
echo "<form action='index.php' method='post'>\n";
echo "<input type='hidden' name='order' value='$orderno'>\n";
echo "<form action=\"index.php\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"order\" value=\"$orderno\">\n";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"" . sesskey() . "\" />";
$settled = settled($order);
$status = authorize_get_status_action($order);
@@ -191,22 +200,24 @@ function authorize_print_order_details($orderno)
if (empty($cmdcapture) and empty($cmdrefund) and empty($cmdvoid) and empty($cmddelete)) {
$table->data[] = array("<b>$strs->course:</b>", $order->shortname);
$table->data[] = array("<b>$strs->status:</b>", $authstrs->{$status->status});
$table->data[] = array("<b>$strs->user:</b>", $order->ccname);
$table->data[] = array("<b>$authstrs->nameoncard:</b>", $order->ccname);
$table->data[] = array("<b>$strs->time:</b>", userdate($order->timecreated));
$table->data[] = array("<b>$authstrs->settlementdate:</b>", $settled ?
userdate($order->settletime) : $authstrs->notsettled);
}
$table->data[] = array("&nbsp;", "<hr size='1' noshade>\n");
if (!empty($cmdcapture)) { // CAPTURE
if (!empty($cmdcapture) and confirm_sesskey()) { // CAPTURE
if (!in_array(ORDER_CAPTURE, $status->actions)) {
$a = new stdClass;
$a->action = $authstrs->capture;
error(get_string('youcantdo', 'enrol_authorize', $a));
}
if (empty($confirm)) {
$strcaptureyes = get_string('captureyes', 'enrol_authorize');
$table->data[] = array("<b>$strs->confirm:</b>",
"$authstrs->captureyes<br /><a href='index.php?order=$orderno&amp;".ORDER_CAPTURE."=y&amp;confirm=y'>$strs->yes</a>
"$strcaptureyes<br /><a href='index.php?order=$orderno&amp;sesskey=$USER->sesskey&amp;".ORDER_CAPTURE."=y&amp;confirm=1'>$strs->yes</a>
&nbsp;&nbsp;&nbsp;&nbsp;<a href='index.php?order=$orderno'>$strs->no</a>");
}
else {
@@ -227,9 +238,11 @@ function authorize_print_order_details($orderno)
if (enrol_student($order->userid, $order->courseid, $timestart, $timeend, 'authorize')) {
$user = get_record('user', 'id', $order->userid);
$teacher = get_teacher($order->courseid);
$a = new stdClass;
$a->coursename = $order->shortname;
$a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id";
email_to_user($user, $teacher,
email_to_user($user,
$teacher,
get_string("enrolmentnew", '', $order->shortname),
get_string('welcometocoursetext', '', $a));
redirect("index.php?order=$orderno");
@@ -247,13 +260,14 @@ function authorize_print_order_details($orderno)
}
print_table($table);
}
elseif (!empty($cmdrefund)) { // REFUND
elseif (!empty($cmdrefund) and confirm_sesskey()) { // REFUND
if (!in_array(ORDER_REFUND, $status->actions)) {
$a = new stdClass;
$a->action = $authstrs->refund;
error(get_string('youcantdo', 'enrol_authorize', $a));
}
$extra = new stdClass();
$extra = new stdClass;
$extra->sum = 0.0;
$extra->orderid = $orderno;
@@ -269,13 +283,15 @@ function authorize_print_order_details($orderno)
}
else {
$amount = format_float(optional_param('amount', $upto), 2);
if (($amount > $upto) || empty($confirm)) {
if (($amount > $upto) or empty($confirm)) {
$a = new stdClass;
$a->upto = $upto;
$strcanbecredit = get_string('canbecredit', 'enrol_authorize', $a);
$table->data[] = array("<b>$authstrs->unenrolstudent</b>",
"<input type='checkbox' name='unenrol' value='y'" . (!empty($unenrol) ? " checked" : "") . ">");
$table->data[] = array("<b>$authstrs->howmuch</b>",
"<input type='hidden' name='confirm' value='y'>
$strhowmuch = get_string('howmuch', 'enrol_authorize');
$cbunenrol = print_checkbox('unenrol', '1', !empty($unenrol), '', '', '', true);
$table->data[] = array("<b>$authstrs->unenrolstudent</b>", $cbunenrol);
$table->data[] = array("<b>$strhowmuch</b>",
"<input type='hidden' name='confirm' value='1'>
<input type='text' size='5' name='amount' value='$amount'>
$strcanbecredit<br /><input type='submit' name='".ORDER_REFUND."' value='$authstrs->refund'>");
}
@@ -286,13 +302,23 @@ function authorize_print_order_details($orderno)
if ($success) {
if (empty($CFG->an_test)) {
$extra->id = insert_record("enrol_authorize_refunds", $extra);
if (!$extra->id) {
// to do: email admin
if (empty($extra->id)) {
$emailsubject = "Authorize.net: insert record error";
$emailmessage = "Error while trying to insert new data to enrol_authorize_refunds table:\n";
$data = (array)$extra;
foreach ($data as $key => $value) {
$emailmessage .= "$key => $value\n";
}
$adminuser = get_admin();
email_to_user($adminuser, $adminuser, $emailsubject, $emailmessage);
$table->data[] = array("<b><font color=red>$strs->error:</font></b>", $emailmessage);
}
if (!empty($unenrol)) {
unenrol_student($order->userid, $order->courseid);
else {
if (!empty($unenrol)) {
unenrol_student($order->userid, $order->courseid);
}
redirect("index.php?order=$orderno");
}
redirect("index.php?order=$orderno");
}
else {
$table->data[] = array(get_string('testmode', 'enrol_authorize'),
@@ -306,8 +332,9 @@ function authorize_print_order_details($orderno)
}
print_table($table);
}
elseif (!empty($cmdvoid)) { // VOID
elseif (!empty($cmdvoid) and confirm_sesskey()) { // VOID
if (!in_array(ORDER_VOID, $status->actions)) {
$a = new stdClass;
$a->action = $authstrs->void;
error(get_string('youcantdo', 'enrol_authorize', $a));
}
@@ -318,7 +345,7 @@ function authorize_print_order_details($orderno)
$strvoidyes = get_string('voidyes', 'enrol_authorize');
$table->data[] = array("<b>$strs->confirm:</b>",
"$strvoidyes<br /><input type='hidden' name='".ORDER_VOID."' value='y'>
<input type='hidden' name='confirm' value='y'>
<input type='hidden' name='confirm' value='1'>
<input type='submit' value='$strs->yes'>
&nbsp;&nbsp;&nbsp;&nbsp;<a href='index.php?order=$orderno'>$strs->no</a>");
}
@@ -351,16 +378,15 @@ function authorize_print_order_details($orderno)
}
else {
if (empty($confirm)) {
$a = new stdClass;
$a->transid = $suborder->transid;
$a->amount = $suborder->amount;
$strsubvoidyes = get_string('subvoidyes', 'enrol_authorize', $a);
$table->data[] = array("<b>$authstrs->unenrolstudent</b>",
"<input type='checkbox' name='unenrol' value='y'" . (!empty($unenrol) ? " checked" : "") . ">");
$cbunenrol = print_checkbox('unenrol', '1', !empty($unenrol), '', '', '', true);
$table->data[] = array("<b>$authstrs->unenrolstudent</b>", $cbunenrol);
$table->data[] = array("<b>$strs->confirm:</b>",
"$strsubvoidyes<br /><input type='hidden' name='".ORDER_VOID."' value='y'>
<input type='hidden' name='confirm' value='y'>
<input type='hidden' name='confirm' value='1'>
<input type='hidden' name='suborder' value='$suborderno'>
<input type='submit' value='$strs->yes'>
&nbsp;&nbsp;&nbsp;&nbsp;<a href='index.php?order=$orderno'>$strs->no</a>");
@@ -390,18 +416,18 @@ function authorize_print_order_details($orderno)
}
print_table($table);
}
elseif (!empty($cmddelete)) { // DELETE
elseif (!empty($cmddelete) and confirm_sesskey()) { // DELETE
if (!in_array(ORDER_DELETE, $status->actions)) {
$a = new stdClass;
$a->action = $authstrs->delete;
error(get_string('youcantdo', 'enrol_authorize', $a));
}
if (empty($confirm)) {
$table->data[] = array("<b>$authstrs->unenrolstudent</b>",
"<input type='checkbox' name='unenrol' value='y'" . (!empty($unenrol) ? " checked" : "") . ">");
$cbunenrol = print_checkbox('unenrol', '1', !empty($unenrol), '', '', '', true);
$table->data[] = array("<b>$authstrs->unenrolstudent</b>", $cbunenrol);
$table->data[] = array("<b>$strs->confirm:</b>",
"<input type='hidden' name='".ORDER_DELETE."' value='y'>
<input type='hidden' name='confirm' value='y'>
<input type='hidden' name='confirm' value='1'>
<input type='submit' value='$strs->yes'>
&nbsp;&nbsp;&nbsp;&nbsp;<a href='index.php?order=$orderno'>$strs->no</a>");
}
@@ -427,14 +453,14 @@ function authorize_print_order_details($orderno)
$table->data[] = array("<b>$strs->action</b>", $actions);
print_table($table);
if ($settled) { // show refunds.
echo "<h4>" . get_string('returns', 'enrol_authorize') . "</h4>\n";
$t2 = new stdClass;
$t2->size = array('15%', '15%', '20%', '35%', '15%');
$t2->align = array('right', 'right', 'right', 'left', 'right');
$t2->align = array('right', 'right', 'right', 'right', 'right');
$t2->head = array($authstrs->transid,
$authstrs->amount,
$strs->status,
$authstrs->settlementdate,
$strs->action);
$authstrs->amount,
$strs->status,
$authstrs->settlementdate,
$strs->action);
$refunds = get_records('enrol_authorize_refunds', 'orderid', $orderno);
if ($refunds) {
foreach ($refunds as $rf) {
@@ -446,19 +472,20 @@ function authorize_print_order_details($orderno)
else {
foreach ($substatus->actions as $vl) {
$subactions .=
"<a href='index.php?$vl=y&amp;order=$orderno&amp;suborder=$rf->id'>{$authstrs->$vl}</a> ";
"<a href='index.php?$vl=y&amp;sesskey=$USER->sesskey&amp;order=$orderno&amp;suborder=$rf->id'>{$authstrs->$vl}</a> ";
}
}
$t2->data[] = array($rf->transid,
$rf->amount,
$authstrs->{$substatus->status},
userdate($rf->settletime),
$subactions);
$rf->amount,
$authstrs->{$substatus->status},
userdate($rf->settletime),
$subactions);
}
}
else {
$t2->data[] = array(get_string('noreturns', 'enrol_authorize'));
$t2->data[] = array('','',get_string('noreturns', 'enrol_authorize'),'','');
}
echo "<h4>" . get_string('returns', 'enrol_authorize') . "</h4>\n";
print_table($t2);
}
}
@@ -473,21 +500,28 @@ function authorize_print_order_details($orderno)
*/
function authorize_get_status_action($order)
{
global $CFG, $USER;
static $timediff30;
global $CFG;
static $timediff30, $newordertime;
if (empty($timediff30)) {
$timediff30 = getsettletime(time()) - (30 * 3600 * 24);
$timenow = time();
$timediff30 = getsettletime($timenow) - (30 * 3600 * 24);
$newordertime = $timenow - 120; // -2 minutes. Order may be still in process.
}
$ret = new stdClass();
$ret->actions = array();
if (intval($order->transid) == 0) { // test transaction
if (isadmin() || (!empty($CFG->an_teachermanagepay) && isteacher($order->courseid))) {
$ret->actions = array(ORDER_DELETE);
if (intval($order->transid) == 0) { // test transaction or new order
if ($order->timecreated < $newordertime) {
if (isadmin() || (!empty($CFG->an_teachermanagepay) && isteacher($order->courseid))) {
$ret->actions = array(ORDER_DELETE);
}
$ret->status = 'tested';
}
else {
$ret->status = 'new';
}
$ret->status = 'tested';
return $ret;
}
+1 -1
View File
@@ -1,6 +1,6 @@
<?PHP // $Id$
$plugin->version = 2006021500;
$plugin->version = 2006021501;
$plugin->requires = 2005072200;
?>
+1 -1
View File
@@ -529,7 +529,7 @@ function process_person_tag($tagcontents){
}
if($CFG->enrol_imssourcedidfallback && trim($person->username)==''){
// This is the point where we can fall back to useing the "sourcedid" if "userid" is not supplied
// NB We don't use an "elseif" because the tag may be supplied-but-empty
// NB We don't use an "elseif" because the tag may be supplied-but-empty
$person->username = $person->idnumber;
}
if(preg_match('{<email>(.*?)</email>}is', $tagcontents, $matches)){
+5 -5
View File
@@ -3,20 +3,20 @@ require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_login();
if (!$site = get_site()) {
redirect("index.php");
redirect("index.php");
}
if (!isadmin()) {
error("Only the admin can use this page");
error("Only the admin can use this page");
}
/// get language strings
$str = get_strings(array('enrolments', 'users', 'administration', 'settings'));
print_header("$site->shortname: $str->enrolments", "$site->fullname",
"<a href=\"../../admin/index.php\">$str->administration</a> ->
<a href=\"../../admin/users.php\">$str->users</a> ->
$str->enrolments -> IMS import");
"<a href=\"../../admin/index.php\">$str->administration</a> ->
<a href=\"../../admin/users.php\">$str->users</a> ->
$str->enrolments -> IMS import");
require_once('enrol.php');
+4
View File
@@ -353,6 +353,10 @@ function cron() {
// Notify teachers/students about students who's enrolment are going to expire
global $CFG;
if (empty($CFG->lastexpirynotify)) {
$CFG->lastexpirynotify = 0;
}
if ($CFG->lastexpirynotify < date('Ymd') && ($courses = get_records_select('course', 'enrolperiod > 0 AND expirynotify > 0 AND expirythreshold > 0'))) {
$site = get_site();
$admin = get_admin();

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