Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1093
Línea 42... Línea 42...
42
/**
42
/**
43
 * @package    theme_universe
43
 * @package    theme_universe
44
 * @copyright  2023 Marcin Czaja - Rosea Themes - rosea.io
44
 * @copyright  2023 Marcin Czaja - Rosea Themes - rosea.io
45
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
45
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
46
 */
46
 */
47
class course_renderer extends \core_course_renderer {
47
class course_renderer extends \core_course_renderer
-
 
48
{
Línea 48... Línea 49...
48
 
49
 
49
    /**
50
    /**
50
     * Renders html to display a course search form
51
     * Renders html to display a course search form
51
     *
52
     *
52
     * @param string $value default value to populate the search field
53
     * @param string $value default value to populate the search field
53
     * @return string
54
     * @return string
54
     */
55
     */
-
 
56
    public function course_search_form($value = '')
Línea 55... Línea 57...
55
    public function course_search_form($value = '') {
57
    {
56
 
58
 
57
        $data = [
59
        $data = [
58
            'action' => \core_search\manager::get_course_search_url(),
60
            'action' => \core_search\manager::get_course_search_url(),
Línea 84... Línea 86...
84
     *
86
     *
85
     * @throws \coding_exception
87
     * @throws \coding_exception
86
     * @throws \dml_exception
88
     * @throws \dml_exception
87
     * @throws \moodle_exception
89
     * @throws \moodle_exception
88
     */
90
     */
89
    protected function coursecat_courses(coursecat_helper $chelper, $courses, $totalcount = null) {
91
    protected function coursecat_courses(coursecat_helper $chelper, $courses, $totalcount = null)
-
 
92
    {
90
        global $CFG, $COURSE;
93
        global $CFG, $COURSE;
Línea 91... Línea 94...
91
 
94
 
Línea 92... Línea 95...
92
        $theme = \theme_config::load('universe');
95
        $theme = \theme_config::load('universe');
Línea 181... Línea 184...
181
        $content .= html_writer::end_tag('div'); // End courses.
184
        $content .= html_writer::end_tag('div'); // End courses.
Línea 182... Línea 185...
182
 
185
 
183
        return $content;
186
        return $content;
Línea 184... Línea 187...
184
    }
187
    }
-
 
188
 
185
 
189
    protected function coursecat_subcategories(coursecat_helper $chelper, $coursecat, $depth)
186
    protected function coursecat_subcategories(coursecat_helper $chelper, $coursecat, $depth) {
190
    {
187
        global $CFG;
191
        global $CFG;
188
        $subcategories = array();
192
        $subcategories = array();
189
        if (!$chelper->get_categories_display_option('nodisplay')) {
193
        if (!$chelper->get_categories_display_option('nodisplay')) {
Línea 271... Línea 275...
271
     *
275
     *
272
     * @throws \coding_exception
276
     * @throws \coding_exception
273
     * @throws \dml_exception
277
     * @throws \dml_exception
274
     * @throws \moodle_exception
278
     * @throws \moodle_exception
275
     */
279
     */
276
    protected function coursecat_coursebox_content(coursecat_helper $chelper, $course) {
280
    protected function coursecat_coursebox_content(coursecat_helper $chelper, $course)
-
 
281
    {
277
        global $DB, $COURSE;
282
        global $DB, $COURSE,  $USER;
278
        $theme = \theme_config::load('universe');
283
        $theme = \theme_config::load('universe');
Línea 279... Línea 284...
279
 
284
 
280
        if ($course instanceof stdClass) {
285
        if ($course instanceof stdClass) {
281
            $course = new core_course_list_element($course);
286
            $course = new core_course_list_element($course);
Línea 306... Línea 311...
306
            $showcustomfields = true;
311
            $showcustomfields = true;
307
        } else {
312
        } else {
308
            $showcustomfields = false;
313
            $showcustomfields = false;
309
        }
314
        }
Línea -... Línea 315...
-
 
315
 
-
 
316
        $lastactivityurl = null;
-
 
317
        $params = [
-
 
318
            'userid' => $USER->id,
-
 
319
            'courseid' => $course->id,
-
 
320
            'eventname' => '\\core\\event\\course_module_viewed',
-
 
321
        ];
-
 
322
        $lastactivity = $DB->get_record_sql(
-
 
323
            "SELECT cm.id AS cmid, cmc.module, cmc.instance
-
 
324
             FROM {logstore_standard_log} l
-
 
325
             JOIN {course_modules} cm ON cm.id = l.contextinstanceid
-
 
326
             JOIN {modules} cmc ON cm.module = cmc.id
-
 
327
             WHERE l.userid = :userid
-
 
328
               AND l.courseid = :courseid
-
 
329
               AND l.eventname = :eventname
-
 
330
             ORDER BY l.timecreated DESC
-
 
331
             LIMIT 1",
-
 
332
            $params
-
 
333
        );
-
 
334
 
-
 
335
        if ($lastactivity) {
-
 
336
            $lastactivityurl = new moodle_url('/mod/' . $lastactivity->module . '/view.php', ['id' => $lastactivity->cmid]);
-
 
337
        }
310
 
338
 
311
        $data = [
339
        $data = [
312
            'id' => $course->id,
340
            'id' => $course->id,
313
            'fullname' => $chelper->get_course_formatted_name($course),
341
            'fullname' => $chelper->get_course_formatted_name($course),
314
            'visible' => $course->visible,
342
            'visible' => $course->visible,
Línea 325... Línea 353...
325
            'contacts' => $coursecontacts,
353
            'contacts' => $coursecontacts,
326
            'courseprogressbar' => $courseprogressbar,
354
            'courseprogressbar' => $courseprogressbar,
327
            'cccteachers' => $cccteachers,
355
            'cccteachers' => $cccteachers,
328
            'cccsummary' => $cccsummary,
356
            'cccsummary' => $cccsummary,
329
            'coursecarddesclimit' => $coursecarddesclimit,
357
            'coursecarddesclimit' => $coursecarddesclimit,
330
            'forcedlanguage' => $forcedlanguage
358
            'forcedlanguage' => $forcedlanguage,
-
 
359
            'lastactivityurl' => $lastactivityurl,
331
        ];
360
        ];
Línea 332... Línea 361...
332
 
361
 
333
        if ($theme->settings->courselistview == 1) {
362
        if ($theme->settings->courselistview == 1) {
334
            return $this->render_from_template('theme_universe/custom_courselist', $data);
363
            return $this->render_from_template('theme_universe/custom_courselist', $data);
Línea 347... Línea 376...
347
     * @param core_course_list_element|stdClass $course
376
     * @param core_course_list_element|stdClass $course
348
     * @param string $additionalclasses additional classes to add to the main <div> tag (usually
377
     * @param string $additionalclasses additional classes to add to the main <div> tag (usually
349
     *    depend on the course position in list - first/last/even/odd)
378
     *    depend on the course position in list - first/last/even/odd)
350
     * @return string
379
     * @return string
351
     */
380
     */
352
    protected function coursecat_coursebox(coursecat_helper $chelper, $course, $additionalclasses = '') {
381
    protected function coursecat_coursebox(coursecat_helper $chelper, $course, $additionalclasses = '')
-
 
382
    {
353
        if (!isset($this->strings->summary)) {
383
        if (!isset($this->strings->summary)) {
354
            $this->strings->summary = get_string('summary');
384
            $this->strings->summary = get_string('summary');
355
        }
385
        }
Línea 356... Línea 386...
356
 
386
 
Línea 370... Línea 400...
370
     *
400
     *
371
     * @param coursecat_helper $chelper various display options
401
     * @param coursecat_helper $chelper various display options
372
     * @param core_course_category $coursecat top category (this category's name and description will NOT be added to the tree)
402
     * @param core_course_category $coursecat top category (this category's name and description will NOT be added to the tree)
373
     * @return string
403
     * @return string
374
     */
404
     */
375
    protected function coursecat_tree(coursecat_helper $chelper, $coursecat) {
405
    protected function coursecat_tree(coursecat_helper $chelper, $coursecat)
-
 
406
    {
376
        // Reset the category expanded flag for this course category tree first.
407
        // Reset the category expanded flag for this course category tree first.
377
        $this->categoryexpandedonload = false;
408
        $this->categoryexpandedonload = false;
378
        $categorycontent = $this->coursecat_category_content($chelper, $coursecat, 1);
409
        $categorycontent = $this->coursecat_category_content($chelper, $coursecat, 1);
379
        if (empty($categorycontent)) {
410
        if (empty($categorycontent)) {
380
            return '';
411
            return '';
Línea 385... Línea 416...
385
        $attributes = $chelper->get_and_erase_attributes('course_category_tree clearfix');
416
        $attributes = $chelper->get_and_erase_attributes('course_category_tree clearfix');
386
        $content .= html_writer::start_tag('div', $attributes);
417
        $content .= html_writer::start_tag('div', $attributes);
Línea 387... Línea 418...
387
 
418
 
388
        if ($coursecat->get_children_count()) {
419
        if ($coursecat->get_children_count()) {
389
            $classes = array(
420
            $classes = array(
-
 
421
                'collapseexpand',
390
                'collapseexpand', 'aabtn'
422
                'aabtn'
Línea 391... Línea 423...
391
            );
423
            );
392
 
424
 
393
            // Check if the category content contains subcategories with children's content loaded.
425
            // Check if the category content contains subcategories with children's content loaded.
Línea 421... Línea 453...
421
     * @param coursecat_helper $chelper various display options
453
     * @param coursecat_helper $chelper various display options
422
     * @param core_course_category $coursecat
454
     * @param core_course_category $coursecat
423
     * @param int $depth depth of this category in the current tree
455
     * @param int $depth depth of this category in the current tree
424
     * @return string
456
     * @return string
425
     */
457
     */
426
    protected function coursecat_category(coursecat_helper $chelper, $coursecat, $depth) {
458
    protected function coursecat_category(coursecat_helper $chelper, $coursecat, $depth)
-
 
459
    {
427
        // Open category tag.
460
        // Open category tag.
428
        $classes = array('category');
461
        $classes = array('category');
429
        if (empty($coursecat->visible)) {
462
        if (empty($coursecat->visible)) {
430
            $classes[] = 'dimmed_category';
463
            $classes[] = 'dimmed_category';
431
        }
464
        }
Línea 535... Línea 568...
535
     * @param \core_course_list_element $course
568
     * @param \core_course_list_element $course
536
     * @param string $courselink
569
     * @param string $courselink
537
     *
570
     *
538
     * @return string
571
     * @return string
539
     */
572
     */
540
    public static function get_course_summary_image($course, $courselink) {
573
    public static function get_course_summary_image($course, $courselink)
-
 
574
    {
541
        global $CFG;
575
        global $CFG;
Línea 542... Línea 576...
542
 
576
 
543
        $contentimage = '';
577
        $contentimage = '';
544
        foreach ($course->get_course_overviewfiles() as $file) {
578
        foreach ($course->get_course_overviewfiles() as $file) {
Línea 569... Línea 603...
569
     *
603
     *
570
     * @param array $icons
604
     * @param array $icons
571
     *
605
     *
572
     * @return array
606
     * @return array
573
     */
607
     */
574
    protected function render_enrolment_icons(array $icons): array {
608
    protected function render_enrolment_icons(array $icons): array
-
 
609
    {
575
        $data = [];
610
        $data = [];
Línea 576... Línea 611...
576
 
611
 
577
        foreach ($icons as $icon) {
612
        foreach ($icons as $icon) {
578
            $data[] = $this->render($icon);
613
            $data[] = $this->render($icon);