/**
  * toc progress percentage
  * @param stdClass $section
  * @param stdClass $course
  * @param boolean $perc - display as a percentage if true
  * @return string
  *
  * @Author Guy Thomas
  * @Date 2014-05-23
  */
 protected function toc_progress($section, $course, $perc = false)
 {
     global $CFG, $OUTPUT;
     require_once $CFG->libdir . '/completionlib.php';
     $completioninfo = new completion_info($course);
     if (!$completioninfo->is_enabled()) {
         return '';
         // Completion tracking not enabled.
     }
     $sac = snap_shared::section_activity_summary($section, $course, null);
     if (!empty($sac->progress)) {
         if ($perc) {
             $percentage = $sac->progress->percentage != null ? round($sac->progress->percentage, 0) . '%' : '';
             return '<span class="completionstatus percentage">' . $percentage . '</span>';
         } else {
             if ($sac->progress->total > 0) {
                 $progress = get_string('progresstotal', 'completion', $sac->progress);
                 $completed = '';
                 if ($sac->progress->complete === $sac->progress->total) {
                     $winbadge = $OUTPUT->pix_url('i/completion-manual-y');
                     $completedstr = s(get_string('completed', 'completion'));
                     $completed = "<img class=snap-section-complete src='{$winbadge}' alt='{$completedstr}' />";
                 }
                 $printprogress = "<span class='completionstatus outoftotal'>{$completed} {$progress}</span>";
                 return $printprogress;
             } else {
                 return '';
             }
         }
     }
 }
 protected function end_section_list()
 {
     $output = html_writer::end_tag('ul');
     $output .= "<section id='coursetools' class='clearfix' tabindex='-1'>";
     $output .= snap_shared::coursetools_svg_icons();
     $output .= snap_shared::appendices();
     $output .= "</section>";
     return $output;
 }
Beispiel #3
0
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Layout - header.
 * This layout is baed on a moodle site index.php file but has been adapted to show news items in a different
 * way.
 *
 * @package   theme_snap
 * @copyright Copyright (c) 2015 Moodlerooms Inc. (http://www.moodlerooms.com)
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
$PAGE->set_popup_notification_allowed(false);
// Require standard page js.
snap_shared::page_requires_js();
echo $OUTPUT->doctype();
?>

<html <?php 
echo $OUTPUT->htmlattributes();
?>
>
<head>
    <?php 
if (stripos($PAGE->bodyclasses, 'path-blocks-reports') !== false) {
    // Fix IE charting bug (flash stuff does not work correctly in IE).
    echo "\n" . '<meta http-equiv="X-UA-Compatible" content="IE=8,9,10">' . "\n";
}
?>
<title><?php 
<!--
////////////////////////// MAIN  ///////////////////////////////
-->
<main id="moodle-page" class="clearfix">

<header id="page-header" class="clearfix">
<nav class="breadcrumb-nav" role="navigation" aria-label="breadcrumb"><?php 
echo $OUTPUT->navbar();
?>
</nav>
<div id="page-mast">
<?php 
// Output flex page front page warning if necessary.
if ($PAGE->pagetype == 'site-index') {
    echo snap_shared::flexpage_frontpage_warning(true);
}
echo $OUTPUT->page_heading();
echo $OUTPUT->course_header();
?>
</div>

</header>

<?php 
if ($PAGE->user_allowed_editing()) {
    if ($COURSE->id == SITEID) {
        $url = new moodle_url('/course/view.php', array('id' => SITEID));
        echo $OUTPUT->edit_button($url);
    } else {
        echo $OUTPUT->edit_button($PAGE->url);
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Snap settings.
 *
 * @package   theme_snap
 * @copyright Copyright (c) 2015 Moodlerooms Inc. (http://www.moodlerooms.com)
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
defined('MOODLE_INTERNAL') || die;
require_once __DIR__ . '/renderers/snap_shared.php';
if ($ADMIN->fulltree) {
    // Output flex page front page warning if necessary.
    $fpwarning = snap_shared::flexpage_frontpage_warning();
    if (!empty($fpwarning)) {
        $setting = new admin_setting_heading('flexpage_warning', '', $fpwarning);
        $settings->add($setting);
    }
    $name = 'theme_snap/brandingheading';
    $title = new lang_string('brandingheading', 'theme_snap');
    $description = new lang_string('brandingheadingdesc', 'theme_snap');
    $setting = new admin_setting_heading($name, $title, $description);
    $settings->add($setting);
    if (!during_initial_install() && !empty(get_site()->fullname)) {
        // Site name setting.
        $name = 'fullname';
        $title = new lang_string('fullname', 'theme_snap');
        $description = new lang_string('fullnamedesc', 'theme_snap');
        $setting = new admin_setting_sitesettext($name, $title, $description, null);