Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // file: application/forms/Login.php
- class Application_Form_Login extends Zend_Form
- {
- public function init()
- {
- $this->addElement('text', 'username', array (
- 'Label' => 'username',
- 'Required' => true,
- ));
- $this->addElement('password', 'password', array (
- 'Label' => 'password',
- 'Required' => true,
- ));
- $this->addElement('submit', 'login', array (
- 'Label' => 'Login',
- 'Ignore' => true,
- ));
- }
- }
- <?php
- //file: application/controllers/UserController.php
- class UserController extends Zend_Controller_Action
- {
- public function init()
- {
- /* Initialize action controller here */
- }
- public function indexAction()
- {
- $user = new Application_Model_DbTable_User();
- $users = array ();
- try {
- $users = $user->fetchAll();
- } catch (Zend_Db_Exception $e) {
- echo $e->getMessage() . "<br/>";
- }
- $this->view->users = $users;
- }
- public function oneAction()
- {
- $id = $this->getRequest()->getParam('id',0);
- $user = new Application_Model_DbTable_User();
- $this->view->user = $user->find($id);
- }
- public function loginAction()
- {
- $form = $this->_getForm();
- $this->view->form = $form;
- }
- protected function _getForm()
- {
- return new Application_Form_Login(array (
- 'method' => 'post',
- 'action' => $this->view->url(array (
- 'controller' => 'user',
- 'action' => 'auth',
- )),
- ));
- }
- }
- <?php // file: application/views/scripts/user/login.php ?>
- <?php echo $this->form ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement