Subversion-Projekte lars-tiefland.ci

Revision

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

Revision Autor Zeilennr. Zeile
516 lars 1
<?php
2
 
3
/**
4
 * @author Lars Tiefland
5
 * @copyright 2016
6
 */
7
 
518 lars 8
/**
9
 * Navigation
10
 *
11
 * Liest die Menüstruktur aus
12
 *
526 lars 13
 * @package WebanOS CI
14
 * @author Lars Tiefland
15
 * @copyright 2016
16
 * @version $Id: Navigation.php 708 2016-09-28 18:54:13Z lars $
518 lars 17
 * @access public
18
 */
516 lars 19
class Navigation
20
{
518 lars 21
	/**
22
	 * Navigation::__construct()
23
	 *
24
	 * @return
25
	 */
516 lars 26
	public function __construct()
27
	{
28
		$nav = array();
29
		$CI = &get_instance();
30
		$CI->load->model('category_model', 'category');
31
		$CI->db->select('id,name,Beschreibung,short_line_1');
32
		$CI->db->order_by('kennung', 'ASC');
33
		$res = $CI->db->get_where('directory', array(
34
			'Father' => -1,
35
			'language' => 'DE',
36
			'sichtbar' => 1,
37
			'status' => 0,
38
			'artikelstamm' => 0,
39
			));
40
		//$lang_strings = $res->result_array();
41
		$cnt = 0;
42
		while ($row = $res->unbuffered_row('array'))
43
		{
44
			$row['dirLink'] = $CI->category->get_link($row['id']);
45
			$nav[$cnt]['sub'] = $this->get_sub($row['id']);
46
			$nav[$cnt]['top'][] = $row;
47
			$cnt++;
48
		}
49
		$CI->load->model('herstellerkatalog_model', 'hersteller');
50
		$hersteller_in_menu = $CI->hersteller->list_hersteller('', null, 0, 1);
708 lars 51
		$hersteller_serie = array();
52
		foreach ($hersteller_in_menu as $key => $hersteller)
53
		{
54
			$hSerie = $CI->hersteller->get_serien($hersteller['ID']);
55
			if (count($hSerie) > 0)
56
			{
57
				$hersteller_serie[$hersteller['ID']] = $hSerie;
58
			}
59
		}
516 lars 60
		$CI->smarty->assign('herstellerInMenu', $hersteller_in_menu);
708 lars 61
		$CI->smarty->assign("herstellerSerie", $hersteller_serie);
516 lars 62
		$CI->smarty->assign('nav', $nav);
708 lars 63
		$CI->smarty->assign('defaultLandID', 47);
516 lars 64
		$CI->smarty->view('top_navigation.tpl');
65
	}
66
 
518 lars 67
	/**
68
	 * Navigation::get_sub()
69
	 *
70
	 * @param mixed $id
71
	 * @return
72
	 */
516 lars 73
	private function get_sub($id)
74
	{
75
		$sub = array();
76
		$CI = &get_instance();
77
		$CI->load->model('category_model', 'category');
78
		$CI->db->select('id,name,Beschreibung,short_line_1');
79
		$CI->db->order_by('kennung', 'ASC');
80
		$res = $CI->db->get_where('directory', array(
81
			'Father' => $id,
82
			'language' => 'DE',
83
			'status' => 0,
84
			'artikelstamm' => 0,
85
			));
86
		while ($row = $res->unbuffered_row('array'))
87
		{
88
			$row['dirLink'] = $CI->category->get_link($row['id']);
89
			$row['sub2'] = $this->get_sub($row['id']);
90
			$sub[] = $row;
91
		}
92
		return $sub;
93
	}
94
}
95
 
276 lars 96
?>