Merge branch 'master' of github.com:jeena/seinheit.ch

This commit is contained in:
jeena 2013-07-10 14:50:25 +02:00
commit f95b70d17e
11 changed files with 146 additions and 126 deletions

View file

@ -4,7 +4,7 @@ class DidgeridooArtwork_Controller_Plugin_Navigation extends Katharsis_Controlle
public function preController()
{
$view = Katharsis_View::getInstance();
$sql = "SELECT id, name, controller, action, link FROM navigation WHERE parent_id IS NULL ORDER BY sorting";
$sql = "SELECT id, name, controller, action, link FROM navigation WHERE parent_id IS NULL AND active = 1 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)";

View file

@ -1,20 +1,19 @@
<?php
class Katharsis_Controller_Plugin_Autorender extends Katharsis_Controller_Plugin_Abstract
{
public function postController()
{
$view = Katharsis_View::getInstance();
$view->stageContent = false;
$templateName = ucfirst(Katharsis_Request::getControllerName()) . DIRECTORY_SEPARATOR . strtolower(Katharsis_Request::getActionName());
if(file_exists(getcwd() . '/application/view' . DIRECTORY_SEPARATOR . $templateName . '.phtml'))
{
$view->stageContent = $view->render($templateName);
}
echo $view->render('main');
}
}
?>
<?php
class Katharsis_Controller_Plugin_Autorender extends Katharsis_Controller_Plugin_Abstract
{
public function postController()
{
$view = Katharsis_View::getInstance();
$view->stageContent = false;
$templateName = ucfirst(Katharsis_Request::getControllerName()) . DIRECTORY_SEPARATOR . strtolower(Katharsis_Request::getActionName());
if(file_exists(getcwd() . '/application/view' . DIRECTORY_SEPARATOR . $templateName . '.phtml'))
{
$view->stageContent = $view->render($templateName);
}
echo $view->render('main');
}
}

View file

@ -1,73 +1,72 @@
<?php
class Katharsis_View
{
protected static $_instance = null;
protected $_items = array();
public static function getInstance()
{
if(self::$_instance === null)
{
self::$_instance = new self();
}
return self::$_instance;
}
protected function __construct()
{
$base = preg_replace('/(.+)\/[^\/]+/', '\1', $_SERVER['SCRIPT_NAME']);
$this->_items['base'] = $base != $_SERVER['SCRIPT_NAME'] ? $base : '';
}
public function __get($name)
{
if(array_key_exists($name, $this->_items))
{
if(is_array($this->_items[$name]))
{
return (array) $this->_items[$name];
}
return $this->_items[$name];
}
return null;
}
public function __set($name, $value)
{
$this->_items[$name] = $value;
}
public function render($template)
{
ob_start();
if(file_exists('application/view/' . $template . '.phtml'))
{
include('application/view/' . $template . '.phtml');
}
$output = ob_get_contents();
ob_end_clean();
return $output;
}
public function requestHook()
{
}
public function _getParam($key)
{
$params = Katharsis_Request::getParams();
if(array_key_exists($key,$params))
{
return $params[$key];
}
return null;
}
public function formatDate($date)
{
$date = explode("-", $date);
return $date[2] . '.' . $date[1] . '.' . $date[0];
}
}
?>
<?php
class Katharsis_View
{
protected static $_instance = null;
protected $_items = array();
public static function getInstance()
{
if(self::$_instance === null)
{
self::$_instance = new self();
}
return self::$_instance;
}
protected function __construct()
{
$base = preg_replace('/(.+)\/[^\/]+/', '\1', $_SERVER['SCRIPT_NAME']);
$this->_items['base'] = $base != $_SERVER['SCRIPT_NAME'] ? $base : '';
}
public function __get($name)
{
if(array_key_exists($name, $this->_items))
{
if(is_array($this->_items[$name]))
{
return (array) $this->_items[$name];
}
return $this->_items[$name];
}
return null;
}
public function __set($name, $value)
{
$this->_items[$name] = $value;
}
public function render($template)
{
ob_start();
if(file_exists('application/view/' . $template . '.phtml'))
{
include('application/view/' . $template . '.phtml');
}
$output = ob_get_contents();
ob_end_clean();
return $output;
}
public function requestHook()
{
}
public function _getParam($key)
{
$params = Katharsis_Request::getParams();
if(array_key_exists($key,$params))
{
return $params[$key];
}
return null;
}
public function formatDate($date)
{
$date = explode("-", $date);
return $date[2] . '.' . $date[1] . '.' . $date[0];
}
}