Ejemplo n.º 1
0
 public static function Instance()
 {
     if (self::$instance == null) {
         self::$instance = new M_Gallery();
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
 protected function On_Input()
 {
     parent::On_Input();
     $this->site_title .= " :: Look Book";
     $m_gallery = M_Gallery::Instance();
     $this->categories = $m_gallery->Categories();
     $this->galleries = $m_gallery->Galleries_With_Images();
 }
Ejemplo n.º 3
0
 public function action_diafilm()
 {
     $id_gallery = isset($this->params[2]) ? (int) $this->params[2] : 0;
     if ($id_gallery < 1 || !($images = M_Gallery::Instance()->get_images($id_gallery))) {
         $this->content = '';
     } else {
         // Получение пути к шаблону
         $templateName = $this->getTemplate('components/widgets/v_diafilm.php');
         // Формирование контента страницы
         $this->content = $this->Template($templateName, array('images' => $images));
     }
 }
Ejemplo n.º 4
0
 public function action_gallery()
 {
     $mGallery = M_Gallery::Instance();
     $gallery_id = isset($_GET['param']) ? (int) $_GET['param'] : 0;
     $fields = array();
     $fields['gallery'] = $mGallery->get($gallery_id);
     $fields['images'] = $mGallery->get_images($gallery_id);
     if (empty($fields['gallery'])) {
         $this->p404();
     }
     $this->title = $fields['gallery']['gallery_title'];
     $this->breadCrambsActive = $this->title;
     // Получение пути к шаблону
     $templateName = $this->getTemplate('components/page/v_gallery.php');
     // Формирование контента страницы
     $this->blocks['_content_page'] = $this->Template($templateName, $fields);
 }
Ejemplo n.º 5
0
 public function action_editimg()
 {
     $this->title .= ' :: Галереи';
     $mImages = M_MediaFiles::Instance();
     $gallery_id = isset($_GET['param2']) ? (int) $_GET['param2'] : 0;
     $this->gallery = M_Gallery::Instance()->get($gallery_id);
     $this->error = false;
     if (empty($this->gallery)) {
         $this->p404();
     }
     if ($this->isPost()) {
         if ($mImages->edit($_POST['fid'], $_POST)) {
             $this->redirect(M_Link::ToAdminGallery('images', $this->gallery['gallery_id']));
         }
         $this->fields = $_POST;
         $this->error = true;
     } else {
         $this->fields = $mImages->get($_GET['param']);
     }
     if (empty($this->fields)) {
         $this->p404();
     }
     // Получение пути к шаблону
     $templateName = $this->getTemplate('components/gallery/v_editimg.php');
     $this->content = $this->Template($templateName, $this);
 }
Ejemplo n.º 6
0
 public function action_getgallery()
 {
     foreach (M_Gallery::Instance()->all() as $key => $val) {
         $data[$key]['id_gallery'] = $val['gallery_id'];
         $data[$key]['title'] = $val['gallery_title'];
     }
     echo json_encode($data);
 }