function definition() { global $CFG, $DB; $mform = $this->_form; $config = get_config('morsle'); //------------------------------------------------------- $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('namenotrequired', 'morsle'), array('size' => '48')); if (!empty($CFG->formatstringstriptags)) { $mform->setType('name', PARAM_TEXT); } else { $mform->setType('name', PARAM_CLEANHTML); } //------------------------------------------------------- $mform->addElement('header', 'content', get_string('contentheader', 'morsle')); $mform->addElement('url', 'externalurl', get_string('externalurl', 'morsle'), array('size' => '60'), array('usefilepicker' => true)); $mform->addRule('externalurl', null, 'required', null, 'client'); $mform->setType('externalurl', PARAM_URL); //------------------------------------------------------- $mform->addElement('header', 'optionssection', get_string('optionsheader', 'morsle')); if ($this->current->instance) { $options = resourcelib_get_displayoptions(explode(',', $config->displayoptions), $this->current->display); } else { $options = resourcelib_get_displayoptions(explode(',', $config->displayoptions)); } $mform->addElement('hidden', 'display', get_string('displayselect', 'morsle')); $mform->setDefault('display', RESOURCELIB_DISPLAY_NEW); if (array_key_exists(RESOURCELIB_DISPLAY_POPUP, $options)) { $mform->addElement('text', 'popupwidth', get_string('popupwidth', 'morsle'), 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', 'morsle'), 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); } if (array_key_exists(RESOURCELIB_DISPLAY_AUTO, $options) or array_key_exists(RESOURCELIB_DISPLAY_EMBED, $options) or array_key_exists(RESOURCELIB_DISPLAY_FRAME, $options)) { $mform->addElement('checkbox', 'printheading', get_string('printheading', 'morsle')); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_POPUP); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_OPEN); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_NEW); $mform->setDefault('printheading', $config->printheading); $mform->addElement('checkbox', 'printintro', get_string('printintro', 'morsle')); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_POPUP); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_OPEN); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_NEW); $mform->setDefault('printintro', $config->printintro); } //------------------------------------------------------- $this->standard_coursemodule_elements(); //------------------------------------------------------- $this->add_action_buttons(); }
function definition() { global $CFG, $DB; $mform = $this->_form; $config = get_config('mediaelementjs'); //------------------------------------------------------- $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'); $this->add_intro_editor($config->requiremodintro); //------------------------------------------------------- $mform->addElement('header', 'content', get_string('contentheader', 'mediaelementjs')); $mform->addElement('url', 'externalurl', get_string('externalurl', 'mediaelementjs'), array('size' => '60'), array('usefilepicker' => true)); //------------------------------------------------------- $mform->addElement('header', 'optionssection', get_string('optionsheader', 'mediaelementjs')); 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', 'mediaelementjs'), $options); $mform->setDefault('display', $config->display); $mform->setAdvanced('display', $config->display_adv); $mform->addHelpButton('display', 'displayselect', 'mediaelementjs'); } if (array_key_exists(RESOURCELIB_DISPLAY_POPUP, $options)) { $mform->addElement('text', 'popupwidth', get_string('popupwidth', 'mediaelementjs'), 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->setAdvanced('popupwidth', $config->popupwidth_adv); $mform->addElement('text', 'popupheight', get_string('popupheight', 'mediaelementjs'), 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->setAdvanced('popupheight', $config->popupheight_adv); } if (array_key_exists(RESOURCELIB_DISPLAY_AUTO, $options) or array_key_exists(RESOURCELIB_DISPLAY_EMBED, $options) or array_key_exists(RESOURCELIB_DISPLAY_FRAME, $options)) { $mform->addElement('checkbox', 'printheading', get_string('printheading', 'mediaelementjs')); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_POPUP); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_OPEN); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_NEW); $mform->setDefault('printheading', $config->printheading); $mform->setAdvanced('printheading', $config->printheading_adv); $mform->addElement('checkbox', 'printintro', get_string('printintro', 'mediaelementjs')); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_POPUP); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_OPEN); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_NEW); $mform->setDefault('printintro', $config->printintro); $mform->setAdvanced('printintro', $config->printintro_adv); } //------------------------------------------------------- $mform->addElement('header', 'parameterssection', get_string('parametersheader', 'mediaelementjs')); $mform->addElement('static', 'parametersinfo', '', get_string('parametersheader_help', 'mediaelementjs')); $mform->setAdvanced('parametersinfo'); if (empty($this->current->parameters)) { $parcount = 5; } else { $parcount = 5 + count(unserialize($this->current->parameters)); $parcount = $parcount > 100 ? 100 : $parcount; } $options = mediaelementjs_get_variable_options($config); for ($i = 0; $i < $parcount; $i++) { $parameter = "parameter_{$i}"; $variable = "variable_{$i}"; $pargroup = "pargoup_{$i}"; $group = array($mform->createElement('text', $parameter, '', array('size' => '12')), $mform->createElement('selectgroups', $variable, '', $options)); $mform->addGroup($group, $pargroup, get_string('parameterinfo', 'mediaelementjs'), ' ', false); $mform->setAdvanced($pargroup); } //------------------------------------------------------- $this->standard_coursemodule_elements(); //------------------------------------------------------- $this->add_action_buttons(); }
function definition() { global $CFG, $DB; $mform =& $this->_form; $config = get_config('resource'); if ($this->current->instance and $this->current->tobemigrated) { // resource not migrated yet $resource_old = $DB->get_record('resource_old', array('oldid' => $this->current->instance)); $mform->addElement('static', 'warning', '', get_string('notmigrated', 'resource', $resource_old->type)); $mform->addElement('cancel'); $this->standard_hidden_coursemodule_elements(); return; } //------------------------------------------------------- $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'); $this->standard_intro_elements(); //------------------------------------------------------- $mform->addElement('header', 'contentsection', get_string('contentheader', 'resource')); $mform->setExpanded('contentsection'); $filemanager_options = array(); $filemanager_options['accepted_types'] = '*'; $filemanager_options['maxbytes'] = 0; $filemanager_options['maxfiles'] = -1; $filemanager_options['mainfile'] = true; $mform->addElement('filemanager', 'files', get_string('selectfiles'), null, $filemanager_options); // 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', 'resource'), RESOURCELIB_LEGACYFILES_ACTIVE => get_string('legacyfilesactive', 'resource')); $mform->addElement('select', 'legacyfiles', get_string('legacyfiles', 'resource'), $options); } //------------------------------------------------------- $mform->addElement('header', 'optionssection', 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', 'resource'), $options); $mform->setDefault('display', $config->display); $mform->addHelpButton('display', 'displayselect', 'resource'); } $mform->addElement('checkbox', 'showsize', get_string('showsize', 'resource')); $mform->setDefault('showsize', $config->showsize); $mform->addHelpButton('showsize', 'showsize', 'resource'); $mform->addElement('checkbox', 'showtype', get_string('showtype', 'resource')); $mform->setDefault('showtype', $config->showtype); $mform->addHelpButton('showtype', 'showtype', 'resource'); $mform->addElement('checkbox', 'showdate', get_string('showdate', 'resource')); $mform->setDefault('showdate', $config->showdate); $mform->addHelpButton('showdate', 'showdate', 'resource'); if (array_key_exists(RESOURCELIB_DISPLAY_POPUP, $options)) { $mform->addElement('text', 'popupwidth', get_string('popupwidth', 'resource'), 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->setAdvanced('popupwidth', true); $mform->addElement('text', 'popupheight', get_string('popupheight', 'resource'), 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->setAdvanced('popupheight', true); } if (array_key_exists(RESOURCELIB_DISPLAY_AUTO, $options) or array_key_exists(RESOURCELIB_DISPLAY_EMBED, $options) or array_key_exists(RESOURCELIB_DISPLAY_FRAME, $options)) { $mform->addElement('checkbox', 'printintro', get_string('printintro', 'resource')); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_POPUP); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_DOWNLOAD); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_OPEN); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_NEW); $mform->setDefault('printintro', $config->printintro); } $options = array('0' => get_string('none'), '1' => get_string('allfiles'), '2' => get_string('htmlfilesonly')); $mform->addElement('select', 'filterfiles', get_string('filterfiles', 'resource'), $options); $mform->setDefault('filterfiles', $config->filterfiles); $mform->setAdvanced('filterfiles', true); //------------------------------------------------------- $this->standard_coursemodule_elements(); //------------------------------------------------------- $this->add_action_buttons(); //------------------------------------------------------- $mform->addElement('hidden', 'revision'); $mform->setType('revision', PARAM_INT); $mform->setDefault('revision', 1); }
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Resource module admin settings and defaults * * @package mod_resource * @copyright 2009 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; if ($ADMIN->fulltree) { require_once "{$CFG->libdir}/resourcelib.php"; $displayoptions = resourcelib_get_displayoptions(array(RESOURCELIB_DISPLAY_AUTO, RESOURCELIB_DISPLAY_EMBED, RESOURCELIB_DISPLAY_FRAME, RESOURCELIB_DISPLAY_DOWNLOAD, RESOURCELIB_DISPLAY_OPEN, RESOURCELIB_DISPLAY_NEW, RESOURCELIB_DISPLAY_POPUP, RESOURCELIB_DISPLAY_IFRAME)); $defaultdisplayoptions = array(RESOURCELIB_DISPLAY_AUTO, RESOURCELIB_DISPLAY_EMBED, RESOURCELIB_DISPLAY_DOWNLOAD, RESOURCELIB_DISPLAY_OPEN, RESOURCELIB_DISPLAY_POPUP, RESOURCELIB_DISPLAY_IFRAME); //--- general settings ----------------------------------------------------------------------------------- $settings->add(new admin_setting_configtext('resource/framesize', get_string('framesize', 'resource'), get_string('configframesize', 'resource'), 130, PARAM_INT)); $settings->add(new admin_setting_configmultiselect('resource/displayoptions', get_string('displayoptions', 'resource'), get_string('configdisplayoptions', 'resource'), $defaultdisplayoptions, $displayoptions)); //--- modedit defaults ----------------------------------------------------------------------------------- $settings->add(new admin_setting_heading('resourcemodeditdefaults', get_string('modeditdefaults', 'admin'), get_string('condifmodeditdefaults', 'admin'))); $settings->add(new admin_setting_configcheckbox('resource/printintro', get_string('printintro', 'resource'), get_string('printintroexplain', 'resource'), 1)); $settings->add(new admin_setting_configselect('resource/display', get_string('displayselect', 'resource'), get_string('displayselectexplain', 'resource'), RESOURCELIB_DISPLAY_AUTO, $displayoptions)); $settings->add(new admin_setting_configcheckbox('resource/showsize', get_string('showsize', 'resource'), get_string('showsize_desc', 'resource'), 0)); $settings->add(new admin_setting_configcheckbox('resource/showtype', get_string('showtype', 'resource'), get_string('showtype_desc', 'resource'), 0)); $settings->add(new admin_setting_configtext('resource/popupwidth', get_string('popupwidth', 'resource'), get_string('popupwidthexplain', 'resource'), 620, PARAM_INT, 7)); $settings->add(new admin_setting_configtext('resource/popupheight', get_string('popupheight', 'resource'), get_string('popupheightexplain', 'resource'), 450, PARAM_INT, 7)); $options = array('0' => get_string('none'), '1' => get_string('allfiles'), '2' => get_string('htmlfilesonly')); $settings->add(new admin_setting_configselect('resource/filterfiles', get_string('filterfiles', 'resource'), get_string('filterfilesexplain', 'resource'), 0, $options)); }
function definition() { global $CFG, $DB; $mform = $this->_form; $config = get_config('page'); //------------------------------------------------------- $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'); $this->add_intro_editor($config->requiremodintro); //------------------------------------------------------- $mform->addElement('header', 'contentsection', get_string('contentheader', 'page')); $mform->addElement('editor', 'page', get_string('content', 'page'), null, page_get_editor_options($this->context)); $mform->addRule('page', get_string('required'), 'required', null, 'client'); //------------------------------------------------------- $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', 'page'), $options); $mform->setDefault('display', $config->display); } if (array_key_exists(RESOURCELIB_DISPLAY_POPUP, $options)) { $mform->addElement('text', 'popupwidth', get_string('popupwidth', 'page'), 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', 'page'), 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', 'printheading', get_string('printheading', 'page')); $mform->setDefault('printheading', $config->printheading); $mform->addElement('advcheckbox', 'printintro', get_string('printintro', 'page')); $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', 'page'), RESOURCELIB_LEGACYFILES_ACTIVE => get_string('legacyfilesactive', 'page')); $mform->addElement('select', 'legacyfiles', get_string('legacyfiles', 'page'), $options); $mform->setAdvanced('legacyfiles', 1); } //------------------------------------------------------- $this->standard_coursemodule_elements(); //------------------------------------------------------- $this->add_action_buttons(); //------------------------------------------------------- $mform->addElement('hidden', 'revision'); $mform->setType('revision', PARAM_INT); $mform->setDefault('revision', 1); }
// // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Poll activity - admin settings and defaults * * @package mod_poll * @author Peter Welham * @copyright 2016, Oxford Brookes University * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * */ defined('MOODLE_INTERNAL') || die; if ($ADMIN->fulltree) { require_once "{$CFG->libdir}/resourcelib.php"; $displayoptions = resourcelib_get_displayoptions(array(RESOURCELIB_DISPLAY_OPEN, RESOURCELIB_DISPLAY_POPUP)); // override 'Open' string $displayoptions[RESOURCELIB_DISPLAY_OPEN] = get_string('displayopen', 'poll'); $defaultdisplayoptions = array(RESOURCELIB_DISPLAY_OPEN); //--- general settings ----------------------------------------------------------------------------------- $settings->add(new admin_setting_configcheckbox('poll/requiremodintro', get_string('requiremodintro', 'admin'), get_string('configrequiremodintro', 'admin'), 1)); $settings->add(new admin_setting_configmultiselect('poll/displayoptions', get_string('displayoptions', 'poll'), get_string('configdisplayoptions', 'poll'), $defaultdisplayoptions, $displayoptions)); $settings->add(new admin_setting_configtext('poll/iframewidth', get_string('iframewidth', 'poll'), get_string('iframewidthexplain', 'poll'), 360, PARAM_INT, 7)); $settings->add(new admin_setting_configtext('poll/iframeheight', get_string('iframeheight', 'poll'), get_string('iframeheightexplain', 'poll'), 640, PARAM_INT, 7)); $settings->add(new admin_setting_configtext('poll/popupwidth', get_string('popupwidth', 'poll'), get_string('popupwidthexplain', 'poll'), 480, PARAM_INT, 7)); $settings->add(new admin_setting_configtext('poll/popupheight', get_string('popupheight', 'poll'), get_string('popupheightexplain', 'poll'), 800, PARAM_INT, 7)); //--- modedit defaults ----------------------------------------------------------------------------------- $settings->add(new admin_setting_heading('pollmodeditdefaults', get_string('modeditdefaults', 'admin'), get_string('condifmodeditdefaults', 'admin'))); $settings->add(new admin_setting_configcheckbox('poll/printheading', get_string('printheading', 'poll'), get_string('printheadingexplain', 'poll'), 1)); $settings->add(new admin_setting_configcheckbox('poll/printintro', get_string('printintro', 'poll'), get_string('printintroexplain', 'poll'), 0)); $settings->add(new admin_setting_configselect('poll/display', get_string('displayselect', 'poll'), get_string('displayselectexplain', 'poll'), RESOURCELIB_DISPLAY_OPEN, $displayoptions));
function definition() { global $CFG, $DB; $mform = $this->_form; $config = get_config('widgetspace'); //------------------------------------------------------- $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'); $this->add_intro_editor($config->requiremodintro); //------------------------------------------------------- $mform->addElement('header', 'contentsection', get_string('contentheader', 'widgetspace')); $mform->addElement('editor', 'widgetspace', get_string('content', 'widgetspace'), null, widgetspace_get_editor_options($this->context)); $mform->addRule('widgetspace', get_string('required'), 'required', null, 'client'); // $mform->addElement('text', 'gadgeturl', get_string('gadgeturl', 'widgetspace')); // -------------------------------------------------------- // number of gadget columns $menuoptions = array(); $menuoptions[0] = "1"; $menuoptions[1] = "2"; $menuoptions[2] = "3"; $mform->addElement('header', 'timerestricthdr', get_string('layoutsettings', 'widgetspace')); $mform->addElement('select', 'numbercolumn', get_string('numbercolumn', 'widgetspace'), $menuoptions); //------------------------------------------------------------------------------- $repeatarray = array(); $repeatarray[] =& MoodleQuickForm::createElement('header', '', get_string('gadget', 'widgetspace') . ' {no}'); $repeatarray[] =& MoodleQuickForm::createElement('text', 'gadget', get_string('gadgeturl', 'widgetspace'), array('size' => '80')); $repeatarray[] =& MoodleQuickForm::createElement('hidden', 'gadgetid', 0); if ($this->_instance) { $repeatno = $DB->count_records('widgetspace_gadgets', array('widgetspaceid' => $this->_instance)); $repeatno += 2; } else { $repeatno = 5; } $repeateloptions = array(); $repeateloptions['gadget']['helpbutton'] = array('widgetspacegadgets', 'widgetspace'); $mform->setType('gadget', PARAM_CLEAN); $mform->setType('gadgetid', PARAM_INT); $this->repeat_elements($repeatarray, $repeatno, $repeateloptions, 'gadget_repeats', 'gadget_add_fields', 3); //------------------------------------------------------- $mform->addElement('header', 'optionssection', get_string('optionsheader', 'widgetspace')); 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', 'widgetspace'), $options); $mform->setDefault('display', $config->display); $mform->setAdvanced('display', $config->display_adv); } if (array_key_exists(RESOURCELIB_DISPLAY_POPUP, $options)) { $mform->addElement('text', 'popupwidth', get_string('popupwidth', 'widgetspace'), 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->setAdvanced('popupwidth', $config->popupwidth_adv); $mform->addElement('text', 'popupheight', get_string('popupheight', 'widgetspace'), 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->setAdvanced('popupheight', $config->popupheight_adv); } $mform->addElement('advcheckbox', 'printheading', get_string('printheading', 'widgetspace')); $mform->setDefault('printheading', $config->printheading); $mform->setAdvanced('printintro', $config->printheading_adv); $mform->addElement('advcheckbox', 'printintro', get_string('printintro', 'widgetspace')); $mform->setDefault('printintro', $config->printintro); $mform->setAdvanced('printintro', $config->printintro_adv); // 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', 'widgetspace'), RESOURCELIB_LEGACYFILES_ACTIVE => get_string('legacyfilesactive', 'widgetspace')); $mform->addElement('select', 'legacyfiles', get_string('legacyfiles', 'widgetspace'), $options); $mform->setAdvanced('legacyfiles', 1); } //------------------------------------------------------- $this->standard_coursemodule_elements(); //------------------------------------------------------- $this->add_action_buttons(); //------------------------------------------------------- $mform->addElement('hidden', 'revision'); $mform->setType('revision', PARAM_INT); $mform->setDefault('revision', 1); }
/** * Defines forms elements */ public function definition() { global $CFG; $mform = $this->_form; $config = get_config('poll'); // Adding the "general" fieldset, where all the common settings are showed. $mform->addElement('header', 'general', get_string('general', 'form')); // Adding the standard "name" field. $mform->addElement('text', 'name', get_string('pollname', 'poll'), array('size' => '64')); 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'); $mform->addHelpButton('name', 'pollname', 'poll'); // Adding the standard "intro" and "introformat" fields. if ($CFG->branch >= 29) { $this->standard_intro_elements(); } else { $this->add_intro_editor(); } //------------------------------------------------------- $mform->addElement('header', 'numbersection', get_string('number', 'poll')); $mform->addElement('html', get_string('staffexplain', poll) . '<p />'); $options = "width={$config->popupwidth},height={$config->popupheight},toolbar=no,location=no,menubar=no,copyhistory=no,status=no,directories=no,scrollbars=yes,resizable=yes"; $onclick = "javascript:window.open('https://polls.brookes.ac.uk/', '', '{$options}')"; $qr = '<img width="256" height="256" src="http://chart.apis.google.com/chart?cht=qr&choe=UTF-8&chs=256x256&chl=https://polls.brookes.ac.uk/">'; $mform->addElement('html', '<a href="javascript:void(0)" onclick="' . $onclick . '">' . $qr . '</a>'); $mform->addElement('text', 'number', get_string('number', 'poll')); $mform->setType('number', PARAM_INT); $mform->addRule('number', get_string('required'), 'required', null, 'client'); //------------------------------------------------------- $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)); } // override 'Open' string if (isset($options[RESOURCELIB_DISPLAY_OPEN])) { $options[RESOURCELIB_DISPLAY_OPEN] = get_string('displayopen', 'poll'); } 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', 'poll'), $options); $mform->setDefault('display', $config->display); } //------------------------------------------------------- $mform->addElement('advcheckbox', 'printheading', get_string('printheading', 'poll')); $mform->setDefault('printheading', $config->printheading); $mform->addElement('advcheckbox', 'printintro', get_string('printintro', 'poll')); $mform->setDefault('printintro', $config->printintro); // Add standard grading elements. $this->standard_grading_coursemodule_elements(); // Add standard elements, common to all modules. $this->standard_coursemodule_elements(); // Add standard buttons, common to all modules. $this->add_action_buttons(); }
function definition() { global $CFG, $DB; $mform =& $this->_form; $config = get_config('resource'); if ($this->current->instance and $this->current->tobemigrated) { // resource not migrated yet $resoruce_old = $DB->get_record('resource_old', array('oldid' => $this->current->instance)); $mform->addElement('static', 'warning', '', get_string('notmigrated', 'resource', $resoruce_old->type)); $mform->addElement('cancel'); $this->standard_hidden_coursemodule_elements(); return; } //------------------------------------------------------- $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_CLEAN); } $mform->addRule('name', null, 'required', null, 'client'); $this->add_intro_editor($config->requiremodintro); //------------------------------------------------------- $mform->addElement('header', 'contentsection', get_string('contentheader', 'resource')); $mform->addElement('static', 'note', '', '<i>(TODO: This filemanager + textfield is temporary until we create new file manager with main file support.)</i>'); $mform->addElement('filemanager', 'files', get_string('file')); $mform->addElement('static', 'notex', '', '<i>(TODO: Ignore main file when uploading only one file, if multiple files present use "/myfile.ext" to specify the main file.)</i>'); $mform->addElement('text', 'mainfile', 'Main file'); //------------------------------------------------------- $mform->addElement('header', 'optionssection', get_string('optionsheader', 'resource')); 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'); reset($options); $mform->setDefault('display', key($options)); } else { $mform->addElement('select', 'display', get_string('displayselect', 'resource'), $options); $mform->setDefault('display', $config->display); $mform->setAdvanced('display', $config->display_adv); } if (array_key_exists(RESOURCELIB_DISPLAY_POPUP, $options)) { $mform->addElement('text', 'popupwidth', get_string('popupwidth', 'resource'), 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->setAdvanced('popupwidth', $config->popupwidth_adv); $mform->addElement('text', 'popupheight', get_string('popupheight', 'resource'), 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->setAdvanced('popupheight', $config->popupheight_adv); } if (array_key_exists(RESOURCELIB_DISPLAY_AUTO, $options) or array_key_exists(RESOURCELIB_DISPLAY_EMBED, $options) or array_key_exists(RESOURCELIB_DISPLAY_FRAME, $options)) { $mform->addElement('checkbox', 'printheading', get_string('printheading', 'resource')); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_POPUP); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_DOWNLOAD); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_OPEN); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_NEW); $mform->setDefault('printheading', $config->printheading); $mform->setAdvanced('printheading', $config->printheading_adv); $mform->addElement('checkbox', 'printintro', get_string('printintro', 'resource')); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_POPUP); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_DOWNLOAD); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_OPEN); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_NEW); $mform->setDefault('printintro', $config->printintro); $mform->setAdvanced('printintro', $config->printintro_adv); } $options = array('0' => get_string('none'), '1' => get_string('allfiles'), '2' => get_string('htmlfilesonly')); $mform->addElement('select', 'filterfiles', get_string('filterfiles', 'resource'), $options); $mform->setDefault('filterfiles', $config->filterfiles); $mform->setAdvanced('filterfiles', $config->filterfiles_adv); // add legacy files flag only if used if (isset($this->current->legacyfiles) and $this->current->legacyfiles != RESOURCELIB_LEGACYFILES_NO) { $options = array(RESOURCE_LEGACYYFILES_DONE => get_string('legacyfilesdone', 'resource'), RESOURCELIB_LEGACYFILES_ACTIVE => get_string('legacyfilesactive', 'resource')); $mform->addElement('select', 'legacyfiles', get_string('legacyfiles', 'resource'), $options); $mform->setAdvanced('legacyfiles', 1); } //------------------------------------------------------- $this->standard_coursemodule_elements(); //------------------------------------------------------- $this->add_action_buttons(); //------------------------------------------------------- $mform->addElement('hidden', 'revision'); $mform->setType('revision', PARAM_INT); $mform->setDefault('revision', 1); }
/** * Defines forms elements */ public function definition() { global $CFG, $DB; $mform =& $this->_form; $config = get_config('pdfparts'); //------------------------------------------------------------------------------- $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('name', 'pdfparts'), array('size' => '48')); if (!empty($CFG->formatstringstriptags)) { $mform->setType('name', PARAM_TEXT); } else { $mform->setType('name', PARAM_CLEAN); } $mform->addRule('name', null, 'required', null, 'client'); $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $this->add_intro_editor($config->requiremodintro); //------------------------------------------------------- $mform->addElement('header', 'content', get_string('content', 'pdfparts')); $mform->setExpanded('content'); $filemanager_options = array(); $filemanager_options['accepted_types'] = '*.pdf'; $filemanager_options['maxbytes'] = 0; $filemanager_options['maxfiles'] = 1; $filemanager_options['subdirs'] = 0; $filemanager_options['mainfile'] = true; $filemanager_options['return_types'] = 3; $mform->addElement('filemanager', 'files', get_string('selectfile', 'pdfparts'), null, $filemanager_options); //------------------------------------------------------- $mform->addElement('header', 'appearance', get_string('appearance', 'pdfparts')); $mform->setExpanded('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', 'pdfparts'), $options); $mform->setDefault('display', $config->display); $mform->addHelpButton('display', 'displayselect', 'pdfparts'); } $mform->addElement('text', 'pages', get_string('pages', 'pdfparts'), array('size' => '20')); $mform->setType('pages', PARAM_TEXT); $mform->addHelpButton('pages', 'pages', 'pdfparts'); if (array_key_exists(RESOURCELIB_DISPLAY_POPUP, $options)) { $mform->addElement('text', 'popupwidth', get_string('popupwidth', 'pdfparts'), 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->setAdvanced('popupwidth', true); $mform->addElement('text', 'popupheight', get_string('popupheight', 'pdfparts'), 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->setAdvanced('popupheight', true); } if (array_key_exists(RESOURCELIB_DISPLAY_AUTO, $options) or array_key_exists(RESOURCELIB_DISPLAY_EMBED, $options) or array_key_exists(RESOURCELIB_DISPLAY_FRAME, $options)) { $mform->addElement('checkbox', 'printheading', get_string('printheading', 'pdfparts')); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_POPUP); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_DOWNLOAD); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_OPEN); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_NEW); $mform->setDefault('printheading', $config->printheading); $mform->addElement('checkbox', 'printintro', get_string('printintro', 'pdfparts')); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_POPUP); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_DOWNLOAD); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_OPEN); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_NEW); $mform->setDefault('printintro', $config->printintro); } //------------------------------------------------------------------------------- $this->standard_coursemodule_elements(); //------------------------------------------------------------------------------- $this->add_action_buttons(); //------------------------------------------------------------------------------- $mform->addElement('hidden', 'revision'); $mform->setType('revision', PARAM_INT); $mform->setDefault('revision', 1); }
function definition() { global $CFG, $DB; $mform = $this->_form; $config = get_config('webex'); //------------------------------------------------------- $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'); $this->add_intro_editor($config->requiremodintro); //------------------------------------------------------- $mform->addElement('header', 'content', get_string('contentheader', 'webex')); $mform->addElement('text', 'externalurl', get_string('externalurl', 'webex'), array('size' => '48')); $mform->setType('externalurl', PARAM_TEXT); $mform->addElement('static', 'parametersinfo', '', 'http://<b style="color:red">yoursite</b>.webex.com/'); $mform->addRule('externalurl', null, 'required', null, 'client'); //------------------------------------------------------- $mform->addElement('header', 'optionssection', get_string('optionsheader', 'webex')); 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'); reset($options); $mform->setDefault('display', key($options)); } else { $mform->addElement('select', 'display', get_string('displayselect', 'webex'), $options); $mform->setDefault('display', $config->display); $mform->setAdvanced('display', $config->display_adv); $mform->addHelpButton('display', 'displayselect', 'webex'); } $mform->setType('display', PARAM_INT); if (array_key_exists(RESOURCELIB_DISPLAY_POPUP, $options)) { $mform->addElement('text', 'popupwidth', get_string('popupwidth', 'webex'), 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->setAdvanced('popupwidth', $config->popupwidth_adv); $mform->addElement('text', 'popupheight', get_string('popupheight', 'webex'), 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->setAdvanced('popupheight', $config->popupheight_adv); } if (array_key_exists(RESOURCELIB_DISPLAY_FRAME, $options)) { $mform->addElement('checkbox', 'printheading', get_string('printheading', 'webex')); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_POPUP); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_OPEN); $mform->disabledIf('printheading', 'display', 'eq', RESOURCELIB_DISPLAY_NEW); $mform->setDefault('printheading', $config->printheading); $mform->setAdvanced('printheading', $config->printheading_adv); $mform->addElement('checkbox', 'printintro', get_string('printintro', 'webex')); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_POPUP); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_OPEN); $mform->disabledIf('printintro', 'display', 'eq', RESOURCELIB_DISPLAY_NEW); $mform->setDefault('printintro', $config->printintro); $mform->setAdvanced('printintro', $config->printintro_adv); } //------------------------------------------------------- $mform->addElement('header', 'parameterssection', get_string('parametersheader', 'webex')); $mform->addElement('static', 'parametersinfo', '', get_string('parametersheader_help', 'webex')); //$mform->setAdvanced('parametersinfo'); $mform->addElement('hidden', 'variable_0', 'AT'); $mform->setType('variable_0', PARAM_TEXT); $mform->addElement('hidden', 'parameter_0', 'JM'); $mform->setType('parameter_0', PARAM_TEXT); $mform->addElement('hidden', 'variable_1', 'MK'); $mform->setType('variable_1', PARAM_TEXT); $mform->addElement('text', 'parameter_1', get_string('mettingkey', 'webex'), array('size' => '12')); $mform->setType('parameter_1', PARAM_TEXT); $mform->addElement('hidden', 'variable_2', 'PW'); $mform->setType('variable_2', PARAM_TEXT); $mform->addElement('passwordunmask', 'parameter_2', get_string('password', 'webex'), array('size' => '12')); $mform->setType('parameter_2', PARAM_TEXT); //------------------------------------------------------- $this->standard_coursemodule_elements(); //------------------------------------------------------- $this->add_action_buttons(); }
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * flexpaper module admin settings and defaults * * @package mod_flexpaper * @copyright 2009 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; if ($ADMIN->fulltree) { require_once("$CFG->libdir/resourcelib.php"); $displayoptions = resourcelib_get_displayoptions(array(RESOURCELIB_DISPLAY_EMBED,)); $defaultdisplayoptions = array(RESOURCELIB_DISPLAY_EMBED,); //--- general settings ----------------------------------------------------------------------------------- $settings->add(new admin_setting_configtext('flexpaper/framesize',get_string('framesize', 'flexpaper'), get_string('configframesize', 'flexpaper'), 130, PARAM_INT)); $settings->add(new admin_setting_configtext('flexpaper/key',get_string('key', 'flexpaper'), get_string('flexpaperkey', 'flexpaper'), 300, PARAM_RAW)); $settings->add(new admin_setting_configcheckbox('flexpaper/requiremodintro', get_string('requiremodintro', 'admin'), get_string('configrequiremodintro', 'admin'), 1)); $settings->add(new admin_setting_configmultiselect('flexpaper/displayoptions', get_string('displayoptions', 'flexpaper'), get_string('configdisplayoptions', 'flexpaper'), $defaultdisplayoptions, $displayoptions)); //--- modedit defaults ----------------------------------------------------------------------------------- $settings->add(new admin_setting_heading('flexpapermodeditdefaults', get_string('modeditdefaults', 'admin'), get_string('condifmodeditdefaults', 'admin')));
function definition() { global $CFG, $DB; $mform =& $this->_form; $config = get_config('flexpaper'); if ($this->current->instance and $this->current->tobemigrated) { // flexpaper not migrated yet $flexpaper_old = $DB->get_record('flexpaper_old', array('oldid'=>$this->current->instance)); $mform->addElement('static', 'warning', '', get_string('notmigrated', 'flexpaper', $flexpaper_old->type)); $mform->addElement('cancel'); $this->standard_hidden_coursemodule_elements(); return; } //------------------------------------------------------- $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'); $this->add_intro_editor($config->requiremodintro); //------------------------------------------------------- $mform->addElement('header', 'contentsection', get_string('contentheader', 'flexpaper')); $mform->setExpanded('contentsection'); $filemanager_options = array(); $filemanager_options['accepted_types'] = '*'; $filemanager_options['maxbytes'] = 0; $filemanager_options['maxfiles'] = -1; $filemanager_options['mainfile'] = true; $mform->addElement('filemanager', 'files', get_string('selectfiles'), null, $filemanager_options); // 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', 'flexpaper'), RESOURCELIB_LEGACYFILES_ACTIVE => get_string('legacyfilesactive', 'flexpaper')); $mform->addElement('select', 'legacyfiles', get_string('legacyfiles', 'flexpaper'), $options); } //------------------------------------------------------- // $mform->addElement('header', 'optionssection', 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)); } //$options=1; // print_object($options); // $mform->addElement('text', 'display', get_string('displayselect', 'resource'),$options); // $mform->setType('display', PARAM_INT); // $mform->addHelpButton('display', 'displayselect', 'resource'); /* $mform->addElement('checkbox', 'showsize', get_string('showsize', 'resource')); $mform->setDefault('showsize', $config->showsize); $mform->addHelpButton('showsize', 'showsize', 'resource'); $mform->addElement('checkbox', 'showtype', get_string('showtype', 'resource')); $mform->setDefault('showtype', $config->showtype); $mform->addHelpButton('showtype', 'showtype', 'resource'); */ $options = array('0' => get_string('none'), '1' => get_string('allfiles'), '2' => get_string('htmlfilesonly')); $mform->addElement('select', 'filterfiles', get_string('filterfiles', 'resource'), $options); $mform->setDefault('filterfiles', $config->filterfiles); $mform->setAdvanced('filterfiles', true); //------------------------------------------------------- $this->standard_coursemodule_elements(); //------------------------------------------------------- $this->add_action_buttons(); //------------------------------------------------------- $mform->addElement('hidden', 'revision'); $mform->setType('revision', PARAM_INT); $mform->setDefault('revision', 1); $mform->addElement('hidden', 'display'); $mform->setType('display', PARAM_INT); $mform->setDefault('display', 1); }