Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 24th, 2012  |  syntax: PHP  |  size: 1.43 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. class AdminController extends Zend_Controller_Action
  4. {
  5.         private $_reg = null;
  6.         private $_auth = null;
  7.        
  8.         public function init()
  9.         {
  10.                 $this->_reg = $this->_reg = Zend_Registry::getInstance();
  11.                 $this->_auth = Zend_Auth::getInstance();
  12.                 if(!$this->_auth->hasIdentity())
  13.                 {
  14.                         $this->_redirect("index/login");       
  15.                 }
  16.         }
  17.        
  18.         public function indexAction()
  19.         {
  20.                 $vars = $this->_auth->getStorage()->read();
  21.                 //print_r($vars);
  22.                 $this->view->id = $vars['id'];
  23.                 $this->view->time = $vars['login_time'];
  24.                 $this->view->title = "Admin";
  25.                
  26.                 $kiosks = $this->_reg->em->getRepository("Entity\Kiosk_Session")->findBy(array("end"=>null));
  27.  
  28.                 if(count($kiosks) > 0)
  29.                 {
  30.                         $id_list = array();
  31.                         foreach($kiosks as $k)
  32.                         {
  33.                                 $id_list[] = array("code" => $k->kiosk->code,"ip" => $k->ip);
  34.                         }
  35.                         $this->view->kiosks = $id_list;
  36.                 }
  37.                
  38.                 $kiosk_code = $this->getRequest()->getParam('kiosk');
  39.                
  40.                 if(isset($kiosk_code))
  41.                 {
  42.                         $kiosk_logs = null;
  43.                         foreach($kiosks as $k)
  44.                         {
  45.                                 if($k->kiosk->code == $kiosk_code)
  46.                                 {
  47.                                         $kiosk_logs = $k->kiosk->kiosk_log;
  48.                                         break;
  49.                                 }
  50.                         }
  51.                         $this->view->kiosk_logs = $kiosk_logs; 
  52.                 }
  53.                
  54.                 //$this->_helper->viewRenderer->setNoRender(true);
  55.                 //echo "admin";
  56.                 //print_r($this->_auth->getStorage()->read());
  57.         }
  58.        
  59.         public function startAction()
  60.         {
  61.                 $this->view->title = "Admin Start";
  62.                 //$this->_helper->viewRenderer->setNoRender(true);
  63.                 //echo "Start";
  64.         }
  65. }