fotoController.php
1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
Class Admin_FotoController Extends baseController {
protected $_navig = array('name'=>"Catalog");
public function preDispatch(){
$auth = new Auth();
if($auth->is_login_session() == false)Redirect($this->url.'/admin/auth/');
}
public function index()
{
$menu = new Menu($this->lang);
$row = $menu->view_params('foto');
$this->tpl->assign('menu_one',$row);
$Foto = new Foto($this->lang);
$this->tpl->assign('rubrics',$Foto->getRubrics());
}
public function save($id = 0){
$Foto = new Foto($this->lang);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$this->error = $Foto->valid($this->postParam);
if(!$this->error){
$Foto->saveRubric($this->postParam,$_FILES);
Redirect($this->url.'/admin/foto/');
}
}
if($id != null){
$row = $Foto->viewRubric($id);
$this->tpl->assign('rubric_one', $row);
}
}
public function delete($id = null){
if($id != null){
$Foto = new Foto($this->lang);
$Foto->deleteRubric($id);
Redirect($this->url.'/admin/foto/');
}
}
//*************************************************************************
public function open($rubric_id)
{
$Foto = new Foto($this->lang);
$row = $Foto->viewRubric($rubric_id);
$this->tpl->assign('rubric_one', $row);
$this->tpl->assign('gallery',$Foto->getGallery($rubric_id));
}
public function save_gallery($rubric_id,$id = 0){
$this->tpl->assign("rubric_id",$rubric_id);
$Foto = new Foto($this->lang);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$this->error = $Foto->valid($this->postParam);
if(!$this->error){
$Foto->saveGallery($this->postParam,$_FILES);
Redirect($this->url.'/admin/foto/open/'.$rubric_id.'/');
}
}
if($id != null){
$row = $Foto->getGalleryOne($id);
$this->tpl->assign('gallery', $row);
}
}
public function delete_gallery($rubric_id,$id = null){
if($id != null){
$Foto = new Foto($this->lang);
$Foto->deleteGallery($id);
Redirect($this->url.'/admin/foto/open/'.$rubric_id.'/');
}
}
}
?>