Subversion-Projekte lars-tiefland.ci

Revision

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

Revision Autor Zeilennr. Zeile
321 lars 1
<?php
322 lars 2
 
520 lars 3
/**
4
 * Hersteller
5
 *
6
 * erzeugt die Herstellerübersicht bzw. die Artikelübersicht für einen Hersteller
7
 *
525 lars 8
 * @package WebanOS CI
9
 * @author Lars Tiefland
10
 * @copyright 2016
11
 * @version $Id: Hersteller.php 624 2016-09-20 18:54:47Z lars $
520 lars 12
 * @access public
13
 */
321 lars 14
class Hersteller extends CI_Controller
15
{
520 lars 16
	/**
17
	 * Hersteller::__construct()
18
	 *
19
	 * @return
20
	 */
321 lars 21
	public function __construct()
22
	{
23
		parent::__construct();
322 lars 24
		$this->load->model('Herstellerkatalog_model', 'hersteller');
321 lars 25
	}
26
 
520 lars 27
	/**
28
	 * Hersteller::index()
29
	 *
30
	 * @param string $begin
31
	 * @return
32
	 */
322 lars 33
	public function index($begin = '')
321 lars 34
	{
322 lars 35
		$herstellerListe2 = $this->hersteller->list_hersteller($begin);
508 lars 36
		$this->smarty->assign('title', 'Herstellerliste - '.$GLOBALS['INI']['titel_only']);
335 lars 37
		$this->smarty->assign('herstellerListe2', $herstellerListe2);
323 lars 38
		$this->smarty->view('hersteller_liste.tpl');
321 lars 39
	}
335 lars 40
 
520 lars 41
	/**
42
	 * Hersteller::view()
43
	 *
44
	 * @param mixed $h_id
45
	 * @return
46
	 */
624 lars 47
	public function view($h_id)
333 lars 48
	{
624 lars 49
		$start = 0;
50
		if ($this->input->get('per_page'))
51
		{
52
			$start = $this->input->get('per_page');
53
		}
335 lars 54
		$id = explode("-", $h_id);
55
		if (is_numeric($id[0]))
333 lars 56
		{
375 lars 57
			$hersteller = $this->hersteller->get_info($id[0]);
623 lars 58
			$items = $this->hersteller->list_items($id[0], $start);
380 lars 59
			foreach ($items as $item)
60
			{
386 lars 61
				if (is_array($item["path"]))
380 lars 62
				{
386 lars 63
					$pfad = array();
64
					$url = "/";
65
					foreach ($item["path"] as $path)
380 lars 66
					{
386 lars 67
						$name = $path["Name"];
68
						if ($path["ID"] == $item["Father"])
69
						{
387 lars 70
							$url .= "hersteller/view/".$id[0]."-".str_replace(" ", "-", $hersteller['Name']).
386 lars 71
								".html?kat=".$path["ID"]."-".str_replace(" ", "-", str2url($path["Name"]));
380 lars 72
 
386 lars 73
							$link = '<a href="'.$url.'">'.$name.'</a>';
74
							$katIDs[$path["ID"]] = $name; #
75
							$katUrl[$path["ID"]] = $url;
76
						}
77
						else
78
						{
79
							$link = $name;
80
						}
81
						$pfad[] = $link;
82
 
380 lars 83
					}
386 lars 84
					$pfad = implode(" -> ", $pfad);
85
					$item_kats[] = $pfad;
380 lars 86
				}
87
			}
335 lars 88
			$this->smarty->assign('items', $items);
380 lars 89
			if (!empty($katIDs))
90
			{
91
				$katIDs = array_unique($katIDs);
92
			}
93
			else
94
			{
95
				$katIDs = array();
96
			}
97
 
98
			$this->smarty->assign("katIDs", $katIDs);
99
 
100
			if (!empty($item_kats))
101
			{
102
				$item_kats = array_unique($item_kats);
103
			}
104
			else
105
			{
106
				$item_kats = array();
107
			}
508 lars 108
			$this->smarty->assign('title', $hersteller['Name'].' - '.$GLOBALS['INI']['titel_only']);
380 lars 109
			$this->smarty->assign("item_kats", $item_kats);
375 lars 110
			$this->smarty->assign('hersteller', $hersteller);
333 lars 111
			$this->smarty->view('hersteller_items.tpl');
112
		}
113
		else
114
		{
335 lars 115
 
333 lars 116
		}
117
	}
321 lars 118
}