public function test_gradebookaccess_gradesnotavailableforstuds() { global $DB, $PAGE; $this->resetAfterTest(true); // Get the id for the necessary roles. $studentrole = $DB->get_field('role', 'id', array('shortname' => 'student')); $editteacherrole = $DB->get_field('role', 'id', array('shortname' => 'editingteacher')); // Create a course with grades disabled to students. $course2 = $this->getDataGenerator()->create_course(array('showgrades' => 0)); $PAGE->set_course($course2); // This becomes necessary because gradebook_accessible depends on $COURSE. // Create two users. $student = $this->getDataGenerator()->create_user(); $teacher = $this->getDataGenerator()->create_user(); // Enrol users to created course. $this->getDataGenerator()->enrol_user($student->id, $course2->id, $studentrole); $this->getDataGenerator()->enrol_user($teacher->id, $course2->id, $editteacherrole); $this->setUser($teacher); // Set the teacher as active user. // Check functionality of gradebook_accessible. $coursecontext = context_course::instance($course2->id); $isavailable = shared::gradebook_accessible($coursecontext); $this->assertTrue($isavailable); $this->setUser($student); // Set the student as active user. $isavailable = shared::gradebook_accessible($coursecontext); $this->assertFalse($isavailable); // As long as showgrades is not active, mustn't be available for studs. }
protected function end_section_list() { $output = html_writer::end_tag('ul'); $output .= "<section id='coursetools' class='clearfix' tabindex='-1'>"; $output .= shared::coursetools_svg_icons(); $output .= shared::appendices(); $output .= "</section>"; return $output; }
/** * Set properties from course and section. * @param \stdClass $course * @param \stdClass $section */ public function __construct($course, $section) { global $OUTPUT; static $compinfos = []; if (isset($compinfos[$course->id])) { $completioninfo = $compinfos[$course->id]; } else { $completioninfo = new \completion_info($course); $compinfos[$course->id] = $completioninfo; } if (!$completioninfo->is_enabled()) { return ''; // Completion tracking not enabled. } $sac = shared::section_activity_summary($section, $course, null); if (empty($sac->progress)) { return; } $this->progress = (object) ['complete' => $sac->progress->complete, 'total' => $sac->progress->total]; $this->pixcompleted = $OUTPUT->pix_url('i/completion-manual-y'); $this->completed = $sac->progress->complete === $sac->progress->total; }
echo $OUTPUT->page_heading_button(); // On the front page, output some different content. if ($PAGE->pagetype == 'site-index') { require __DIR__ . '/faux_site_index.php'; } else { echo $OUTPUT->main_content(); } echo $OUTPUT->course_content_footer(); if (stripos($PAGE->bodyclasses, 'format-singleactivity') !== false) { // Display course tools in single activity mode, but only on main page. // Current test for main page is based on the pagetype matching a regex. // Would be nice if there was something more direct to test. if (preg_match('/^mod-.*-view$/', $PAGE->pagetype)) { echo "<section id='coursetools' class='clearfix' tabindex='-1'>"; echo \theme_snap\output\shared::coursetools_svg_icons(); echo \theme_snap\output\shared::appendices(); echo "</section>"; } } ?> </section> <?php require __DIR__ . '/moodle-blocks.php'; ?> </main> </div> </div>
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 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; if ($ADMIN->fulltree) { // Output flex page front page warning if necessary. $fpwarning = \theme_snap\output\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);
// // 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 */ defined('MOODLE_INTERNAL') || die; $PAGE->set_popup_notification_allowed(false); // Require standard page js. \theme_snap\output\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
protected function end_section_list() { global $COURSE; $output = html_writer::end_tag('ul'); $output .= $this->change_num_sections($COURSE); $output .= "<section id='coursetools' class='clearfix'>"; $output .= shared::coursetools_svg_icons(); $output .= shared::appendices(); $output .= "</section>"; return $output; }
<!-- ////////////////////////// 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 \theme_snap\output\shared::flexpage_frontpage_warning(true); } else { if (strpos($PAGE->pagetype, 'course-view-') === 0) { $output = $PAGE->get_renderer('core', 'course'); echo $output->course_format_warning(); } } echo $OUTPUT->page_heading(); echo $OUTPUT->course_header(); ?> </div> </header> <?php if ($PAGE->user_allowed_editing()) {