Subversion-Projekte lars-tiefland.ci

Revision

Revision 1839 | Revision 1841 | 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: 1840 $
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 1840 2016-12-22 09:00:11Z 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
	{
79
		$path = array_reverse(getPath($father));
1840 lars 80
		var_dump($path);
1836 lars 81
		$werte = array();
82
		foreach ($path as $dir)
83
		{
84
			$directory = $dir["ID"];
85
			$sql = "SELECT
86
					dta.wertebereich
87
				FROM
88
					directory_to_auspraegung dta
89
				WHERE
90
					auspraegung=".$id."
91
				AND
92
					directory=".$directory."
93
			";
1839 lars 94
			var_dump($sql);
1836 lars 95
			$res = $this->db->query($sql);
96
			while ($row = $res->unbuffered_row('array'))
97
			{
98
				$werte[] = $row["wertebereich"];
99
			}
100
		}
101
		return $werte;
102
	}
1813 lars 103
}
104
 
105
?>