Subversion-Projekte lars-tiefland.ci

Revision

Revision 526 | Revision 708 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php

/**
 * @author Lars Tiefland
 * @copyright 2016
 */

/**
 * Navigation
 * 
 * Liest die Menüstruktur aus
 * 
 * @package WebanOS CI
 * @author Lars Tiefland
 * @copyright 2016
 * @version $Id: Navigation.php 528 2016-09-15 11:20:18Z lars $
 * @access public
 */
class Navigation
{
        /**
         * Navigation::__construct()
         * 
         * @return
         */
        public function __construct()
        {
                $nav = array();
                $CI = &get_instance();
                $CI->load->model('category_model', 'category');
                $CI->db->select('id,name,Beschreibung,short_line_1');
                $CI->db->order_by('kennung', 'ASC');
                $res = $CI->db->get_where('directory', array(
                        'Father' => -1,
                        'language' => 'DE',
                        'sichtbar' => 1,
                        'status' => 0,
                        'artikelstamm' => 0,
                        ));
                //$lang_strings = $res->result_array();
                $cnt = 0;
                while ($row = $res->unbuffered_row('array'))
                {
                        $row['dirLink'] = $CI->category->get_link($row['id']);
                        $nav[$cnt]['sub'] = $this->get_sub($row['id']);
                        $nav[$cnt]['top'][] = $row;
                        $cnt++;
                }
                $CI->load->model('herstellerkatalog_model', 'hersteller');
                $hersteller_in_menu = $CI->hersteller->list_hersteller('', null, 0, 1);
        $hersteller_serie = array();
        foreach ( $hersteller_in_menu as $key => $hersteller )
        {
            $hSerie = $CI->hersteller->get_serien( $hersteller['ID'] );
            if ( count( $hSerie ) > 0 )
            {
                $hersteller_serie[$hersteller['ID']] = $hSerie;
            }
        }
                $CI->smarty->assign('herstellerInMenu', $hersteller_in_menu);
        $CI->smarty->assign( "herstellerSerie", $hersteller_serie );
                $CI->smarty->assign('nav', $nav);
                $CI->smarty->view('top_navigation.tpl');
        }

        /**
         * Navigation::get_sub()
         * 
         * @param mixed $id
         * @return
         */
        private function get_sub($id)
        {
                $sub = array();
                $CI = &get_instance();
                $CI->load->model('category_model', 'category');
                $CI->db->select('id,name,Beschreibung,short_line_1');
                $CI->db->order_by('kennung', 'ASC');
                $res = $CI->db->get_where('directory', array(
                        'Father' => $id,
                        'language' => 'DE',
                        'status' => 0,
                        'artikelstamm' => 0,
                        ));
                while ($row = $res->unbuffered_row('array'))
                {
                        $row['dirLink'] = $CI->category->get_link($row['id']);
                        $row['sub2'] = $this->get_sub($row['id']);
                        $sub[] = $row;
                }
                return $sub;
        }
}

?>