Packages

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • None
  • PHP

Classes

  • NApplication
  • NPresenterFactory
  • NPresenterRequest

Interfaces

  • IPresenter
  • IPresenterFactory
  • IPresenterResponse
  • IRouter

Exceptions

  • NAbortException
  • NApplicationException
  • NBadRequestException
  • NForbiddenRequestException
  • NInvalidPresenterException
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  1: <?php
  2: 
  3: /**
  4:  * This file is part of the Nette Framework (http://nette.org)
  5:  *
  6:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
  7:  *
  8:  * For the full copyright and license information, please view
  9:  * the file license.txt that was distributed with this source code.
 10:  * @package Nette\Application
 11:  */
 12: 
 13: 
 14: 
 15: /**
 16:  * Presenter request. Immutable object.
 17:  *
 18:  * @author     David Grudl
 19:  *
 20:  * @property   string $presenterName
 21:  * @property   array $parameters
 22:  * @property   array $post
 23:  * @property   array $files
 24:  * @property   string $method
 25:  * @package Nette\Application
 26:  */
 27: final class NPresenterRequest extends NFreezableObject
 28: {
 29:     /** method */
 30:     const FORWARD = 'FORWARD';
 31: 
 32:     /** flag */
 33:     const SECURED = 'secured';
 34: 
 35:     /** flag */
 36:     const RESTORED = 'restored';
 37: 
 38:     /** @var string */
 39:     private $method;
 40: 
 41:     /** @var array */
 42:     private $flags = array();
 43: 
 44:     /** @var string */
 45:     private $name;
 46: 
 47:     /** @var array */
 48:     private $params;
 49: 
 50:     /** @var array */
 51:     private $post;
 52: 
 53:     /** @var array */
 54:     private $files;
 55: 
 56: 
 57:     /**
 58:      * @param  string  fully qualified presenter name (module:module:presenter)
 59:      * @param  string  method
 60:      * @param  array   variables provided to the presenter usually via URL
 61:      * @param  array   variables provided to the presenter via POST
 62:      * @param  array   all uploaded files
 63:      * @param  array   flags
 64:      */
 65:     public function __construct($name, $method, array $params, array $post = array(), array $files = array(), array $flags = array())
 66:     {
 67:         $this->name = $name;
 68:         $this->method = $method;
 69:         $this->params = $params;
 70:         $this->post = $post;
 71:         $this->files = $files;
 72:         $this->flags = $flags;
 73:     }
 74: 
 75: 
 76:     /**
 77:      * Sets the presenter name.
 78:      * @param  string
 79:      * @return self
 80:      */
 81:     public function setPresenterName($name)
 82:     {
 83:         $this->updating();
 84:         $this->name = $name;
 85:         return $this;
 86:     }
 87: 
 88: 
 89:     /**
 90:      * Retrieve the presenter name.
 91:      * @return string
 92:      */
 93:     public function getPresenterName()
 94:     {
 95:         return $this->name;
 96:     }
 97: 
 98: 
 99:     /**
100:      * Sets variables provided to the presenter.
101:      * @return self
102:      */
103:     public function setParameters(array $params)
104:     {
105:         $this->updating();
106:         $this->params = $params;
107:         return $this;
108:     }
109: 
110: 
111:     /**
112:      * Returns all variables provided to the presenter (usually via URL).
113:      * @return array
114:      */
115:     public function getParameters()
116:     {
117:         return $this->params;
118:     }
119: 
120: 
121:     /** @deprecated */
122:     function setParams(array $params)
123:     {
124:         trigger_error(__METHOD__ . '() is deprecated; use setParameters() instead.', E_USER_WARNING);
125:         return $this->setParameters($params);
126:     }
127: 
128: 
129:     /** @deprecated */
130:     function getParams()
131:     {
132:         trigger_error(__METHOD__ . '() is deprecated; use getParameters() instead.', E_USER_WARNING);
133:         return $this->getParameters();
134:     }
135: 
136: 
137:     /**
138:      * Sets variables provided to the presenter via POST.
139:      * @return self
140:      */
141:     public function setPost(array $params)
142:     {
143:         $this->updating();
144:         $this->post = $params;
145:         return $this;
146:     }
147: 
148: 
149:     /**
150:      * Returns all variables provided to the presenter via POST.
151:      * @return array
152:      */
153:     public function getPost()
154:     {
155:         return $this->post;
156:     }
157: 
158: 
159:     /**
160:      * Sets all uploaded files.
161:      * @return self
162:      */
163:     public function setFiles(array $files)
164:     {
165:         $this->updating();
166:         $this->files = $files;
167:         return $this;
168:     }
169: 
170: 
171:     /**
172:      * Returns all uploaded files.
173:      * @return array
174:      */
175:     public function getFiles()
176:     {
177:         return $this->files;
178:     }
179: 
180: 
181:     /**
182:      * Sets the method.
183:      * @param  string
184:      * @return self
185:      */
186:     public function setMethod($method)
187:     {
188:         $this->method = $method;
189:         return $this;
190:     }
191: 
192: 
193:     /**
194:      * Returns the method.
195:      * @return string
196:      */
197:     public function getMethod()
198:     {
199:         return $this->method;
200:     }
201: 
202: 
203:     /**
204:      * Checks if the method is the given one.
205:      * @param  string
206:      * @return bool
207:      */
208:     public function isMethod($method)
209:     {
210:         return strcasecmp($this->method, $method) === 0;
211:     }
212: 
213: 
214:     /**
215:      * Checks if the method is POST.
216:      * @return bool
217:      */
218:     public function isPost()
219:     {
220:         return strcasecmp($this->method, 'post') === 0;
221:     }
222: 
223: 
224:     /**
225:      * Sets the flag.
226:      * @param  string
227:      * @param  bool
228:      * @return self
229:      */
230:     public function setFlag($flag, $value = TRUE)
231:     {
232:         $this->updating();
233:         $this->flags[$flag] = (bool) $value;
234:         return $this;
235:     }
236: 
237: 
238:     /**
239:      * Checks the flag.
240:      * @param  string
241:      * @return bool
242:      */
243:     public function hasFlag($flag)
244:     {
245:         return !empty($this->flags[$flag]);
246:     }
247: 
248: }
249: 
Nette Framework 2.0.11 (for PHP 5.2, prefixed) API API documentation generated by ApiGen 2.8.0