Mage_Adminhtml_IndexController Class Reference

Inheritance diagram for Mage_Adminhtml_IndexController:

Mage_Adminhtml_Controller_Action Mage_Core_Controller_Varien_Action

List of all members.

Public Member Functions

 indexAction ()
 loginAction ()
 logoutAction ()
 globalSearchAction ()
 exampleAction ()
 testAction ()
 changeLocaleAction ()
 deniedJsonAction ()
 deniedIframeAction ()
 forgotpasswordAction ()

Protected Member Functions

 _outTemplate ($tplName, $data=array())
 _getDeniedJson ()
 _getDeniedIframe ()
 _isAllowed ()


Detailed Description

Definition at line 28 of file IndexController.php.


Member Function Documentation

_getDeniedIframe (  )  [protected]

Definition at line 162 of file IndexController.php.

00163     {
00164         return '<script type="text/javascript">parent.window.location = \''.$this->getUrl('*/index/login').'\';</script>';
00165     }

_getDeniedJson (  )  [protected]

Definition at line 147 of file IndexController.php.

00148     {
00149         return Zend_Json::encode(
00150             array(
00151                 'ajaxExpired'  => 1,
00152                 'ajaxRedirect' => $this->getUrl('*/index/login')
00153             )
00154         );
00155     }

_isAllowed (  )  [protected]

Reimplemented from Mage_Adminhtml_Controller_Action.

Definition at line 206 of file IndexController.php.

00207     {
00208         /*if ( $this->getRequest()->getActionName() == 'login' && ! Mage::getSingleton('admin/session')->isAllowed('admin') ) {
00209             Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('You have not enought permissions to login.'));
00210             $request = Mage::app()->getRequest();
00211 
00212         } else {
00213             return Mage::getSingleton('admin/session')->isAllowed('admin');
00214         }
00215         */
00216         return true;
00217     }

_outTemplate ( tplName,
data = array() 
) [protected]

Definition at line 30 of file IndexController.php.

00031     {
00032         $this->_initLayoutMessages('adminhtml/session');
00033         $block = $this->getLayout()->createBlock('adminhtml/template')->setTemplate("$tplName.phtml");
00034         foreach ($data as $index=>$value) {
00035             $block->assign($index, $value);
00036         }
00037         $this->getResponse()->setBody($block->toHtml());
00038     }

changeLocaleAction (  ) 

Definition at line 133 of file IndexController.php.

00134     {
00135         $locale = $this->getRequest()->getParam('locale');
00136         if ($locale) {
00137             Mage::getSingleton('adminhtml/session')->setLocale($locale);
00138         }
00139         $this->_redirectReferer();
00140     }

deniedIframeAction (  ) 

Definition at line 157 of file IndexController.php.

00158     {
00159         $this->getResponse()->setBody($this->_getDeniedIframe());
00160     }

deniedJsonAction (  ) 

Definition at line 142 of file IndexController.php.

00143     {
00144         $this->getResponse()->setBody($this->_getDeniedJson());
00145     }

exampleAction (  ) 

Definition at line 123 of file IndexController.php.

00124     {
00125         $this->_outTemplate('example');
00126     }

forgotpasswordAction (  ) 

Definition at line 167 of file IndexController.php.

00168     {
00169         $email = $this->getRequest()->getParam('email');
00170         $params = $this->getRequest()->getParams();
00171         if (!empty($email) && !empty($params)) {
00172             $collection = Mage::getResourceModel('admin/user_collection');
00173             /* @var $collection Mage_Admin_Model_Mysql4_User_Collection */
00174             $collection->addFieldToFilter('email', $email);
00175             $collection->load(false);
00176 
00177             if ($collection->getSize() > 0) {
00178                 foreach ($collection as $item) {
00179                     $user = Mage::getModel('admin/user')->load($item->getId());
00180                     if ($user->getId()) {
00181                         $pass = substr(md5(uniqid(rand(), true)), 0, 7);
00182                         $user->setPassword($pass);
00183                         $user->save();
00184                         $user->setPlainPassword($pass);
00185                         $user->sendNewPasswordEmail();
00186                         Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('A new password was sent to your email address. Please check your email and click Back to Login.'));
00187                         $email = '';
00188                     }
00189                     break;
00190                 }
00191             } else {
00192                 Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Can\'t find email address.'));
00193             }
00194         } elseif (!empty($params)) {
00195             Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Email address is empty.'));
00196         }
00197 
00198 
00199         $data = array(
00200             'email' => $email
00201         );
00202         $this->_outTemplate('forgotpassword', $data);
00203     }

globalSearchAction (  ) 

Definition at line 82 of file IndexController.php.

00083     {
00084         $searchModules = Mage::getConfig()->getNode("adminhtml/global_search");
00085         $items = array();
00086 
00087         if ( !Mage::getSingleton('admin/session')->isAllowed('admin/global_search') ) {
00088             $items[] = array(
00089                 'id'=>'error',
00090                 'type'=>'Error',
00091                 'name'=>Mage::helper('adminhtml')->__('Access Deny'),
00092                 'description'=>Mage::helper('adminhtml')->__('You have not enought permissions to use this functionality.')
00093             );
00094             $totalCount = 1;
00095         } else {
00096             if (empty($searchModules)) {
00097                 $items[] = array('id'=>'error', 'type'=>'Error', 'name'=>Mage::helper('adminhtml')->__('No search modules registered'), 'description'=>Mage::helper('adminhtml')->__('Please make sure that all global admin search modules are installed and activated.'));
00098                 $totalCount = 1;
00099             } else {
00100                 $start = $this->getRequest()->getParam('start', 1);
00101                 $limit = $this->getRequest()->getParam('limit', 10);
00102                 $query = $this->getRequest()->getParam('query', '');
00103                 foreach ($searchModules->children() as $searchConfig) {
00104                     $className = $searchConfig->getClassName();
00105                     if (empty($className)) {
00106                         continue;
00107                     }
00108                     $searchInstance = new $className();
00109                     $results = $searchInstance->setStart($start)->setLimit($limit)->setQuery($query)->load()->getResults();
00110                     $items = array_merge_recursive($items, $results);
00111                 }
00112                 $totalCount = sizeof($items);
00113             }
00114         }
00115 
00116         $block = $this->getLayout()->createBlock('adminhtml/template')
00117             ->setTemplate('system/autocomplete.phtml')
00118             ->assign('items', $items);
00119 
00120         $this->getResponse()->setBody($block->toHtml());
00121     }

indexAction (  ) 

Definition at line 40 of file IndexController.php.

00041     {
00042         $url = Mage::getSingleton('admin/session')->getUser()->getStartupPageUrl();
00043 
00044         $this->_redirect($url);
00045         return;
00046 
00047         $this->loadLayout();
00048         $block = $this->getLayout()->createBlock('adminhtml/template', 'system.info')
00049             ->setTemplate('system/info.phtml');
00050 
00051         $this->_addContent($block);
00052 
00053         $this->renderLayout();
00054     }

loginAction (  ) 

Definition at line 56 of file IndexController.php.

00057     {
00058         if (Mage::getSingleton('admin/session')->isLoggedIn()) {
00059             $this->_redirect('*');
00060             return;
00061         }
00062         $loginData = $this->getRequest()->getParam('login');
00063         $data = array();
00064 
00065         if( is_array($loginData) && array_key_exists('username', $loginData) ) {
00066             $data['username'] = $loginData['username'];
00067         } else {
00068             $data['username'] = null;
00069         }
00070         #print_r($data);
00071         $this->_outTemplate('login', $data);
00072     }

logoutAction (  ) 

Definition at line 74 of file IndexController.php.

00075     {
00076         $auth = Mage::getSingleton('admin/session')->unsetAll();
00077         Mage::getSingleton('adminhtml/session')->unsetAll();
00078         Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('You successfully logged out.'));
00079         $this->_redirect('*');
00080     }

testAction (  ) 

Definition at line 128 of file IndexController.php.

00129     {
00130         echo $this->getLayout()->createBlock('core/profiler')->toHtml();
00131     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:12 2009 for Magento by  doxygen 1.5.8