June 2017
Beginner to intermediate
368 pages
8h 31m
English
Firstly, we need to provide a means for the user to upload the three model files: the wavefront .OBJ file, the materials .MTL file, and the .PNG texture image file (described previously). Luckily, the File API and Form API together provide functions to manage these files for us. The first is file_prepare_standard_filemanager(). We call this File API function in edit_model.php to associate files (if any) in Moodle's file store with the corresponding form element declared in edit_model_form.php. In our plugin, we have the following line in edit_model.php:
$model = file_prepare_standard_filemanager($model, 'model', $modeloptions, $context, 'mod_wavefront', 'model', $model->id);
The preceeding line prepares the files for ...
Read now
Unlock full access