コード例 #1
0
ファイル: gurupcateg.php プロジェクト: JozefAB/neoacu
 function no_of_programs_for_category_recursive($id)
 {
     //global $no_of_cats_with_programs;
     $no_of_cats_with_programs = 0;
     $db = JFactory::getDBO();
     $query = "SELECT child_id FROM `#__guru_categoryrel` WHERE parent_id=" . $id;
     //$this->_promos = $this->_getList($query);
     $db->setQuery($query);
     $child_id_object = $db->loadColumn();
     if (isset($child_id_object)) {
         foreach ($child_id_object as $child_id) {
             $more = guruModelguruPcateg::no_of_programs_for_category_recursive($child_id);
             $no_of_cats_with_programs = $no_of_cats_with_programs + $more;
             $db = JFactory::getDBO();
             $query = "SELECT count(id) FROM `#__guru_program` WHERE published='1' AND status='1' AND catid=" . $child_id;
             $db->setQuery($query);
             $how_many = $db->loadColumn();
             $how_many = $how_many["0"];
             if ($how_many > 0) {
                 $no_of_cats_with_programs = $no_of_cats_with_programs + $how_many;
             }
         }
     }
     //echo $no_of_cats_with_programs.' - '.$id.'<br />';
     return $no_of_cats_with_programs;
 }
コード例 #2
0
ファイル: view.php プロジェクト: JozefAB/neoacu
$deviceType = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'phone' : 'computer';
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
コード例 #3
0
ファイル: view.html.php プロジェクト: JozefAB/qk
 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;
 }