Subversion-Projekte lars-tiefland.ci

Revision

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

Revision Autor Zeilennr. Zeile
127 lars 1
<?php
2
 
3
/**
4
 * @author Lars Tiefland
5
 * @copyright 2016
6
 */
7
 
519 lars 8
/**
9
 * Shop_position_model
10
 *
527 lars 11
 * @package WebanOS CI
12
 * @author Lars Tiefland
13
 * @copyright 2016
14
 * @version $Id: Shop_position_model.php 528 2016-09-15 11:20:18Z lars $
519 lars 15
 * @access public
16
 */
127 lars 17
class Shop_position_model extends CI_Model
18
{
19
	private $position = array();
519 lars 20
	/**
21
	 * Shop_position_model::__construct()
22
	 * zeit auf allen Shop-Seiten den Pfad zur aktuellen Seite an.
23
	 *
24
	 * @return
25
	 */
127 lars 26
	public function __construct()
27
	{
28
		parent::__construct();
128 lars 29
		$this->load->model('category_model', 'category');
127 lars 30
	}
31
 
519 lars 32
	/**
33
	 * Shop_position_model::get_position()
34
	 *
35
	 * Liest die aktuelle Positon aus und gibt diese zurück
36
	 *
37
	 * @param mixed $father
38
	 * @return
39
	 */
127 lars 40
	public function get_position($father)
41
	{
42
		$pos = array();
43
		$sql = 'SELECT
44
				*
45
			FROM
46
				directory
47
			WHERE
139 lars 48
				ID = ?
127 lars 49
			AND
50
				language="DE"
51
		';
52
		$res = $this->db->query($sql, array($father));
133 lars 53
		$row = $res->row_array();
127 lars 54
		$id = $row["ID"];
135 lars 55
		$father = $row["Father"];
152 lars 56
		$row["link"] = $this->category->get_link($id, 2);
127 lars 57
		$pos[] = $row;
135 lars 58
		while ($father != -1)
127 lars 59
		{
139 lars 60
			$res = $this->db->query($sql, array($father));
133 lars 61
			$row = $res->row_array();
127 lars 62
			$id = $row["ID"];
135 lars 63
			$father = $row["Father"];
152 lars 64
			$row["link"] = $this->category->get_link($id, 2);
127 lars 65
			$pos[] = $row;
66
		}
67
		$this->position = array_reverse($pos);
68
		return $this->position;
69
	}
70
}
71
 
72
?>