added some useful models and controllers

This commit is contained in:
Logsol 2013-07-08 21:02:22 +02:00
parent 9bb724147e
commit 1d4b2a3314
44 changed files with 6424 additions and 0 deletions

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