mirror of
https://github.com/moodle/moodle.git
synced 2025-07-24 15:51:56 +02:00
MDL-41082 navigation: Remove unnecessary load of portfolio instances
This commit is contained in:
@@ -4049,7 +4049,7 @@ class settings_navigation extends navigation_node {
|
||||
// Portfolio
|
||||
if ($currentuser && !empty($CFG->enableportfolios) && has_capability('moodle/portfolio:export', $systemcontext)) {
|
||||
require_once($CFG->libdir . '/portfoliolib.php');
|
||||
if (portfolio_instances(true, false)) {
|
||||
if (portfolio_has_visible_instances()) {
|
||||
$portfolio = $usersetting->add(get_string('portfolios', 'portfolio'), null, self::TYPE_SETTING);
|
||||
|
||||
$url = new moodle_url('/user/portfolio.php', array('courseid'=>$course->id));
|
||||
|
@@ -533,6 +533,16 @@ function portfolio_instances($visibleonly=true, $useronly=true) {
|
||||
return $instances;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether there are visible instances in portfolio.
|
||||
*
|
||||
* @return bool true when there are some visible instances.
|
||||
*/
|
||||
function portfolio_has_visible_instances() {
|
||||
global $DB;
|
||||
return $DB->record_exists('portfolio_instance', array('visible' => 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported formats currently in use.
|
||||
* Canonical place for a list of all formats
|
||||
|
Reference in New Issue
Block a user