/
var
/
www
/
html
/
gte
/
theme
/
isqua
/
Upload File
HOME
<?php include_once($CFG->dirroot . "/course/renderer.php"); class theme_isqua_core_renderer extends theme_boost\output\core_renderer { /** * Wrapper for header elements. * * @return string HTML to display the main header. */ public function full_header() { global $PAGE; $header = new stdClass(); $header->settingsmenu = $this->context_header_settings_menu(); $header->contextheader = $this->context_header(); $header->hasnavbar = empty($PAGE->layout_options['nonavbar']); $header->navbar = $this->navbar(); $header->pageheadingbutton = $this->page_heading_button(); $header->courseheader = $this->course_header(); return $this->render_from_template('theme_isqua/header', $header); } } class theme_isqua_core_course_renderer extends core_course_renderer { /** * Displays one course in the list of courses. * * This is an internal function, to display an information about just one course * please use {@link core_course_renderer::course_info_box()} * * @param coursecat_helper $chelper various display options * @param core_course_list_element|stdClass $course * @param string $additionalclasses additional classes to add to the main <div> tag (usually * depend on the course position in list - first/last/even/odd) * @return string */ protected function coursecat_coursebox(coursecat_helper $chelper, $course, $additionalclasses = '') { if (!isset($this->strings->summary)) { $this->strings->summary = get_string('summary'); } if ($chelper->get_show_courses() <= self::COURSECAT_SHOW_COURSES_COUNT) { return ''; } if ($course instanceof stdClass) { $course = new core_course_list_element($course); } $content = ''; $classes = trim('coursebox clearfix '. $additionalclasses); if ($chelper->get_show_courses() >= self::COURSECAT_SHOW_COURSES_EXPANDED) { $nametag = 'h3'; } else { $classes .= ' collapsed'; $nametag = 'div'; } // .coursebox $content .= html_writer::start_tag('div', array( 'class' => $classes, 'data-courseid' => $course->id, 'data-type' => self::COURSECAT_TYPE_COURSE, )); //$content .= html_writer::start_tag('div', array('class' => 'info')); // course name $coursename = $chelper->get_course_formatted_name($course); $coursenamelink = html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)), $coursename, array('class' => $course->visible ? '' : 'dimmed')); $content .= html_writer::tag($nametag, $coursenamelink, array('class' => 'coursename')); // If we display course in collapsed form but the course has summary or course contacts, display the link to the info page. $content .= html_writer::start_tag('div', array('class' => 'moreinfo')); if ($chelper->get_show_courses() < self::COURSECAT_SHOW_COURSES_EXPANDED) { if ($course->has_summary() || $course->has_course_contacts() || $course->has_course_overviewfiles()) { $url = new moodle_url('/course/info.php', array('id' => $course->id)); $image = $this->output->pix_icon('i/info', $this->strings->summary); $content .= html_writer::link($url, $image, array('title' => $this->strings->summary)); // Make sure JS file to expand course content is included. $this->coursecat_include_js(); } } //$content .= html_writer::end_tag('div'); // .moreinfo // print enrolmenticons if ($icons = enrol_get_course_info_icons($course)) { $content .= html_writer::start_tag('div', array('class' => 'enrolmenticons')); foreach ($icons as $pix_icon) { $content .= $this->render($pix_icon); } $content .= html_writer::end_tag('div'); // .enrolmenticons } $content .= html_writer::end_tag('div'); // .info //$content .= html_writer::start_tag('div', array('class' => 'content')); $content .= $this->coursecat_coursebox_content($chelper, $course); //$content .= html_writer::end_tag('div'); // .content $courselink = html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)), 'Entrar', array('class' => $course->visible ? 'btn btn-dark btn-block' : 'dimmed')); $content .= html_writer::tag('div', $courselink, array('class' => 'link')); $content .= html_writer::end_tag('div'); // .coursebox return $content; } /** * Returns HTML to display course content (summary, course contacts and optionally category name) * * This method is called from coursecat_coursebox() and may be re-used in AJAX * * @param coursecat_helper $chelper various display options * @param stdClass|core_course_list_element $course * @return string */ protected function coursecat_coursebox_content(coursecat_helper $chelper, $course) { global $CFG; if ($chelper->get_show_courses() < self::COURSECAT_SHOW_COURSES_EXPANDED) { return ''; } // if ($course instanceof stdClass) { // $course = new core_course_list_element($course); // } $content = ''; // display course summary if ($course->has_summary()) { $content .= html_writer::start_tag('div', array('class' => 'summary')); $content .= $chelper->get_course_formatted_summary($course, array('overflowdiv' => true, 'noclean' => true, 'para' => false)); $content .= html_writer::end_tag('div'); // .summary } // display course overview files $contentimages = $contentfiles = ''; foreach ($course->get_course_overviewfiles() as $file) { $isimage = $file->is_valid_image(); $url = file_encode_url("$CFG->wwwroot/pluginfile.php", '/'. $file->get_contextid(). '/'. $file->get_component(). '/'. $file->get_filearea(). $file->get_filepath(). $file->get_filename(), !$isimage); if ($isimage) { $contentimages .= html_writer::tag('div', html_writer::empty_tag('img', array('src' => $url)), array('class' => 'courseimage')); } else { $image = $this->output->pix_icon(file_file_icon($file, 24), $file->get_filename(), 'moodle'); $filename = html_writer::tag('span', $image, array('class' => 'fp-icon')). html_writer::tag('span', $file->get_filename(), array('class' => 'fp-filename')); $contentfiles .= html_writer::tag('span', html_writer::link($url, $filename), array('class' => 'coursefile fp-filename-icon')); } } $content .= $contentimages. $contentfiles; // Display course contacts. See core_course_list_element::get_course_contacts(). if ($course->has_course_contacts()) { $content .= html_writer::start_tag('ul', array('class' => 'teachers')); foreach ($course->get_course_contacts() as $coursecontact) { $rolenames = array_map(function ($role) { return $role->displayname; }, $coursecontact['roles']); $name = implode(", ", $rolenames).': '. html_writer::link(new moodle_url('/user/view.php', array('id' => $coursecontact['user']->id, 'course' => SITEID)), $coursecontact['username']); $content .= html_writer::tag('li', $name); } $content .= html_writer::end_tag('ul'); // .teachers } // display course category if necessary (for example in search results) if ($chelper->get_show_courses() == self::COURSECAT_SHOW_COURSES_EXPANDED_WITH_CAT) { if ($cat = core_course_category::get($course->category, IGNORE_MISSING)) { $content .= html_writer::start_tag('div', array('class' => 'coursecat')); $content .= get_string('category').': '. html_writer::link(new moodle_url('/course/index.php', array('categoryid' => $cat->id)), $cat->get_formatted_name(), array('class' => $cat->visible ? '' : 'dimmed')); $content .= html_writer::end_tag('div'); // .coursecat } } // Display custom fields. // if ($course->has_custom_fields()) { // $handler = core_course\customfield\course_handler::create(); // $customfields = $handler->display_custom_fields_data($course->get_custom_fields()); // $content .= \html_writer::tag('div', $customfields, ['class' => 'customfields-container']); // } return $content; } }