Subversion-Projekte lars-tiefland.ci

Revision

Revision 1899 | Revision 1924 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
898 lars 1
<?php
1577 lars 2
 
3
class Artikel extends CI_Controller
4
{
5
	public function __construct()
828 lars 6
	{
1577 lars 7
		parent::__construct();
8
		$this->load->model('artikel_model', 'artikel');
1584 lars 9
		$this->load->model('herstellerkatalog_model', 'hersteller');
1739 lars 10
		$this->load->model('preise_model', 'preise');
1899 lars 11
		$this->load->model('medien_model', 'medien');
1702 lars 12
		if (isset($GLOBALS["web_rechte"]["online_shop"]["artikel"]["status"]) && $GLOBALS["web_rechte"]["online_shop"]["artikel"]["status"])
13
		{
14
			$artikelstatus = explode(";", $GLOBALS["web_rechte"]["online_shop"]["artikel"]["status"]);
15
			$this->smarty->assign('artikelstatus', $artikelstatus);
16
		}
17
		if (isset($GLOBALS["web_rechte"]["online_shop"]["artikel"]["Lieferstatus"]) && $GLOBALS["web_rechte"]["online_shop"]["artikel"]["Lieferstatus"])
18
		{
19
			$lieferstatus = explode(";", $GLOBALS["web_rechte"]["online_shop"]["artikel"]["Lieferstatus"]);
20
			$this->smarty->assign('lieferstatus', $lieferstatus);
21
		}
22
		if (isset($GLOBALS["web_rechte"]["online_shop"]["artikel"]["LieferstatusMaintainer"]) &&
23
			$GLOBALS["web_rechte"]["online_shop"]["artikel"]["LieferstatusMaintainer"])
24
		{
25
			$lieferstatusMaintainer = explode(";", $GLOBALS["web_rechte"]["online_shop"]["artikel"]["LieferstatusMaintainer"]);
26
			$this->smarty->assign('lieferstatusMaintainer', $lieferstatusMaintainer);
27
		}
1618 lars 28
		$robots = array(
29
			"index,follow",
30
			"index,nofollow",
31
			"noindex,follow",
32
			"noindex,nofollow",
33
			);
1588 lars 34
		$hersteller = $this->hersteller->get_list('dropdown');
1793 lars 35
		$preiseNamen = explode(";", ";".$GLOBALS["web_rechte"]["online_shop"]["artikel"]["preise"]);
1922 lars 36
		$typen = array();
37
		$aehnlich = array(
38
			"nein",
39
			"ja",
40
			);
41
		$sql = "SELECT
42
	            id,
43
	            name
44
	        FROM
45
	            content_management.medien_typ
46
	    ";
47
		$res = $this->db->query($sql);
48
		while ($row = $res->unbuffered_row('array'))
49
		{
50
			$typen[$row['id']] = $row['name'];
51
		}
52
		$this->smarty->assign("typen", $typen);
53
		$this->smarty->assign("aehnlich", $aehnlich);
1793 lars 54
		$this->smarty->assign('preisNamen', $preiseNamen);
55
		$this->smarty->assign('robots', $robots);
56
		$this->smarty->assign('hersteller', $hersteller);
57
	}
1922 lars 58
 
1793 lars 59
	public function create($father)
60
	{
1922 lars 61
		$daten = array("Father" => $father, );
1793 lars 62
		$this->smarty->assign('daten', $daten);
63
		$this->smarty->view('artikel.tpl');
64
	}
65
	public function edit($id = null)
66
	{
1577 lars 67
		$daten = array();
1584 lars 68
		if ($id)
1577 lars 69
		{
70
			$daten = $this->artikel->get($id);
71
		}
1584 lars 72
		$this->smarty->assign('daten', $daten);
1577 lars 73
		$this->smarty->view('artikel.tpl');
74
	}
1673 lars 75
 
1899 lars 76
	public function medien($id)
77
	{
78
		$medien = $this->medien->get_artikel_medien($id);
79
		$this->smarty->assign('medien', $medien);
80
		$this->smarty->view('medien.tpl');
81
	}
82
 
1754 lars 83
	public function del($id = null)
84
	{
85
		if ($id)
86
		{
87
			$daten = $this->artikel->get($id);
88
			$name = $daten["kurzbezeichnung"];
89
			$typ = "Artikel";
90
			$this->smarty->assign('name', $name);
91
			$this->smarty->assign('id', $id);
92
			$this->smarty->assign('typ', $typ);
93
			$this->smarty->view('del.tpl');
94
		}
95
		elseif ($this->input->post('id'))
96
		{
97
			$this->artikel->del($this->input->post('id'));
98
		}
99
	}
1763 lars 100
 
101
	public function reset_cache($id)
102
	{
103
		$res = $this->artikel->reset_cache($id);
104
	}
105
 
1673 lars 106
	public function save()
107
	{
108
		$artikel = $this->input->post('artikel');
109
		$this->artikel->save($artikel);
110
	}
1577 lars 111
}