Beispiel #1
0
 public function __construct($view, $param)
 {
     parent::__construct();
     $this->add("hornav");
     $this->add("n");
     $this->name = "form_viewgallery";
     $this->enctype = "multipart/form-data";
     $this->action = URL::current();
     $viewgallery_obj = new ViewgalleryDB();
     $viewgallery_obj->load($param["view_id"]);
     $this->hornav = new Hornav();
     $this->hornav->addData("Админпанель", URL::get("menu", "admin"));
     $this->hornav->addData("Галерея", URL::get("viewgallery", "admin"));
     $this->hornav->addData($viewgallery_obj->title, URL::get("listgallery", "admin", array("view_id" => $param["view_id"])));
     if (!$param["gallery_id"]) {
         $this->hornav->addData("Добавить");
         $this->text("title", "Название:", FormProcessor::getSessionData("title"));
         $this->file("img", "Картинка:");
         $this->textarea("meta_desc", "Описание:", FormProcessor::getSessionData("meta_desc"));
         $this->textarea("meta_key", "Ключевые слова:", FormProcessor::getSessionData("meta_key"));
         $this->submit("insert_listgallery", "Сохранить");
     } else {
         $this->hidden("id", $param["gallery_id"]);
         $gallery_obj = new GalleryDB();
         $gallery_obj->load($param["gallery_id"]);
         $this->hornav->addData("Изменить");
         $this->text("title", "Название:", $gallery_obj->title);
         $this->file("img", "Картинка:");
         $this->textarea("meta_desc", "Описание:", $gallery_obj->meta_desc);
         $this->textarea("meta_key", "Ключевые слова:", $gallery_obj->meta_key);
         $this->submit("update_listgallery", "Сохранить");
     }
 }
Beispiel #2
0
 public function __construct($view, $param)
 {
     parent::__construct();
     $this->add("hornav");
     $this->add("n");
     $this->name = "form_viewgallery";
     $this->enctype = "multipart/form-data";
     $this->action = URL::current();
     $viewgallery_obj = new ViewgalleryDB();
     $viewgallery_obj->load($param["view_id"]);
     $gallery_obj = new GalleryDB();
     $gallery_obj->load($param["gallery_id"]);
     $this->hornav = new Hornav();
     $this->hornav->addData("Админпанель", URL::get("menu", "admin"));
     $this->hornav->addData("Галерея", URL::get("viewgallery", "admin"));
     $this->hornav->addData($viewgallery_obj->title, URL::get("listgallery", "admin", array("view_id" => $param["view_id"])));
     $this->hornav->addData($gallery_obj->title, URL::get("listimg", "admin", array("view_id" => $param["view_id"], "gallery_id" => $param["gallery_id"])));
     if (!$param["img_id"]) {
         $this->hornav->addData("Добавить");
         $this->file("img", "Картинка:");
         $this->submit("insert_imggallery", "Сохранить");
     } else {
         $this->hidden("id", $param["img_id"]);
         $gallery_obj = new GalleryDB();
         $gallery_obj->load($param["img_id"]);
         $this->hornav->addData("Изменить");
         $this->file("img", "Картинка:");
         $this->submit("update_imggallery", "Сохранить");
     }
 }
Beispiel #3
0
 public function actionDelete()
 {
     if (!self::isAuthAdmin()) {
         return null;
     }
     switch ($this->request->view) {
         case "viewgallery":
             try {
                 $obj_db = new ViewgalleryDB();
                 $obj_db->load($this->request->view_id);
                 $tmp = $obj_db->img;
                 if ($tmp) {
                     File::delete(Config::DIR_IMG_VIEWGALLERY . $tmp);
                 }
                 if ($obj_db->delete()) {
                     $this->fp->setSessionMessage($this->request->view, "SUCCESS_POSITION_DELETE");
                 } else {
                     $this->fp->setSessionMessage($this->request->view, "NOTFOUND_POSITION");
                 }
                 $this->redirect(URL::get($this->request->view, "admin"));
             } catch (Exception $e) {
                 $this->setSessionMessage($this->request->view, $this->getError($e));
             }
             break;
         case "listgallery":
             try {
                 $obj_db = new GalleryDB();
                 $obj_db->load($this->request->gallery_id);
                 $tmp = $obj_db->img;
                 if ($tmp) {
                     File::delete(Config::DIR_IMG_GALLERY . $tmp);
                 }
                 if ($obj_db->delete()) {
                     $this->fp->setSessionMessage("listgallery", "SUCCESS_POSITION_DELETE");
                 } else {
                     $this->fp->setSessionMessage("listgallery", "NOTFOUND_POSITION");
                 }
                 $this->redirect(URL::get("listgallery", "admin", array("view_id" => $this->request->view_id)));
             } catch (Exception $e) {
                 $this->setSessionMessage($this->request->view, $this->getError($e));
             }
             break;
         case "imggallery":
             try {
                 $obj_db = new ImggalleryDB();
                 $obj_db->load($this->request->img_id);
                 $tmp = $obj_db->img;
                 if ($tmp) {
                     File::delete(Config::DIR_IMG_IMGGALLERY . $tmp);
                 }
                 if ($obj_db->delete()) {
                     $this->fp->setSessionMessage("imggallery", "SUCCESS_POSITION_DELETE");
                 } else {
                     $this->fp->setSessionMessage("imggallery", "NOTFOUND_POSITION");
                 }
                 $this->redirect(URL::get("listimg", "admin", array("view_id" => $this->request->view_id, "gallery_id" => $this->request->gallery_id), false));
             } catch (Exception $e) {
                 $this->setSessionMessage($this->request->view, $this->getError($e));
             }
             break;
         case "collective":
             try {
                 $obj_db = new CollectiveDB();
                 $obj_db->load($this->request->img_id);
                 $tmp = $obj_db->img;
                 if ($tmp) {
                     File::delete(Config::DIR_IMG_COLLECTIVE . $tmp);
                 }
                 if ($obj_db->delete()) {
                     $this->fp->setSessionMessage("collective", "SUCCESS_POSITION_DELETE");
                 } else {
                     $this->fp->setSessionMessage("collective", "NOTFOUND_POSITION");
                 }
                 $this->redirect(URL::current());
             } catch (Exception $e) {
                 $this->setSessionMessage($this->request->view, $this->getError($e));
             }
             break;
     }
 }
Beispiel #4
0
 public function actionGallery()
 {
     if (isset($_REQUEST["view"]) && !isset($_REQUEST["id"])) {
         $view = $this->request->view;
         $obj = new ViewgalleryDB();
         $obj->load($view);
         $this->title = $obj->title;
         $this->meta_desc = $obj->meta_desc;
         $this->meta_key = $obj->meta_key;
         $head = $this->getHead(array("/css/main.css"), false);
         $content = new Gallery();
         $content->items = GalleryDB::getItemsOnView($view);
         $head->add("js", null, true);
         $head->js = array("/js/main.js");
         $hornav = $this->getHornav();
         $hornav->addData("Фотогалерея", URL::get("gallery", ""));
         $hornav->addData($obj->title);
         $content->hornav = $hornav;
         $content->header = $obj->title;
         $this->render($head, $content);
     } else {
         if (isset($_REQUEST["view"]) && isset($_REQUEST["id"])) {
             $view = $this->request->view;
             $id = $this->request->id;
             $obj = new GalleryDB();
             $obj->load($id);
             $this->title = $obj->title;
             $this->meta_desc = $obj->meta_desc;
             $this->meta_key = $obj->meta_key;
             $head = $this->getHead(array("/css/main.css", "/css/lightbox.css"), false);
             $content = new Imggallery();
             $content->items = ImggalleryDB::getImagesOnGalleryId($id);
             $head->add("js", null, true);
             $head->js = array("/js/main.js", "/js/lightbox-2.6.min.js");
             $v = new ViewgalleryDB();
             $v->load($view);
             $hornav = $this->getHornav();
             $hornav->addData("Фотогалерея", URL::get("gallery", ""));
             $hornav->addData($v->title, URL::get("gallery", "", array("view" => $v->id)));
             $hornav->addData($obj->title);
             $content->hornav = $hornav;
             $content->header = $obj->title;
             $content->title = $obj->title;
             $this->render($head, $content);
         } else {
             $this->title = "Фотогалерея";
             $this->meta_desc = "Фотогалерея";
             $this->meta_key = "Фотогалерея";
             $head = $this->getHead(array("/css/main.css"), false);
             $content = new Viewgallery();
             $content->items = ViewgalleryDB::getAllShow();
             $head->add("js", null, true);
             $head->js = array("/js/main.js");
             $hornav = $this->getHornav();
             $hornav->addData("Фотогалерея");
             $content->hornav = $hornav;
             $content->header = "Фотогалерея";
             $this->render($head, $content);
         }
     }
 }