if ($categ->published == 1) { $var_inc = 0; if (trim($categ->image) == "") { $categ->image = "components/com_guru/images/thumbs/no_image.gif"; $categ->imageName = "no_image.gif"; $guruHelper->createThumb($categ->imageName, "components/com_guru/images", $config_category->ctg_image_size, $type); } else { $guruHelper->createThumb($categ->imageName, $config->imagesin . "/categories", $config_category->ctg_image_size, $type); } if (trim($categ->image) != "") { $categ_image = '<img border="0" alt="" src="' . JURI::root() . $categ->image . '" />'; } else { $categ_image = ""; } $guruModelguruPcateg = new guruModelguruPcateg(); $no_programs = $guruModelguruPcateg->getnoprograms($categ->id); $return_value = $this->categlist($categ->id); $desc_align = $config_category->ctg_description_alignment == "0" ? "left" : "right"; $desc = $this->cutDescription($categ->description, $config_category->ctg_description_length, $config_category->ctg_description_type, $config_category->ctg_description_mode); ?> <div class="gru-courses"> <?php $category_layout .= '<div id="g_cath_detail_top" class="cat_level_wrap cat_level_' . $var_inc . ' g_sect clearfix">'; $category_layout .= '<div class="uk-grid"> <div class="uk-width-large-1-1"> <div class="uk-block uk-block-muted"> <div class="uk-container"> <h2>' . $categ->name . '</h2>'; if ($config_category->ctg_wrap_image == "0") { //wrap image if ($config_category->ctg_image_alignment == "0") {
function categlist_home($cid = '0', $level = '0', $selected_categories = array()) { $tree = ''; $level++; $db = JFactory::getDBO(); $q = "SELECT id, child_id, ordering, published, name FROM #__guru_category,#__guru_categoryrel "; $q .= "WHERE #__guru_categoryrel.parent_id='{$cid}' "; $q .= "AND #__guru_category.id=#__guru_categoryrel.child_id "; $q .= "ORDER BY #__guru_category.ordering ASC"; $db->setQuery($q); $allresults = $db->loadObjectList(); $ask = "SELECT * FROM `#__guru_config` LIMIT 1 "; $db->setQuery($ask); $result = $db->loadObject(); $cols = $result->ctgscols; global $i; $i = 0; foreach ($allresults as $child) { $id = $child->id; $no_programs = guruModelguruPcateg::getnoprograms($id); $no_programs2 = guruModelguruPcateg::no_of_programs_for_category_recursive($id); if ($result->show_empty_categ == '1' || $result->show_empty_categ == '0' && $no_programs > 0 || $result->show_empty_categ == '0' && $no_programs2 > 0) { $link = JRoute::_("index.php?option=com_guru&view=guruPcategs&task=view&cid=" . $id); $child_id = $child->id; if ($child_id != $cid) { $tree = $tree . "<li><a href='" . $link . "'>"; } $tree = $tree . $child->name . " (" . $no_programs . ")</a>"; $no_of_sub_categories = 0; // we extract how many subcategories has a subcategory $sub_category = guruModelguruPcateg::getchildren_of_subcategory($id); $no_of_sub_categories = count($sub_category); if ($no_of_sub_categories > 0) { $tree = $tree . '<ul>' . $this->categlist_home($child_id, $level, $selected_categories) . '</ul>'; } } $i++; } return $tree; }