public function addAction() { $config = Config::getInstance(); $config = $config->getConfig(); $Cars = new Cars(); $this->view->data = $Cars->getCategory(); $model = $this->request->getPost('model'); $marka = $this->request->getPost('marka_id'); $opis = $this->request->getPost('opis'); $zdjecie = $this->request->getFiles('zdjecie'); if ($model == NULL && $marka == NULL && $opis == NULL && $zdjecie == NULL) { $this->view->display('add'); } else { if ($model == NULL || $marka == NULL || $opis == NULL || $zdjecie == NULL) { echo "Uzupelnij wszystkie pola"; } else { $podpis = date("Y-m-d G:i:s", time()); $zdjecie = WideImage::loadFromUpload('zdjecie'); $zdjecie->saveToFile($config['DOC_ROOT'] . $config['CUSTOM_IMG_DIR'] . $podpis . '.png'); $Car = new Cars(); $Car->saveCar($model, $marka, $opis, $podpis); header('location: ' . Url::getUrl('car', 'list', array('status' => 8))); } } }