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

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);
}
}