Subversion-Projekte lars-tiefland.ci

Revision

Revision 624 | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php

/**
 * Hersteller
 * 
 * erzeugt die Herstellerübersicht bzw. die Artikelübersicht für einen Hersteller
 * 
 * @package WebanOS CI
 * @author Lars Tiefland
 * @copyright 2016
 * @version $Id: Hersteller.php 624 2016-09-20 18:54:47Z lars $
 * @access public
 */
class Hersteller extends CI_Controller
{
        /**
         * Hersteller::__construct()
         * 
         * @return
         */
        public function __construct()
        {
                parent::__construct();
                $this->load->model('Herstellerkatalog_model', 'hersteller');
        }

        /**
         * Hersteller::index()
         * 
         * @param string $begin
         * @return
         */
        public function index($begin = '')
        {
                $herstellerListe2 = $this->hersteller->list_hersteller($begin);
                $this->smarty->assign('title', 'Herstellerliste - '.$GLOBALS['INI']['titel_only']);
                $this->smarty->assign('herstellerListe2', $herstellerListe2);
                $this->smarty->view('hersteller_liste.tpl');
        }

        /**
         * Hersteller::view()
         * 
         * @param mixed $h_id
         * @return
         */
        public function view($h_id)
        {
                $start = 0;
                if ($this->input->get('per_page'))
                {
                        $start = $this->input->get('per_page');
                }
                $id = explode("-", $h_id);
                if (is_numeric($id[0]))
                {
                        $hersteller = $this->hersteller->get_info($id[0]);
                        $items = $this->hersteller->list_items($id[0], $start);
                        foreach ($items as $item)
                        {
                                if (is_array($item["path"]))
                                {
                                        $pfad = array();
                                        $url = "/";
                                        foreach ($item["path"] as $path)
                                        {
                                                $name = $path["Name"];
                                                if ($path["ID"] == $item["Father"])
                                                {
                                                        $url .= "hersteller/view/".$id[0]."-".str_replace(" ", "-", $hersteller['Name']).
                                                                ".html?kat=".$path["ID"]."-".str_replace(" ", "-", str2url($path["Name"]));

                                                        $link = '<a href="'.$url.'">'.$name.'</a>';
                                                        $katIDs[$path["ID"]] = $name; #
                                                        $katUrl[$path["ID"]] = $url;
                                                }
                                                else
                                                {
                                                        $link = $name;
                                                }
                                                $pfad[] = $link;

                                        }
                                        $pfad = implode(" -> ", $pfad);
                                        $item_kats[] = $pfad;
                                }
                        }
                        $this->smarty->assign('items', $items);
                        if (!empty($katIDs))
                        {
                                $katIDs = array_unique($katIDs);
                        }
                        else
                        {
                                $katIDs = array();
                        }

                        $this->smarty->assign("katIDs", $katIDs);

                        if (!empty($item_kats))
                        {
                                $item_kats = array_unique($item_kats);
                        }
                        else
                        {
                                $item_kats = array();
                        }
                        $this->smarty->assign('title', $hersteller['Name'].' - '.$GLOBALS['INI']['titel_only']);
                        $this->smarty->assign("item_kats", $item_kats);
                        $this->smarty->assign('hersteller', $hersteller);
                        $this->smarty->view('hersteller_items.tpl');
                }
                else
                {

                }
        }
}