layout.phtml:
<?php echo $this->doctype()."\n" ?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
<head>
<?php
echo $this->headMeta()."\n"; echo $this->headTitle()."\n";
echo $this->headLink()->prependStylesheet($this->baseUrl()."/application/modules/default/views/css/style.css")."\n"; echo $this->headLink()->prependStylesheet($this->BaseUrl().'/application/modules/default/views/css/jscal2/jscal2.css')."\n"; echo $this->headLink()->prependStylesheet($this->BaseUrl().'/application/modules/default/views/css/jscal2/border-radius.css')."\n"; echo $this->headLink()->prependStylesheet($this->BaseUrl().'/application/modules/default/views/css/jscal2/steel.css')."\n";
echo $this->headScript()->appendFile($this->BaseUrl() . '/application/modules/default/views/js/jscal2/jscal2.js')."\n"; echo $this->headScript()->appendFile($this->BaseUrl() . '/application/modules/default/views/js/jscal2/lang/en.js')."\n";
echo $this->headScript()->appendFile($this->BaseUrl() . '/application/modules/default/views/js/ckeditor/ckeditor.js')."\n"; echo $this->headScript()->appendFile($this->BaseUrl() . '/application/modules/default/views/js/ckeditor/_samples/sample.js')."\n";
echo $this->headLink()->prependStylesheet($this->BaseUrl().'/application/modules/default/views/css/ckeditor/_samples/sample.css')."\n"; echo $this->headLink()->prependStylesheet($this->BaseUrl()."/application/modules/default/views/css/prettyPhoto.css", "screen,projection")."\n"; echo $this->headLink()->prependStylesheet($this->BaseUrl() . "/application/modules/default/views/js/pagination/css/jq.css", "screen,projection")."\n"; echo $this->headLink()->prependStylesheet($this->BaseUrl() . "/application/modules/default/views/js/pagination/themes/blue/style.css", "screen,projection")."\n"; echo $this->headLink()->prependStylesheet($this->BaseUrl() . "/application/modules/default/views/js/slide_menu/jqueryslidemenu.css", "screen,projection")."\n"; echo $this->headScript()->appendFile($this->BaseUrl() . '/application/modules/default/views/js/slide_menu/jquery.min.js')."\n"; echo $this->headScript()->appendFile($this->BaseUrl() . '/application/modules/default/views/js/slide_menu/jqueryslidemenu.js')."\n"; // echo $this->headStyle();
// echo $this->headScript()."\n";
?>
<script type="text/javascript">
$(function() {
$("table")
.tablesorter({widthFixed: true, widgets: ['zebra']})
.tablesorterPager({container: $("#pager")});
});
</script>
</head>
<body>
<div id="myslidemenu" class="jqueryslidemenu">
<?php echo $this->navigation(); ?> </div>
<div id="content">
<?php echo $this->layout()->content; ?> </div>
</body>
</html>
Bootstrap.php (główny, te w modułach są puste, więc nie ma sensu ich pokazywać)
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
private $_acl = null;
protected function _initAutoload()
{
Zend_Loader_Autoloader::getInstance()->suppressNotFoundWarnings(false);
$autoloader = new Zend_Application_Module_Autoloader
(array( 'namespace' => '',
'basePath' => APPLICATION_PATH . '/modules/default'
));
if(Zend_Auth::getInstance()->hasIdentity()) {
Zend_Registry::set("role", Zend_Auth::getInstance()->getStorage()->read()->role);
} else {
Zend_Registry::set("role", "guest");
}
$this->_acl = new Model_Acl();
$fc = Zend_Controller_Front::getInstance();
$fc->registerPlugin(new Plugin_AccessCheck($this->_acl));
$fc->registerPlugin(new Plugin_RegisterSettings("settings"));
return $autoloader;
}
protected function _initViewHelpers() {
$this->bootstrap("layout");
$layout = $this->getResource("layout");
$view = $layout->getView();
$view->doctype("XHTML1_TRANSITIONAL");
$view->headMeta()
->appendHttpEquiv('Content-Type','text/html; charset=UTF-8')
->appendHttpEquiv('Content-Language','pl-PL')
->appendName("description","Login page");
$view->headTitle()->setSeparator(" - ");
$view->headTitle("TEST");
$navContainerConfig = new Zend_Config_Xml(APPLICATION_PATH."/configs/navigation.xml", "nav");
$navContainer = new Zend_Navigation($navContainerConfig);
$view->navigation($navContainer)->setAcl($this->_acl)->setRole(Zend_Registry::get("role"));
}
}
application.ini[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
;includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules = ""
resources.db.adapter = pdo_mysql
resources.db.params.host = localhost
resources.db.params.username = HAHA
resources.db.params.password = HEHE
resources.db.params.dbname = HIHI
resources.layout.layoutpath = APPLICATION_PATH "/layouts"
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
IndexController.phpclass IndexController extends Zend_Controller_Action
{
private $_user = null;
private $_role = null;
private $_login = null;
public function init()
{
$this->_user = Zend_Auth::getInstance()->getStorage()->read();
$this->_role = $this->_user->role;
$this->_login = $this->_user->login;
}
public function indexAction()
{
if(Zend_Auth::getInstance()->getIdentity()->account_status == 0) {
Zend_Auth::getInstance()->clearIdentity();
$this->_redirect('authenticate/login/blocked/1');
}
}
}