public function dodajAction() { $form = new Form_Catalog(); $this->view->form = $form; $user_id = Zend_Auth::getInstance()->getIdentity()->id; $user_name = Zend_Auth::getInstance()->getIdentity()->username; if ($this->getRequest()->isPost()) { if ($form->isValid($this->_request->getPost())) { $dane = $form->getValues(); $katalog = $dane['catalog']; $sciezka = 'userdata/' . $user_name . '/photos/' . $katalog; $obj = new Model_Catalog(); $obj->setName($katalog); $obj->setPath($sciezka); $obj->setUsersId($user_id); $mapper = Model_CatalogMapper::getInstance(); $wynik = $mapper->sprawdzNazwe($user_id, $katalog); if (!$wynik) { $mapper->save($obj); //$dir_name = iconv('UTF-8','cp1250', $sciezka); $dir_name = $sciezka; mkdir($dir_name); $this->view->message = 'Dodano pomyślnie.'; } else { $this->view->message = 'Katalog o podanej nazwie już istnieje.'; } } else { $this->view->message = 'Nieprawidłowa nazwa katalogu.'; } } }
protected function _populate($data) { $obj = new Model_Catalog(); $obj->setId($data['id']); $obj->setName($data['name']); $obj->setPath($data['path']); $obj->setDate($data['date']); $obj->setUsersId($data['users_id']); return $obj; }