Processes the upload, creating the course module and returning the result.
More...
|
| __construct ($courseid, $section, $type, $modulename) |
| Set up some basic information needed to handle the upload. More...
|
|
| process ($displayname=null, $content=null) |
| Process the upload - creating the module in the course and returning the result to the browser. More...
|
|
|
const | ERROR_OK = 0 |
| Returned when no error has occurred.
|
|
|
| create_course_module () |
| Create the coursemodule to hold the file/content that has been uploaded.
|
|
| display_name_from_file ($filename) |
| Generate the name of the mod instance from the name of the file (remove the extension and convert underscore => space. More...
|
|
| finish_setup_course_module ($instanceid) |
| Called after the mod has set itself up, to finish off any course module settings (set instance id, add to correct section, set visibility, etc.) and send the response. More...
|
|
| handle_file_upload () |
| Handle uploads containing files - create the course module, ask the upload repository to process the file, ask the mod to set itself up, then return the result to the browser.
|
|
| handle_other_upload ($content) |
| Handle uploads not containing file - create the course module, ask the mod to set itself up, then return the result to the browser. More...
|
|
| is_file_upload () |
| Check if this upload is a 'file' upload. More...
|
|
| prepare_module_data ($draftitemid=null, $content=null) |
| Gather together all the details to pass on to the mod, so that it can initialise it's own database tables. More...
|
|
| send_response ($mod) |
| Send the details of the newly created activity back to the client browser. More...
|
|
|
object | $cm = null |
| The course module that has been created.
|
|
context_course | $context = null |
| The course context for capability checking.
|
|
object | $course = null |
| The course that we are uploading to.
|
|
string | $displayname = null |
| The name to give the new activity instance.
|
|
dndupload_handler | $dnduploadhandler = null |
| used to check the allowed file types
|
|
object | $module = null |
| The details of the module type that will be created.
|
|
int | $section = null |
| The section number we are uploading to.
|
|
string | $type = null |
| The type of upload (e.g. More...
|
|
Processes the upload, creating the course module and returning the result.
- Copyright
- 2012 Davo Smith
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
dndupload_ajax_processor::__construct |
( |
|
$courseid, |
|
|
|
$section, |
|
|
|
$type, |
|
|
|
$modulename |
|
) |
| |
Set up some basic information needed to handle the upload.
- Parameters
-
int | $courseid | The ID of the course we are uploading to |
int | $section | The section number we are uploading to |
string | $type | The type of upload (as reported by the browser) |
string | $modulename | The name of the module requested to handle this upload |
◆ display_name_from_file()
dndupload_ajax_processor::display_name_from_file |
( |
|
$filename | ) |
|
|
protected |
Generate the name of the mod instance from the name of the file (remove the extension and convert underscore => space.
- Parameters
-
string | $filename | the filename of the uploaded file |
- Return values
-
string | the display name to use |
◆ finish_setup_course_module()
dndupload_ajax_processor::finish_setup_course_module |
( |
|
$instanceid | ) |
|
|
protected |
Called after the mod has set itself up, to finish off any course module settings (set instance id, add to correct section, set visibility, etc.) and send the response.
- Parameters
-
int | $instanceid | id returned by the mod when it was created |
◆ handle_other_upload()
dndupload_ajax_processor::handle_other_upload |
( |
|
$content | ) |
|
|
protected |
Handle uploads not containing file - create the course module, ask the mod to set itself up, then return the result to the browser.
- Parameters
-
string | $content | the content uploaded to the browser |
◆ is_file_upload()
dndupload_ajax_processor::is_file_upload |
( |
| ) |
|
|
protected |
Check if this upload is a 'file' upload.
- Return values
-
bool | true if it is a 'file' upload, false otherwise |
◆ prepare_module_data()
dndupload_ajax_processor::prepare_module_data |
( |
|
$draftitemid = null , |
|
|
|
$content = null |
|
) |
| |
|
protected |
Gather together all the details to pass on to the mod, so that it can initialise it's own database tables.
- Parameters
-
int | $draftitemid | optional the id of the draft area containing the file (for file uploads) |
string | $content | optional the content dropped onto the course (for non-file uploads) |
- Return values
-
object | data to pass on to the mod, containing: string $type the 'type' as registered with dndupload_handler (or 'Files') object $course the course the upload was for int $draftitemid optional the id of the draft area containing the files int $coursemodule id of the course module that has already been created string $displayname the name to use for this activity (can be overriden by the mod) |
◆ process()
dndupload_ajax_processor::process |
( |
|
$displayname = null , |
|
|
|
$content = null |
|
) |
| |
Process the upload - creating the module in the course and returning the result to the browser.
- Parameters
-
string | $displayname | optional the name (from the browser) to give the course module instance |
string | $content | optional the content of the upload (for non-file uploads) |
◆ send_response()
dndupload_ajax_processor::send_response |
( |
|
$mod | ) |
|
|
protected |
Send the details of the newly created activity back to the client browser.
- Parameters
-
cm_info | $mod | details of the mod just created |
◆ $type
string dndupload_ajax_processor::$type = null |
|
protected |
The type of upload (e.g.
'Files', 'text/plain')
The documentation for this class was generated from the following file: