Skip to content

Commit

Permalink
MDL-19794 Added global $OUTPUT to print_courses()
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasconnault committed Aug 7, 2009
1 parent 3bfcfdc commit 2f48819
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions course/lib.php
Expand Up @@ -22,7 +22,7 @@
define('MOD_CLASS_ACTIVITY', 0);
define('MOD_CLASS_RESOURCE', 1);

if (!defined('MAX_MODINFO_CACHE_SIZE')) {
if (!defined('MAX_MODINFO_CACHE_SIZE')) {
define('MAX_MODINFO_CACHE_SIZE', 10);
}

Expand Down Expand Up @@ -1249,11 +1249,11 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
// 1) The activity is not visible to users
// and
// 2a) The 'showavailability' option is not set (if that is set,
// we need to display the activity so we can show
// we need to display the activity so we can show
// availability info)
// or
// 2b) The 'availableinfo' is empty, i.e. the activity was
// hidden in a way that leaves no info, such as using the
// 2b) The 'availableinfo' is empty, i.e. the activity was
// hidden in a way that leaves no info, such as using the
// eye icon.
if (!$modinfo->cms[$modnumber]->uservisible &&
(empty($modinfo->cms[$modnumber]->showavailability) ||
Expand All @@ -1273,7 +1273,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
}
}

// In some cases the activity is visible to user, but it is
// In some cases the activity is visible to user, but it is
// dimmed. This is done if viewhiddenactivities is true and if:
// 1. the activity is not visible, or
// 2. the activity has dates set which do not include current, or
Expand All @@ -1289,7 +1289,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
$accessiblebutdim = $accessiblebutdim ||
$mod->availablefrom > time() ||
($mod->availableuntil && $mod->availableuntil < time()) ||
count($mod->conditionsgrade) > 0 ||
count($mod->conditionsgrade) > 0 ||
count($mod->conditionscompletion) > 0;
}
}
Expand Down Expand Up @@ -1383,7 +1383,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
}

echo '<a '.$linkcss.' '.$extra.
' href="'.$CFG->wwwroot.'/mod/'.$mod->modname.'/view.php?id='.$mod->id.'">'.
' href="'.$CFG->wwwroot.'/mod/'.$mod->modname.'/view.php?id='.$mod->id.'">'.
'<img src="'.$icon.'" class="activityicon" alt="" /> '.
$accesstext.'<span>'.$instancename.$altname.'</span></a>';

Expand Down Expand Up @@ -1431,7 +1431,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
$completion = $hidecompletion
? COMPLETION_TRACKING_NONE
: $completioninfo->is_enabled($mod);
if ($completion!=COMPLETION_TRACKING_NONE && isloggedin() &&
if ($completion!=COMPLETION_TRACKING_NONE && isloggedin() &&
!isguestuser() && $mod->uservisible) {
$completiondata = $completioninfo->get_data($mod,true);
$completionicon = '';
Expand Down Expand Up @@ -1476,7 +1476,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
// If this completion state is used by the
// conditional activities system, we need to turn
// off the JS.
if (!empty($CFG->enableavailability) &&
if (!empty($CFG->enableavailability) &&
condition_info::completion_value_used_as_condition(
$course, $mod)) {
$extraclass = ' preventjs';
Expand All @@ -1502,15 +1502,15 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
}
}

// Show availability information (for someone who isn't allowed to
// Show availability information (for someone who isn't allowed to
// see the activity itself, or for staff)
if (!$mod->uservisible) {
echo '<div class="availabilityinfo">'.$mod->availableinfo.'</div>';
} else if ($canviewhidden && !empty($CFG->enableavailability)) {
$ci = new condition_info($mod);
$fullinfo = $ci->get_full_information();
if($fullinfo) {
echo '<div class="availabilityinfo">'.get_string($mod->showavailability
echo '<div class="availabilityinfo">'.get_string($mod->showavailability
? 'userrestriction_visible'
: 'userrestriction_hidden','condition',
$fullinfo).'</div>';
Expand Down Expand Up @@ -2057,7 +2057,7 @@ function update_category_button($categoryid = 0) {
* Category is 0 (for all courses) or an object
*/
function print_courses($category) {
global $CFG;
global $CFG, $OUTPUT;

if (!is_object($category) && $category==0) {
$categories = get_child_categories(0); // Parent = 0 ie top-level categories only
Expand Down Expand Up @@ -3138,7 +3138,7 @@ function category_delete_full($category, $showfeedback=true) {

events_trigger('course_category_deleted', $category);

return $deletedcourses;
return $deletedcourses;
}

/**
Expand Down Expand Up @@ -3354,7 +3354,7 @@ function create_course($data) {
throw new moodle_exception('idnumbertaken');
}
}


// preprocess allowed mods
$allowedmods = empty($data->allowedmods) ? array() : $data->allowedmods;
Expand Down Expand Up @@ -3504,13 +3504,13 @@ function is_course_participant ($userid, $courseid) {
$users = get_users_by_capability(
get_context_instance(CONTEXT_COURSE, $courseid),
'moodle/course:view','u.id');

foreach($users as $user) {
if ($user->id == $userid) {
return true;
}
}

return false;
}

Expand Down

0 comments on commit 2f48819

Please sign in to comment.