◆ __construct()
portfolio_add_button::__construct |
( |
|
$options = null | ) |
|
Constructor.
Either pass the options here or set them using the helper methods. Generally the code will be clearer if you use the helper methods.
- Parameters
-
array | $options | keyed array of options: key 'callbackclass': name of the caller class (eg forum_portfolio_caller') key 'callbackargs': the array of callback arguments your caller class wants passed to it in the constructor key 'callbackcomponent': the file containing the class definition of your caller class. See set_callback_options for more information on these three. key 'formats': an array of PORTFOLIO_FORMATS this caller will support See set_formats or set_format_by_file for more information on this. |
◆ get_callbackargs()
portfolio_add_button::get_callbackargs |
( |
| ) |
|
Getter for $callbackargs property.
- Return values
-
◆ get_callbackclass()
portfolio_add_button::get_callbackclass |
( |
| ) |
|
Getter for $callbackclass property.
- Return values
-
◆ get_callbackcomponent()
portfolio_add_button::get_callbackcomponent |
( |
| ) |
|
Getter for $callbackcomponent property.
- Return values
-
◆ get_formats()
portfolio_add_button::get_formats |
( |
| ) |
|
Getter for $format property.
- Return values
-
◆ render()
portfolio_add_button::render |
( |
|
$format = null , |
|
|
|
$addstr = null |
|
) |
| |
Echo the form/button/icon/text link to the page.
- Parameters
-
int | $format | format to display the button or form or icon or link. See constants PORTFOLIO_ADD_XXX for more info. optional, defaults to PORTFOLIO_ADD_FULL_FORM |
string | $addstr | string to use for the button or icon alt text or link text. this is whole string, not key. optional, defaults to 'Export to portfolio'; |
◆ set_callback_options()
portfolio_add_button::set_callback_options |
( |
|
$class, |
|
|
array |
$argarray, |
|
|
|
$component |
|
) |
| |
Function to set the callback options.
- Parameters
-
string | $class | Name of the class containing the callback functions activity components should ALWAYS use their name_portfolio_caller other locations must use something unique |
array | $argarray | This can be an array or hash of arguments to pass back to the callback functions (passed by reference) these MUST be primatives to be added as hidden form fields. and the values get cleaned to PARAM_ALPHAEXT or PARAM_FLOAT or PARAM_PATH |
string | $component | This is the name of the component in Moodle, eg 'mod_forum' |
◆ set_format_by_file()
portfolio_add_button::set_format_by_file |
( |
stored_file |
$file, |
|
|
|
$extraformats = null |
|
) |
| |
If we already know we have exactly one file, bypass set_formats and just pass the file so we can detect the formats by mimetype.
- Parameters
-
stored_file | $file | file to set the format from |
array | $extraformats | any additional formats other than by mimetype eg leap2a etc |
◆ set_format_by_intended_file()
portfolio_add_button::set_format_by_intended_file |
( |
|
$extn, |
|
|
|
$extraformats = null |
|
) |
| |
Correllary this is use to set_format_by_file, but it is also used when there is no stored_file and when we're writing out a new type of file (like csv or pdf)
- Parameters
-
string | $extn | the file extension we intend to generate |
array | $extraformats | any additional formats other than by mimetype eg leap2a etc |
◆ set_formats()
portfolio_add_button::set_formats |
( |
|
$formats = null | ) |
|
Sets the available export formats for this content.
This function will also poll the static function in the caller class and make sure we're not overriding a format that has nothing to do with mimetypes. Eg: if you pass IMAGE here but the caller can export LEAP2A it will keep LEAP2A as well.
- See also
- portfolio_most_specific_formats for more information
-
portfolio_format_from_mimetype
- Parameters
-
array | $formats | if the calling code knows better than the static method on the calling class (base_supported_formats). Eg: if it's going to be a single file, or if you know it's HTML, you can pass it here instead. This is almost always the case so it should be use all the times portfolio_format_from_mimetype for how to get the appropriate formats to pass here for uploaded files. or just call set_format_by_file instead |
◆ to_html()
portfolio_add_button::to_html |
( |
|
$format = null , |
|
|
|
$addstr = null |
|
) |
| |
Returns the form/button/icon/text link as html.
- Parameters
-
int | $format | format to display the button or form or icon or link. See constants PORTFOLIO_ADD_XXX for more info. Optional, defaults to PORTFOLIO_ADD_FULL_FORM |
string | $addstr | string to use for the button or icon alt text or link text. This is whole string, not key. optional, defaults to 'Add to portfolio'; |
- Return values
-
The documentation for this class was generated from the following file: