diff --git a/application/controller/AdminUploadController.php b/application/controller/AdminUploadController.php index da5ffc6..8cc249c 100644 --- a/application/controller/AdminUploadController.php +++ b/application/controller/AdminUploadController.php @@ -4,30 +4,13 @@ class AdminUploadController extends Katharsis_Controller_Abstract public function indexAction() { } - - public function productAction() - { - $shop = new Product(); - $this->_view->item = $shop->getProduct($this->_getParam('productId')); - } - public function processAction() + public function headerAction() { $upload = new Upload(); - if($this->_getParam('productId')) - { - if($_FILES['small']['type'] != $_FILES['big']['type']) - { - throw new DidgeridooArtwork_Exception('Beide Bilder müssen vom selben Dateityp sein.'); - } - - $filename = $upload->product($this->_getParam('productId'), $_FILES); - $product = new Product(); - $product->addImage($this->_getParam('productId'), $filename); + $filename = $upload->header($this->_getParam('pageId'), $_FILES); - DidgeridooArtwork_Notice::add('Das Hochladen war erfolgreich.'); - $this->_location('edit', 'adminShop', array('productId' => $this->_getParam('productId'))); - } + DidgeridooArtwork_Notice::add('Das Hochladen war erfolgreich. Dateiname: ' . $filename); } } \ No newline at end of file diff --git a/application/model/Page.php b/application/model/Page.php index e893613..ed590a2 100644 --- a/application/model/Page.php +++ b/application/model/Page.php @@ -52,7 +52,8 @@ class Page extends Katharsis_Model_Abstract 'subtitle' => $params['subtitle'], 'url' => $params['url'], 'content' => $params['content'], - 'active' => $params['active'] + 'active' => $params['active'], + 'header_image' => $params['header_image'] ); if(isset($params['id']) && is_numeric($params['id'])) @@ -64,7 +65,8 @@ class Page extends Katharsis_Model_Abstract subtitle = :subtitle, url = :url, content = :content, - active = :active + active = :active, + header_image = :header_image WHERE id = :id "; diff --git a/application/model/Upload.php b/application/model/Upload.php index 4aa670f..03a1f31 100644 --- a/application/model/Upload.php +++ b/application/model/Upload.php @@ -5,37 +5,11 @@ class Upload extends Katharsis_Model_Abstract { } - - public function product($id, $files) - { - $dir = getcwd() . '/img/shop/product'; - - $name = $this->_uploadFile($id, $files['small'], $dir . '/small'); - $this->_uploadFile($id, $files['big'], $dir . '/big', $name); - - return $name; - } - - public function category($id, $file) - { - $dir = getcwd() . '/img/shop/category'; - return $this->_uploadFile($id, $file, $dir); - } - - public function sound($id, $file) - { - $dir = getcwd() . '/sound'; - return $this->_uploadFile($id, $file, $dir); - } - - public function event($id, $files) - { - $dir = getcwd() . '/img/event'; - - $name = $this->_uploadFile($id, $files['image'], $dir); - $this->_uploadFile($id, $files['image_full'], $dir . '/full', $name); - return $name; + public function header($id, $file) + { + $dir = getcwd() . '/img/header'; + return $this->_uploadFile($id, $file, $dir); } public function page($file) diff --git a/application/view/AdminPage/edit.phtml b/application/view/AdminPage/edit.phtml index 50a60dc..4efd068 100644 --- a/application/view/AdminPage/edit.phtml +++ b/application/view/AdminPage/edit.phtml @@ -75,6 +75,13 @@