Blame view

modules/admin/controller/fotovideoController.php 2.09 KB
8d65d0ce   andryeyev   init
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_FotovideoController 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('fotovideo');
  	$this->tpl->assign('menu_one',$row);
  	
  	$FotoVideo = new FotoVideo($this->lang);
  	$this->tpl->assign('rubrics',$FotoVideo->getRubrics());
  }
  
  
  
  
  
  
  
  public function save($id = 0){
    $FotoVideo = new FotoVideo($this->lang);
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
       $this->error = $FotoVideo->valid($this->postParam);
       if(!$this->error){
        $FotoVideo->saveRubric($this->postParam,$_FILES);
        Redirect($this->url.'/admin/fotovideo/');
       }
    }
    if($id != null){
     $row = $FotoVideo->viewRubric($id);
     $this->tpl->assign('rubric_one', $row);
    }
  }
  
  
  
  
  
  
  
  public function delete($id = null){
    if($id != null){
  	$FotoVideo = new FotoVideo($this->lang);
  	$FotoVideo->deleteRubric($id);
  	Redirect($this->url.'/admin/fotovideo/');
    }
  }
  
  //*************************************************************************
  
  public function open($rubric_id)
  {
  	$FotoVideo = new FotoVideo($this->lang);
  	$row = $FotoVideo->viewRubric($rubric_id);
  	$this->tpl->assign('rubric_one', $row);
  
  	$this->tpl->assign('gallery',$FotoVideo->getGallery($rubric_id));
  }
  
  public function save_gallery($rubric_id,$id = 0){
    $this->tpl->assign("rubric_id",$rubric_id);
    $FotoVideo = new FotoVideo($this->lang);
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
       $this->error = $FotoVideo->valid($this->postParam);
       if(!$this->error){
        $FotoVideo->saveGallery($this->postParam,$_FILES);
        Redirect($this->url.'/admin/fotovideo/open/'.$rubric_id.'/');
       }
    }
    if($id != null){
     $row = $FotoVideo->getGalleryOne($id);
     $this->tpl->assign('gallery', $row);
    }
  }
  
  public function delete_gallery($rubric_id,$id = null){
    if($id != null){
  	$FotoVideo = new FotoVideo($this->lang);
  	$FotoVideo->deleteGallery($id);
  	Redirect($this->url.'/admin/fotovideo/open/'.$rubric_id.'/');
    }
  }
  
  }
  ?>