Stores all the information about the available dndupload handlers.
More...
|
| __construct ($course, $modnames=null) |
| Gather a list of dndupload handlers from the different mods. More...
|
|
| get_handled_file_types ($module) |
| Gets a list of the file types that are handled by a particular module. More...
|
|
| get_js_data () |
| Returns an object to pass onto the javascript code with data about all the registered file / type handlers. More...
|
|
| has_file_handler ($module, $extension) |
| Check to see if the module in question has registered to handle files with the given extension (or to handle all file types) More...
|
|
| has_type_handler ($module, $type) |
| Check to see if the module in question has registered to handle the type given. More...
|
|
| is_known_type ($type) |
| Check to see if the type has been registered. More...
|
|
|
| register_file_handler ($extension, $module, $message) |
| Used to declare that a particular module will handle a particular type of dropped file. More...
|
|
| register_type ($identifier, $datatransfertypes, $addmessage, $namemessage, $handlermessage, $priority=100) |
| Used to add a new mime type that can be drag and dropped onto a course displayed in a browser window. More...
|
|
| register_type_handler ($type, $module, $message, $noname) |
| Used to declare that a particular module will handle a particular type of dropped data. More...
|
|
| type_compare ($type1, $type2) |
| Comparison function used when sorting types by priority. More...
|
|
|
context_course null | $context = null |
|
array | $filehandlers = array() |
| A list of the different file types (extensions) that different modules will handle.
|
|
array | $types = array() |
| A list of all registered mime types that can be dropped onto a course along with the modules that will handle them.
|
|
Stores all the information about the available dndupload handlers.
- Copyright
- 2012 Davo Smith
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
dndupload_handler::__construct |
( |
|
$course, |
|
|
|
$modnames = null |
|
) |
| |
Gather a list of dndupload handlers from the different mods.
- Parameters
-
◆ get_handled_file_types()
dndupload_handler::get_handled_file_types |
( |
|
$module | ) |
|
Gets a list of the file types that are handled by a particular module.
- Parameters
-
string | $module | The name of the module to check |
- Return values
-
array | of file extensions or string '*' |
◆ get_js_data()
dndupload_handler::get_js_data |
( |
| ) |
|
Returns an object to pass onto the javascript code with data about all the registered file / type handlers.
- Return values
-
object | Data to pass on to Javascript code |
◆ has_file_handler()
dndupload_handler::has_file_handler |
( |
|
$module, |
|
|
|
$extension |
|
) |
| |
Check to see if the module in question has registered to handle files with the given extension (or to handle all file types)
- Parameters
-
string | $module | The name of the module |
string | $extension | The extension of the uploaded file |
- Return values
-
bool | True if the module has registered to handle files with that extension (or to handle all file types) |
◆ has_type_handler()
dndupload_handler::has_type_handler |
( |
|
$module, |
|
|
|
$type |
|
) |
| |
Check to see if the module in question has registered to handle the type given.
- Parameters
-
string | $module | The name of the module |
string | $type | The identifier of the type |
- Return values
-
bool | True if the module has registered to handle that type |
◆ is_known_type()
dndupload_handler::is_known_type |
( |
|
$type | ) |
|
Check to see if the type has been registered.
- Parameters
-
string | $type | The identifier of the type you are interested in |
- Return values
-
bool | True if the type is registered |
◆ register_file_handler()
dndupload_handler::register_file_handler |
( |
|
$extension, |
|
|
|
$module, |
|
|
|
$message |
|
) |
| |
|
protected |
Used to declare that a particular module will handle a particular type of dropped file.
- Parameters
-
string | $extension | The file extension to handle ('*' for all types) |
string | $module | The name of the module to handle this type |
string | $message | The message to show the user if more than one handler is registered for a type and the user needs to make a choice between them |
◆ register_type()
dndupload_handler::register_type |
( |
|
$identifier, |
|
|
|
$datatransfertypes, |
|
|
|
$addmessage, |
|
|
|
$namemessage, |
|
|
|
$handlermessage, |
|
|
|
$priority = 100 |
|
) |
| |
|
protected |
Used to add a new mime type that can be drag and dropped onto a course displayed in a browser window.
- Parameters
-
string | $identifier | The name that this type will be known as |
array | $datatransfertypes | An array of the different types in the browser 'dataTransfer.types' object that will map to this type |
string | $addmessage | The message to display in the browser when this type is being dragged onto the page |
string | $namemessage | The message to pop up when asking for the name to give the course module instance when it is created |
string | $handlermessage | The message to pop up when asking which module should handle this type |
int | $priority | Controls the order in which types are checked by the browser (mainly needed to check for 'text' last as that is usually given as fallback) |
◆ register_type_handler()
dndupload_handler::register_type_handler |
( |
|
$type, |
|
|
|
$module, |
|
|
|
$message, |
|
|
|
$noname |
|
) |
| |
|
protected |
Used to declare that a particular module will handle a particular type of dropped data.
- Parameters
-
string | $type | The name of the type (as declared in register_type) |
string | $module | The name of the module to handle this type |
string | $message | The message to show the user if more than one handler is registered for a type and the user needs to make a choice between them |
bool | $noname | If true, the 'name' dialog should be disabled in the pop-up. |
- Exceptions
-
◆ type_compare()
dndupload_handler::type_compare |
( |
|
$type1, |
|
|
|
$type2 |
|
) |
| |
|
protected |
Comparison function used when sorting types by priority.
- Parameters
-
object | $type1 | first type to compare |
object | $type2 | second type to compare |
- Return values
-
integer | -1 for $type1 < $type2; 1 for $type1 > $type2; 0 for equal |
The documentation for this class was generated from the following file: