added some useful models and controllers
This commit is contained in:
parent
9bb724147e
commit
1d4b2a3314
44 changed files with 6424 additions and 0 deletions
BIN
library/DidgeridooArtwork/Controller/.DS_Store
vendored
Normal file
BIN
library/DidgeridooArtwork/Controller/.DS_Store
vendored
Normal file
Binary file not shown.
17
library/DidgeridooArtwork/Controller/Plugin/Access.php
Normal file
17
library/DidgeridooArtwork/Controller/Plugin/Access.php
Normal 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');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
library/DidgeridooArtwork/Controller/Plugin/Defaults.php
Normal file
13
library/DidgeridooArtwork/Controller/Plugin/Defaults.php
Normal 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;
|
||||
}
|
||||
}
|
||||
39
library/DidgeridooArtwork/Controller/Plugin/Navigation.php
Normal file
39
library/DidgeridooArtwork/Controller/Plugin/Navigation.php
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
library/DidgeridooArtwork/Controller/Plugin/Notice.php
Normal file
9
library/DidgeridooArtwork/Controller/Plugin/Notice.php
Normal 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();
|
||||
}
|
||||
}
|
||||
11
library/DidgeridooArtwork/Controller/Plugin/SetNames.php
Normal file
11
library/DidgeridooArtwork/Controller/Plugin/SetNames.php
Normal 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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue