'.format_text($this->content->title, FORMAT_HTML, array('filter' => true)).'
'.format_text($this->content->subtitle, FORMAT_HTML, array('filter' => true)).'
'.format_text($this->content->subtitle, FORMAT_HTML, array('filter' => true)).'
'.get_string('number_of_courses', 'theme_edumy', $ccnGetCategoryDetails->coursesCount).'
'; } elseif($ccnGetCategoryDetails->subcategoriesCount >= 1) { $countNoOfCourses = ''.get_string('number_of_subcategories', 'theme_edumy', $ccnGetCategoryDetails->subcategoriesCount).'
'; } else { $countNoOfCourses = ''; } $this->content->text .= ' '; } } elseif($data->items > 0) { if ($topcategory->is_uservisible() && ($categories = $topcategory->get_children())) { // Check we have categories. if (count($categories) > 1 || (count($categories) == 1 && $DB->count_records('course') > 200)) { // Just print top level category links $i = 0; foreach ($categories as $category) { if(++$i > $data->items) break; $outputimage = ''; //ccnComm: Fetching the image manually added to the coursecat description via the Atto editor. $chelper = new coursecat_helper(); $description = $chelper->get_category_formatted_description($category); if ($description) { $dom = new DOMDocument(); $dom->loadHTML($description); $xpath = new DOMXPath($dom); $src = $xpath->evaluate("string(//img/@src)"); } if ($src && $description){ $outputimage = $src; } else { $children_courses = $category->get_courses(); if($children_courses >= 1){ $countNoOfCourses = ''.get_string('number_of_courses', 'theme_edumy', count($children_courses)).'
'; } else { $countNoOfCourses = ''; } foreach($children_courses as $child_course) { if ($child_course === reset($children_courses)) { foreach ($child_course->get_course_overviewfiles() as $file) { if ($file->is_valid_image()) { $imagepath = '/' . $file->get_contextid() . '/' . $file->get_component() . '/' . $file->get_filearea() . $file->get_filepath() . $file->get_filename(); $imageurl = file_encode_url($CFG->wwwroot . '/pluginfile.php', $imagepath, false); $outputimage = $imageurl; // Use the first image found. break; } } } } } $categoryname = $category->get_formatted_name(); $linkcss = $category->visible ? "" : " class=\"dimmed\" "; $this->content->text .= ' '; } } } else { // Just print course names of single category $category = array_shift($categories); if($category !== null){ $courses = $category->get_courses(); if ($courses) { foreach ($courses as $course) { $coursecontext = context_course::instance($course->id); $linkcss = $course->visible ? "" : " class=\"dimmed\" "; $this->content->text .= '