Subversion-Projekte lars-tiefland.ci

Revision

Revision 1924 | Revision 2090 | 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"]);
36
		$this->smarty->assign('preisNamen', $preiseNamen);
37
		$this->smarty->assign('robots', $robots);
38
		$this->smarty->assign('hersteller', $hersteller);
39
	}
1922 lars 40
 
1793 lars 41
	public function create($father)
42
	{
1922 lars 43
		$daten = array("Father" => $father, );
1793 lars 44
		$this->smarty->assign('daten', $daten);
45
		$this->smarty->view('artikel.tpl');
46
	}
47
	public function edit($id = null)
48
	{
1577 lars 49
		$daten = array();
1584 lars 50
		if ($id)
1577 lars 51
		{
52
			$daten = $this->artikel->get($id);
53
		}
1584 lars 54
		$this->smarty->assign('daten', $daten);
1577 lars 55
		$this->smarty->view('artikel.tpl');
56
	}
1673 lars 57
 
1899 lars 58
	public function medien($id)
59
	{
60
		$medien = $this->medien->get_artikel_medien($id);
61
		$this->smarty->assign('medien', $medien);
62
		$this->smarty->view('medien.tpl');
63
	}
64
 
1754 lars 65
	public function del($id = null)
66
	{
67
		if ($id)
68
		{
69
			$daten = $this->artikel->get($id);
70
			$name = $daten["kurzbezeichnung"];
71
			$typ = "Artikel";
72
			$this->smarty->assign('name', $name);
73
			$this->smarty->assign('id', $id);
74
			$this->smarty->assign('typ', $typ);
75
			$this->smarty->view('del.tpl');
76
		}
77
		elseif ($this->input->post('id'))
78
		{
79
			$this->artikel->del($this->input->post('id'));
80
		}
81
	}
1763 lars 82
 
83
	public function reset_cache($id)
84
	{
85
		$res = $this->artikel->reset_cache($id);
86
	}
87
 
1673 lars 88
	public function save()
89
	{
2086 lars 90
		if ($this->form_validation->run() !== false)
91
		{
92
			$artikel = $this->input->post('artikel');
93
			$this->artikel->save($artikel);
94
		}
1673 lars 95
	}
1577 lars 96
}