예제 #1
0
 public function actionListimg()
 {
     $this->title = "Админ панель";
     $this->meta_desc = "Админ панель";
     $this->meta_key = "админ панель";
     $head = $this->getHead(array("/css/main.css"), false);
     $admin_menu = new Listimggallery();
     $admin_menu->link_insert = URL::get("insert", "admin", array("view" => "imggallery", "view_id" => $this->request->view_id, "gallery_id" => $this->request->gallery_id));
     $admin_menu->items = ImggalleryDB::getAdminShow($this->request->view_id, $this->request->gallery_id);
     $hornav = new Hornav();
     $gallery = new GalleryDB();
     $gallery->load($this->request->gallery_id);
     $viewgallery = new ViewgalleryDB();
     $viewgallery->load($gallery->view_id);
     $admin_menu->header = $gallery->title;
     $admin_menu->message = $this->fp->getSessionMessage("imggallery");
     $hornav->addData("Админпанель", URL::get("menu", "admin"));
     $hornav->addData("Галерея", URL::get("viewgallery", "admin"));
     $hornav->addData($viewgallery->title, URL::get("listgallery", "admin", array("view_id" => $viewgallery->id)));
     $hornav->addData($gallery->title);
     $this->render($head, $this->renderData(array("hornav" => $hornav, "admin_menu" => $admin_menu), "adminpanel"));
 }
예제 #2
0
 protected function getHornav()
 {
     $hornav = new Hornav();
     $hornav->addData("Главная", URL::get(""));
     return $hornav;
 }
예제 #3
0
 public function actionUpdate()
 {
     if (!self::isAuthAdmin()) {
         return null;
     }
     if ($this->request->update_brand) {
         $obj_db = new BrandDB();
         $obj_db->load($this->request->id);
         $tmp = $obj_db->img;
         $img = $this->fp->checkIMG($this->request->view, $_FILES["img"], Config::MAX_SIZE_IMG);
         $link = URL::get($this->request->view, "", array("id" => $this->request->id), true, "", false);
         $checks = array(array(strlen($this->request->alias), true, "ERROR_ALIAS"));
         if ($img) {
             $res = $this->fp->process($this->request->view, $obj_db, array("title", "meta_desc", "meta_key", array("img", $img)), $checks, "SUCCESS_POSITION_UPDATE");
             if ($res["obj"] instanceof BrandDB) {
                 $this->fp->uploadIMG($this->request->view, $_FILES["img"], $img, Config::DIR_IMG_BRAND);
                 File::delete(Config::DIR_IMG_BRAND . $tmp);
                 $sef_db = new SefDB();
                 $sef_db->loadOnLink($link);
                 if ($sef_db->alias !== $this->request->alias && !SefDB::issetAlias($this->request->alias)) {
                     $this->fp->process($this->request->view, $sef_db, array(array("link", $link), "alias"), array());
                 }
                 $this->redirect(URL::get($this->request->view, "admin"));
             } else {
                 $this->redirect(URL::current());
             }
         } else {
             $res = $this->fp->process($this->request->view, $obj_db, array("title", "meta_desc", "meta_key"), $checks, "SUCCESS_POSITION_UPDATE");
             if ($res["obj"] instanceof BrandDB) {
                 $sef_db = new SefDB();
                 $sef_db->loadOnLink($link);
                 if ($sef_db->alias !== $this->request->alias && !SefDB::issetAlias($this->request->alias)) {
                     $this->fp->process($this->request->view, $sef_db, array(array("link", $link), "alias"), array());
                 }
                 $this->redirect(URL::get($this->request->view, "admin"));
             } else {
                 $this->redirect(URL::current());
             }
         }
     }
     if ($this->request->update_product) {
         $obj_db = new ProductDB();
         $obj_db->load($this->request->id);
         $tmp = $obj_db->img;
         $img = $this->fp->checkIMG($this->request->view, $_FILES["img"], Config::MAX_SIZE_IMG);
         $link = URL::get($this->request->view, "", array("id" => $this->request->id), true, "", false);
         $checks = array(array(strlen($this->request->alias), true, "ERROR_ALIAS"));
         if ($img) {
             $res = $this->fp->process($this->request->view, $obj_db, array("category_id", array("img", $img), "video", "brand_id", "price", "title", "full_text", "meta_desc", "meta_key", "available"), $checks, "SUCCESS_POSITION_UPDATE");
             if ($res["obj"] instanceof ProductDB) {
                 $this->fp->uploadIMG($this->request->view, $_FILES["img"], $img, Config::DIR_IMG_PRODUCT);
                 File::delete(Config::DIR_IMG_PRODUCT . $tmp);
                 $sef_db = new SefDB();
                 $sef_db->loadOnLink($link);
                 if ($sef_db->alias !== $this->request->alias && !SefDB::issetAlias($this->request->alias)) {
                     $this->fp->process($this->request->view, $sef_db, array(array("link", $link), "alias"), array());
                 }
                 $this->redirect(URL::get($this->request->view, "admin"));
             } else {
                 $this->redirect(URL::current());
             }
         } else {
             $res = $this->fp->process($this->request->view, $obj_db, array("category_id", array("img", $tmp), "video", "brand_id", "price", "title", "full_text", "meta_desc", "meta_key", "available"), $checks, "SUCCESS_POSITION_UPDATE");
             if ($res["obj"] instanceof ProductDB) {
                 $sef_db = new SefDB();
                 $sef_db->loadOnLink($link);
                 if ($sef_db->alias !== $this->request->alias && !SefDB::issetAlias($this->request->alias)) {
                     $this->fp->process($this->request->view, $sef_db, array(array("link", $link), "alias"), array());
                 }
                 $this->redirect(URL::get($this->request->view, "admin"));
             } else {
                 $this->redirect(URL::current());
             }
         }
     } else {
         if ($this->request->update_category) {
             $obj_db = new CategoryDB();
             $obj_db->load($this->request->id);
             $link = URL::get($this->request->view, "", array("id" => $this->request->id), true, "", false);
             $checks = array(array(strlen($this->request->alias), true, "ERROR_ALIAS"));
             $res = $this->fp->process($this->request->view, $obj_db, array("section_id", "title", "meta_desc", "meta_key", $this->request->show ? "show" : array("show", 0)), $checks, "SUCCESS_POSITION_UPDATE");
             if ($res["obj"] instanceof CategoryDB) {
                 $sef_db = new SefDB();
                 $sef_db->loadOnLink($link);
                 if ($sef_db->alias !== $this->request->alias && !SefDB::issetAlias($this->request->alias)) {
                     $this->fp->process($this->request->view, $sef_db, array(array("link", $link), "alias"), array());
                 }
                 $this->redirect(URL::get("category", "admin"));
             } else {
                 $this->redirect(URL::current());
             }
         } else {
             if ($this->request->update_section) {
                 $obj_db = new SectionDB();
                 $obj_db->load($this->request->id);
                 $link = URL::get($this->request->view, "", array("id" => $this->request->id), true, "", false);
                 $checks = array(array(strlen($this->request->alias), true, "ERROR_ALIAS"));
                 $res = $this->fp->process($this->request->view, $obj_db, array("title", "meta_desc", "meta_key", "full_text"), array(), "SUCCESS_POSITION_UPDATE");
                 if ($res["obj"] instanceof SectionDB) {
                     $sef_db = new SefDB();
                     $sef_db->loadOnLink($link);
                     if ($sef_db->alias !== $this->request->alias && !SefDB::issetAlias($this->request->alias)) {
                         $this->fp->process($this->request->view, $sef_db, array(array("link", $link), "alias"), array());
                     }
                     $this->redirect(URL::get("section", "admin"));
                 } else {
                     $this->redirect(URL::current());
                 }
             } else {
                 if ($this->request->update_slider) {
                     $obj_db = new SliderDB();
                     $obj_db->load($this->request->id);
                     $res = $this->fp->process($this->request->view, $obj_db, array("product_id", "title", "description"), array(), "SUCCESS_POSITION_UPDATE");
                     if ($res["obj"] instanceof SliderDB) {
                         $this->redirect(URL::get("slider", "admin"));
                     } else {
                         $this->redirect(URL::current());
                     }
                 } else {
                     if ($this->request->upload_small_img) {
                         $img = $this->fp->checkIMG($this->request->view, $_FILES["small_img"], Config::MAX_SIZE_IMG);
                         $this->fp->uploadIMG($this->request->view, $_FILES["small_img"], $img, Config::DIR_IMG_FSAPRODUCT);
                         if ($img) {
                             $obj_db = new ImgDB();
                             $res = $this->fp->process($this->request->view, $obj_db, array(array("product_id", $this->request->id), array("url", $img)), array(), "SUCCESS_POSITION_INSERT");
                             $this->redirect(URL::current());
                         }
                     }
                 }
             }
         }
     }
     $this->title = "Админ панель";
     $this->meta_desc = "Админ панель";
     $this->meta_key = "админ панель";
     $head = $this->getHead(array("/css/main.css"), false);
     $head->add("js", null, true);
     $head->js = array("/js/admin.js");
     $class = "Form" . $this->request->view;
     $admin_menu = new $class($this->request->id);
     $admin_menu->message = $this->fp->getSessionMessage($this->request->view);
     $hornav = new Hornav();
     $hornav->addData("Админпанель", URL::get("menu", "admin"));
     $name = $this->names[$this->request->view];
     $hornav->addData($name, URL::get($this->request->view, "admin"));
     $hornav->addData("Изменить");
     $this->render($head, $this->renderData(array("hornav" => $hornav, "admin_menu" => $admin_menu), "adminpanel"));
 }