mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-71486 course: Notice when in site home/course page
This commit is contained in:
parent
5b315fa595
commit
feb8548a45
1 changed files with 4 additions and 3 deletions
|
@ -1928,7 +1928,7 @@ class cm_info implements IteratorAggregate {
|
||||||
// Check parent section.
|
// Check parent section.
|
||||||
if ($this->available) {
|
if ($this->available) {
|
||||||
$parentsection = $this->modinfo->get_section_info($this->sectionnum);
|
$parentsection = $this->modinfo->get_section_info($this->sectionnum);
|
||||||
if (!$parentsection->available) {
|
if (!$parentsection->get_available()) {
|
||||||
// Do not store info from section here, as that is already
|
// Do not store info from section here, as that is already
|
||||||
// presented from the section (if appropriate) - just change
|
// presented from the section (if appropriate) - just change
|
||||||
// the flag
|
// the flag
|
||||||
|
@ -2790,11 +2790,12 @@ class section_info implements IteratorAggregate {
|
||||||
/**
|
/**
|
||||||
* Finds whether this section is available at the moment for the current user.
|
* Finds whether this section is available at the moment for the current user.
|
||||||
*
|
*
|
||||||
* The value can be accessed publicly as $sectioninfo->available
|
* The value can be accessed publicly as $sectioninfo->available, but can be called directly if there
|
||||||
|
* is a case when it might be called recursively (you can't call property values recursively).
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function get_available() {
|
public function get_available() {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
$userid = $this->modinfo->get_user_id();
|
$userid = $this->modinfo->get_user_id();
|
||||||
if ($this->_available !== null || $userid == -1) {
|
if ($this->_available !== null || $userid == -1) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue