|
| __construct (\Trails\Dispatcher $dispatcher) |
|
| before_filter (&$action, &$args) |
|
| injectResponse (Psr\Http\Message\ResponseInterface $response) |
|
| perform ($unconsumed_path) |
|
| after_filter ($action, $args) |
|
| validate_args (&$args, $types=null) |
|
| url_for ($to='') |
|
| link_for ($to='') |
|
| redirect ($to) |
|
| relocate ($to) |
|
| rescue ($exception) |
|
| render_json ($data) |
|
| render_csv ($data, $filename=null, $delimiter=';', $enclosure='"') |
|
| render_file (string $file, ?string $filename=null, ?string $content_type=null, string $content_disposition='attachment', ?Closure $callback=null) |
|
| render_temporary_file (string $file, ?string $filename=null, ?string $content_type=null, string $content_disposition='attachment', ?Closure $callback=null) |
|
| render_form (\Studip\Forms\Form $form) |
|
| render_vue_app (\Studip\VueApp $app) |
|
| relay ($to_uri) |
|
| relayWithRedirect (... $args) |
|
| perform_relayed ($unconsumed) |
|
| render_template ($template_name, $layout=null) |
|
| render_template_as_string ($template, $layout=null) |
|
| __call ($method, $arguments) |
|
| has_action ($action) |
|
| action_url ($action) |
|
| action_link ($action) |
|
| validate_datetime ($datetime, $format='H:i') |
|
| render_spreadsheet (array $header, array $data, string $format, string $filename, ?string $filepath=null) |
|
| __construct (Dispatcher $dispatcher) |
|
| erase_response () |
|
| get_response () |
|
| perform ($unconsumed) |
|
| extract_action_and_args ($string) |
|
| default_action_and_args () |
|
| map_action ($action) |
|
| before_filter (&$action, &$args) |
|
| after_filter ($action, $args) |
|
| does_not_understand ($action, $args) |
|
| redirect ($to) |
|
| render_text ($text=' ') |
|
| render_nothing () |
|
| render_action ($action) |
|
| get_default_template ($action) |
|
| render_template ($template_name, $layout=null) |
|
| get_template_factory () |
|
| get_assigned_variables () |
|
| set_layout ($layout) |
|
| url_for ($to) |
|
| set_status ($status, $reason_phrase=null) |
|
| set_content_type ($type) |
|
| rescue ($exception) |
|
| respond_to ($ext) |
|
◆ __construct()
◆ __call()
__call |
( |
|
$method, |
|
|
|
$arguments |
|
) |
| |
Magic methods that intercepts all unknown method calls. If a method is called that matches an action on this controller, an url to that action is generated.
Basically, this:
$controller->url_for('foo/bar/baz/' . $param)
is equal to calling this on the Foo_BarController:
$controller->baz($param)
- Parameters
-
String | $method | Called method name |
array | $arguments | Provided arguments |
- Returns
- string url to the requested action
- Exceptions
-
◆ action_link()
Generates the link for an action on this controller without the neccessity to provide the full "path" to the action (since it is implicitely known).
Basically, this:
$controller->link_for('foo/bar/baz/' . $param)
is equal to calling this on the Foo_BarController:
$controller->action_link('baz/' . $param)
- Parameters
-
string | $action | Name of the action |
- Returns
- string to the requested action
◆ action_url()
Generates the url for an action on this controller without the neccessity to provide the full "path" to the action (since it is implicitely known).
Basically, this:
$controller->url_for('foo/bar/baz/' . $param)
is equal to calling this on the Foo_BarController:
$controller->action_url('baz/' . $param)
- Parameters
-
string | $action | Name of the action |
- Returns
- string url to the requested action
◆ after_filter()
after_filter |
( |
|
$action, |
|
|
|
$args |
|
) |
| |
Callback function being called after an action is executed.
- Parameters
-
string | Name of the action to perform. |
array | An array of arguments to the action. |
- Returns
- void
◆ before_filter()
before_filter |
( |
& |
$action, |
|
|
& |
$args |
|
) |
| |
◆ controller_path()
Returns the url path to this controller.
- Returns
- string url path to this controller
◆ getBodyElementIdForControllerAndAction()
getBodyElementIdForControllerAndAction |
( |
|
$unconsumed_path | ) |
|
|
protected |
Creates the body element id for this controller a given action.
- Parameters
-
string | $unconsumed_path | Unconsumed path to extract action from |
- Returns
- string
◆ has_action()
Returns whether this controller has the specificed action.
- Parameters
-
string | $action | Name of the action |
- Returns
- true if action is defined, false otherwise
◆ injectResponse()
injectResponse |
( |
Psr\Http\Message\ResponseInterface |
$response | ) |
|
method to inject extended response object.
◆ link_for()
Returns an escaped URL to a specified route to your Trails application. without first parameter the current action is used if route begins with a / then the current controller ist prepended if second parameter is an array it is passed to URLHeper
- Parameters
-
string | a string containing a controller and optionally an action |
strings | optional arguments |
- Returns
- string a URL to this route
◆ perform()
perform |
( |
|
$unconsumed_path | ) |
|
Hooked perform method in order to inject body element id creation.
In order to avoid clashes, these body element id will be joined with a minus sign. Otherwise the controller "x" with action "y_z" would be given the same id as the controller "x/y" with the action "z", namely "x_y_z". With the minus sign this will result in the ids "x-y_z" and "x_y-z".
Plugins will always have a leading 'plugin-' and the decamelized plugin name in front of the id.
- Parameters
-
String | $unconsumed_path | Path segment containing action and optionally arguments or format |
- Returns
- Trails from parent controller
◆ perform_relayed()
perform_relayed |
( |
|
$unconsumed | ) |
|
perform a given action/parameter string from an relayed request before_filter and after_filter methods are not called
- See also
- perform
- Parameters
-
- Returns
- Trails
◆ redirect()
◆ relay()
relays current request to another controller and returns the response the other controller is given all assigned properties, additional parameters are passed through
- Parameters
-
string | $to_uri | a trails route |
- Returns
- Trails
◆ relayWithRedirect()
relayWithRedirect |
( |
|
$args | ) |
|
◆ relocate()
Relocate the user to another location. This is a specialized version of redirect that differs in two points:
- Parameters
-
◆ render_csv()
render_csv |
( |
|
$data, |
|
|
|
$filename = null , |
|
|
|
$delimiter = ';' , |
|
|
|
$enclosure = '"' |
|
) |
| |
Render given data as csv, data is assumed to be utf-8. The first row of data may contain column titles.
- Parameters
-
array | $data | data as two dimensional array |
string | $filename | download file name (optional) |
string | $delimiter | field delimiter char (optional) |
string | $enclosure | field enclosure char (optional) |
◆ render_file()
render_file |
( |
string |
$file, |
|
|
?string |
$filename = null , |
|
|
?string |
$content_type = null , |
|
|
string |
$content_disposition = 'attachment' , |
|
|
?Closure |
$callback = null |
|
) |
| |
Renders a file
- Parameters
-
string | $file | Path of the file to render |
string | null | $filename | Name of the file displayed to user (will equal $file when missing) |
string | null | $content_type | Optional content type (will be determined if missing) |
string | $content_disposition | Either attachment (default) or inline |
Closure | null | $callback | Optional callback when download has finished |
◆ render_form()
Renders a stud.ip form object.
- Parameters
-
\Studip\Forms\Form | $form | the form that should be rendered. |
◆ render_json()
render given data as json, data is converted to utf-8
- Parameters
-
◆ render_pdf()
render_pdf |
( |
TCPDF |
$pdf, |
|
|
|
$filename, |
|
|
|
$inline = false |
|
) |
| |
|
protected |
Renders a pdf file given by a TCPDF/ExportPDF object.
- Parameters
-
TCPDF | $pdf | TCPDF object to render |
string | $filename | Filename |
bool | $inline | Should the pdf be displayed inline (default: no) |
◆ render_spreadsheet()
render_spreadsheet |
( |
array |
$header, |
|
|
array |
$data, |
|
|
string |
$format, |
|
|
string |
$filename, |
|
|
?string |
$filepath = null |
|
) |
| |
Export xlsx and csv files via PhpSpreadsheet
- Exceptions
-
◆ render_template()
render_template |
( |
|
$template_name, |
|
|
|
$layout = null |
|
) |
| |
◆ render_template_as_string()
render_template_as_string |
( |
|
$template, |
|
|
|
$layout = null |
|
) |
| |
Renders a given template and returns the resulting string.
- Parameters
-
string | $template | Name of the template file |
mixed | $layout | Optional layout |
- Returns
- string
◆ render_temporary_file()
render_temporary_file |
( |
string |
$file, |
|
|
?string |
$filename = null , |
|
|
?string |
$content_type = null , |
|
|
string |
$content_disposition = 'attachment' , |
|
|
?Closure |
$callback = null |
|
) |
| |
Renders a temporary file which will be deleted after transmission. This is just a convenience method so you don't have to write the delete callback.
- Parameters
-
string | $file | Path of the file to render |
string | null | $filename | Name of the file displayed to user (will equal $file when missing) |
string | null | $content_type | Optional content type (will be determined if missing) |
string | $content_disposition | Either attachment (default) or inline |
Closure | null | $callback | Optional callback when download has finished |
◆ render_vue_app()
Renders a vue app
Use this if the vue app is the only content located on the page so you don't have to create a template file.
◆ rescue()
Exception handler called when the performance of an action raises an exception.
- Parameters
-
object | the thrown exception |
◆ url_for()
Returns a URL to a specified route to your Trails application. without first parameter the current action is used if route begins with a / then the current controller ist prepended if second parameter is an array it is passed to URLHeper
- Parameters
-
string | a string containing a controller and optionally an action |
string[] | optional arguments |
- Returns
- string a URL to this route
◆ validate_args()
validate_args |
( |
& |
$args, |
|
|
|
$types = null |
|
) |
| |
Validate arguments based on a list of given types. The types are: 'int', 'float', 'option' and 'string'. If the list of types is NULL or shorter than the argument list, 'option' is assumed for all remaining arguments. 'option' differs from Request::option() in that it also accepts the charaters '-' and ',' in addition to all word characters.
Since Stud.IP 4.0 it is also possible to directly inject SimpleORMap objects. If types is NULL, the signature of the called action is analyzed and any type hint that matches a sorm class will be used to create an object using the argument as the id that is passed to the object's constructor.
If $_autobind is set to true, the created object is also assigned to the controller so that it is available in a view.
- Parameters
-
array | $args | an array of arguments to the action |
array | $types | list of argument types (optional) |
◆ validate_datetime()
validate_datetime |
( |
|
$datetime, |
|
|
|
$format = 'H:i' |
|
) |
| |
Validate the datetime according to specific format.
- Parameters
-
string | $datetime | the datetime which should be validate |
string | $format | the format that the datetime should have by default H:i for time |
- Returns
- bool result of validation
◆ $_autobind
◆ $allow_nobody
◆ $with_session
The documentation for this class was generated from the following file: