Subversion-Projekte lars-tiefland.ci

Revision

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

Revision 927 Revision 933
Zeile 123... Zeile 123...
123
		$this->smarty->assign("rep_hours", $rep_hours);
123
		$this->smarty->assign("rep_hours", $rep_hours);
124
		$this->smarty->assign("hours", $hours);
124
		$this->smarty->assign("hours", $hours);
125
		$this->smarty->view('scheduler_edit.tpl');
125
		$this->smarty->view('scheduler_edit.tpl');
126
	}
126
	}
Zeile -... Zeile 127...
-
 
127
 
-
 
128
	public function save()
-
 
129
	{
-
 
130
		$intervall = $this->create_intervall();
-
 
131
		if (!column_exists("schnittstellen", "aktiv", $GLOBALS["webs"]["datenbank"], $this->db))
-
 
132
		{
-
 
133
			$sql = "
-
 
134
                ALTER TABLE
-
 
135
                    schnittstellen
-
 
136
                ADD
-
 
137
                    aktiv BOOL NOT NULL DEFAULT '1' AFTER user
-
 
138
            ";
-
 
139
			$this->db->query($sql);
-
 
140
		}
-
 
141
		if (column_exists("schnittstellen", "email", $GLOBALS["webs"]["datenbank"], $this->db))
-
 
142
		{
-
 
143
			$extra = "email='".$this->input->post('email')."',";
-
 
144
		}
-
 
145
		if ($this->input->post('id'))
-
 
146
		{
-
 
147
			$sql = "
-
 
148
                UPDATE
-
 
149
                    schnittstellen
-
 
150
                SET
-
 
151
                    ".$extra."
-
 
152
                    name='".$this->input->post("name")."',
-
 
153
                    art='".$this->input->post('art')."',
-
 
154
                    user='".$this->input->post('user')."',
-
 
155
                    skript='".$this->input->post('skript')."',
-
 
156
                    parameter='".$this->input->post('parameter')."',
-
 
157
                    nutzungsart='".$this->input->post('nutzungsart')."',
-
 
158
                    aktiv = ".$this->input->post('aktiv').",
-
 
159
                    intervall='".$intervall."',
-
 
160
                    letzte_aenderung_von='".$_SERVER["PHP_AUTH_USER"]."'
-
 
161
                WHERE
-
 
162
                    id='".$this->input->post('id')."'
-
 
163
            ";
-
 
164
			$res = $this->db->query($sql);
-
 
165
			if ($res)
-
 
166
			{
-
 
167
				$msg = "Cronjob erfolgreich aktualisiert!";
-
 
168
			}
-
 
169
			else
-
 
170
			{
-
 
171
				$msg = "Leider ist ein Fehler aufgetreten.<br>";
-
 
172
				$msg .= "Bitte versuchen Sie es sp&auml;ter noch einmal!<br>";
-
 
173
				//$msg .= mysql_error();
-
 
174
			}
-
 
175
		}
-
 
176
		else
-
 
177
		{
-
 
178
			$sql = "
-
 
179
                INSERT INTO
-
 
180
                    schnittstellen
-
 
181
                SET
-
 
182
                    ".$extra."
-
 
183
                    name='".$this->input->post('name')."',
-
 
184
                    art='".$this->input->post('art')."',
-
 
185
                    user='".$this->input->post('user')."',
-
 
186
                    skript='".$this->input->post('skript')."',
-
 
187
                    parameter='".$this->input->post('parameter')."',
-
 
188
                    nutzungsart='".$this->input->post('nutzungsart')."',
-
 
189
                    aktiv = ".$this->input->post('aktiv').",
-
 
190
                    intervall='".$intervall."',
-
 
191
                    erstellt_am=NOW(),
-
 
192
                    erstellt_von='".$_SERVER["PHP_AUTH_USER"]."',
-
 
193
                    letzte_aenderung_von='".$_SERVER["PHP_AUTH_USER"]."'
-
 
194
 
-
 
195
            ";
-
 
196
			$res = $this->db->query($sql);
-
 
197
			if ($res)
-
 
198
			{
-
 
199
				$msg = "neuen Cronjob erfolgreich angelegt!";
-
 
200
			}
-
 
201
			else
-
 
202
			{
-
 
203
				$msg = "Leider ist ein Fehler aufgetreten.<br>";
-
 
204
				$msg .= "Bitte versuchen Sie es sp&auml;ter noch einmal!<br>";
-
 
205
				//$msg .= mysql_error();
-
 
206
			}
-
 
207
		}
-
 
208
		echo $msg;
-
 
209
	}
127
 
210
 
128
	private function get_task($id)
211
	private function get_task($id)
129
	{
212
	{
130
		$sql = "SELECT
213
		$sql = "SELECT
131
				*
214
				*
Zeile 229... Zeile 312...
229
		return $intervallArr;
312
		return $intervallArr;
230
	}
313
	}
Zeile 231... Zeile 314...
231
 
314
 
232
	function create_intervall()
315
	function create_intervall()
233
	{
316
	{
234
		if ($_POST["rep_hour"] != 0)
317
		if ($this->input->post('rep_hour') != 0)
235
		{
318
		{
236
			$hour = "*";
319
			$hour = "*";
237
			if ($_POST["rep_hour"] != 1)
320
			if ($this->input->post('rep_hour') != 1)
238
			{
321
			{
239
				$hour .= "/".$_POST["rep_hour"];
322
				$hour .= "/".$this->input->post('rep_hour');
240
			}
323
			}
241
		}
324
		}
242
		elseif (count($_POST["Time_Hour"]) == 24)
325
		elseif (count($this->input->post('Time_Hour')) == 24)
243
		{
326
		{
244
			$hour = "*";
327
			$hour = "*";
245
		}
328
		}
246
		else
329
		else
247
		{
330
		{
248
			$hour = implode(",", $_POST["Time_Hour"]);
331
			$hour = implode(",", $this->input->post('Time_Hour'));
249
		}
332
		}
250
		if ($_POST["rep_min"] != 0)
333
		if ($this->input->post('rep_min') != 0)
251
		{
334
		{
252
			$min = "*";
335
			$min = "*";
253
			if ($_POST["rep_min"] != 1)
336
			if ($this->input->post('rep_min') != 1)
254
			{
337
			{
255
				$min .= "/".$_POST["rep_min"];
338
				$min .= "/".$this->input->post('rep_min');
256
			}
339
			}
257
		}
340
		}
258
		elseif (count($_POST["Time_Minute"]) == 60)
341
		elseif (count($this->input->post('Time_Minute')) == 60)
259
		{
342
		{
260
			$min = "*";
343
			$min = "*";
261
		}
344
		}
262
		else
345
		else
263
		{
346
		{
264
			$min = implode(",", $_POST["Time_Minute"]);
347
			$min = implode(",", $this->input->post('Time_Minute'));
265
		}
348
		}
266
		if (count($_POST["dow"]) == 7)
349
		if (count($this->input->post('dow')) == 7)
267
		{
350
		{
268
			$dow = "*";
351
			$dow = "*";
269
		}
352
		}
270
		else
353
		else
271
		{
354
		{
272
			$dow = implode(",", $_POST["dow"]);
355
			$dow = implode(",", $this->input->post('dow'));
Zeile 273... Zeile 356...
273
		}
356
		}
274
 
357
 
275
		if (count($_POST["dom"]) == 31)
358
		if (count($this->input->post('dom')) == 31)
276
		{
359
		{
277
			$dom = "*";
360
			$dom = "*";
278
		}
361
		}
279
		else
362
		else
280
		{
363
		{
Zeile 281... Zeile 364...
281
			$dom = implode(",", $_POST["dom"]);
364
			$dom = implode(",", $this->input->post('dom'));
282
		}
365
		}
283
 
366
 
284
		if (count($_POST["mon"]) == 12)
367
		if (count($this->input->post('mon')) == 12)
285
		{
368
		{
286
			$mon = "*";
369
			$mon = "*";
287
		}
370
		}
288
		else
371
		else
Zeile 289... Zeile 372...
289
		{
372
		{
290
			$mon = implode(",", $_POST["mon"]);
373
			$mon = implode(",", $this->input->post('mon'));
291
		}
374
		}