[surforce-library commit] r34 - trunk/library/Zsurforce/Generic

0 views
Skip to first unread message

codesite...@google.com

unread,
Jan 20, 2009, 9:42:44 PM1/20/09
to surforce...@googlegroups.com
Author: enriqueplace
Date: Tue Jan 20 17:59:34 2009
New Revision: 34

Modified:
trunk/library/Zsurforce/Generic/Controller.php
trunk/library/Zsurforce/Generic/ControllerAdmin.php

Log:
Actualiza nuevas variables para tener disponible información en el
controller y en la vista

Modified: trunk/library/Zsurforce/Generic/Controller.php
==============================================================================
--- trunk/library/Zsurforce/Generic/Controller.php (original)
+++ trunk/library/Zsurforce/Generic/Controller.php Tue Jan 20 17:59:34 2009
@@ -38,32 +38,40 @@
/*
* Carga información desde el bootstrap (index.php).
*/
- $this->_registry = Zend_Registry::getInstance();
- $this->_debug = $this->_registry->get('config_sys')->debug;
-
- if( Zend_Registry::isRegistered('session')){
- $this->_session = $this->_registry->get('session');
+ $this->_registry = Zend_Registry::getInstance();
+ $this->_debug = $this->_registry->get('config')->debug;
+ $this->_devel = $this->_registry->get('config')->devel;
+ $this->_config = $this->_registry->get('config');
+
+ if( Zend_Registry::isRegistered('session')){
+ $this->_session = $this->_registry->get('session');
}

- /*
+ /*
* Carga información para las vistas del sistema
*/
$this->initView();
- $this->view->basePath = $this->_registry->get('base_path');
- $this->view->baseUrl = $this->_request->getBaseUrl();
- $this->view->debug = $this->_debug;
- $this->view->session = $this->_session;
- $this->view->user = Zend_Auth::getInstance ()->getIdentity();
-
- /* Ruta para acceder a toda la información pública y compartida del
sistema:
- * - estilos
- * - layout
- * - imagenes
- * - scripts / js / etc
- */
- $this->view->addBasePath('./html/','');
-
-
$this->view->addHelperPath('./library/Zsurforce/View/Helper/', 'Zsurforce_View_Helper');

+ $this->view->basePath =
$this->_registry->get('base_path_app');
+ $this->view->basePathHtml =
$this->_registry->get('base_path_html');
+ $this->view->baseUrl = $this->_request->getBaseUrl();
+
+ $this->view->debug = $this->_debug;
+ $this->view->devel = $this->_devel;
+ $this->view->session = $this->_session;
+ $this->view->config = $this->_config;
+
+ $this->view->user = Zend_Auth::getInstance
()->getIdentity();
+ $this->view->controllerName =
$this->_request->getParam('controller');
+ $this->view->moduleName = $this->_request->getParam('module');
+
+ $this->view->addHelperPath(
+ '../library/Zsurforce/View/Helper/',
+ 'Zsurforce_View_Helper'
+ );
+ $this->view->addHelperPath(
+ 'ZendX/JQuery/View/Helper',
+ 'ZendX_JQuery_View_Helper'
+ );

/*
* Ejemplo para cargar por defecto las clases necesarias para el
controller,
@@ -88,5 +96,4 @@
$this->view->usuarioLogueado = true;
}
}
-}
-?>
\ No newline at end of file
+}
\ No newline at end of file

Modified: trunk/library/Zsurforce/Generic/ControllerAdmin.php
==============================================================================
--- trunk/library/Zsurforce/Generic/ControllerAdmin.php (original)
+++ trunk/library/Zsurforce/Generic/ControllerAdmin.php Tue Jan 20 17:59:34
2009
@@ -19,11 +19,16 @@
final function preDispatch()
{
$auth = Zend_Auth::getInstance ();
+
if ($auth->hasIdentity ()) {
$this->view->usuarioLogueado = true;
+
+ /* Genera el menú dinámico para el sistema de admin */
+ $layout = Zend_Layout::getMvcInstance();
+ $layout->menu =
Models_Menu::getMenu($this->_registry->config->general->appid);
}else {
- die('Acceso Restringido');
+ $this->_redirect('/admin/login/');
+ return;
}
}
-}
-?>
\ No newline at end of file
+}
\ No newline at end of file
Reply all
Reply to author
Forward
0 new messages