edited page mechanism

This commit is contained in:
Logsol 2013-07-10 12:15:34 +02:00
parent 4c21bbcefd
commit 79a0690fad
8 changed files with 51 additions and 37 deletions

View file

@ -20,12 +20,23 @@ class AdminPageController extends Katharsis_Controller_Abstract
public function imageAction()
{
if($this->_getParam('type') == 'header') {
$type = 'header';
} else {
$type = 'page';
}
$path = getcwd().'/img/' . $type . '/';
if(isset($_FILES['myfile']))
{
$upload = new Upload();
$upload->page($_FILES['myfile']);
if($type == 'header') {
$upload->header($_FILES['myfile']);
} else {
$upload->page($_FILES['myfile']);
}
echo 'Das Hochladen war erfolgreich.<br><br>';
}
@ -33,25 +44,25 @@ class AdminPageController extends Katharsis_Controller_Abstract
if(isset($_GET['delete']))
{
$deleteFile = getcwd() . '/img/page/' . $_GET['delete'];
$deleteFile = $path . $_GET['delete'];
if(file_exists($deleteFile)) {
unlink($deleteFile);
}
}
if ($handle = opendir(getcwd().'/img/page/'))
$ar = array();
if (is_readable($path) && $handle = opendir())
{
$ar = array();
while (false !== ($file = readdir($handle))) {
if(is_dir($file)) continue;
$ar[] = $file;
}
$this->_view->files = $ar;
closedir($handle);
}
$this->_view->files = $ar;
echo $this->_view->render('AdminPage/image');
die();
}

View file

@ -1,16 +1,5 @@
<?php
class AdminUploadController extends Katharsis_Controller_Abstract
{
public function indexAction()
{
}
public function headerAction()
{
$upload = new Upload();
$filename = $upload->header($this->_getParam('pageId'), $_FILES);
DidgeridooArtwork_Notice::add('Das Hochladen war erfolgreich. Dateiname: ' . $filename);
}
// check adminPageController and Upload model
}

View file

@ -15,11 +15,23 @@ class PageController extends Katharsis_Controller_Abstract
{
$preview = true;
}
$method = substr($method, 0, -6);
$content = $this->_page->render($method, $preview);
$url = substr($method, 0, -6);
$content = DidgeridooArtwork_Page_Plugin::render($content);
$pageId = $this->_page->getIdByUrl($url);
if(!$pageId) {
throw new DidgeridooArtwork_Exception('Page konnte nicht geladen werden.');
}
$pageData = $this->_page->getPage($pageId);
foreach($pageData as $key => $value) {
$this->_view->{$key} = $value;
}
$this->_view->content = DidgeridooArtwork_Page_Plugin::render($this->_view->content);
$content = $this->_view->render('page/post');
$this->_view->stageContent = $content;
echo $this->_view->render('main');
die();