Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
StudipController Class Reference
Inheritance diagram for StudipController:
Api_OauthController AuthenticatedController BannerController Calendar_ContentboxController CasController Course_LtiController Courseware_PublicController DocumentController ForumController iCalController IliasAuthController MediaProxyController NewPasswordController NewsController OAuth2Controller Oer_EndpointsController Oer_MarketController Oer_OaiController PluginController PluginsController SiteinfoController StudipControllerTestController WebMigrateController

Public Member Functions

 before_filter (&$action, &$args)
 
 erase_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 ($file, $filename=null, $content_type=null, $content_disposition= 'attachment', Closure $callback=null, $chunk_size=262144)
 
 render_temporary_file ($file, $filename=null, $content_type=null, $content_disposition= 'attachment', Closure $callback=null, $chunk_size=262144)
 
 relay ($to_uri)
 
 relayWithRedirect (...$args)
 
 perform_relayed ($unconsumed)
 
 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')
 

Protected Member Functions

 render_pdf (TCPDF $pdf, $filename, $inline=false)
 
 controller_path ()
 
 getBodyElementIdForControllerAndAction ($unconsumed_path)
 

Protected Attributes

 $with_session = false
 
 $allow_nobody = true
 
 $_autobind = false
 

Member Function Documentation

__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$methodCalled method name
array$argumetnsProvided arguments
Returns
url to the requested action
Exceptions
Trails_UnknownActionif no action matches the method
action_link (   $action)

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$actionName of the action
Returns
string to the requested action
action_url (   $action)

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$actionName of the action
Returns
string url to the requested action
after_filter (   $action,
  $args 
)

Callback function being called after an action is executed.

Parameters
stringName of the action to perform.
arrayAn array of arguments to the action.
Returns
void
before_filter ( $action,
$args 
)
Returns
false|void
controller_path ( )
protected

Returns the url path to this controller.

Returns
string url path to this controller
erase_response ( )

Extended method to inject extended response object.

getBodyElementIdForControllerAndAction (   $unconsumed_path)
protected

Creates the body element id for this controller a given action.

Parameters
string$unconsumed_pathUnconsumed path to extract action from
Returns
string
has_action (   $action)

Returns whether this controller has the specificed action.

Parameters
string$actionName of the action
Returns
true if action is defined, false otherwise
link_for (   $to = '')

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
stringa string containing a controller and optionally an action
stringsoptional arguments
Returns
string a URL to this route
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_pathPath segment containing action and optionally arguments or format
Returns
Trails_Response from parent controller
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
string$unconsumed
Returns
Trails_Response
redirect (   $to)

Redirects the user another page. Accepts multiple parameters just like url_for().

Parameters
string$to
See Also
StudipController::url_for()
relay (   $to_uri)

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_uria trails route
Returns
Trails_Response
relayWithRedirect (   $args)

Relays current request and performs redirect if neccessary.

Parameters
string$to_uria trails route
Returns
Trails_Response
See Also
StudipController::relay()
relocate (   $to)

Relocate the user to another location. This is a specialized version of redirect that differs in two points:

Parameters
String$toLocation to redirect to
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$datadata as two dimensional array
string$filenamedownload file name (optional)
string$delimiterfield delimiter char (optional)
string$enclosurefield enclosure char (optional)
render_file (   $file,
  $filename = null,
  $content_type = null,
  $content_disposition = 'attachment',
Closure  $callback = null,
  $chunk_size = 262144 
)

Renders a file

Parameters
string$filePath of the file to render
string$filenameName of the file displayed to user (will equal $file when missing)
string$content_typeOptional content type (will be determined if missing)
string$content_dispositionEither attachment (default) or inline
Closure$callbackOptional callback when download has finished
int$chunk_sizeOptional size of chunks to send (default: 256k)
render_json (   $data)

render given data as json, data is converted to utf-8

Parameters
mixed$data
render_pdf ( TCPDF  $pdf,
  $filename,
  $inline = false 
)
protected

Renders a pdf file given by a TCPDF/ExportPDF object.

Parameters
TCPDF$pdfTCPDF object to render
string$filenameFilename
bool$inlineShould the pdf be displayed inline (default: no)
render_template_as_string (   $template,
  $layout = null 
)

Renders a given template and returns the resulting string.

Parameters
string$templateName of the template file
mixed$layoutOptional layout
Returns
string
render_temporary_file (   $file,
  $filename = null,
  $content_type = null,
  $content_disposition = 'attachment',
Closure  $callback = null,
  $chunk_size = 262144 
)

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$filePath of the file to render
string$filenameName of the file displayed to user (will equal $file when missing)
string$content_typeOptional content type (will be determined if missing)
string$content_dispositionEither attachment (default) or inline
Closure$callbackOptional callback when download has finished
int$chunk_sizeOptional size of chunks to send (default: 256k)
rescue (   $exception)

Exception handler called when the performance of an action raises an exception.

Parameters
objectthe thrown exception
url_for (   $to = '')

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
stringa string containing a controller and optionally an action
string[]optional arguments
Returns
string a URL to this route
validate_args ( $args,
  $types = null 
)

Validate arguments based on a list of given types. The types are: 'int', 'float', 'option'. 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 charaters.

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
arrayan array of arguments to the action
arraylist of argument types (optional)
validate_datetime (   $datetime,
  $format = 'H:i' 
)

Validate the datetime according to specific format.

Parameters
string$datetimethe datetime which should be validate
string$formatthe format that the datetime should have by default H:i for time
Returns
bool result of validation

Field Documentation

$_autobind = false
protected
$allow_nobody = true
protected
$with_session = false
protected

The documentation for this class was generated from the following file: