Advertisement
mogaj

redirect

May 31st, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function where $this->_redirect('employees/index'); is defined this is in Application/ControllersIndexController.php
  2. -------------------------------  
  3.  public function loginAction()
  4.     {
  5.         $request = $this->getRequest();
  6.         $form = new Application_Form_Login();
  7.        
  8.         if ($this->getRequest()->isPost()) {
  9.             if ($form->isValid($_POST)) {
  10.                 $EmployeeMapper = new Application_Model_EmployeeMapper();
  11.  
  12.                 $Employee = $EmployeeMapper->findByUsername($form->getValue('username'));
  13.  
  14.                 if ($Employee->isValidLogin($form->getValue('password'))) {
  15.                     Zend_Session::regenerateId();
  16.                     $this->_sessData->userId = $Employee->employee_id;
  17.  
  18.                     $EmployeePropertyMapper = new Application_Model_EmployeePropertyMapper();
  19.                     $PropertyMapper         = new Application_Model_PropertyMapper();
  20.  
  21.                     if ($Employee->isAdmin()) {
  22.                         $properties = $PropertyMapper->fetchAll();
  23.                         if (empty($properties)) {
  24.                             $this->_sessData->propertyId = 0;
  25.                             $multiple_properties = false;
  26.                         }
  27.                         else {
  28.                             $this->_sessData->propertyId = $properties[0]->property_id;
  29.                             $multiple_properties = (count($properties) > 1);
  30.                         }
  31.                         $this->_sessData->multipleProperties = $multiple_properties;
  32.                     }
  33.                     else {
  34.                         $property_ids = $EmployeePropertyMapper->propertyIdsOfEmployee($Employee->employee_id);
  35.                         if (empty($property_ids)) {
  36.                             $this->_sessData->propertyId = 0;
  37.                             $multiple_properties = false;
  38.                         }
  39.                         else {
  40.                             $this->_sessData->propertyId = $property_ids[0];
  41.                             $multiple_properties = (count($property_ids) > 1);
  42.                         }
  43.                         $this->_sessData->multipleProperties = $multiple_properties;
  44.                     }
  45.                     $this->_redirect('employees/index');
  46.                 }
  47.                 else {
  48.                     $this->view->error = $Employee->getError();
  49.                 }
  50.             }
  51.         }
  52.  
  53.         $this->view->form = $form;
  54.     }
  55. -----------------------------------------------
  56. Request URL:http://projectnir.runcode/internet-items/index
  57. Request Method:GET
  58. Status Code:302 Found
  59. Request Headersview parsed
  60. GET /internet-items/index HTTP/1.1
  61. Host: projectnir.runcode
  62. Connection: keep-alive
  63. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  64. User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31
  65. Referer: http://projectnir.runcode/employees/configurations
  66. Accept-Encoding: gzip,deflate,sdch
  67. Accept-Language: en-US,en;q=0.8,te;q=0.6,az;q=0.4
  68. Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
  69. Cookie: nir=5klnq7b4ka6n1h2i2t8temqgl3
  70. Response Headersview parsed
  71. HTTP/1.1 302 Found
  72. Date: Fri, 31 May 2013 09:56:51 GMT
  73. Server: Apache/2.2.22 (Ubuntu)
  74. X-Powered-By: PHP/5.3.10-1ubuntu3.6
  75. Expires: Thu, 19 Nov 1981 08:52:00 GMT
  76. Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
  77. Pragma: no-cache
  78. Location: /employees/index
  79. Vary: Accept-Encoding
  80. Content-Encoding: gzip
  81. Content-Length: 20
  82. Keep-Alive: timeout=5, max=100
  83. Connection: Keep-Alive
  84. Content-Type: text/html
  85.  
  86. Controller page:
  87. ------------------
  88. <?php
  89.  
  90. require_once dirname(__FILE__) . '/../../library/Nir/Controller/Action.php';
  91. class InternetItemsController extends Nir_Controller_Action
  92. {
  93.  
  94.     public function init()
  95.     {
  96.         parent::init();
  97.     }
  98.  
  99.     public function indexAction()
  100.     {
  101.         // action body
  102.     }
  103.  
  104.  
  105. }
  106.  
  107. View page in internet-items folder(internet-items/index.phtml)
  108. ------------------------------------------------------------------
  109. <br /><br />
  110. <div id="view-content">
  111.     <p>View script for controller <b>InternetItems</b> and script/action name <b>index</b></p>
  112. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement