function definition() { global $DB, $PAGE; $mform = & $this->_form; $reportid = $this->_customdata['id']; $scheduledreportid = $this->_customdata['scheduleid']; $PAGE->requires->yui_module('moodle-block_cobalt_reports-schedulertype', 'M.block_cobalt_reports.init_schedulertype', array(array('formid' => $mform->getAttribute('id')))); $mform->addElement('hidden', 'id', $reportid); $mform->setType('id', PARAM_INT); $mform->addElement('hidden', 'scheduleid', $scheduledreportid); $mform->setType('scheduleid', PARAM_INT); $exportoptions = cr_get_export_plugins(); $reportname = $DB->get_field('block_cobalt_reports', 'name', array('id' => $reportid)); $exporttofilesystem = false; if (get_config('block_cobalt_reports', 'exportfilesystem') == 1) { $exporttofilesystem = true; } if ($scheduledreportid < 0) { $pagename = 'addscheduledreport'; } else { $pagename = 'editscheduledreport'; } $mform->addElement('header', 'general', get_string($pagename, 'block_cobalt_reports')); $mform->addElement('static', 'report', get_string('report', 'block_cobalt_reports'), $reportname); $mform->addElement('select', 'exportformat', get_string('export', 'block_cobalt_reports'), $exportoptions); if ($exporttofilesystem) { $exporttosystemarray = array(); $exporttosystemarray[] = & $mform->createElement('radio', 'exporttofilesystem', '', get_string('exporttoemail', 'block_cobalt_reports'), REPORT_EMAIL); $exporttosystemarray[] = & $mform->createElement('radio', 'exporttofilesystem', '', get_string('exporttosave', 'block_cobalt_reports'), REPORT_EXPORT); $exporttosystemarray[] = & $mform->createElement('radio', 'exporttofilesystem', '', get_string('exporttoemailandsave', 'block_cobalt_reports'), REPORT_EXPORT_AND_EMAIL); $mform->setDefault('exporttofilesystem', 1); $mform->addGroup($exporttosystemarray, 'exporttofilesystemarray', get_string('exportfilesystemoptions', 'block_cobalt_reports'), array('<br />'), false); } else { $mform->addElement('hidden', 'emailsaveorboth', REPORT_EMAIL); $mform->setType('emailsaveorboth', PARAM_TEXT); } //Schedule type options $scheduling = new schedule(); $frequencyselect = $scheduling->get_options(); $mform->registerNoSubmitButton('updatefrequency'); $mform->addElement('submit', 'updatefrequency', get_string('updatefrequency', 'block_cobalt_reports')); $mform->addElement('select', 'frequency', get_string('schedule', 'block_cobalt_reports'), $frequencyselect); $mform->addElement('hidden', 'frequentpos'); $mform->setType('frequentpos', PARAM_RAW); $this->add_action_buttons(); }
function definition() { global $DB, $USER, $CFG; $mform =& $this->_form; $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('name')); if (!empty($CFG->formatstringstriptags)) { $mform->setType('name', PARAM_TEXT); } else { $mform->setType('name', PARAM_CLEAN); } $mform->addRule('name', null, 'required', null, 'client'); $mform->addElement('htmleditor', 'summary', get_string('summary')); $mform->setType('summary', PARAM_RAW); $typeoptions = cr_get_report_plugins($this->_customdata['courseid']); $eloptions = array(); if (isset($this->_customdata['report']->id) && $this->_customdata['report']->id) { $eloptions = array('disabled' => 'disabled'); } $mform->addElement('select', 'type', get_string("typeofreport", 'block_configurable_reports'), $typeoptions, $eloptions); $mform->addHelpButton('type', 'typeofreport', 'block_configurable_reports'); for ($i = 0; $i <= 100; $i++) { $pagoptions[$i] = $i; } $mform->addElement('select', 'pagination', get_string("pagination", 'block_configurable_reports'), $pagoptions); $mform->setDefault('pagination', 0); $mform->addHelpButton('pagination', 'pagination', 'block_configurable_reports'); $mform->addElement('checkbox', 'jsordering', get_string('ordering', 'block_configurable_reports'), get_string('enablejsordering', 'block_configurable_reports')); $mform->addHelpButton('jsordering', 'jsordering', 'block_configurable_reports'); $mform->addElement('header', 'exportoptions', get_string('exportoptions', 'block_configurable_reports')); $options = cr_get_export_plugins(); foreach ($options as $key => $val) { $mform->addElement('checkbox', 'export_' . $key, null, $val); } if (isset($this->_customdata['report']->id) && $this->_customdata['report']->id) { $mform->addElement('hidden', 'id', $this->_customdata['report']->id); } $mform->addElement('hidden', 'courseid', $this->_customdata['courseid']); // buttons $this->add_action_buttons(true, get_string('add')); }
function definition() { global $DB, $USER, $CFG; $adminmode = optional_param('adminmode', null, PARAM_INT); $mform = & $this->_form; $mform->addElement('header', 'general', get_string('general', 'form')); $mform->addElement('text', 'name', get_string('name'), array('maxlength' => 60, 'size' => 58)); if (!empty($CFG->formatstringstriptags)) { $mform->setType('name', PARAM_TEXT); } else { $mform->setType('name', PARAM_NOTAGS); } $mform->addRule('name', null, 'required', null, 'client'); $mform->addElement('htmleditor', 'summary', get_string('summary')); $mform->setType('summary', PARAM_RAW); $typeoptions = cr_get_report_plugins($this->_customdata['courseid']); $eloptions = array(); if (isset($this->_customdata['report']->id) && $this->_customdata['report']->id) $eloptions = array('disabled' => 'disabled'); $select = $mform->addElement('select', 'type', get_string("typeofreport", 'block_cobalt_reports'), $typeoptions, $eloptions); $mform->addHelpButton('type', 'typeofreport', 'block_cobalt_reports'); $select->setSelected('sql'); for ($i = 0; $i <= 100; $i++) $pagoptions[$i] = $i; $mform->addElement('select', 'pagination', get_string("pagination", 'block_cobalt_reports'), $pagoptions); $mform->setDefault('pagination', 0); $mform->addHelpButton('pagination', 'pagination', 'block_cobalt_reports'); $mform->addElement('checkbox', 'global', get_string('global', 'block_cobalt_reports'), get_string('enableglobal', 'block_cobalt_reports')); $mform->addHelpButton('global', 'global', 'block_cobalt_reports'); $mform->setDefault('global', 0); $mform->addElement('checkbox', 'jsordering', get_string('ordering', 'block_cobalt_reports'), get_string('enablejsordering', 'block_cobalt_reports')); $mform->addHelpButton('jsordering', 'jsordering', 'block_cobalt_reports'); $mform->setDefault('jsordering', 1); $mform->addElement('checkbox', 'cron', get_string('cron', 'block_cobalt_reports'), get_string('crondescription', 'block_cobalt_reports')); $mform->addHelpButton('cron', 'cron', 'block_cobalt_reports'); $mform->setDefault('cron', 0); $mform->disabledIf('cron', 'type', 'neq', 'sql'); $mform->addElement('header', 'exportoptions', get_string('exportoptions', 'block_cobalt_reports')); $options = cr_get_export_plugins(); foreach ($options as $key => $val) { $mform->addElement('checkbox', 'export_' . $key, null, $val); } if (isset($this->_customdata['report']->id) && $this->_customdata['report']->id) $mform->addElement('hidden', 'id', $this->_customdata['report']->id); $mform->setType('id', PARAM_INT); if (!empty($adminmode)) { $mform->addElement('text', 'courseid', get_string("setcourseid", 'block_cobalt_reports'), $this->_customdata['courseid']); $mform->setType('courseid', PARAM_INT); } else { $mform->addElement('hidden', 'courseid', $this->_customdata['courseid']); $mform->setType('courseid', PARAM_INT); } // buttons $this->add_action_buttons(true, get_string('add')); }