added header_image flag to page view and model, cleaned up uploader
This commit is contained in:
parent
1a3664b517
commit
4c21bbcefd
4 changed files with 18 additions and 52 deletions
|
|
@ -4,30 +4,13 @@ class AdminUploadController extends Katharsis_Controller_Abstract
|
||||||
public function indexAction()
|
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();
|
$upload = new Upload();
|
||||||
|
|
||||||
if($this->_getParam('productId'))
|
$filename = $upload->header($this->_getParam('pageId'), $_FILES);
|
||||||
{
|
|
||||||
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);
|
|
||||||
|
|
||||||
DidgeridooArtwork_Notice::add('Das Hochladen war erfolgreich.');
|
DidgeridooArtwork_Notice::add('Das Hochladen war erfolgreich. Dateiname: ' . $filename);
|
||||||
$this->_location('edit', 'adminShop', array('productId' => $this->_getParam('productId')));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +52,8 @@ class Page extends Katharsis_Model_Abstract
|
||||||
'subtitle' => $params['subtitle'],
|
'subtitle' => $params['subtitle'],
|
||||||
'url' => $params['url'],
|
'url' => $params['url'],
|
||||||
'content' => $params['content'],
|
'content' => $params['content'],
|
||||||
'active' => $params['active']
|
'active' => $params['active'],
|
||||||
|
'header_image' => $params['header_image']
|
||||||
);
|
);
|
||||||
|
|
||||||
if(isset($params['id']) && is_numeric($params['id']))
|
if(isset($params['id']) && is_numeric($params['id']))
|
||||||
|
|
@ -64,7 +65,8 @@ class Page extends Katharsis_Model_Abstract
|
||||||
subtitle = :subtitle,
|
subtitle = :subtitle,
|
||||||
url = :url,
|
url = :url,
|
||||||
content = :content,
|
content = :content,
|
||||||
active = :active
|
active = :active,
|
||||||
|
header_image = :header_image
|
||||||
WHERE
|
WHERE
|
||||||
id = :id
|
id = :id
|
||||||
";
|
";
|
||||||
|
|
|
||||||
|
|
@ -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)
|
public function page($file)
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,13 @@
|
||||||
<dd>
|
<dd>
|
||||||
<input class="textfield" type="text" name="url" value="<?php echo $this->page['url'] ?>"/>
|
<input class="textfield" type="text" name="url" value="<?php echo $this->page['url'] ?>"/>
|
||||||
</dd>
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl>
|
||||||
|
<dt>Header Bild</dt>
|
||||||
|
<dd>
|
||||||
|
<input class="textfield" type="text" name="header_image" value="<?php echo $this->page['header_image'] ?>" readonly="readonly" />
|
||||||
|
<a onclick="alert('choose');">Auswählen</a> | <a onclick="alert('upload');">Hochladen</a>
|
||||||
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>Inhalt</dt>
|
<dt>Inhalt</dt>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue