Subversion-Projekte lars-tiefland.ci

Revision

Revision 2176 | 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);
2224 lars 58
		$this->samrty->assign("l_type", "a");
1899 lars 59
		$this->smarty->assign('medien', $medien);
60
		$this->smarty->view('medien.tpl');
61
	}
62
 
1754 lars 63
	public function del($id = null)
64
	{
2176 lars 65
		if ($id) {
1754 lars 66
			$daten = $this->artikel->get($id);
67
			$name = $daten["kurzbezeichnung"];
68
			$typ = "Artikel";
69
			$this->smarty->assign('name', $name);
70
			$this->smarty->assign('id', $id);
71
			$this->smarty->assign('typ', $typ);
72
			$this->smarty->view('del.tpl');
2176 lars 73
		} elseif ($this->input->post('id')) {
1754 lars 74
			$this->artikel->del($this->input->post('id'));
75
		}
76
	}
1763 lars 77
 
78
	public function reset_cache($id)
79
	{
80
		$res = $this->artikel->reset_cache($id);
81
	}
82
 
1673 lars 83
	public function save()
84
	{
2176 lars 85
		if ($this->form_validation->run() !== false) {
2086 lars 86
			$artikel = $this->input->post('artikel');
87
			$this->artikel->save($artikel);
2176 lars 88
		} else {
2090 lars 89
			echo validation_errors();
90
		}
1673 lars 91
	}
1577 lars 92
}