Commit graph

2120 commits

Author SHA1 Message Date
martinlanghoff
4dde1463ee course/lib: print_courses() and print_course() rework
print_course() can now recognise a $course object that already has a
$course->context obj and a $course->managers array, which means that
there will be no DB access triggered by print_course().

(Backwards compat is retained so it still works the old way for
callers that get a single course printed anyway (during enrolment
for example.)

And print_courses() now uses get_courses_wmanagers(), and passes the
returned $course objects to print_course().

With this patch, a homepage listing 9 courses (with varying numbers of
teachers) sheds 63 DB queries (88 to 25). A course listing page with
3 courses sheds 9 (33 to 24).

On a single server overall time spent serving the homepage is reduced just
a little bit (262ms to 238ms) -- on a clustered environment, less DB queries
mean much lower latency and DB costs.
2007-09-19 07:26:54 +00:00
martinlanghoff
431cad0d62 course/lib: print_course() bugfix when $rusers is empty 2007-09-19 07:26:27 +00:00
martinlanghoff
57770b87d0 Interactive enrolment/unenrolments: make sure we unset mycourses 2007-09-19 07:17:23 +00:00
martinlanghoff
0e801c6c9d course/unenrol: check $USER->access[rsw] for role switches 2007-09-19 07:15:38 +00:00
martinlanghoff
88903eeab9 course/index: Move categories around using move_category()
Use the newfangled move_category() when moving categories
around, to ensure we Do The Right Thing in the backend,
decoupled from UI stuff.
2007-09-19 07:14:34 +00:00
martinlanghoff
19f601d178 course/lib: move_courses() calls content_moved(), intro move_category()
move_courses() now calls content_moved() which will take care of any
accesslib-required changes. And introducing move_category() which
also calls content_moved() when needed.
2007-09-19 07:14:23 +00:00
martinlanghoff
a372aab507 course: Changing a course cat from course/edit calls context_moved()
Changes to course cat from the main course settings form now calls
context_moved(), and accesslib data is properly maintained.
2007-09-19 07:13:57 +00:00
martinlanghoff
c633af7a5a course/edit: mark the course contextpath as dirty to force a reload
Combined with the path creation in create_context() we can now create
a course, enter and edit it immediately. Amazing.

Like - 21st century technology.
2007-09-19 07:13:20 +00:00
martinlanghoff
3d3def3a4e course/unenrol codepaths mark the context dirty - bugfix
Oops. one if() branch was missing the mark_context_dirty(). Fixed.
2007-09-19 07:12:43 +00:00
martinlanghoff
a9d4ea7849 All interactive enrol/unenrol codepaths mark the context dirty
Manually enrolling and unenrolling self, and other users should
transparently set the context dirty. So walk all callers to
role_assign() and role_unassign() and mark the context dirty
where appropriate.

OTOH, most automated-backend enrol/unenrol mechanisms should not.
The backend lookups that happen when you login are well covered
by the login/enrolment process, and don't need to be marked dirty.
2007-09-19 07:11:42 +00:00
martinlanghoff
690c946c15 get_role_users() callers rework to use the new $gethidden 2007-09-19 07:09:50 +00:00
martinlanghoff
3bf13d05f5 course/lib:print_course() smarter calling of get_role_users()
And saves a few dbqueries too...
2007-09-19 07:09:24 +00:00
martinlanghoff
026579bbc3 course/search.php: smarter about contexts, bugfix in pagination
Save a ton of queries about contexts, and a bugfix in how we are
calling the pagination for get_courses_search().
2007-09-19 07:08:50 +00:00
martinlanghoff
679b617967 categories: Categories page and get_courses_page() - smarter about context
This patch saves 1600 context lookups on a 1600 course category. rcache
does help a bit with small categories, but on large setups, this is
not sustainable.

And it's not needed either. We have the data right at our fingertips.
Just get it when it's cheap...
2007-09-19 07:08:24 +00:00
martinlanghoff
d7d4b0e572 course/view: roleswitch checks moved to the course page
Implemented all the relevant checks for role_switch().

accesslib's role_switch() doesn't do any UI-related checks any more,
being a backend lib call. These belong here.
2007-09-19 07:06:44 +00:00
martinlanghoff
d863419245 course/index: move orphan fixups to an optimised fix_coursecategory_orphans()
Move the fixups for orphan courses to the newly minted
fix_coursecategory_orphans() -- and optimise it to take only 1 dbquery for
the common case.

If we do find lots of orphans, we issue 2 updates per orphan.

This cuts down dbqueries drastically - we used to have 2x the number of
courses in the site.
2007-09-12 02:56:36 +00:00
skodak
ffc536af8e MDL-7380 converted various places to use new groups API 2007-09-08 20:53:05 +00:00
mattc-catalyst
263017bbdd MDL-10888: groupings - mod/workshop - add grouping support 2007-09-06 01:35:37 +00:00
moodler
7b0d5cd551 Merged fixes for MDL-7425 from 1.8 stable 2007-08-30 06:01:57 +00:00
toyomoyo
a683deeca6 merged fix for MDL-10818, do not display graph if user has no permission 2007-08-28 07:04:41 +00:00
nicolasconnault
9837bd1d2c MDL-7574 Applying Matthew Davidson's patch. 2007-08-27 16:59:04 +00:00
skodak
97928ddf00 MDL-11003 adding of first activity on frontpage does not work - incorrect section 2007-08-26 15:30:51 +00:00
skodak
273eb2f5aa MDL-10999 Cannot Insert or Edit a Label 2007-08-26 07:44:14 +00:00
nicolasconnault
ba7472ccdf MDL-10910 Corrected two errors committed while fixing MDL-10870 2007-08-23 15:08:14 +00:00
nicolasconnault
d02240f302 MDL-10870 A few more files with old style navigation strings. 2007-08-23 14:58:15 +00:00
moodler
6cf890e36b Remove timelimits from rebuild_course_cache() MDL-10954 (merged from 1.8) 2007-08-23 05:46:07 +00:00
moodler
4ae6d1ed41 untick teachers by default, merged from 1.8 MDL-10946 2007-08-23 05:16:16 +00:00
toyomoyo
66af2bf186 fixing a broken get_context_instance() call 2007-08-22 05:51:04 +00:00
Martin Langhoff
13534ef716 cvsimport fixups 2007-08-29 13:10:11 +12:00
skodak
e04ff2d559 MDL-10383 adding new standard elements method - modules now must specify what they support (groups/groupings/groupmembersonly); by default only groupmode selector is enabled 2007-08-20 07:27:04 +00:00
toyomoyo
1dc08b85b1 MDL-4384, fixed undefined function call, hide the add sub category form in non-editing mode 2007-08-20 01:59:50 +00:00
skodak
b299029264 fixed syntax error 2007-08-19 21:07:15 +00:00
nicolasconnault
0be6f67819 MDL-10870 All files updated to new build_navigation() method. Most are untested, because they are not easily accessible within a moodle site. 2007-08-17 19:09:11 +00:00
skodak
a104debf4f MDL-10892 modules explicitly declare support for groupmembersonly; the grouping and groupmembersonly elements are now marked as advanced; only Resource supports groupmembers only now 2007-08-17 12:29:18 +00:00
nicolasconnault
e295df447f MDL-10870 All files updated to new build_navigation() method. 2007-08-17 11:18:58 +00:00
skodak
24f41672ba MDL-10383 - adding UI for new grouping settings into course and mod edit forms + fixed section handling on mod edit page + other minor cleanup 2007-08-17 08:05:04 +00:00
nicolasconnault
73c24ef80b MDL-10870 All files updated to new build_navigation() method. 2007-08-16 15:01:25 +00:00
skodak
5bf243d131 MDL-10383 - groups/groupings refactoring nearly finished ;-) 2007-08-16 11:06:48 +00:00
skodak
62d6383803 MDL-10383 - groups/groupings refactoring and improvements - basic UI for groupings implemented 2007-08-16 09:28:18 +00:00
toyomoyo
3aafb7d9d2 merged fix for MDL-10818, do not display broken graph when user has no permission to view actities graph 2007-08-16 04:05:31 +00:00
skodak
ddff2fa806 MDL-10383 - yet more groups and groupigns refactoring, cleanup and bugfixing - grouping edit form now works 2007-08-15 23:51:07 +00:00
skodak
2c386f82e5 MDL-10383 - deprecated get_groups(), user_group() and ismember() 2007-08-15 20:21:01 +00:00
toyomoyo
ca5d523bef MDL-4384, description for course categories 2007-08-15 08:28:40 +00:00
moodler
a0501fc36a Make sure require_login is being called from reports MDL-10833 2007-08-13 13:45:14 +00:00
moodler
665f8762ae Fixed theme and require_login MDL-10833 2007-08-13 13:40:35 +00:00
moodler
36d3e28d30 Fixed course theme and require_login MDL-10833 2007-08-13 13:39:32 +00:00
moodler
76655d6ff1 Make course themes work on course settings page MDL-10833 2007-08-13 13:35:29 +00:00
stronk7
4f6bd3b9c1 Increasing the displayed size of course->shortinfo to 20. MDL-10026
(bigger but enough smaller than the fullname field)
2007-08-09 12:26:43 +00:00
moodler
8047ab1d9d Using right_to_left() function MDL-10768 2007-08-09 08:41:08 +00:00
moodler
932be04628 Patch for left-right buttons in course view MDL-10768 2007-08-09 07:50:21 +00:00