141 Commits

Author SHA1 Message Date
Sam Hemelryk
9c83b82b1b Merge branch 'MDL-40947-master' of https://github.com/lucisgit/moodle 2013-08-06 17:39:41 +12:00
Ruslan Kabalin
b2b2c136b6 MDL-40947: Fix segmentation fault issue in get_fast_modinfo. 2013-08-02 09:53:28 +01:00
Tim Hunt
9e1fe42150 MDL-40854 fix mod/...:view capabilities
Prior to the fix, if you did not have a capability like mod/page:view,
then you woulds still see the link to the Page activity in the course
section, but when you clicked on it, you would run into a
require_capability error.

It is a principle that we never show users a link to a page they are not
allowed to access, therefore, when users do not have mod/...:view, they
should not see the link on the course page.

This patch implements this in the cm_info class, in a similar way to how
access restrictions by groups works.

It does not assume that the mod/...:view capability exists. If the
capability does not exist, then users are not prevented from seeing the
link.
2013-07-26 11:44:43 +01:00
Rajesh Taneja
8f7d3d129f MDL-40407 Libraries: deprecated preload_course_contexts 2013-07-09 15:46:51 +08:00
Tony Levi
00726467f6 MDL-40035: Avoid rebuild_course_cache always for empty course 2013-07-09 13:53:27 +10:00
Marina Glancy
4202471a36 MDL-38541 Make sure course cache is cleared properly during upgrade
- Core upgrade MUST NOT call rebuild_course_cache() at all - update DB directly instead
- Plugins MUST call rebuild_course_cache(.., TRUE) for clearing the course cache and can not update DB directly
- Plugins MUST NOT call rebuild_course_cache() unless for clearing the cache
- Created function upgrade_ensure_not_running() to be included in other functions that can not be used during upgrade
2013-04-09 11:31:18 +10:00
Marina Glancy
3008f86c3f MDL-33774 mod_label stores the content where it is supposed to
removed hardcoded checking for 'label' module type

changed label update script
2013-02-14 19:46:19 +11:00
Marina Glancy
5c016ab30d MDL-37085 fixed mess with code overwriting cm_info properties
In case when groupmode is forced by the course we should take it from the
course and not overwrite cm_info::groupmode externally
2013-01-14 15:01:25 +11:00
Marina Glancy
f89c53f679 MDL-37085 Substitute get_print_section_cm_text() with cm_info functions 2013-01-14 15:01:21 +11:00
Petr Škoda
e271f71da4 MDL-36719 update $SITE caches in rebuild_course_cache() 2012-11-20 15:39:43 +01:00
Marina Glancy
9428a1545d MDL-36267 corrected phpdocs for get_fast_modinfo() 2012-11-14 09:52:52 +08:00
Eloy Lafuente (stronk7)
cd59310d1b Merge branch 'MDL-35762_fix' of git://github.com/andyjdavis/moodle 2012-11-06 16:13:47 +01:00
Andrew Davis
5e76227126 MDL-35762 core_grade: altered the code that determines whether an activity is visible on the user report 2012-11-05 09:35:10 +08:00
Marina Glancy
aea2e3c30d MDL-35768 Allow caching of section format options in course.sectioncache 2012-11-02 10:55:24 +08:00
Marina Glancy
fc79ede5a1 MDL-35768 Added format-specific options to edit course and section forms
- Course format may define additional fields (format options) to store for course and each section
- Edit course form allows to edit format-specific options and refreshes their list on format change
- Course format may provide it's own form for editing a section
- Default form for editing section allows to edit all format-specific fields
- Class section_info refactored, it defines magic methods such as __get() to access basic section
  information and format-specific options (retrieved only on the first request)
- format_base::update_course_format_options() allows to watch pre-update state of the course,
  format_legacy automatically copies the options with the same names between formats
2012-11-02 10:55:23 +08:00
Marina Glancy
b46be6adf4 MDL-35339 Better cache reset for get_fast_modinfo(), allow exec get_fast_modinfo($courseid) 2012-10-15 14:08:15 +08:00
Marina Glancy
d57aa283f7 MDL-35339 Deprecate get_all_mods() add get_module_types_names()
- added function get_module_types_names() returning the list of localised strings used for module names;
- added function cm_info::get_used_module_names();
- added magic properties cm_info:: and cm_info:: returning human readable module name;
- replaced usage of function get_all_mods() with get_fast_modinfo() and get_module_types_names();
- function print_section_add_menus() may now retrieve the modules names list itself;
- deprecated function get_all_mods()
2012-10-15 14:08:13 +08:00
Marina Glancy
99e9f9a69d MDL-35339 deprecate function get_all_sections() 2012-10-15 14:08:13 +08:00
Dan Poltawski
0d24043d66 Merge branch 'wip-MDL-35263-master' of git://github.com/marinaglancy/moodle 2012-10-02 12:49:26 +08:00
Marina Glancy
ee7084e950 MDL-35263 Converting course formats to OOP
- added class format_base as the base for all course formats
- added class format_site for the pseudo-format 'site' used for displaying activities on the front page
- added class format_legacy that overrides format_base functions with calling old-style 'callback_xxx' functions
- replaced all usage of 'callback_xxx' functions with format_base methods
- made arguments of get_section_name(), get_course_url() more flexible
- deprecated function get_generic_section_name(), it's contents is moved to format_base
- global_navigation::format_display_course_content() is removed, plugins can supress the sections navigations using extend_course_navigation()
2012-09-28 13:42:27 +08:00
Frederic Massart
5fee56d5c3 MDL-34931 core_grade: Fixed grades hidden when activity is hidden 2012-09-28 11:39:46 +08:00
Andrew Robert Nicols
fd0680ff4a MDL-34936 Warn if the sectioncache property is missing in a get_fast_modinfo call 2012-08-24 15:43:38 +01:00
Adrian Greeve
b0c6dc1cac MDL-34465 - lib - Replacing get_context_instance with context_XXXX::instance (group 8) 2012-07-27 10:10:46 +08:00
Sam Hemelryk
871c06e583 Merge branch 'MDL-29538_usercond' of git://github.com/markn86/moodle 2012-07-09 11:44:39 +12:00
Sam Hemelryk
dc31e8d73d Merge branch 'MDL-33466-master' of git://github.com/sammarshallou/moodle 2012-07-04 09:37:38 +12:00
Mark Nelson
e01fbcf765 MDL-29538 core_condition: Integrated with the latest code, can now place user field conditions on sections as well 2012-06-26 15:18:53 +08:00
Mark Nelson
76af15bb4c MDL-29538 core_condition: initial commit to add support for making things conditional on user profile fields 2012-06-26 15:18:51 +08:00
sam marshall
c069dacfc1 MDL-33937 Paged course view: Allows view of sections that are not visible 2012-06-21 16:25:52 +01:00
sam marshall
a098f340fe MDL-33466: Group restriction should hide activity even with 'show availability' option
This is a modified version of fix by Luke Tucker at NetSpot - thanks.
2012-06-13 13:08:30 +01:00
Eloy Lafuente (stronk7)
94dc3c7d1e MDL-24419 (5): Coding style cleanup 2012-05-17 00:51:50 +02:00
sam marshall
ce4dfd2703 MDL-24419 (4): Add conditional availability support to sections; section cache
Credit: original version done by Kirill Astashov of NetSpot (netspot.com.au),
finished and tweaked by sam.

This change adds conditional availability support for sections analagous to
that already available for activities. (Backend, UI, backup/restore.)

In order that this feature does not reduce performance, section cacheing has
also been added using a new course 'sectioncache' field analagous to modinfo.

The new feature integrates with activity availability so that activities
inside sections which are not available are automatically not available
themselves (meaning it works to restrict access).
2012-05-14 11:19:25 +01:00
Eloy Lafuente (stronk7)
c443a1cdb6 MDL-30175 cm_info - add support to external url icon images 2011-11-07 22:14:13 +01:00
sam marshall
8c40662e22 MDL-27001 'Show description' feature part 1: infrastructure that allows modules to support feature
The 'Show description' feature is about optionally including module description on the course page. This change include the necessary infrastructure - new database field, new FEATURE constant, changes to forms to display it, new language strings for it, backup and restore, and old course conversion. (I found the places to change by searching for an existing field in course_modules).

Documentation for the field is included in install.xml and in modinfolib.
2011-09-06 11:03:00 +01:00
Adam Olley
0420f8dca0 MDL-25191: Properly destroy all elements of the modinfo cache 2011-05-27 13:28:55 +01:00
Petr Skoda
112d3b4962 MDL-26990 fix undefined rebuild_course_cache() regression 2011-03-26 22:49:04 +01:00
sam marshall
adaeccb66d MDL-26781 Ensure get_fast_modinfo $cm is compatible with get_record $cm 2011-03-16 15:03:01 +00:00
Petr Skoda
12923c92b1 MDL-26476 fix incorrect fetching of user groups in modinfo 2011-02-17 18:19:41 +01:00
Petr Skoda
4478743ca4 MDL-26265 use cm_info in PAGE->cm because it has more useful information; add context property to cm_info 2011-02-07 23:11:43 +01:00
Sam Hemelryk
1e4cb18940 lib-modinfolib MDL-26264 cm_info and course_modinfo classes both now extend stdClass 2011-02-04 16:22:57 +08:00
Petr Skoda
d6f4508c36 MDL-25981 add missing global DB when fetching course modinfo 2011-01-31 22:23:34 +01:00
sam marshall
0d8b6a69ce lib MDL-25981 Improved modinfo
This commit:
a) moves modinfo code into new library modinfolib.php
b) uses classes instead of stdClass objects, allowing a huge amount of documentation (and IDE completion)
c) adds hooks so that plugins other than forum can display messages like forum's 'unread', and plugins other than label can display html (apart from/as well as their view.php link) on the course view page
d) removes current hacks for forum and label (mainly in print_section but also across the code), replacing with new 'content' and similar variables [this is the reason for the changes in blocks, etc]
e) reduces size of modinfo in database (only when rebuilt) by excluding empty fields

The change is intended to be backward compatible and does not affect the format of modinfo in database.
2011-01-26 10:29:16 +00:00