public function __construct($id = false) { parent::__construct(); $this->add("products"); $this->name = "form_slider"; $this->enctype = "multipart/form-data"; $this->action = URL::current(); $this->products = ProductDB::getAdminShow(); if (!$id) { $this->text("title", "Название:"); $this->textarea("description", "Описание:"); $this->submit("insert_slider", "Сохранить"); } else { $this->add("img"); $this->add("product_id"); $this->hidden("id", $id); $obj = new SliderDB(); $obj->load($id); $this->text("title", "Название:", $obj->title); $img = ProductDB::getCellOnID($obj->product_id, "img"); $view = new View(Config::DIR_TMPL); $this->img = $view->render("img", array("src" => Config::DIR_IMG_PRODUCT . $img), true); $this->textarea("description", "Описание:", $obj->description); $this->submit("update_slider", "Сохранить"); $this->product_id = $obj->product_id; } }
public function actionProduct() { if (!self::isAuthAdmin()) { return null; } $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"); $admin_menu = new Productadmin(); $admin_menu->items = ProductDB::getAdminShow(); $admin_menu->link_insert = URL::get("insert", "admin", array("view" => "product")); $admin_menu->message = $this->fp->getSessionMessage("product"); $hornav = new Hornav(); $hornav->addData("Админпанель", URL::get("menu", "admin")); $hornav->addData("Товары"); $this->render($head, $this->renderData(array("hornav" => $hornav, "admin_menu" => $admin_menu), "adminpanel")); }