Subversion-Projekte lars-tiefland.ci

Revision

Revision 1897 | Revision 1901 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 1897 Revision 1900
Zeile 11... Zeile 11...
11
 * Liest die Bilder von Artikeln oder Kategorien aus
11
 * Liest die Bilder von Artikeln oder Kategorien aus
12
 * 
12
 * 
13
 * @package WebanOS CI
13
 * @package WebanOS CI
14
 * @author Lars Tiefland
14
 * @author Lars Tiefland
15
 * @copyright 2016
15
 * @copyright 2016
16
 * @version $Id: Medien_model.php 1897 2016-12-24 23:35:19Z lars $
16
 * @version $Id: Medien_model.php 1900 2016-12-25 20:26:48Z lars $
17
 * @access public
17
 * @access public
18
 */
18
 */
19
class Medien_model extends CI_Model
19
class Medien_model extends CI_Model
20
{
20
{
21
	private $sql;
21
	private $sql;
Zeile 43... Zeile 43...
43
			"_sl" => "sl/",
43
			"_sl" => "sl/",
44
			"_start" => "start/",
44
			"_start" => "start/",
45
			"_icon" => "icon/",
45
			"_icon" => "icon/",
46
			);
46
			);
Zeile 47... Zeile 47...
47
 
47
 
48
		$this->sql["medien"]["artikel"] = "SELECT
48
		$this->sql["medien"]["artikel_all"] = "SELECT
49
				m.name,
49
				m.name,
50
				m.folder,
50
				m.folder,
51
				m.beschreibung,
51
				m.beschreibung,
52
				m.typ,
52
				m.typ,
Zeile 93... Zeile 93...
93
			AND
93
			AND
94
				typ=?
94
				typ=?
95
			ORDER BY
95
			ORDER BY
96
				rang
96
				rang
97
		";
97
		";
-
 
98
		$this->sql["medien"]["artikel"] = "SELECT
-
 
99
				m.name,
-
 
100
				m.folder,
-
 
101
				m.beschreibung,
-
 
102
				m.typ,
-
 
103
				am.rang,
-
 
104
				am.aehnlich,
-
 
105
				mt.name AS typ_name
-
 
106
			FROM
-
 
107
				medien m
-
 
108
			JOIN
-
 
109
				artikel_medien am
-
 
110
			JOIN
-
 
111
				content_management.medien_typ mt
-
 
112
			ON
-
 
113
				mt.id=m.typ
-
 
114
			WHERE
-
 
115
				am.medien_id=m.id
-
 
116
			AND
-
 
117
				artikel_id=?
-
 
118
			ORDER BY
-
 
119
				rang
-
 
120
		";
-
 
121
		$this->sql["medien"]["category_all"] = "SELECT
-
 
122
				m.name,
-
 
123
				m.folder,
-
 
124
				m.beschreibung,
-
 
125
				m.typ,
-
 
126
				dm.rang,
-
 
127
				dm.aehnlich,
-
 
128
				mt.name AS typ_name
-
 
129
			FROM
-
 
130
				medien m
-
 
131
			JOIN
-
 
132
				directory_medien dm
-
 
133
			JOIN
-
 
134
				content_management.medien_typ mt
-
 
135
			ON
-
 
136
				mt.id=m.typ
-
 
137
			WHERE
-
 
138
				dm.medien_id=m.id
-
 
139
			AND
-
 
140
				directory_id=?
-
 
141
			ORDER BY
-
 
142
				rang
-
 
143
		";
98
	}
144
	}
Zeile 99... Zeile 145...
99
 
145
 
100
	/**
146
	/**
101
	 * Medien_model::get_artikel_medien()
147
	 * Medien_model::get_artikel_medien()
Zeile 104... Zeile 150...
104
	 * 
150
	 * 
105
	 * @param mixed $artikel_id
151
	 * @param mixed $artikel_id
106
	 * @param integer $typ
152
	 * @param integer $typ
107
	 * @return
153
	 * @return
108
	 */
154
	 */
109
	public function get_artikel_medien($artikel_id, $typ = 1)
155
	public function get_artikel_medien($artikel_id, $typ = null)
110
	{
156
	{
111
		$medien = array();
157
		$medien = array();
-
 
158
		if (is_null($typ))
-
 
159
		{
-
 
160
			$am_res = $this->db->query($this->sql["medien"]["artikel_all"], array($artikel_id, ));
-
 
161
		}
-
 
162
		else
-
 
163
		{
112
		$am_res = $this->db->query($this->sql["medien"]["artikel"], array(
164
			$am_res = $this->db->query($this->sql["medien"]["artikel"], array(
113
			$artikel_id,
165
				$artikel_id,
114
			$typ,
166
				$typ,
115
			));
167
				));
-
 
168
		}
116
		$basis = $GLOBALS["webs"]["verzeichnis"]."/images/upload/";
169
		$basis = $GLOBALS["webs"]["verzeichnis"]."/images/upload/";
117
		if ($am_res->num_rows())
170
		if ($am_res->num_rows())
118
		{
171
		{
119
			while ($row = $am_res->unbuffered_row('array'))
172
			while ($row = $am_res->unbuffered_row('array'))
120
			{
173
			{
Zeile 171... Zeile 224...
171
	 * 
224
	 * 
172
	 * @param mixed $category_id
225
	 * @param mixed $category_id
173
	 * @param integer $typ
226
	 * @param integer $typ
174
	 * @return
227
	 * @return
175
	 */
228
	 */
176
	public function get_category_medien($category_id, $typ = 1)
229
	public function get_category_medien($category_id, $typ = null)
177
	{
230
	{
178
		$basis = $GLOBALS["webs"]["verzeichnis"]."/images/upload/";
231
		$basis = $GLOBALS["webs"]["verzeichnis"]."/images/upload/";
179
		$medien = array();
232
		$medien = array();
-
 
233
		if (is_null($typ))
-
 
234
		{
-
 
235
			$am_res = $this->db->query($this->sql["medien"]["category_all"], array($category_id, ));
-
 
236
		}
-
 
237
		else
-
 
238
		{
180
		$am_res = $this->db->query($this->sql["medien"]["category"], array(
239
			$am_res = $this->db->query($this->sql["medien"]["category"], array(
181
			$category_id,
240
				$category_id,
182
			$typ,
241
				$typ,
183
			));
242
				));
-
 
243
		}
184
		if ($am_res->num_rows())
244
		if ($am_res->num_rows())
185
		{
245
		{
186
			while ($row = $am_res->unbuffered_row('array'))
246
			while ($row = $am_res->unbuffered_row('array'))
187
			{
247
			{
188
				$url = '/images/upload/';
248
				$url = '/images/upload/';