Subversion-Projekte lars-tiefland.ci

Revision

Revision 2090 | Revision 2224 | 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');
2176 lars 12
		if (isset($GLOBALS["web_rechte"]["online_shop"]["artikel"]["status"]) && $GLOBALS["web_rechte"]["online_shop"]["artikel"]["status"]) {
1702 lars 13
			$artikelstatus = explode(";", $GLOBALS["web_rechte"]["online_shop"]["artikel"]["status"]);
14
			$this->smarty->assign('artikelstatus', $artikelstatus);
15
		}
2176 lars 16
		if (isset($GLOBALS["web_rechte"]["online_shop"]["artikel"]["Lieferstatus"]) && $GLOBALS["web_rechte"]["online_shop"]["artikel"]["Lieferstatus"]) {
1702 lars 17
			$lieferstatus = explode(";", $GLOBALS["web_rechte"]["online_shop"]["artikel"]["Lieferstatus"]);
18
			$this->smarty->assign('lieferstatus', $lieferstatus);
19
		}
20
		if (isset($GLOBALS["web_rechte"]["online_shop"]["artikel"]["LieferstatusMaintainer"]) &&
2176 lars 21
			$GLOBALS["web_rechte"]["online_shop"]["artikel"]["LieferstatusMaintainer"]) {
1702 lars 22
			$lieferstatusMaintainer = explode(";", $GLOBALS["web_rechte"]["online_shop"]["artikel"]["LieferstatusMaintainer"]);
23
			$this->smarty->assign('lieferstatusMaintainer', $lieferstatusMaintainer);
24
		}
1618 lars 25
		$robots = array(
26
			"index,follow",
27
			"index,nofollow",
28
			"noindex,follow",
29
			"noindex,nofollow",
30
			);
1588 lars 31
		$hersteller = $this->hersteller->get_list('dropdown');
2176 lars 32
		$preiseNamen = explode(";", ";" . $GLOBALS["web_rechte"]["online_shop"]["artikel"]["preise"]);
1793 lars 33
		$this->smarty->assign('preisNamen', $preiseNamen);
34
		$this->smarty->assign('robots', $robots);
35
		$this->smarty->assign('hersteller', $hersteller);
36
	}
1922 lars 37
 
1793 lars 38
	public function create($father)
39
	{
1922 lars 40
		$daten = array("Father" => $father, );
1793 lars 41
		$this->smarty->assign('daten', $daten);
42
		$this->smarty->view('artikel.tpl');
43
	}
44
	public function edit($id = null)
45
	{
1577 lars 46
		$daten = array();
2176 lars 47
		if ($id) {
1577 lars 48
			$daten = $this->artikel->get($id);
49
		}
1584 lars 50
		$this->smarty->assign('daten', $daten);
1577 lars 51
		$this->smarty->view('artikel.tpl');
52
	}
1673 lars 53
 
1899 lars 54
	public function medien($id)
55
	{
56
		$medien = $this->medien->get_artikel_medien($id);
2176 lars 57
		$this->smarty->assign("artikelId", $id);
1899 lars 58
		$this->smarty->assign('medien', $medien);
59
		$this->smarty->view('medien.tpl');
60
	}
61
 
1754 lars 62
	public function del($id = null)
63
	{
2176 lars 64
		if ($id) {
1754 lars 65
			$daten = $this->artikel->get($id);
66
			$name = $daten["kurzbezeichnung"];
67
			$typ = "Artikel";
68
			$this->smarty->assign('name', $name);
69
			$this->smarty->assign('id', $id);
70
			$this->smarty->assign('typ', $typ);
71
			$this->smarty->view('del.tpl');
2176 lars 72
		} elseif ($this->input->post('id')) {
1754 lars 73
			$this->artikel->del($this->input->post('id'));
74
		}
75
	}
1763 lars 76
 
77
	public function reset_cache($id)
78
	{
79
		$res = $this->artikel->reset_cache($id);
80
	}
81
 
1673 lars 82
	public function save()
83
	{
2176 lars 84
		if ($this->form_validation->run() !== false) {
2086 lars 85
			$artikel = $this->input->post('artikel');
86
			$this->artikel->save($artikel);
2176 lars 87
		} else {
2090 lars 88
			echo validation_errors();
89
		}
1673 lars 90
	}
1577 lars 91
}