Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
QuestionBox Class Reference
Inheritance diagram for QuestionBox:
LayoutMessage

Public Member Functions

 setAcceptURL ($url, array $parameters=[])
 
 setDeclineURL ($url, array $parameters=[])
 
 setBaseURL ($url)
 
 includeTicket ($name= 'studip_ticket')
 
 __toString ()
 

Static Public Member Functions

static create ($question, $accept_url= '', $decline_url= '')
 
static createHTML ($question, $accept_url= '', $decline_url= '')
 

Protected Member Functions

 __construct ($question, $accept_url, $decline_url)
 
 extractURLParameters ($url)
 

Protected Attributes

 $question
 
 $accept_url
 
 $accept_parameters = []
 
 $decline_url
 
 $decline_parameters = []
 
 $include_ticket = false
 

Detailed Description

A question box is used to display a confirmation dialog for a specific action, quite similar to the message boxes.

A question box consists at least of a question and some approval parameters that will be sent when the question is approved. You may pass additional parameters that are sent when the question is disapproved and both urls for approving and disapproving may be set.

Author
Jan-Hendrik Willms GPL2 or any later version
Since
Stud.IP 4.2

Constructor & Destructor Documentation

__construct (   $question,
  $accept_url,
  $decline_url 
)
finalprotected

Constructs the object. Protected to enforce the use of our static helper functions.

Parameters
string$questionThe question that should be confirmed

Member Function Documentation

__toString ( )

Renders the question box as html.

Returns
string

Implements LayoutMessage.

static create (   $question,
  $accept_url = '',
  $decline_url = '' 
)
static

Creates a question object that should be confirmed.

If you want to pass additional parameters, include them in the url. They will be extract from the url.

Parameters
string$questionThe question that should be confirmed
string$accept_urlURL to send the acceptance request to
string$decline_urlURL to send the declination request to
Returns
QuestionBox instance to allow chaining
static createHTML (   $question,
  $accept_url = '',
  $decline_url = '' 
)
static

Creates a question object that should be confirmed. The question may contain HTML.

If you want to pass additional parameters, include them in the url. They will be extract from the url.

Parameters
string$questionThe question that should be confirmed
string$accept_urlURL to send the acceptance request to
string$decline_urlURL to send the declination request to
Returns
QuestionBox instance to allow chaining
extractURLParameters (   $url)
protected

Extracts parameters from a url.

Parameters
string$url
Returns
array
includeTicket (   $name = 'studip_ticket')

Defines whether a stud.ip ticket should be included in the question.

Parameters
bool$name
Returns
QuestionBox instance to allow chaining
setAcceptURL (   $url,
array  $parameters = [] 
)

Set the url the acceptance request is sent to.

Parameters
string$url
array$parameters
Returns
QuestionBox instance to allow chaining
setBaseURL (   $url)

Sets boths url for acceptance and declination to the same url.

Parameters
string$url
Returns
QuestionBox instance to allow chaining
setDeclineURL (   $url,
array  $parameters = [] 
)

Set the url the declination url is sent to.

Parameters
string$url
array$parameters
Returns
QuestionBox instance to allow chaining

Field Documentation

$accept_parameters = []
protected
$accept_url
protected
$decline_parameters = []
protected
$decline_url
protected
$include_ticket = false
protected
$question
protected

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