74 Commits

Author SHA1 Message Date
sam marshall
eedf5a5a1c MDL-47240 Modinfo: Section info accesses nonexisting property groupingid
This code wasn't actually used, so we should remove it.
2014-09-18 16:38:22 +01:00
sam marshall
61c3b60c03 MDL-44725 Update cm_info::create to allow 'false' param (13)
Currently cm_info::create allows the 'null' parameter, and
returns null (as a null $cm should still be null when treated
as a cm_info object).

Some unit tests relied on the value 'false' being treated
the same as null in this regard. This seems like a generally
safe assumption (given this is a function about changing
weakly typed data into a stronger type) so I modified the
function to accept anything PHP false, returning null.
2014-09-02 13:03:33 +01:00
sam marshall
061e6b2864 MDL-44725 Availability: Replace groupmembersonly - upgrade, core (1)
* Upgrades existing data so that the groupmembersonly option is
  replaced with equivalent data for the new availability API.
* Removes the database field and admin setting used for
  groupmembersonly.
* Changes core modinfo library to remove/deprecate groupmembersonly
  data and functions.
* Changes other core library files to remove groupmembersonly
  references.

Includes deprecation of several functions, listed in lib/upgrade.txt.
2014-09-02 13:03:07 +01:00
sam marshall
d25c41fbc5 MDL-46706 Library: API to get cm_info more easily
Creates two new functions that make it easier to get cm_info
objects (both in modinfolib.php):

get_course_and_cm($cmid) - intended for use e.g. in modules;
efficiently loads $course and $cm (normally saves 1 query).

cm_info::from_mixed($cm) - for use in back-end API where we
are not sure whether a $cm is a real cm_info or a stdClass.
2014-08-15 18:24:11 +01:00
Marina Glancy
acbf4579d5 MDL-46147 modinfo: performance improvement for course page (check filterall) 2014-07-01 15:28:54 +08:00
Damyon Wiese
0d9805dc14 MDL-46147 modinfo: performance improvement for course page
This is a big win in a specific situation, ie filters enabled for content+headings,
and no activity descriptions visible on the course page.
2014-07-01 15:26:06 +08:00
Ankit Agarwal
5793538a59 MDL-45409 conditional_activity: Do not iterate over deprecated properties 2014-05-05 16:26:35 +08:00
Marina Glancy
58d113934d MDL-45038 modinfo: added property section_info::modinfo 2014-04-10 20:26:25 +08:00
sam marshall
8d1f33e122 MDL-44070 Conditional availability enhancements (6): core changes
Changes core code to use new API instead of the old one when
checking user access to activities and sections.

Includes changes to other libraries that are necessary after
adding the availability system and removing old conditional tables
etc.
2014-04-07 20:11:48 +01:00
Marina Glancy
92e2e85523 MDL-44720 modinfo: make it easier to use cm_info instead of get_coursemodule_from_id
by adding function cm_info::get_course_module_record()
2014-03-27 11:24:00 +08:00
Dan Poltawski
07e78d935f MDL-41690 cm_info: deprecate various properties 2014-01-06 10:45:59 +08:00
Sam Hemelryk
a59a423926 Merge branch 'MDL-42084-master' of git://github.com/sammarshallou/moodle 2013-12-03 11:12:34 +13:00
Marina Glancy
724b00b2b6 MDL-43024 course: fixed bug for accessing section options 2013-11-22 12:41:35 +11:00
sam marshall
3ef7279f26 MDL-42084 Core: Change set_time_limit to core_php_time_limit::raise everywhere
Exceptions (places where set_time_limit is still left) are:

Third-party libraries:
  ADODB
  PHPMailer

Moodle core:
  PHPUnit - not relevant (CLI mode)
2013-11-06 16:40:01 +00:00
Frederic Massart
de170aacda MDL-41436 modinfo: Concatenate SQL fields instead of passing array 2013-09-11 10:02:41 +08:00
Marina Glancy
4cc819adf0 MDL-41436 Allow user=-1 in get_fast_modinfo()
Remove ref to nonexisting course.modinfo in MNET auth, use get_fast_modinfo() for user=-1 instead
2013-09-10 14:11:51 +10:00
Marina Glancy
299cfee5f2 MDL-41436 Move course content cache to MUC
added cache definition and DB field course.cacherev for cache validation
2013-09-10 14:11:45 +10:00
Marina Glancy
44ddd2a115 MDL-41219 course: Make properties of course_modinfo read-only
added phpdocs and unittests
2013-09-10 14:11:37 +10:00
Marina Glancy
6d04c4f2a2 MDL-41192 course: Added property-read cm_info::effectivegroupmode 2013-09-10 14:11:36 +10:00
Marina Glancy
d872881f2a MDL-41192 course: Properties of cm_info are read-only and calculated on request
Also added phpdocs
2013-09-10 14:11:31 +10:00
Marina Glancy
4e4309064d MDL-41218 Object section_info calculates expensive data on demand only
Added phpdocs and unittests, removed unnecessary fields such as course and userid because they can be retrieved from modinfo
2013-09-10 14:11:24 +10:00
Marina Glancy
3e439915d3 MDL-41179 is_user_access_restricted_by_capability() must look at specified user and not current 2013-08-30 14:29:57 +10:00
Dan Poltawski
67c6ab1646 Merge branch 'wip-MDL-41222-master' of git://github.com/marinaglancy/moodle 2013-08-27 11:03:35 +08:00
Damyon Wiese
74df2951d1 Revert "MDL-39876 Change get_record('course') calls to get_course"
This reverts commit ab7632b74c331540c90229bf03d13aa2e6bdd9be.
2013-08-21 13:42:30 +08:00
Dan Poltawski
d99a300563 Merge branch 'wip-MDL-36690-master' of git://github.com/marinaglancy/moodle 2013-08-21 11:35:27 +08:00
Sam Hemelryk
487caf6b65 Revert "MDL-39876 update_course_record function to update global COURSE"
This reverts commit c290ac5510ca06b3eae557c2165c2f106dde46aa.

Conflicts:
	course/lib.php
2013-08-21 15:21:06 +12:00
Marina Glancy
4fcdb0123c MDL-36690 Do not cache objects inside course.modinfo as they may fail to serialize
convert moodle_url (all other fields are numbers or strings) to string before caching and then back to moodle_url when restoring.
Otherwise serialized modinfo can contain \0 byte which cause problems in Postgres DB
2013-08-21 12:30:38 +10:00
Sam Hemelryk
6eee89bc8f Merge branch 'MDL-39876-master' of git://github.com/sammarshallou/moodle
Conflicts:
	course/lib.php
2013-08-21 12:08:46 +12:00
Marina Glancy
5a3204d05b MDL-41222 Remove unnecessary course cache rebuild 2013-08-20 10:27:15 +10:00
Marina Glancy
676fa06af3 MDL-36789 Quick course cache integrity check for deleted modules 2013-08-15 21:48:24 +10:00
sam marshall
c290ac5510 MDL-39876 update_course_record function to update global COURSE 2013-08-15 11:31:21 +01:00
sam marshall
ab7632b74c MDL-39876 Change get_record('course') calls to get_course 2013-08-15 11:31:20 +01:00
Petr Škoda
2f1e464a88 MDL-40438 migrate all collatorlib:: and textlib:: uses 2013-08-06 21:04:35 +02:00
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