added some useful models and controllers

This commit is contained in:
Logsol 2013-07-08 21:02:22 +02:00
parent a6873ee6c8
commit 57c0436f14
45 changed files with 6456 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

BIN
application/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,32 @@
<?php
class AdminController extends Katharsis_Controller_Abstract
{
public function indexAction()
{
if(!Access::isLogged()) $this->_location('gate');
}
public function gateAction()
{
}
public function loginAction()
{
if($this->_getParam('password') == 'holzmitloch')
{
$_SESSION['logged'] = 1;
$this->_location('index');
}
else
{
$this->_location('gate', null, array('wrongpassword' => ''));
}
}
public function logoutAction()
{
$_SESSION['logged'] = 0;
$this->_location('gate');
}
}

View file

@ -0,0 +1,53 @@
<?php
class AdminNavigationController extends Katharsis_Controller_Abstract
{
protected $_navi;
public function init()
{
$this->_navi = new Navigation();
}
public function indexAction()
{
$this->_view->list = $this->_navi->getAllItems();
}
public function editAction()
{
$this->_view->mainItems = $this->_navi->getMainItems();
$this->_view->item = $this->_navi->getItem($this->_getParam('id'));
$this->_view->sites = $this->_navi->getSites();
}
public function deleteAction()
{
$this->_navi->delete($this->_getParam('id'));
DidgeridooArtwork_Notice::add('Navigationseintrag wurde erfolgreich gelöscht!');
$this->_location('index');
}
public function saveAction()
{
$params = $this->_getAllParams();
$params['active'] = 0;
if($this->_getParam('active') && $this->_getParam('active') == 'on')
{
$params['active'] = 1;
}
$params['parentId'] = ($params['parentId'] == '0') ? null : $params['parentId'];
$this->_navi->save($params);
DidgeridooArtwork_Notice::add('Navigationseintrag wurde erfolgreich gespeichert!');
$this->_location('index');
}
public function moveAction()
{
$this->_navi->move($this->_getParam('direction'), $this->_getParam('id'));
DidgeridooArtwork_Notice::add('Navigationseintrag wurde erfolgreich verschoben!');
$this->_location('index');
}
}

View file

@ -0,0 +1,79 @@
<?php
class AdminPageController extends Katharsis_Controller_Abstract
{
protected $_page;
public function init()
{
$this->_page = new Page();
}
public function indexAction()
{
$this->_view->pages = $this->_page->getPages();
}
public function editAction()
{
$this->_view->page = $this->_page->getPage($this->_getParam('pageId'));
}
public function imageAction()
{
if(isset($_FILES['myfile']))
{
$upload = new Upload();
$upload->page($_FILES['myfile']);
echo 'Das Hochladen war erfolgreich.<br><br>';
}
if(isset($_GET['delete']))
{
$deleteFile = getcwd() . '/img/page/' . $_GET['delete'];
if(file_exists($deleteFile)) {
unlink($deleteFile);
}
}
if ($handle = opendir(getcwd().'/img/page/'))
{
$ar = array();
while (false !== ($file = readdir($handle))) {
if(is_dir($file)) continue;
$ar[] = $file;
}
$this->_view->files = $ar;
closedir($handle);
}
echo $this->_view->render('AdminPage/image');
die();
}
public function saveAction()
{
$params = $this->_getAllParams();
$params['active'] = 0;
if($this->_getParam('active') && $this->_getParam('active') == 'on')
{
$params['active'] = 1;
}
$this->_page->save($params);
DidgeridooArtwork_Notice::add('Page wurde erfolgreich gespeichert!');
$this->_location('index');
}
public function deleteAction()
{
$this->_page->delete($this->_getParam('pageId'));
DidgeridooArtwork_Notice::add('Page wurde erfolgreich gelöscht!');
$this->_location('index');
}
}

View file

@ -0,0 +1,33 @@
<?php
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()
{
$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);
DidgeridooArtwork_Notice::add('Das Hochladen war erfolgreich.');
$this->_location('edit', 'adminShop', array('productId' => $this->_getParam('productId')));
}
}
}

View file

@ -0,0 +1,27 @@
<?php
class PageController extends Katharsis_Controller_Abstract
{
protected $_page;
public function init()
{
$this->_page = new Page();
}
public function __call($method, $args)
{
$preview = false;
if(array_key_exists('preview', $this->_getAllParams()) && Access::isLogged())
{
$preview = true;
}
$method = substr($method, 0, -6);
$content = $this->_page->render($method, $preview);
$content = DidgeridooArtwork_Page_Plugin::render($content);
$this->_view->stageContent = $content;
echo $this->_view->render('main');
die();
}
}

94
application/main.phtml Normal file
View file

@ -0,0 +1,94 @@
<html>
<head>
<title>Swiss Didgeridoo Artwork - Schweizer Holz Didgeridoo bester Qualität</title>
<link rel="stylesheet" type="text/css" href="<?php echo $this->base ?>/style/main.css" />
<link rel="shortcut icon" href="<?php echo $this->base ?>/img/leafs/favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Description" content="Bei uns findest du alles rund ums Didgeridoo - Qualitäts Instrumente aus einheimischen Hölzern - Taschen - Mundstücke - Musik - Konzertkalender - Unterricht -Therapie - Clapstick - Trommel Reparaturen - Diverse Links" />
<meta name="keywords" content="Didgeridoo, Didjeridoo, Yidaki, Clapstick, Mundstück, Holzblasinstrument, Australisches Instrument, Didgeridoo Reparaturen, Didgeridoo Konzert, Trommel Reparaturen, Didgeridoo Unterricht, Zirkularatmung, Rhythmus Didgeridoo" />
<?php if($this->autoScriptFile): ?>
<script type="text/javascript" src="<?php echo $this->autoScriptFile ?>"></script>
<?php endif ?>
</head>
<body style="background-image: url('<?php echo $this->base ?>/img/leafs/background<?php echo rand(1,3); ?>.png')">
<?php if($this->notices): ?>
<ul class="notices">
<?php foreach($this->notices as $notice): ?>
<li><?php echo $notice ?></li>
<?php endforeach ?>
</ul>
<?php endif ?>
<a href="<?php echo $this->base ?>/page/home" title="zur Startseite" id="logo">&nbsp;</a>
<h2><?php echo Navigation::getSubtitle(); ?></h2>
<h1><?php echo Navigation::getTitle(); ?></h1>
<div id="head">
<ul id="navigation">
<?php foreach($this->mainNavigationItems as $item): ?>
<li <?php if($item['id'] == $this->activeMenuItem) echo 'class="active"'?>>
<div>
<a href="<?php echo $this->base ?>/<?php echo $item['controller'] ?>/<?php echo $item['action'] ?>"><?php echo $item['name'] ?></a>
</div>
</li>
<?php endforeach ?>
</ul>
<?php if(Access::isLogged()): ?>
<ul id="adminNavigation">
<li>
Admin Bereich
</li>
<li>
<a href="<?php echo $this->base ?>/adminOrder">Bestellungen</a>
</li>
<li>
<a href="<?php echo $this->base ?>/adminNavigation">Navigationen</a>
</li>
<li>
<a href="<?php echo $this->base ?>/adminPage">Pages</a>
</li>
<li>
<a href="<?php echo $this->base ?>/adminShop">Shop</a>
</li>
<li>
<a href="<?php echo $this->base ?>/adminNews">News</a>
</li>
<li>
<a href="<?php echo $this->base ?>/adminEvent">Events</a>
</li>
<li>
<a href="<?php echo $this->base ?>/admin/logout">Ausloggen</a>
</li>
</ul>
<?php endif ?>
</div>
<div id="topStage">
<?php if($this->subNavigationItems): ?>
<ul id="subNavigation">
<?php foreach($this->subNavigationItems as $subitem): ?>
<li <?php if($this->activeSubMenuItem == $subitem['id']) echo 'class="active"'; ?>>
<div>
<?php if($subitem['link']): ?>
<a href="<?php echo $subitem['link'] ?>"><?php echo $subitem['name'] ?></a>
<?php else: ?>
<a href="<?php echo $this->base ?>/<?php echo $subitem['controller'] ?>/<?php echo $subitem['action'] ?>"><?php echo $subitem['name'] ?></a>
<?php endif ?>
</div>
</li>
<?php endforeach ?>
</ul>
<?php else: ?>
&nbsp;
<?php endif ?>
</div>
<div id="stage">
<?php echo $this->stageContent ?>
</div>
</body>
</html>

View file

@ -0,0 +1,17 @@
<?php
class Access extends Katharsis_Model_Abstract
{
public function init()
{
}
public static function isLogged()
{
if(isset($_SESSION['logged']) && $_SESSION['logged'] == 1)
{
return true;
}
return false;
}
}
?>

View file

@ -0,0 +1,288 @@
<?php
class Navigation extends Katharsis_Model_Abstract
{
public function init()
{
}
public function getAllItems()
{
$tidyResult = array();
$result = $this->_con->fetchAll("SELECT * FROM navigation WHERE parent_id IS NULL ORDER BY sorting");
foreach($result as $item)
{
$subSet = array();
$sql = "SELECT * FROM navigation WHERE parent_id = :parentId ORDER BY sorting";
$sql = $this->_con->createStatement($sql, array('parentId' => $item['id']));
$item['children'] = $this->_con->fetchAll($sql);
$tidyResult[] = $item;
}
return $tidyResult;
}
public function getMainItems()
{
return $this->_con->fetchAll("SELECT id, name FROM navigation WHERE parent_id IS NULL ORDER BY sorting");
}
public function getItem($id)
{
if($id !== null)
{
$sql = "SELECT * FROM navigation WHERE id = :id";
$sql = $this->_con->createStatement($sql, array('id' => $id));
if(!$result = $this->_con->fetchOne($sql))
{
throw new DidgeridooArtwork_Exception('Item with this id not existent');
}
}
else
{
$sql = "SHOW COLUMNS FROM navigation";
$res = $this->_con->fetchAll($sql);
foreach($res as $it)
{
$result[$it['Field']] = '';
}
}
return $result;
}
public function add()
{
}
public function delete($id)
{
$sql = "DELETE FROM navigation WHERE id = :id";
$sql = $this->_con->createStatement($sql, array('id' => $id));
$this->_con->run($sql);
}
public function move($direction, $id)
{
$sql = "SELECT sorting, parent_id FROM navigation WHERE id = :id";
$sql = $this->_con->createStatement($sql, array('id' => $id));
if($active = $this->_con->fetchOne($sql))
{
$parentPart = ($active['parent_id'] === null) ? "parent_id IS NULL" : "parent_id = :parentId";
if($direction == 'up')
{
$sql = "SELECT id, sorting FROM navigation
WHERE
" . $parentPart . "
AND sorting < :sorting
ORDER BY sorting DESC
LIMIT 1
";
}
else if($direction == 'down')
{
$sql = "SELECT id, sorting FROM navigation
WHERE
" . $parentPart . "
AND sorting > :sorting
ORDER BY sorting ASC
LIMIT 1
";
}
else
{
throw new DidgeridooArtwork_Exception('Wrong Direction');
}
$sql = $this->_con->createStatement($sql, array(':id' => $id, 'parentId' => $active['parent_id'], 'sorting' => $active['sorting']));
$passiveItem = $this->_con->fetchOne($sql);
//updating active item
$sql = "UPDATE navigation SET sorting = :sorting WHERE id = :id";
$sql = $this->_con->createStatement($sql, array('id' => $id, 'sorting' => $passiveItem['sorting']));
$this->_con->run($sql);
//updating passive item
$sql = "UPDATE navigation SET sorting = :sorting WHERE id = :id";
$sql = $this->_con->createStatement($sql, array('id' => $passiveItem['id'], 'sorting' => $active['sorting']));
$this->_con->run($sql);
}
else
{
throw new DidgeridooArtwork_Exception('Wrong Parameters');
}
}
public static function buildLink($base, $item, $simpleMode = false)
{
if($item['link'] !== null)
{
return $item['link'];
}
$link = $base . '/' . $item['controller'];
if($simpleMode)
{
$link = $item['controller'];
}
if($item['action'] !== null)
{
$link .= '/' . $item['action'];
if($simpleMode) return $link;
if($item['controller'] == 'page')
{
$link .= '/preview';
}
}
return $link;
}
public static function getTitle()
{
if(substr(Katharsis_Request::getControllerName(), 0, 5) == 'admin')
{
return 'Admin';
}
$con = Katharsis_DatabaseConnector::getConnection();
if(Katharsis_Request::getControllerName() == 'page')
{
$sql = "SELECT title FROM page WHERE url = :url";
$sql = $con->createStatement($sql, array('url' => Katharsis_Request::getActionName()));
if($field = $con->fetchField($sql))
{
return $field;
}
}
$menuItemId = Katharsis_View::getInstance()->activeMenuItem;
$sql = "SELECT name FROM navigation WHERE id = :menuItemId";
$sql = $con->createStatement($sql, array('menuItemId' => $menuItemId));
if($field = $con->fetchField($sql))
{
return $field;
}
return Katharsis_Registry::getInstance()->defaults['title'];
}
public static function getSubtitle()
{
$con = Katharsis_DatabaseConnector::getConnection();
if(Katharsis_Request::getControllerName() == 'page')
{
$sql = "SELECT subtitle FROM page WHERE url = :url";
$sql = $con->createStatement($sql, array('url' => Katharsis_Request::getActionName()));
if($field = $con->fetchField($sql))
{
return $field;
}
}
return Katharsis_Registry::getInstance()->defaults['subtitle'];
}
public function getSites()
{
$sql = "SELECT url FROM page";
$sql = $this->_con->createStatement($sql, array('url' => Katharsis_Request::getActionName()));
$sites = $this->_con->fetchAll($sql);
foreach($sites as &$site)
{
$site = 'page/' . $site['url'];
}
$sites = array(
'defaults' => explode(", ", Katharsis_Registry::getInstance()->defaults['sites']),
'pages' => $sites
);
return $sites;
}
public function save($params)
{
$transformed = $this->_transformUrl($params['url'], $params['external']);
$values = array(
'id' => $params['id'],
'name' => $params['name'],
'parent_id' => $params['parentId'],
'active' => $params['active']
);
$values = array_merge($values, $transformed);
if(isset($values['id']) && is_numeric($values['id']))
{
$sql = "UPDATE navigation
SET
name = :name,
controller = :controller,
action = :action,
link = :link,
parent_id = parent_id,
active = :active
WHERE
id = :id
";
$sql = $this->_con->createStatement($sql, $values);
$this->_con->run($sql);
}
else
{
if($values['parent_id'] === null)
{
$sql = "SELECT max(sorting) + 1 as maxi FROM `navigation` WHERE parent_id IS NULL";
}
else
{
$sql = "SELECT max(sorting) + 1 as maxi FROM `navigation` WHERE parent_id = :parentId";
$sql = $this->_con->createStatement($sql, array('parentId' => $values['parent_id']));
}
$max = $this->_con->fetchField($sql);
$max = ($max === null) ? 1 : $max;
$values['sorting'] = $max;
$this->_con->insert('navigation', $values);
}
}
protected function _transformUrl($url, $external = null)
{
$values = array(
'controller' => null,
'action' => null,
'link' => null
);
if($url == '-external-')
{
$values['link'] = $external;
return $values;
}
$e = explode('/', $url);
if(array_key_exists(1, $e))
{
$values['controller'] = $e[0];
$values['action'] = $e[1];
}
else
{
$values['controller'] = $url;
}
return $values;
}
}

View file

@ -0,0 +1,87 @@
<?php
class Page extends Katharsis_Model_Abstract
{
public function init()
{
}
public function render($url, $preview)
{
$activeTerm = '';
if(!$preview)
{
$activeTerm = 'AND active = 1';
}
$sql = $this->_con->createStatement("SELECT * FROM page WHERE url = :url " . $activeTerm, array("url" => $url));
if($result = $this->_con->fetchOne($sql))
{
return $result['content'];
}
else
{
throw new DidgeridooArtwork_Exception('Die von Ihnen angeforderte Seite (Page) "' . $url . '" konnte nicht gefunden werden.');
}
}
public function getPages()
{
$sql = "SELECT id, title, subtitle, url, active FROM page ORDER BY id";
return $this->_con->fetchAll($sql);
}
public function getPage($pageId)
{
$default = $this->_con->getEmptyColumnArray('page');
if($pageId === null) return $default;
$sql = "SELECT * FROM page WHERE id = :pageId";
$sql = $this->_con->createStatement($sql, array('pageId' => $pageId));
if($result = $this->_con->fetchOne($sql))
{
return $result;
}
return $default;
}
public function save($params)
{
$values = array(
'title' => $params['title'],
'subtitle' => $params['subtitle'],
'url' => $params['url'],
'content' => $params['content'],
'active' => $params['active']
);
if(isset($params['id']) && is_numeric($params['id']))
{
$values['id'] = $params['id'];
$sql = "UPDATE page
SET
title = :title,
subtitle = :subtitle,
url = :url,
content = :content,
active = :active
WHERE
id = :id
";
$sql = $this->_con->createStatement($sql, $values);
$this->_con->run($sql);
}
else
{
$this->_con->insert('page', $values);
}
}
public function delete($pageId)
{
$sql = "DELETE FROM page WHERE id = :pageId";
$sql = $this->_con->createStatement($sql, array('pageId' => (int) $pageId));
$this->_con->run($sql);
}
}
?>

View file

@ -0,0 +1,79 @@
<?php
class Upload extends Katharsis_Model_Abstract
{
public function init()
{
}
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 page($file)
{
$dir = getcwd() . '/img/page';
return $this->_uploadFile(null, $file, $dir, $file['name'] . '-' . time());
}
protected function _uploadFile($id, $file, $dir, $name = null)
{
if($name === null)
{
$name = $id . '-' . time();
}
else
{
if($nameparts = explode(".", $name))
{
$name = $nameparts[0];
}
}
$handle = new Verot_Upload($file);
$handle->file_new_name_body = $name;
if ($handle->uploaded)
{
$handle->Process($dir);
if (!$handle->processed)
{
throw new DidgeridooArtwork_Exception('Datei konnte nicht verschoben werden (' . $handle->error . ').');
}
$handle->Clean();
}
else
{
throw new DidgeridooArtwork_Exception('Datei konnte nicht hochgeladen werden (' . $handle->error . ').');
}
$returnName = $handle->file_dst_name;
return $returnName;
}
}

BIN
application/view/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,11 @@
<div id="admin">
<form action="<?php echo $this->base ?>/admin/login" method="post">
<dl>
<dt>Admin</dt>
<dd>
<?php if($this->_getParam('wrongpassword')) echo 'passwort falsch<br/>' ?>
<input type="password" name="password" value="" /> <input type="submit" name="login" value="login" />
</dd>
</dl>
</form>
</div>

View file

@ -0,0 +1,5 @@
<div id="admin">
<p>
Willkommen im Admin Bereich.
</p>
</div>

View file

@ -0,0 +1,56 @@
<div id="admin">
<h3>Navigation/Menüpunkt bearbeiten</h3>
<form action="<?php echo $this->base ?>/adminNavigation/save"method="post">
<input type="hidden" name="id" value="<?php if($this->item['id']) echo $this->item['id'] ?>" />
<dl>
<dt>Aktiv</dt>
<dd>
<input type="checkbox" name="active" <?php if($this->item['active']) echo 'checked="checked"' ?> />
</dd>
</dl>
<dl>
<dt>Menüpunkttyp</dt>
<dd>
<select name="parentId">
<option value="0">Hauptpunkt</option>
<?php foreach($this->mainItems as $item): ?>
<option <?php if($item['id'] == $this->item['parent_id'] || $item['id'] == $this->_getParam('parentId')) echo 'selected="selected"' ?> value="<?php echo $item['id'] ?>">Unterpunkt von <?php echo $item['name'] ?></option>
<?php endforeach ?>
</select>
</dd>
</dl>
<dl>
<dt>Titel</dt>
<dd>
<input type="text" name="name" value="<?php echo $this->item['name'] ?>"/>
</dd>
</dl>
<dl>
<dt>Url</dt>
<dd>
<table>
<tr>
<td>
<?php foreach($this->sites['defaults'] as $key => $site): ?>
<input type="radio" checked="checked" name="url" id="sitedefault_<?php echo $key ?>" value="<?php echo $site ?>"/><label for="sitedefault_<?php echo $key ?>"><?php echo $site ?></label><br/>
<?php endforeach ?>
</td>
<td>
<?php foreach($this->sites['pages'] as $key => $site): ?>
<input type="radio" name="url" id="sitepage_<?php echo $key ?>" value="<?php echo $site ?>"/><label for="sitepage_<?php echo $key ?>"><?php echo $site ?></label><br/>
<?php endforeach ?>
</td>
<td>
<input type="radio" name="url" id="sitenew" value="-external-"/><label for="sitenew">Externe Adresse:</label><br/>
<input type="text" name="external" value="http://"/>
</tr>
</table>
</dd>
</dl>
<p>
<input type="submit" name="save" value="speichern" />
</p>
</form>
</div>

View file

@ -0,0 +1,111 @@
<div id="admin">
<h3>Navigation Bearbeiten</h3>
<table>
<tr>
<th>
Aktiv
</th>
<th>
Name
</th>
<th colspan="7">
Link
</th>
</tr>
<?php $o=0; foreach($this->list as $parent): $i=0; ?>
<tr>
<td>
<?php if($parent['active']) echo 'Ja'; else echo 'Nein'; ?>
</td>
<td>
<?php echo $parent['name'] ?>
</td>
<td>
<?php echo Navigation::buildLink($this->base, $parent, true); ?>
</td>
<td>
<?php if($o!=0): ?>
<a href="<?php echo $this->base ?>/adminNavigation/move/direction/up/id/<?php echo $parent['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/arrow_up.png" alt="Nach oben verschieben" title="Nach oben verschieben"/>
</a>
<?php endif ?>
</td>
<td>
<?php if($o<count($this->list)-1): ?>
<a href="<?php echo $this->base ?>/adminNavigation/move/direction/down/id/<?php echo $parent['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/arrow_down.png" alt="Nach unten verschieben" title="Nach unten verschieben" />
</a>
<?php endif ?>
</td>
<td>
<a href="<?php echo $this->base ?>/adminNavigation/delete/id/<?php echo $parent['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/delete.png" alt="Löschen" title="Löschen" />
</a>
</td>
<td>
<a href="<?php echo $this->base ?>/adminNavigation/edit/parentId/<?php echo $parent['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/addSub.png" alt="Unterpunkt hinzufügen" title="Unterpunkt hinzufügen" />
</a>
</td>
<td>
<a href="<?php echo $this->base ?>/adminNavigation/edit/id/<?php echo $parent['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/change.png" alt="Ändern" title="Ändern" />
</a>
</td>
<td>
<a href="<?php echo Navigation::buildLink($this->base, $parent, false); ?>">
<img src="<?php echo $this->base ?>/img/leafs/preview.png" alt="Vorschau" title="Vorschau" />
</a>
</td>
</tr>
<?php foreach($parent['children'] as $child): ?>
<tr class="sub">
<td>
<?php if($child['active']) echo 'Ja'; else echo 'Nein'; ?>
</td>
<td>
<?php echo $child['name'] ?>
</td>
<td>
<?php echo Navigation::buildLink($this->base, $child, true); ?>
</td>
<td>
<?php if($i!=0): ?>
<a href="<?php echo $this->base ?>/adminNavigation/move/direction/up/id/<?php echo $child['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/arrow_up.png" alt="Nach oben verschieben" title="Nach oben verschieben"/>
</a>
<?php endif ?>
</td>
<td>
<?php if($i<count($parent['children'])-1): ?>
<a href="<?php echo $this->base ?>/adminNavigation/move/direction/down/id/<?php echo $child['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/arrow_down.png" alt="Nach unten verschieben" title="Nach unten verschieben" />
</a>
<?php endif ?>
</td>
<td>
<a href="<?php echo $this->base ?>/adminNavigation/delete/id/<?php echo $child['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/delete.png" alt="Löschen" title="Löschen" />
</a>
</td>
<td>
&nbsp;
</td>
<td>
<a href="<?php echo $this->base ?>/adminNavigation/edit/id/<?php echo $child['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/change.png" alt="Ändern" title="Ändern" />
</a>
</td>
<td>
<a href="<?php echo Navigation::buildLink($this->base, $child, false); ?>">
<img src="<?php echo $this->base ?>/img/leafs/preview.png" alt="Vorschau" title="Vorschau" />
</a>
</td>
</tr>
<?php $i++; endforeach ?>
<?php $o++; endforeach ?>
</table>
<p>
<a href="<?php echo $this->base ?>/adminNavigation/edit">Neuen Hauptpunkt anlegen</a>
</p>
</div>

View file

@ -0,0 +1,93 @@
<div id="admin">
<h3>Page bearbeiten</h3>
<!-- TinyMCE -->
<script type="text/javascript" src="<?php echo $this->base ?>/scripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
language : "de",
mode : "textareas",
theme : "advanced",
plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Example content CSS (should be your site CSS)
content_css : "<?php echo $this->base ?>/style/tiny.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",
// Style formats
style_formats : [
{title : 'Bold text', inline : 'b'},
{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
{title : 'Example 1', inline : 'span', classes : 'example1'},
{title : 'Example 2', inline : 'span', classes : 'example2'},
{title : 'Table styles'},
{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
],
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
</script>
<!-- /TinyMCE -->
<form action="<?php echo $this->base ?>/adminPage/save"method="post">
<input type="hidden" name="id" value="<?php echo $this->page['id'] ?>" />
<dl>
<dt>Aktiv</dt>
<dd>
<input type="checkbox" name="active" <?php if($this->page['active']) echo 'checked="checked"' ?> />
</dd>
</dl>
<dl>
<dt>Titel</dt>
<dd>
<input class="textfield" type="text" name="title" value="<?php echo $this->page['title'] ?>"/>
</dd>
</dl>
<dl>
<dt>Untertitel</dt>
<dd>
<input class="textfield" type="text" name="subtitle" value="<?php echo $this->page['subtitle'] ?>"/>
</dd>
</dl>
<dl>
<dt>Url</dt>
<dd>
<input class="textfield" type="text" name="url" value="<?php echo $this->page['url'] ?>"/>
</dd>
</dl>
<dl>
<dt>Inhalt</dt>
<dd>
<!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded -->
<div>
<textarea id="content" name="content" rows="15" cols="80" style="width: 500px"><?php echo htmlentities($this->page['content']) ?></textarea>
</div>
</dd>
</dl>
<p>
<input type="submit" name="save" value="speichern" />
</p>
</form>
</div>

View file

@ -0,0 +1,31 @@
<html>
<head>
<title>Swiss Didgeridoo Artwork</title>
<link rel="stylesheet" type="text/css" href="/style/main.css" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="Description" content="Swiss Didgeridoo Artwork - Online Shop" />
</head>
<body>
<div style="padding: 10px;">
<h3 style="color:white; padding: 3px;background-color: #CB3829;">Bild Hochladen</h3>
<p><form method="post" enctype="multipart/form-data">
<input name="myfile" type="file" size="50" maxlength="100000" accept="text/*"> <input type="submit" value="Go" />
</form>
</p>
<h3 style="color:white; padding: 3px;background-color: #CB3829;">Bild Ausw&auml;hlen</h3>
<ul style="padding-left: 16px; list-style-type: none">
<?php foreach($this->files as $file): ?>
<li>
<a href="javascript: void(0);" onclick="window.open('/img/page/<?php echo $file; ?>', 'Bild', 'width=400,height=300,status=yes,scrollbars=yes,resizable=yes');"><img src="/img/page/<?php echo $file; ?>" width="50" height="50" /></a>
<a href="javascript: void(0);" onclick="opener.document.getElementById('src').value='/img/page/<?php echo $file; ?>'; window.close();" >Einf&uuml;gen</a>
<a href="?delete=<?php echo $file ?>" style="float:right; margin-top: 35px">L&ouml;schen</a>
</li>
<?php endforeach; ?>
</ul>
</div>
</body>
</html>

View file

@ -0,0 +1,57 @@
<div id="admin">
<h3>Page Übersicht</h3>
<table>
<tr>
<th>
Aktiv
</th>
<th>
Titel
</th>
<th>
Untertitel
</th>
<th>
Url
</th>
<th colspan="3">
&nbsp;
</th>
</tr>
<?php foreach($this->pages as $page): ?>
<tr>
<td>
<?php if($page['active']) echo 'Ja'; else echo 'Nein'; ?>
</td>
<td>
<?php echo $page['title'] ?>
</td>
<td>
<?php echo $page['subtitle'] ?>
</td>
<td>
<?php echo $page['url'] ?>
</td>
<td>
<a href="<?php echo $this->base ?>/adminPage/delete/pageId/<?php echo $page['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/delete.png" alt="Löschen" title="Löschen" />
</a>
</td>
<td>
<a href="<?php echo $this->base ?>/adminPage/edit/pageId/<?php echo $page['id'] ?>">
<img src="<?php echo $this->base ?>/img/leafs/change.png" alt="Ändern" title="Ändern" />
</a>
</td>
<td>
<a href="<?php echo $this->base ?>/page/<?php echo $page['url'] ?>/preview">
<img src="<?php echo $this->base ?>/img/leafs/preview.png" alt="Vorschau" title="Vorschau" />
</a>
</td>
</tr>
<?php endforeach ?>
</table>
<p>
<a href="<?php echo $this->base ?>/adminPage/edit">Neue Seite anlegen</a>
</p>
</div>

View file

@ -0,0 +1,34 @@
<div id="admin">
<h3>Produkt-Bild hinzufügen</h3>
<form action="<?php echo $this->base ?>/adminUpload/process" method="post" enctype="multipart/form-data">
<input type="hidden" name="productId" value="<?php echo $this->_getParam('productId') ?>"/>
<dl>
<dt>
Produkt
</dt>
<dd>
<?php echo $this->item['name'] ?>
</dd>
</dl>
<dl>
<dt>
Klein
</dt>
<dd>
<input type="file" value="" name="small" size="32" />
</dd>
</dl>
<dl>
<dt>
Groß
</dt>
<dd>
<input type="file" value="" name="big" size="32" />
</dd>
</dl>
<p>
<input type="submit" value="Hochladen" />
</p>
</form>
</div>

View file

@ -0,0 +1,34 @@
<div id="admin">
<h3>Produkt-Bild hinzufügen</h3>
<form action="<?php echo $this->base ?>/adminUpload/process" method="post" enctype="multipart/form-data">
<input type="hidden" name="productId" value="<?php echo $this->_getParam('productId') ?>"/>
<dl>
<dt>
Produkt
</dt>
<dd>
<?php echo $this->item['name'] ?>
</dd>
</dl>
<dl>
<dt>
Klein
</dt>
<dd>
<input type="file" value="" name="small" size="32" />
</dd>
</dl>
<dl>
<dt>
Groß
</dt>
<dd>
<input type="file" value="" name="big" size="32" />
</dd>
</dl>
<p>
<input type="submit" value="Hochladen" />
</p>
</form>
</div>

View file

@ -0,0 +1,17 @@
<div id="admin">
<h3>Hochladen</h3>
<form action="<?php echo $this->base ?>/adminUpload/process" method="post" enctype="multipart/form-data">
<input type="hidden" name="productId" value="<?php echo $this->_getParam('productId') ?>"/>
<dl>
<dt>
Datei
</dt>
<dd>
<input type="file" value="" name="myfile" size="32"/>
</dd>
</dl>
<p>
<input type="submit" value="Hochladen" />
</p>
</form>
</div>

View file

@ -0,0 +1,4 @@
<h3>Fehler</h3>
<p>
<?php echo $this->message ?>
</p>

View file

@ -0,0 +1,15 @@
<html>
<head>
<title>Swiss Didgeridoo Artwork - Schweizer Holz Didgeridoo bester Qualit&auml;t</title>
<link rel="stylesheet" type="text/css" href="/style/main.css" />
<link rel="shortcut icon" href="/img/leafs/favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Description" content="Bei uns findest du alles rund ums Didgeridoo - Qualitäts Instrumente aus einheimischen Hölzern - Taschen - Mundstücke - Musik - Konzertkalender - Unterricht -Therapie - Clapstick - Trommel Reparaturen - Diverse Links" />
<meta name="keywords" content="Didgeridoo, Didjeridoo, Yidaki, Clapstick, Mundstück, Holzblasinstrument, Australisches Instrument, Didgeridoo Reparaturen, Didgeridoo Konzert, Trommel Reparaturen, Didgeridoo Unterricht, Zirkularatmung, Rhythmus Didgeridoo" />
</head>
<body id="index">
<a href="<?php echo $this->base ?>/page/home" title="Klick!" alt="Willkommensbild">
<img src="<?php echo $this->base ?>/img/leafs/index.png" />
</a>
</body>
</html>

View file

@ -0,0 +1,12 @@
<html>
<head>
<title>Swiss Didgeridoo Artwork</title>
<link rel="stylesheet" type="text/css" href="<?php echo $this->base ?>/style/main.css" />
<link rel="shortcut icon" href="<?php echo $this->base ?>/img/leafs/favicon.ico" type="image/x-icon" />
</head>
<body id="index">
<a href="<?php echo $this->base ?>/page/home" title="Klick!" alt="Willkommensbild">
<img src="<?php echo $this->base ?>/img/leafs/index.png" />
</a>
</body>
</html>

216
config/dbinit.sql Normal file
View file

@ -0,0 +1,216 @@
-- MySQL dump 10.13 Distrib 5.5.27, for osx10.8 (i386)
--
-- Host: localhost Database: kingkoen_didgeridooartwork
-- ------------------------------------------------------
-- Server version 5.5.27
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `cart`
--
DROP TABLE IF EXISTS `cart`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cart` (
`id` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7011 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `cart_item`
--
DROP TABLE IF EXISTS `cart_item`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cart_item` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cart_id` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`amount` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=7512 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `category`
--
DROP TABLE IF EXISTS `category`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `category` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(256) NOT NULL,
`info` varchar(512) NOT NULL,
`parent_id` int(11) DEFAULT NULL,
`image` varchar(256) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `event`
--
DROP TABLE IF EXISTS `event`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `event` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(256) NOT NULL,
`description` text NOT NULL,
`date` date NOT NULL,
`till` date NOT NULL,
`image` varchar(256) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=67 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `navigation`
--
DROP TABLE IF EXISTS `navigation`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `navigation` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`controller` varchar(64) DEFAULT NULL,
`action` varchar(64) DEFAULT NULL,
`link` varchar(255) DEFAULT NULL,
`parent_id` int(11) DEFAULT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
`sorting` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=69 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `news`
--
DROP TABLE IF EXISTS `news`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `news` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`subject` varchar(256) NOT NULL,
`content` text NOT NULL,
`published` date NOT NULL,
`till` date NOT NULL DEFAULT '2010-06-22',
`active` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `order`
--
DROP TABLE IF EXISTS `order`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `order` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(256) NOT NULL,
`price` varchar(32) NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`content` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=67 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `page`
--
DROP TABLE IF EXISTS `page`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `page` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(256) NOT NULL,
`subtitle` varchar(256) NOT NULL,
`url` varchar(256) NOT NULL,
`content` text NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=36 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `product`
--
DROP TABLE IF EXISTS `product`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `product` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(256) NOT NULL,
`description` varchar(512) NOT NULL,
`price` decimal(10,2) NOT NULL,
`category_id` int(11) NOT NULL,
`soundfile` varchar(256) DEFAULT NULL,
`active` tinyint(1) NOT NULL DEFAULT '0',
`info1` varchar(512) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=43 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `product_detail`
--
DROP TABLE IF EXISTS `product_detail`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `product_detail` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(256) NOT NULL,
`value` text NOT NULL,
`product_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=671 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `product_image`
--
DROP TABLE IF EXISTS `product_image`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `product_image` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`file` varchar(128) NOT NULL,
`product_id` int(11) NOT NULL,
`default` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=181 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2013-07-08 20:51:41

BIN
library/.DS_Store vendored Normal file

Binary file not shown.

BIN
library/DidgeridooArtwork/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,17 @@
<?php
class DidgeridooArtwork_Controller_Plugin_Access extends Katharsis_Controller_Plugin_Abstract
{
public function preController()
{
if(Katharsis_Request::getControllerName() != 'admin')
{
$firstFive = substr(Katharsis_Request::getControllerName(), 0, 5);
if($firstFive == 'admin' && !Access::isLogged())
{
Katharsis_Request::setControllerName('admin');
Katharsis_Request::setActionName('index');
}
}
}
}

View file

@ -0,0 +1,13 @@
<?php
class DidgeridooArtwork_Controller_Plugin_Defaults extends Katharsis_Controller_Plugin_Abstract
{
public function preController()
{
$ini = parse_ini_file('config/defaults.config.ini', true);
$registry = Katharsis_Registry::getInstance();
$registry->defaults = $ini;
$view = Katharsis_View::getInstance();
$view->defaults = $ini;
}
}

View file

@ -0,0 +1,39 @@
<?php
class DidgeridooArtwork_Controller_Plugin_Navigation extends Katharsis_Controller_Plugin_Abstract
{
public function preController()
{
$view = Katharsis_View::getInstance();
$sql = "SELECT id, name, controller, action, link FROM navigation WHERE parent_id IS NULL ORDER BY sorting";
$view->mainNavigationItems = $this->_con->fetchAll($sql);
$sql = "SELECT id, parent_id, controller, action FROM navigation WHERE (action = :action AND controller = :controller) OR (action IS NULL AND controller = :controller)";
$sql = $this->_con->createStatement($sql, array(
'controller' => Katharsis_Request::getControllerName(),
'action' => Katharsis_Request::getActionName()
));
if($row = $this->_con->fetchOne($sql))
{
$activeItemId = ($row['parent_id'] === null) ? $row['id'] : $row['parent_id'];
$view->activeMenuItem = $activeItemId;
$sql = "SELECT id, name, controller, action, link FROM navigation WHERE parent_id = :parentId ORDER BY sorting";
$sql = $this->_con->createStatement($sql, array('parentId' => $activeItemId));
$view->subNavigationItems = $this->_con->fetchAll($sql);
if($row['parent_id'] !== null)
{
$view->activeSubMenuItem = $row['id'];
}
else
{
$actionpart = ($row['action'] === null) ? ' action IS NULL ' : ' action = :action';
$sql = "SELECT id FROM navigation WHERE controller = :controller AND " . $actionpart . " AND parent_id IS NOT NULL";
$sql = $this->_con->createStatement($sql, array('controller' => $row['controller'], 'action' => $row['action']));
$view->activeSubMenuItem = $this->_con->fetchField($sql);
}
}
}
}

View file

@ -0,0 +1,9 @@
<?php
class DidgeridooArtwork_Controller_Plugin_Notice extends Katharsis_Controller_Plugin_Abstract
{
public function preController()
{
$view = Katharsis_View::getInstance();
$view->notices = DidgeridooArtwork_Notice::get();
}
}

View file

@ -0,0 +1,11 @@
<?php
class DidgeridooArtwork_Controller_Plugin_SetNames extends Katharsis_Controller_Plugin_Abstract
{
public function preController()
{
$view = Katharsis_View::getInstance();
$sql = "SET NAMES utf8";
$this->_con->run($sql);
}
}

View file

@ -0,0 +1,16 @@
<?php
class DidgeridooArtwork_Exception extends Katharsis_Exception
{
protected $_important = false;
public function __construct($message, $important = false)
{
$this->_important = $important;
parent::__construct($message);
}
public function handle()
{
}
}

View file

@ -0,0 +1,23 @@
<?php
class DidgeridooArtwork_Notice
{
public static function add($notice)
{
if(!is_array($_SESSION['notices']))
{
$_SESSION['notices'] = array();
}
$_SESSION['notices'][] = $notice;
}
public static function get()
{
$notices = array();
if(array_key_exists('notices', $_SESSION))
{
$notices = $_SESSION['notices'];
}
$_SESSION['notices'] = array();
return $notices;
}
}

View file

@ -0,0 +1,26 @@
<?php
class DidgeridooArtwork_Page_Plugin
{
public static function render($content)
{
preg_match_all("~\{plugin\=([^\}| ]*)([^\}]*)~", $content, $findings);
$findings[1] = array_reverse($findings[1]);
$findings[2] = array_reverse($findings[2]);
foreach($findings[1] as $key => $item)
{
$instanceName = "DidgeridooArtwork_Page_Plugin_" . ucfirst($findings[1][$key]);
if(!Katharsis_Autoload::findClass($instanceName))
{
throw new DidgeridooArtwork_Exception('PagePlugin ' . $instanceName . ' konnte nicht gefunden werden.', 1);
}
$object = new $instanceName;
$plugincontent = (string) $object->render(trim($findings[2][$key]));
$content = preg_replace("~(.*)\{plugin\=" . $findings[1][$key] . "[^\}]*\}(.*)~", '${1}' . $plugincontent . '${2}', $content);
}
return $content;
}
}

View file

@ -0,0 +1,19 @@
<?php
abstract class DidgeridooArtwork_Page_Plugin_Abstract
{
protected $_con;
protected $_view;
public final function __construct()
{
$this->_con = Katharsis_DatabaseConnector::getConnection();
$this->_view = Katharsis_View::getInstance();
$this->init();
}
public function init()
{
}
abstract public function render($parameters);
}

View file

@ -0,0 +1,8 @@
<?php
class DidgeridooArtwork_Page_Plugin_Mail extends DidgeridooArtwork_Page_Plugin_Abstract
{
public function render($parameters)
{
return $this->_view->render('Plugin/mail');
}
}

View file

@ -0,0 +1,11 @@
<?php
class DidgeridooArtwork_Page_Plugin_MiniEventList extends DidgeridooArtwork_Page_Plugin_Abstract
{
public function render($parameters)
{
$event = new Event();
$this->_view->pluginEvents = $event->getEventList();
return $this->_view->render('Plugin/minieventlist');
}
}

View file

@ -0,0 +1,10 @@
<?php
class DidgeridooArtwork_Page_Plugin_MiniNewsList extends DidgeridooArtwork_Page_Plugin_Abstract
{
public function render($parameters)
{
$news = new News();
$this->_view->pluginNews = $news->getActiveNews();
return $this->_view->render('Plugin/mininewslist');
}
}

View file

@ -0,0 +1,8 @@
<?php
class DidgeridooArtwork_Page_Plugin_Newsletter extends DidgeridooArtwork_Page_Plugin_Abstract
{
public function render($parameters)
{
return $this->_view->render('Plugin/newsletter');
}
}

View file

@ -0,0 +1,11 @@
<?php
class DidgeridooArtwork_Page_Plugin_ShopVorschau extends DidgeridooArtwork_Page_Plugin_Abstract
{
public function render($parameters)
{
$event = new Event();
$this->_view->pluginEvents = $event->getEventList();
return $this->_view->render('Plugin/shopvorschau');
}
}

4750
library/Verot/Upload.php Normal file

File diff suppressed because it is too large Load diff