Subversion-Projekte lars-tiefland.ci

Revision

Revision 1841 | Revision 1850 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1813 lars 1
<?php
2
 
3
/**
4
 *
5
 * @package WebanOS CI
6
 * @author Lars Tiefland <ltiefland@gmail.com>
7
 * @copyright 2016
8
 * @version $Rev: 1842 $
9
 */
10
 
11
/**
12
 * Auspraegung_model
13
 *
14
 * @package WebanOS CI
15
 * @author Lars Tiefland
16
 * @copyright 2016
17
 * @version $Id: Directory_to_auspraegung_model.php 1842 2016-12-22 09:03:03Z lars $
18
 * @access public
19
 */
20
class Directory_to_auspraegung_model extends CI_Model
21
{
22
	/**
23
	 * Auspraegung_model::__construct()
24
	 *
25
	 * @return
26
	 */
27
	public function __construct()
28
	{
29
		parent::__construct();
30
	}
31
 
32
	/**
33
	 * Auspraegung_model::get_list()
34
	 *
35
	 * @return
36
	 */
37
	public function get_list($dir)
38
	{
1836 lars 39
		$sql = "SELECT DISTINCT
40
				auspraegung AS id
1813 lars 41
			FROM
42
				directory_to_auspraegung
43
			WHERE
44
				directory_id=".$dir."
45
		";
46
		$res = $this->db->query($sql);
47
		$rows = array();
48
		while ($row = $res->unbuffered_row('array'))
49
		{
50
			$row = $this->get($row["id"]);
1836 lars 51
			$row["wertebereich"] = $this->get_werte($row["id"], $dir);
1813 lars 52
			$rows[] = $row;
53
		}
54
		return $rows;
55
	}
56
 
1836 lars 57
	public function get($ausp)
1813 lars 58
	{
59
		$sql = "SELECT
1836 lars 60
				*
1813 lars 61
			FROM
1836 lars 62
				auspraegung
1813 lars 63
			WHERE
1836 lars 64
				id=".$ausp."
1813 lars 65
		";
66
		$res = $this->db->query($sql);
1836 lars 67
		$row = $res->unbuffered_row('array');
1813 lars 68
		return $row;
69
	}
1836 lars 70
 
71
	/**
72
	 * Auspraegung_model::get()
73
	 *
74
	 * @param mixed $id
75
	 * @return
76
	 */
77
	public function get_werte($id, $father)
78
	{
1841 lars 79
		$path = array_reverse(getPath($father, true));
1836 lars 80
		$werte = array();
81
		foreach ($path as $dir)
82
		{
83
			$directory = $dir["ID"];
84
			$sql = "SELECT
85
					dta.wertebereich
86
				FROM
87
					directory_to_auspraegung dta
88
				WHERE
89
					auspraegung=".$id."
90
				AND
91
					directory=".$directory."
92
			";
93
			$res = $this->db->query($sql);
94
			while ($row = $res->unbuffered_row('array'))
95
			{
96
				$werte[] = $row["wertebereich"];
97
			}
98
		}
99
		return $werte;
100
	}
1813 lars 101
}
102
 
103
?>