public function index() { // -- ** -- GET Twig & city list $twig = Config::getTwig(); #$loginResult = ProductList::getAllProducts(); //die($_SERVER['REQUEST_URI']); $brands = Brand::getBrands(); $sections = Section::getSections(); if (Request::_request_post('product_name')) { $array["do"] = "addProduct"; if (Request::_request_post("product_brand")) { $array['brand_id'] = Request::_request_post("product_brand"); } $array['name'] = Request::_request_post("product_name"); if (Request::_request_post("product_code")) { $array['barcode'] = Request::_request_post("product_code"); } if (Request::_request_post("product_desc")) { $array['desc'] = Request::_request_post("product_desc"); } if (Request::_request_post("product_section")) { $array['section_id'] = Request::_request_post("product_section"); } if ($_FILES["product_image"]) { } else { echo "lkşkşki"; } $array["admin_id"] = "123459"; $res = ProductDetail::addProduct($array); if ($res->isSuccess()) { $result = array('addProductSuccess' => true, 'brands' => json_decode($brands)->content, 'sections' => json_decode($sections)->content); } else { $result = array('addProductFailure' => true, 'brands' => json_decode($brands)->content, 'sections' => json_decode($sections)->content); } return $twig->render('admin/pages/forms/general2.html', $result); } else { $prod = ProductList::getProduct(Request::_get("id")); if ($prod->isSuccess()) { $result = array('brands' => json_decode($brands)->content, 'sections' => json_decode($sections)->content, 'product' => $prod->content); } else { $result = array('brands' => json_decode($brands)->content, 'sections' => json_decode($sections)->content); } return $twig->render('admin/pages/forms/product.html', $result); } }