Skip to content

Commit

Permalink
refactoring: delete unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
jrm-unamur committed Sep 10, 2019
1 parent 489203c commit aca190f
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,6 @@ protected function section_header($section, $course, $onsectionpage, $sectionret
$complete = 0;
$cancomplete = isloggedin() && !isguestuser();
$modinfo = get_fast_modinfo($course);

$sectionmods = array();
$completioninfo = new completion_info($course);
if (!empty($modinfo->sections[$section->section])) {
foreach ($modinfo->sections[$section->section] as $cmid) {
Expand All @@ -215,13 +213,6 @@ protected function section_header($section, $course, $onsectionpage, $sectionret
}

if ($thismod->uservisible) {
if (isset($sectionmods[$thismod->modname])) {
$sectionmods[$thismod->modname]['name'] = $thismod->modplural;
$sectionmods[$thismod->modname]['count']++;
} else {
$sectionmods[$thismod->modname]['name'] = $thismod->modfullname;
$sectionmods[$thismod->modname]['count'] = 1;
}
if ($cancomplete && $completioninfo->is_enabled($thismod) != COMPLETION_TRACKING_NONE) {
$total++;
$completiondata = $completioninfo->get_data($thismod, true);
Expand Down Expand Up @@ -422,7 +413,7 @@ protected function section_activity_summary($section, $course, $mods) {
return '';
}

// Generate array with count of activities in this section:
// Generate array with count of activities in this section.
$sectionmods = array();
$total = 0;
$complete = 0;
Expand Down Expand Up @@ -451,17 +442,17 @@ protected function section_activity_summary($section, $course, $mods) {
}

if (empty($sectionmods)) {
// No sections
// No sections.
return '';
}

// Output section activities summary:
// Output section activities summary.
$o = '';
$o.= html_writer::start_tag('div', array('class' => 'section-summary-activities mdl-right'));
$o .= html_writer::start_tag('div', array('class' => 'section-summary-activities mdl-right'));
foreach ($sectionmods as $mod) {
$o.= html_writer::start_tag('span', array('class' => 'activity-count'));
$o.= $mod['name'].': '.$mod['count'];
$o.= html_writer::end_tag('span');
$o .= html_writer::start_tag('span', array('class' => 'activity-count'));
$o .= $mod['name'].': '.$mod['count'];
$o .= html_writer::end_tag('span');
}
$o.= html_writer::end_tag('div');

Expand Down

0 comments on commit aca190f

Please sign in to comment.