/
var
/
www
/
html
/
mogi
/
mod
/
videoaula
/
Upload File
HOME
<?php /** * videoaula configuration form * * @package mod * @subpackage videoaula */ defined('MOODLE_INTERNAL') || die; require_once($CFG->dirroot.'/course/moodleform_mod.php'); require_once($CFG->dirroot.'/mod/videoaula/locallib.php'); require_once($CFG->libdir.'/filelib.php'); class mod_videoaula_mod_form extends moodleform_mod { function definition() { global $CFG, $DB; $mform = $this->_form; $config = get_config('videoaula'); //GENERAL ------------------------------------------------------- $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('name'), array('size'=>'48')); if (!empty($CFG->formatstringstriptags)) { $mform->setType('name', PARAM_TEXT); } else { $mform->setType('name', PARAM_CLEANHTML); } $mform->addRule('name', null, 'required', null, 'client'); $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); //Description $this->add_intro_editor($config->requiremodintro); //CONTENT ------------------------------------------------------- $mform->addElement('header', 'contentsection', get_string('contentheader', 'videoaula')); $subtitle = $mform->addElement('text', 'subtitle', get_string('subtitlelabel', 'videoaula'), array('class'=>'va-subtitle')); $subtitle->setType('PARAM_NOTAGS'); $mform->addElement('editor', 'page', get_string('content', 'videoaula'), null, videoaula_get_editor_options($this->context)); $mform->addRule('page', get_string('required'), 'required', null, 'client'); //VIDEOAULA FILES $mform->addElement('header', 'videoaulafiles', get_string('videoaulafilesfieldset', 'videoaula')); //video(s) url $mform->addElement('textarea', 'video', get_string('videolabel', 'videoaula'), 'wrap="virtual" class="va-video"'); $mform->addRule('video', get_string('required'), 'required', null, 'client'); $mform->addHelpButton('video', 'videohelp', 'videoaula'); //content url $files = $mform->addElement('text', 'file', get_string('filelabel', 'videoaula'), array('class'=>'va-file')); $files->setType('PARAM_NOTAGS'); //image url $poster = $mform->addElement('text', 'poster', get_string('posterlabel', 'videoaula'), array('class'=>'va-poster')); $poster->setType('PARAM_NOTAGS'); //chapters url $chapters = $mform->addElement('text', 'chapters', get_string('chapterslabel', 'videoaula'), array('class'=>'va-chapters')); $chapters->setType('PARAM_NOTAGS'); //captions url $captions = $mform->addElement('text', 'captions', get_string('captionslabel', 'videoaula'), array('class'=>'va-captions')); $captions->setType('PARAM_NOTAGS'); //thumbnails url $thumbs = $mform->addElement('text', 'thumbnails', get_string('thumbslabel', 'videoaula'), array('class'=>'va-thumbs')); $thumbs->setType('PARAM_NOTAGS'); //logo url $logourl = $mform->addElement('text', 'logo', get_string('logolabel', 'videoaula'), array('class'=>'va-logo')); $logourl->setType('PARAM_NOTAGS'); //VIDEOAULA SETTINGS $mform->addElement('header', 'videoaulasettings', get_string('videoaulasettingsfieldset', 'videoaula')); //paidkey $paidkey = $mform->addElement('text', 'paidkey', get_string('paidkeylabel', 'videoaula'), array('class'=>'va-paidkey')); $paidkey->setType('PARAM_NOTAGS'); //skin $skinoptions = array( 'beelden' => 'beelden', 'bekle' => 'bekle', 'five' => 'five', 'glow' => 'glow', 'roundster' => 'roundster', 'six (def)' => 'six', 'stormtrooper' => 'stormtrooper', 'vapor' => 'vapor' ); $selectskin = $mform->addElement('select', 'skin', get_string('skinlabel', 'videoaula'), $skinoptions); $selectskin->setSelected('six (def)'); //checkpoints $mform->addElement('textarea', 'checkpoints', get_string('checkpointslabel', 'videoaula'), 'wrap="virtual" class="va-checkpoints"'); $mform->addHelpButton('checkpoints', 'checkpointshelp', 'videoaula'); //player position $positionoptions = array( 0 => 'top', 1 => 'middle', 2 => 'bottom' ); $selectposition = $mform->addElement('select', 'position', get_string('positionlabel', 'videoaula'), $positionoptions); $selectposition->setSelected(1); //APPEARANCE ------------------------------------------------------- $mform->addElement('header', 'appearancehdr', get_string('appearance')); if ($this->current->instance) { $options = resourcelib_get_displayoptions(explode(',', $config->displayoptions), $this->current->display); } else { $options = resourcelib_get_displayoptions(explode(',', $config->displayoptions)); } if (count($options) == 1) { $mform->addElement('hidden', 'display'); $mform->setType('display', PARAM_INT); reset($options); $mform->setDefault('display', key($options)); } else { $mform->addElement('select', 'display', get_string('displayselect', 'videoaula'), $options); $mform->setDefault('display', $config->display); } if (array_key_exists(RESOURCELIB_DISPLAY_POPUP, $options)) { $mform->addElement('text', 'popupwidth', get_string('popupwidth', 'videoaula'), array('size'=>3)); if (count($options) > 1) { $mform->disabledIf('popupwidth', 'display', 'noteq', RESOURCELIB_DISPLAY_POPUP); } $mform->setType('popupwidth', PARAM_INT); $mform->setDefault('popupwidth', $config->popupwidth); $mform->addElement('text', 'popupheight', get_string('popupheight', 'videoaula'), array('size'=>3)); if (count($options) > 1) { $mform->disabledIf('popupheight', 'display', 'noteq', RESOURCELIB_DISPLAY_POPUP); } $mform->setType('popupheight', PARAM_INT); $mform->setDefault('popupheight', $config->popupheight); } $mform->addElement('advcheckbox', 'printintro', get_string('printintro', 'videoaula')); $mform->setDefault('printintro', $config->printintro); // add legacy files flag only if used if (isset($this->current->legacyfiles) and $this->current->legacyfiles != RESOURCELIB_LEGACYFILES_NO) { $options = array(RESOURCELIB_LEGACYFILES_DONE => get_string('legacyfilesdone', 'videoaula'), RESOURCELIB_LEGACYFILES_ACTIVE => get_string('legacyfilesactive', 'videoaula')); $mform->addElement('select', 'legacyfiles', get_string('legacyfiles', 'videoaula'), $options); $mform->setAdvanced('legacyfiles', 1); } //COMMON MODULE SETTINGS ------------------------------------------------------- $this->standard_coursemodule_elements(); //BUTTONS ------------------------------------------------------- $this->add_action_buttons(); //------------------------------------------------------- $mform->addElement('hidden', 'revision'); $mform->setType('revision', PARAM_INT); $mform->setDefault('revision', 1); echo '<link rel="stylesheet" type="text/css" href="'.$CFG->wwwroot.'/mod/videoaula/styles.css">'; } function data_preprocessing(&$default_values) { if ($this->current->instance) { $draftitemid = file_get_submitted_draft_itemid('videoaula'); $default_values['page']['format'] = $default_values['contentformat']; $default_values['page']['text'] = file_prepare_draft_area($draftitemid, $this->context->id, 'mod_videoaula', 'content', 0, videoaula_get_editor_options($this->context), $default_values['content']); $default_values['page']['itemid'] = $draftitemid; } if (!empty($default_values['displayoptions'])) { $displayoptions = unserialize($default_values['displayoptions']); if (isset($displayoptions['printintro'])) { $default_values['printintro'] = $displayoptions['printintro']; } if (!empty($displayoptions['popupwidth'])) { $default_values['popupwidth'] = $displayoptions['popupwidth']; } if (!empty($displayoptions['popupheight'])) { $default_values['popupheight'] = $displayoptions['popupheight']; } } } }