Advertisement
mOrloff

/application/controller/UserController.php

Jun 21st, 2011
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.60 KB | None | 0 0
  1. <?php
  2.  
  3. class UserController extends Zend_Controller_Action
  4. {
  5.  
  6.     public function init()
  7.     {
  8.         /* Initialize action controller here */
  9.     }
  10.  
  11.     public function indexAction()
  12.     {
  13.         // action body
  14.     }
  15.  
  16.     public function frankAction()
  17.     {
  18.         // action body
  19.     }
  20.  
  21.     private function viewAction($var = null) {// renders via the /views/scripts/user/user.phtml template
  22.         $var = $var? $var: 'user';
  23.         $this->render($var);
  24.     }
  25.  
  26.     public function __call($method,$args) {
  27.         // $method is the method name (whose name contains 'Action')
  28.         $username=ucwords(substr($method,0, -6));  // so we remove 'Action' from the end
  29.         $this->view->username=$username;
  30.         $this->countformfieldsAction();
  31.         $this->viewAction();
  32.     }
  33.  
  34.     public function newuserAction() {// renders application/views/scripts/user/user.phtml
  35.         $payload = $this->getRequest()->getPost();
  36.         $this->view->username = $payload['newuser'];
  37.         $this->viewAction();
  38.     }
  39.    
  40.     public function countformfieldsAction(){
  41.         // action body
  42.         $formfieldCounter = $this->_helper->getHelper('FormfieldCounter');
  43.         $count = $formfieldCounter->count( $this->view->render('users/new-user.phtml'));
  44.         //$this->view->count = $count;
  45.         $this->view->count = 5;  // for testting ##
  46.     }
  47.  
  48.     public function newuserdataAction() {// renders application/views/scripts/user/user.phtml
  49.         $payload = $this->getRequest()->getPost();
  50.         $this->view->username = $payload['newuser'];
  51.         $this->viewAction();
  52.     }
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement