Get Widget

Wednesday, February 5, 2014

zend list page

 public function listuserAction()  
   {  
     $db = Zend_Db_Table::getDefaultAdapter();  
     //$db = $this->_db;  
     $select = $db->select();  
     $select->from('user', array('*'));  
     $test = $db->fetchAll($select);  
     print_r($test); die;  
   }  
 -----------  
 login  
 <div><?php echo $this->fmessages; ?></div>  
 <form name="<?php echo $this->form->getAttrib('name'); ?>" id="<?php echo $this->form->getAttrib('id'); ?>" action="<?php echo $this->form->getAction(); ?>" method="<?php echo $this->form->getMethod(); ?>">  
 <ul>   
   <li>  
     <label>Username: <?php echo $this->form->user_name; ?></label>  
   </li>  
   <li>  
     <label>Password: <?php echo $this->form->password; ?></label>  
   </li>  
   <li>  
     <?php echo $this->form->login; ?>  
   </li>  
 </ul>  
 </form>  
 -----  
 public function init()  
   {  
     //Initialize action controller here  
     $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger');  
     $registry = Zend_Registry::getInstance();  
     $this->_em = $registry->entitymanager;  
     if($this->_flashMessenger->getMessages())  
     {  
       $fmsgArr = $this->_flashMessenger->getMessages();  
       $this->fmsg = $fmsgArr[0];  
     }  
     $this->view->fmessages = $this->fmsg;  
     $this->request = Zend_Controller_Front::getInstance()->getRequest();  
     $this->contUrl = $this->request->getBaseUrl().'/'.$this->request->getModuleName().'/'.$this->request->getControllerName();     
   }  
   public function getUserMapperObj()  
   {  
     if(is_null($this->userObj))  
     {  
       $this->userObj = new User_Model_userRegisterMapper($this->_em);  
     }  
     return $this->userObj;  
   }  
 --------  
 $auth = Zend_Auth::getInstance();  
    if(!$auth->hasIdentity())  
    {  
     $this->_redirect('/user/login');  
    }  

No comments:

Post a Comment

 
follow me on Twitter
Get Widget