}
        $testpath = str_replace($CFG->wwwroot, $CFG->dirroot, $cssurl);
        if (!file_exists($testpath)) {
            error('require_css: ' . $cssurl . ' - file not found.');
        }
        $requiredcss[$cssurl] = 1;
    } else {
        $output = '';
        foreach ($requiredcss as $css => $ignored) {
            $output .= '<link type="text/css" rel="stylesheet" href="' . $css . '" />' . "\n";
        }
        return $output;
    }
}
// Register our custom form control
MoodleQuickForm::registerElementType('username', "{$CFG->dirroot}/admin/report/userroles/username.php", 'MoodleQuickForm_username');
// moodleform for controlling the report
class user_roles_report_form extends moodleform
{
    function definition()
    {
        global $CFG;
        $mform =& $this->_form;
        $mform->addElement('header', 'reportsettings', get_string('reportsettings', 'report_userroles'));
        $mform->addElement('username', 'username', get_string('username'));
        $mform->addElement('submit', 'submit', get_string('getreport', 'report_userroles'));
    }
}
$mform = new user_roles_report_form();
// Start the page.
admin_externalpage_setup('reportuserroles');
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Duration form element
 *
 * Contains class to create length of time for element.
 *
 * @package   format_periods
 * @copyright 2015 Marina Glancy
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
global $CFG;
require_once $CFG->libdir . '/form/group.php';
require_once $CFG->libdir . '/formslib.php';
require_once $CFG->libdir . '/form/text.php';
MoodleQuickForm::registerElementType('periodduration', "{$CFG->dirroot}/course/format/periods/periodduration.php", 'format_periods_periodduration');
/**
 * Period duration element
 *
 * HTML class for a length of days/weeks/months.
 * The values returned to PHP as string to use in strtotime(), for example
 * '1 day', '2 week', '3 month', etc..
 *
 * @package   format_periods
 * @copyright 2015 Marina Glancy
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class format_periods_periodduration extends MoodleQuickForm_group
{
    /**
     * Control the fieldnames for form elements
Пример #3
0
 * HTML class for a drop down element in a tree like structure.
 * @access public
 */
class MoodleQuickForm_selecttree extends MoodleQuickForm_selectgroups
{
    private $_options = array('top' => false, 'currentcat' => 0, 'nochildrenof' => -1);
    /**
     * Constructor
     *
     * @param string $elementname Select name attribute
     * @param mixed $elementlabel Label(s) for the select
     * @param mixed $attributes Either a typical HTML attribute string or an associative array
     * @param array $options additional options. Recognised options are courseid, published and
     *   only_editable, corresponding to the arguments of question_category_options from
     *   moodlelib.php.
     * @access public
     * @return void
     */
    public function MoodleQuickForm_selecttree($elementname = null, $elementlabel = null, $options = null, $attributes = null)
    {
        parent::__construct($elementname, $elementlabel, array(), $attributes);
        $this->_type = 'selecttree';
        if (is_array($options)) {
            $this->_options = $options + $this->_options;
            $this->loadArrayOptGroups($this->_options['options']);
        }
    }
}
//register wikieditor
MoodleQuickForm::registerElementType('selecttree', $CFG->dirroot . "/mod/subpage/form/selecttree.php", 'MoodleQuickForm_selecttree');
Пример #4
0
        $wiki_editor['nowiki'] = array('ed_nowiki.gif', get_string('wikinowikitext', 'wiki'), $tag[0], $tag[1], get_string('wikinowikitext', 'wiki'));
        $PAGE->requires->js('/mod/wiki/editors/wiki/buttons.js');
        $html = "";
        foreach ($wiki_editor as $button) {
            $html .= "<a href=\"javascript:insertTags";
            $html .= "('" . $button[2] . "','" . $button[3] . "','" . $button[4] . "');\">";
            $html .= "<img width=\"23\" height=\"22\" src=\"{$CFG->wwwroot}/mod/wiki/editors/wiki/images/{$button['0']}\" alt=\"" . $button[1] . "\" title=\"" . $button[1] . "\" />";
            $html .= "</a>";
        }
        return $html;
    }
    private function getTokens($format, $token)
    {
        $tokens = wiki_parser_get_token($format, $token);
        if (is_array($tokens)) {
            foreach ($tokens as &$t) {
                $this->escapeToken($t);
            }
        } else {
            $this->escapeToken($tokens);
        }
        return $tokens;
    }
    private function escapeToken(&$token)
    {
        $token = urlencode(str_replace("'", "\\'", $token));
    }
}
//register wikieditor
MoodleQuickForm::registerElementType('wikieditor', $CFG->dirroot . "/mod/wiki/editors/wikieditor.php", 'MoodleQuickForm_wikieditor');
Пример #5
0
MoodleQuickForm::registerElementType('checkbox', "{$CFG->libdir}/form/checkbox.php", 'MoodleQuickForm_checkbox');
MoodleQuickForm::registerElementType('file', "{$CFG->libdir}/form/file.php", 'MoodleQuickForm_file');
MoodleQuickForm::registerElementType('group', "{$CFG->libdir}/form/group.php", 'MoodleQuickForm_group');
MoodleQuickForm::registerElementType('password', "{$CFG->libdir}/form/password.php", 'MoodleQuickForm_password');
MoodleQuickForm::registerElementType('passwordunmask', "{$CFG->libdir}/form/passwordunmask.php", 'MoodleQuickForm_passwordunmask');
MoodleQuickForm::registerElementType('radio', "{$CFG->libdir}/form/radio.php", 'MoodleQuickForm_radio');
MoodleQuickForm::registerElementType('select', "{$CFG->libdir}/form/select.php", 'MoodleQuickForm_select');
MoodleQuickForm::registerElementType('selectgroups', "{$CFG->libdir}/form/selectgroups.php", 'MoodleQuickForm_selectgroups');
MoodleQuickForm::registerElementType('submitlink', "{$CFG->libdir}/form/submitlink.php", 'MoodleQuickForm_submitlink');
MoodleQuickForm::registerElementType('text', "{$CFG->libdir}/form/text.php", 'MoodleQuickForm_text');
MoodleQuickForm::registerElementType('textarea', "{$CFG->libdir}/form/textarea.php", 'MoodleQuickForm_textarea');
MoodleQuickForm::registerElementType('date_selector', "{$CFG->libdir}/form/dateselector.php", 'MoodleQuickForm_date_selector');
MoodleQuickForm::registerElementType('date_time_selector', "{$CFG->libdir}/form/datetimeselector.php", 'MoodleQuickForm_date_time_selector');
MoodleQuickForm::registerElementType('htmleditor', "{$CFG->libdir}/form/htmleditor.php", 'MoodleQuickForm_htmleditor');
MoodleQuickForm::registerElementType('format', "{$CFG->libdir}/form/format.php", 'MoodleQuickForm_format');
MoodleQuickForm::registerElementType('static', "{$CFG->libdir}/form/static.php", 'MoodleQuickForm_static');
MoodleQuickForm::registerElementType('hidden', "{$CFG->libdir}/form/hidden.php", 'MoodleQuickForm_hidden');
MoodleQuickForm::registerElementType('modvisible', "{$CFG->libdir}/form/modvisible.php", 'MoodleQuickForm_modvisible');
MoodleQuickForm::registerElementType('selectyesno', "{$CFG->libdir}/form/selectyesno.php", 'MoodleQuickForm_selectyesno');
MoodleQuickForm::registerElementType('modgrade', "{$CFG->libdir}/form/modgrade.php", 'MoodleQuickForm_modgrade');
MoodleQuickForm::registerElementType('cancel', "{$CFG->libdir}/form/cancel.php", 'MoodleQuickForm_cancel');
MoodleQuickForm::registerElementType('button', "{$CFG->libdir}/form/button.php", 'MoodleQuickForm_button');
MoodleQuickForm::registerElementType('choosecoursefile', "{$CFG->libdir}/form/choosecoursefile.php", 'MoodleQuickForm_choosecoursefile');
MoodleQuickForm::registerElementType('choosecoursefileorimsrepo', "{$CFG->libdir}/form/choosecoursefileorimsrepo.php", 'MoodleQuickForm_choosecoursefileorimsrepo');
MoodleQuickForm::registerElementType('header', "{$CFG->libdir}/form/header.php", 'MoodleQuickForm_header');
MoodleQuickForm::registerElementType('submit', "{$CFG->libdir}/form/submit.php", 'MoodleQuickForm_submit');
MoodleQuickForm::registerElementType('questioncategory', "{$CFG->libdir}/form/questioncategory.php", 'MoodleQuickForm_questioncategory');
MoodleQuickForm::registerElementType('advcheckbox', "{$CFG->libdir}/form/advcheckbox.php", 'MoodleQuickForm_advcheckbox');
MoodleQuickForm::registerElementType('recaptcha', "{$CFG->libdir}/form/recaptcha.php", 'MoodleQuickForm_recaptcha');
MoodleQuickForm::registerElementType('selectwithlink', "{$CFG->libdir}/form/selectwithlink.php", 'MoodleQuickForm_selectwithlink');
Пример #6
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    elis
 * @subpackage curriculummanagement
 * @author     Remote-Learner.net Inc
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 2008-2012 Remote Learner.net Inc http://www.remote-learner.net
 *
 */
require_once CURMAN_DIRLOCATION . '/form/cmform.class.php';
MoodleQuickForm::registerElementType('time_selector', "{$CFG->dirroot}/curriculum/form/timeselector.php", 'cm_time_selector');
class cmclassform extends cmform
{
    function definition()
    {
        global $USER, $CFG, $COURSE, $CURMAN;
        parent::definition();
        if (!empty($this->_customdata['obj'])) {
            $obj = $this->_customdata['obj'];
            if (empty($obj->startdate) || $obj->startdate == 0) {
                $this->set_data(array('disablestart' => '1'));
            }
            if (empty($obj->enddate) || $obj->enddate == 0) {
                $this->set_data(array('disableend' => '1'));
            }
            if (isset($obj->starttimeminute) && isset($obj->starttimehour)) {
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// 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/>.
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
require_once $CFG->dirroot . '/course/moodleform_mod.php';
require_once $CFG->dirroot . '/mod/customcert/locallib.php';
require_once $CFG->dirroot . '/mod/customcert/includes/colourpicker.php';
MoodleQuickForm::registerElementType('customcert_colourpicker', $CFG->dirroot . '/mod/customcert/includes/colourpicker.php', 'MoodleQuickForm_customcert_colourpicker');
/**
 * The form for handling editing a customcert element.
 *
 * @package    mod_customcert
 * @copyright  2013 Mark Nelson <*****@*****.**>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class mod_customcert_edit_element_form extends moodleform
{
    /**
     * The element object.
     */
    private $element;
    /**
     * Form definition.
Пример #8
0
global $CFG;
require_once("{$CFG->libdir}/form/filemanager.php");

class alfresco_filemanager extends MoodleQuickForm_filemanager {
    /**
     * the name used to identify the formslib element
     */
    const NAME = 'alfresco_filemanager';

    /**
     * Construct a alfresco_filemanager.
     *
     * @param string $elementName Element's name
     * @param mixed $elementLabel Label(s) for an element
     * @param array $options Options to control the element's display
     * @param mixed $attributes Either a typical HTML attribute string or an associative array
     */
    public function alfresco_filemanager($elementName=null, $elementLabel=null, $attributes=null, $options=null) {
        parent::__construct($elementName, $elementLabel, $attributes, $options);
    }

}

/* first argument is the string that will be used to identify the element.
 * second argument is the filename that contains the class definition
 * third argument is the class name
 */
MoodleQuickForm::registerElementType(alfresco_filemanager::NAME, __FILE__, 'alfresco_filemanager');

Пример #9
0
     * @return array
     */
    function exportValue(&$submitValues, $assoc = false)
    {
        $value = null;
        $valuearray = array();
        foreach ($this->_elements as $element) {
            $thisexport = $element->exportValue($submitValues[$this->getName()], true);
            if ($thisexport != null) {
                $valuearray += $thisexport;
            }
        }
        if (count($valuearray)) {
            if ($this->_options['optional']) {
                // If checkbox is on, the value is zero, so go no further
                if (!empty($valuearray['off'])) {
                    $value[$this->getName()] = 0;
                    return $value;
                }
            }
            $valuearray = $valuearray + array('year' => $this->_options['year'], 'month' => 1, 'day' => 1, 'hour' => 0, 'minute' => 0);
            $value[$this->getName()] = make_timestamp($valuearray['year'], $valuearray['month'], $valuearray['day'], $valuearray['hour'], $valuearray['minute'], 0, $this->_options['timezone'], $this->_options['applydst']);
            //error_log("/elis/core/lib/form/timeselector.php::exportValue(): calling make_timestamp( ..., hour => {$valuearray['hour']}, minute => {$valuearray['minute']} [, timezone => {$this->_options['timezone']}, applydst => {$this->_options['applydst']} ]) = {$value[$this->getName()]}");
            return $value;
        } else {
            return null;
        }
    }
}
MoodleQuickForm::registerElementType('time_selector', "{$CFG->dirroot}/elis/core/lib/form/timeselector.php", 'elis_time_selector');
 function definition()
 {
     global $CFG, $COURSE, $DB;
     $mform =& $this->_form;
     /// form definition with new course defaults
     $course = $this->_customdata['course'];
     // this contains the data of this form
     if (!empty($course->id)) {
         $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
         $context = $coursecontext;
     }
     $mform->addElement('hidden', 'id', $this->_customdata['course']->id);
     $mform->setType('id', PARAM_INT);
     $mform->addElement('hidden', 'defaulttabwhenset', time());
     $mform->setType('defaulttabwhenset', PARAM_INT);
     //get showsection0 heading from database
     $mform->addElement('header', 'fncoursetabs', 'Tabs');
     //For mainheading for the course
     $label = get_string('mainheading', 'format_octabs');
     $mform->addElement('text', 'mainheading', $label, 'maxlength="24" size="25"');
     $mform->addRule('mainheading', get_string('missingmainheading', 'format_octabs'), 'required', null, 'client');
     $mform->setDefault('mainheading', get_string('defaultmainheading', 'format_octabs'));
     $mform->setType('mainheading', PARAM_MULTILANG);
     //For topic heading for example Week Section
     $label = get_string('topicheading', 'format_octabs');
     $mform->addElement('text', 'topicheading', $label, 'maxlength="24" size="25"');
     $mform->addRule('topicheading', get_string('missingtopicheading', 'format_octabs'), 'required', null, 'client');
     $mform->setDefault('topicheading', get_string('defaulttopicheading', 'format_octabs'));
     $mform->setType('topicheading', PARAM_MULTILANG);
     //for changing the number of tab to show before next link
     $numberoftabs = array();
     for ($i = 12; $i <= 20; $i++) {
         $numberoftabs[$i] = $i;
     }
     $mform->addElement('select', 'maxtabs', get_string('setnumberoftabs', 'format_octabs'), $numberoftabs);
     $mform->setDefault('maxtabs', $numberoftabs[12]);
     //////work to be done for default tab
     $radioarray = array();
     $attributes = array();
     $radioarray[] = $mform->createElement('radio', 'defaulttab', '', get_string('default_tab_text', 'format_octabs'), 'option1', array('checked' => true, 'class' => 'padding_before_radio', 'style' => 'padding-left:10px;'));
     // add second option if the course completion is enabled
     $completion = new completion_info($course);
     if ($completion->is_enabled()) {
         $radioarray[] = $mform->createElement('radio', 'defaulttab', '', get_string('default_tab_notattempted_text', 'format_octabs'), 'option2');
     }
     $radioarray[] = $mform->createElement('radio', 'defaulttab', '', get_string('default_tab_specifyweek_text', 'format_octabs'), 'option3');
     $mform->addGroup($radioarray, 'radioar', get_string('label_deafulttab_text', 'format_octabs'), array('<br />'), false);
     $mform->setDefault('defaulttab', 'option1');
     //dropdown will contain week upto current section
     $timenow = time();
     $weekdate = $course->startdate;
     // this should be 0:00 Monday of that week
     $weekdate += 7200;
     // Add two hours to avoid possible DST problems
     $weekofseconds = 604800;
     $course->enddate = $course->startdate + $weekofseconds * $course->numsections;
     //  Calculate the current week based on today's date and the starting date of the course.
     $currentweek = $timenow > $course->startdate ? (int) (($timenow - $course->startdate) / $weekofseconds + 1) : 0;
     $currentweek = min($currentweek, $course->numsections);
     $topiclist = array();
     if ($currentweek > 0) {
         for ($i = 1; $i <= $currentweek; $i++) {
             $topiclist[$i] = $i;
         }
     } else {
         $topiclist[1] = 1;
     }
     ////////////
     $mform->addElement('select', 'topictoshow', '', $topiclist, array('class' => 'ddl_padding'));
     $mform->setDefault('topictoshow', $topiclist[1]);
     ///default tab end
     $mform->addElement('header', 'fncoursecolours', 'Colors');
     $mform->addElement('html', '<table style="width:100%"><tr><td>');
     MoodleQuickForm::registerElementType('tccolourpopup', "{$CFG->dirroot}/course/format/octabs/js/tc_colourpopup.php", 'MoodleQuickForm_tccolourpopup');
     $mform->addElement('tccolourpopup', 'bgcolour', get_string('bgcolour', 'format_octabs'), 'maxlength="6" size="6"');
     $mform->setType('bgcolour', PARAM_ALPHANUM);
     $mform->addElement('tccolourpopup', 'activecolour', get_string('activeweek', 'format_octabs'), 'maxlength="6" size="6"');
     $mform->setType('activecolour', PARAM_ALPHANUM);
     $mform->addElement('tccolourpopup', 'selectedcolour', get_string('selectedweek', 'format_octabs'), 'maxlength="6" size="6"');
     $mform->setType('selectedcolour', PARAM_ALPHANUM);
     $mform->addElement('tccolourpopup', 'inactivecolour', get_string('inactiveweek', 'format_octabs'), 'maxlength="6" size="6"');
     $mform->setType('inactivecolour', PARAM_ALPHANUM);
     $mform->addElement('tccolourpopup', 'inactivebgcolour', get_string('inactivebgcolour', 'format_octabs'), 'maxlength="6" size="6"');
     $mform->setType('inactivebgcolour', PARAM_ALPHANUM);
     $mform->addElement('tccolourpopup', 'activelinkcolour', get_string('activelinkcolour', 'format_octabs'), 'maxlength="6" size="6"');
     $mform->setType('activelinkcolour', PARAM_ALPHANUM);
     $mform->addElement('tccolourpopup', 'inactivelinkcolour', get_string('inactivelinkcolour', 'format_octabs'), 'maxlength="6" size="6"');
     $mform->setType('inactivelinkcolour', PARAM_ALPHANUM);
     $mform->addElement('tccolourpopup', 'highlightcolour', get_string('highlightcolour', 'format_octabs'), 'maxlength="6" size="6"');
     $mform->setType('highlightcolour', PARAM_ALPHANUM);
     $mform->addElement('html', '</td><td width="320px">');
     $mform->addElement('html', '<img src="pix/octabs_colourkey.png" />');
     $mform->addElement('html', '</td></tr></table>');
     //header for FN other setting
     $mform->addElement('header', 'Section0', 'Section 0');
     //For shwosection 0 or not
     $choices['0'] = get_string("hide");
     $choices['1'] = get_string("show");
     $label = get_string('showsection0', 'format_octabs');
     $mform->addElement('select', 'showsection0', $label, $choices);
     $mform->setDefault('showsection0', $choices['0']);
     unset($choices);
     //for shwo only section 0 setting
     $choices['0'] = get_string("no");
     $choices['1'] = get_string("yes");
     $label = get_string('showonlysection0', 'format_octabs');
     $mform->addElement('select', 'showonlysection0', $label, $choices);
     $mform->setDefault('showonlysection0', $choices['0']);
     unset($choices);
     $this->add_action_buttons();
 }
Пример #11
0
     * コンストラクタ
     */
    public function MoodleQuickForm_script($script = '', $import = '')
    {
        $this->script = $script;
        $this->import = $import;
    }
    /**
     * HTML 生成
     */
    public function toHtml()
    {
        $html = '';
        if (!empty($this->import)) {
            $html .= '
<script type="text/javascript" src="' . $this->import . '"></script>';
        }
        $html .= '
<script type="text/javascript">
//<![CDATA[
' . $this->script . '
//]]>
</script>
';
        return $html;
    }
    protected $script = '';
    protected $import = '';
}
MoodleQuickForm::registerElementType('script', __FILE__, 'MoodleQuickForm_script');
Пример #12
0
// 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/>.
/**
 * Form.
 *
 * @package    tool_lpmigrate
 * @copyright  2016 Frédéric Massart - FMCorz.net
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
namespace tool_lpmigrate\form;

defined('MOODLE_INTERNAL') || die;
require_once $CFG->libdir . '/formslib.php';
\MoodleQuickForm::registerElementType('framework_autocomplete', $CFG->dirroot . '/admin/tool/lp/classes/form/framework_autocomplete.php', '\\tool_lp\\form\\framework_autocomplete');
/**
 * Form class.
 *
 * @package    tool_lpmigrate
 * @copyright  2016 Frédéric Massart - FMCorz.net
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class migrate_framework extends \moodleform
{
    /** @var context The page context. */
    protected $pagecontext;
    /**
     * Constructor.
     * @param \context $context The page context.
     */
Пример #13
0
 /**
  * Adds format options elements to the course/section edit form.
  *
  * This function is called from {@link course_edit_form::definition_after_data()}.
  *
  * @param MoodleQuickForm $mform form the elements are added to.
  * @param bool $forsection 'true' if this is a section edit form, 'false' if this is course edit form.
  * @return array array of references to the added form elements.
  */
 public function create_edit_form_elements(&$mform, $forsection = false)
 {
     global $CFG, $OUTPUT;
     MoodleQuickForm::registerElementType('gfcolourpopup', "{$CFG->dirroot}/course/format/grid/js/gf_colourpopup.php", 'MoodleQuickForm_gfcolourpopup');
     $elements = parent::create_edit_form_elements($mform, $forsection);
     if ($forsection == false) {
         global $USER;
         /*
          Increase the number of sections combo box values if the user has increased the number of sections
          using the imagecontainer on the course page beyond course 'maxsections' or course 'maxsections' has been
          reduced below the number of sections already set for the course on the site administration course
          defaults page.  This is so that the number of sections is not reduced leaving unintended orphaned
          activities / resources.
         */
         $maxsections = get_config('moodlecourse', 'maxsections');
         $numsections = $mform->getElementValue('numsections');
         $numsections = $numsections[0];
         if ($numsections > $maxsections) {
             $element = $mform->getElement('numsections');
             for ($i = $maxsections + 1; $i <= $numsections; $i++) {
                 $element->addOption("{$i}", $i);
             }
         }
         $coursecontext = context_course::instance($this->courseid);
         $changeimagecontainersize = has_capability('format/grid:changeimagecontainersize', $coursecontext);
         $changeimageresizemethod = has_capability('format/grid:changeimageresizemethod', $coursecontext);
         $changeimagecontainerstyle = has_capability('format/grid:changeimagecontainerstyle', $coursecontext);
         $resetall = is_siteadmin($USER);
         // Site admins only.
         $elements[] = $mform->addElement('header', 'gfreset', get_string('gfreset', 'format_grid'));
         $mform->addHelpButton('gfreset', 'gfreset', 'format_grid', '', true);
         $resetelements = array();
         if ($changeimagecontainersize || $changeimageresizemethod || $changeimagecontainerstyle) {
             if ($changeimagecontainersize) {
                 $checkboxname = get_string('resetimagecontainersize', 'format_grid') . $OUTPUT->help_icon('resetimagecontainersize', 'format_grid');
                 $resetelements[] =& $mform->createElement('checkbox', 'resetimagecontainersize', '', $checkboxname);
             }
             if ($changeimageresizemethod) {
                 $checkboxname = get_string('resetimageresizemethod', 'format_grid') . $OUTPUT->help_icon('resetimageresizemethod', 'format_grid');
                 $resetelements[] =& $mform->createElement('checkbox', 'resetimageresizemethod', '', $checkboxname);
             }
             if ($changeimagecontainerstyle) {
                 $checkboxname = get_string('resetimagecontainerstyle', 'format_grid') . $OUTPUT->help_icon('resetimagecontainerstyle', 'format_grid');
                 $resetelements[] =& $mform->createElement('checkbox', 'resetimagecontainerstyle', '', $checkboxname);
             }
         }
         $checkboxname = get_string('resetnewactivity', 'format_grid') . $OUTPUT->help_icon('resetnewactivity', 'format_grid');
         $resetelements[] =& $mform->createElement('checkbox', 'resetnewactivity', '', $checkboxname);
         $checkboxname = get_string('resetfitpopup', 'format_grid') . $OUTPUT->help_icon('resetfitpopup', 'format_grid');
         $resetelements[] =& $mform->createElement('checkbox', 'resetfitpopup', '', $checkboxname);
         $elements[] = $mform->addGroup($resetelements, 'resetgroup', get_string('resetgrp', 'format_grid'), null, false);
         if ($resetall) {
             $resetallelements = array();
             $checkboxname = get_string('resetallimagecontainersize', 'format_grid') . $OUTPUT->help_icon('resetallimagecontainersize', 'format_grid');
             $resetallelements[] =& $mform->createElement('checkbox', 'resetallimagecontainersize', '', $checkboxname);
             $checkboxname = get_string('resetallimageresizemethod', 'format_grid') . $OUTPUT->help_icon('resetallimageresizemethod', 'format_grid');
             $resetallelements[] =& $mform->createElement('checkbox', 'resetallimageresizemethod', '', $checkboxname);
             $checkboxname = get_string('resetallimagecontainerstyle', 'format_grid') . $OUTPUT->help_icon('resetallimagecontainerstyle', 'format_grid');
             $resetallelements[] =& $mform->createElement('checkbox', 'resetallimagecontainerstyle', '', $checkboxname);
             $checkboxname = get_string('resetallnewactivity', 'format_grid') . $OUTPUT->help_icon('resetallnewactivity', 'format_grid');
             $resetallelements[] =& $mform->createElement('checkbox', 'resetallnewactivity', '', $checkboxname);
             $checkboxname = get_string('resetallfitpopup', 'format_grid') . $OUTPUT->help_icon('resetallfitpopup', 'format_grid');
             $resetallelements[] =& $mform->createElement('checkbox', 'resetallfitpopup', '', $checkboxname);
             $elements[] = $mform->addGroup($resetallelements, 'resetallgroup', get_string('resetallgrp', 'format_grid'), null, false);
         }
     }
     return $elements;
 }
            $table = new html_table();
            // $table->updateAttributes($this->getAttributes());
            $col = 0;
            $header = array();
            if ($this->_columnNames) {
                foreach ($this->_columnNames as $key => $value) {
                    ++$col;
                    $header[] = $value;
                }
            }
            $table->head = $header;
            $data = array();
            foreach (array_keys($this->_rows) as $key) {
                $col = 0;
                $row = array();
                foreach (array_keys($this->_rows[$key]) as $key2) {
                    ++$col;
                    $row[] = $this->_rows[$key][$key2]->toHTML();
                }
                $data[] = $row;
            }
            $table->data = $data;
            return html_writer::table($table);
        }
    }
    if (file_exists($CFG->libdir . '/form/elementgrid.php')) {
        MoodleQuickForm::registerElementType('elementgrid', "{$CFG->libdir}/form/elementgrid.php", 'MoodleQuickForm_elementgrid');
    } else {
        MoodleQuickForm::registerElementType('elementgrid', $CFG->dirroot . '/local/vmoodle/__other/elementgrid.php', 'MoodleQuickForm_elementgrid');
    }
}
Пример #15
0
            default:
                return parent::onQuickFormEvent($event, $arg, $caller);
        }
    }
    /**
     * Return the formslib elements's value
     *
     * @param array $submitValues
     * @param bool $assoc
     * @return array
     */
    public function exportValue(&$submitValues, $assoc = false)
    {
        $value = null;
        $valuearray = array();
        foreach ($this->_elements as $element) {
            $thisexport = $element->exportValue($submitValues[$this->getName()], true);
            if ($thisexport != null) {
                $valuearray += $thisexport;
            }
        }
        $value = array($this->getName() => $valuearray['value']);
        return $value;
    }
}
/* first argument is the string that will be used to identify the element.
 * second argument is the filename that contains the class definition
 * third argument is the class name
 */
MoodleQuickForm::registerElementType(elis_custom_field_multiselect::NAME, __FILE__, 'elis_custom_field_multiselect');
Пример #16
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    local_elisprogram
 * @author     Remote-Learner.net Inc
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @copyright  (C) 2008-2013 Remote Learner.net Inc http://www.remote-learner.net
 *
 */
defined('MOODLE_INTERNAL') || die;
require_once elispm::file('form/cmform.class.php');
MoodleQuickForm::registerElementType('time_selector', "{$CFG->dirroot}/local/elisprogram/form/timeselector.php", 'pm_time_selector');
class pmclassform extends cmform
{
    function definition()
    {
        global $USER, $CFG, $DB, $PAGE;
        parent::definition();
        if (!empty($this->_customdata['obj'])) {
            $obj = $this->_customdata['obj'];
            if (empty($obj->startdate) || $obj->startdate == 0) {
                $this->set_data(array('disablestart' => '1'));
            }
            if (empty($obj->enddate) || $obj->enddate == 0) {
                $this->set_data(array('disableend' => '1'));
            }
            if (isset($obj->starttimeminute) && isset($obj->starttimehour) && $obj->starttimeminute < 61 && $obj->starttimehour < 25) {
Пример #17
0
        $args->elementname = $elname;
        // We can only tell the filepicker that we want FILE_REFERENCE repos
        // and which specific repo types we don't want. So here we build a list
        // of all FILE_REFERENCE supplying repos that aren't thebox to force
        // it to only display that one.
        $refrepos = repository::get_instances(array('currentcontext' => $PAGE->context, 'return_types' => FILE_REFERENCE));
        $disabled = array();
        foreach ($refrepos as $repo) {
            if (($name = $repo->get_typename()) != $this->repo) {
                $disabled[] = $name;
            }
        }
        $args->disable_types = $disabled;
        $html = $this->_getTabs();
        $fp = new file_picker($args);
        $options = $fp->options;
        $options->context = $PAGE->context;
        $html .= $OUTPUT->render($fp);
        $html .= '<input type="hidden" name="' . $elname . '" id="' . $id . '" value="' . $draftitemid . '" class="filepickerhidden"/>';
        $module = array('name' => 'form_filepicker', 'fullpath' => '/lib/form/filepicker.js', 'requires' => array('core_filepicker', 'node', 'node-event-simulate', 'core_dndupload'));
        $PAGE->requires->js_init_call('M.form_filepicker.init', array($fp->options), true, $module);
        $nonjsfilepicker = new moodle_url('/repository/draftfiles_manager.php', array('env' => 'filepicker', 'action' => 'browse', 'itemid' => $draftitemid, 'subdirs' => 0, 'maxbytes' => 0, 'maxfiles' => 1, 'ctx_id' => $PAGE->context->id, 'course' => $PAGE->course->id, 'sesskey' => sesskey()));
        // non js file picker
        $html .= '<noscript>';
        $html .= "<div><object type='text/html' data='{$nonjsfilepicker}' height='160' width='600' style='border:1px solid #000'></object></div>";
        $html .= '</noscript>';
        return $html;
    }
}
MoodleQuickForm::registerElementType('uploader', $CFG->dirroot . "/mod/mediagallery/classes/quickform/uploader.php", 'MoodleQuickForm_uploader');
Пример #18
0
}
$GLOBALS['_HTML_QuickForm_default_renderer'] =& new MoodleQuickForm_Renderer();
MoodleQuickForm::registerElementType('checkbox', "{$CFG->libdir}/form/checkbox.php", 'MoodleQuickForm_checkbox');
MoodleQuickForm::registerElementType('file', "{$CFG->libdir}/form/file.php", 'MoodleQuickForm_file');
MoodleQuickForm::registerElementType('group', "{$CFG->libdir}/form/group.php", 'MoodleQuickForm_group');
MoodleQuickForm::registerElementType('password', "{$CFG->libdir}/form/password.php", 'MoodleQuickForm_password');
MoodleQuickForm::registerElementType('passwordunmask', "{$CFG->libdir}/form/passwordunmask.php", 'MoodleQuickForm_passwordunmask');
MoodleQuickForm::registerElementType('radio', "{$CFG->libdir}/form/radio.php", 'MoodleQuickForm_radio');
MoodleQuickForm::registerElementType('select', "{$CFG->libdir}/form/select.php", 'MoodleQuickForm_select');
MoodleQuickForm::registerElementType('selectgroups', "{$CFG->libdir}/form/selectgroups.php", 'MoodleQuickForm_selectgroups');
MoodleQuickForm::registerElementType('submitlink', "{$CFG->libdir}/form/submitlink.php", 'MoodleQuickForm_submitlink');
MoodleQuickForm::registerElementType('text', "{$CFG->libdir}/form/text.php", 'MoodleQuickForm_text');
MoodleQuickForm::registerElementType('textarea', "{$CFG->libdir}/form/textarea.php", 'MoodleQuickForm_textarea');
MoodleQuickForm::registerElementType('date_selector', "{$CFG->libdir}/form/dateselector.php", 'MoodleQuickForm_date_selector');
MoodleQuickForm::registerElementType('date_time_selector', "{$CFG->libdir}/form/datetimeselector.php", 'MoodleQuickForm_date_time_selector');
MoodleQuickForm::registerElementType('htmleditor', "{$CFG->libdir}/form/htmleditor.php", 'MoodleQuickForm_htmleditor');
MoodleQuickForm::registerElementType('format', "{$CFG->libdir}/form/format.php", 'MoodleQuickForm_format');
MoodleQuickForm::registerElementType('static', "{$CFG->libdir}/form/static.php", 'MoodleQuickForm_static');
MoodleQuickForm::registerElementType('hidden', "{$CFG->libdir}/form/hidden.php", 'MoodleQuickForm_hidden');
MoodleQuickForm::registerElementType('modvisible', "{$CFG->libdir}/form/modvisible.php", 'MoodleQuickForm_modvisible');
MoodleQuickForm::registerElementType('selectyesno', "{$CFG->libdir}/form/selectyesno.php", 'MoodleQuickForm_selectyesno');
MoodleQuickForm::registerElementType('modgrade', "{$CFG->libdir}/form/modgrade.php", 'MoodleQuickForm_modgrade');
MoodleQuickForm::registerElementType('cancel', "{$CFG->libdir}/form/cancel.php", 'MoodleQuickForm_cancel');
MoodleQuickForm::registerElementType('button', "{$CFG->libdir}/form/button.php", 'MoodleQuickForm_button');
MoodleQuickForm::registerElementType('choosecoursefile', "{$CFG->libdir}/form/choosecoursefile.php", 'MoodleQuickForm_choosecoursefile');
MoodleQuickForm::registerElementType('choosecoursefileorimsrepo', "{$CFG->libdir}/form/choosecoursefileorimsrepo.php", 'MoodleQuickForm_choosecoursefileorimsrepo');
MoodleQuickForm::registerElementType('header', "{$CFG->libdir}/form/header.php", 'MoodleQuickForm_header');
MoodleQuickForm::registerElementType('submit', "{$CFG->libdir}/form/submit.php", 'MoodleQuickForm_submit');
MoodleQuickForm::registerElementType('questioncategory', "{$CFG->libdir}/form/questioncategory.php", 'MoodleQuickForm_questioncategory');
MoodleQuickForm::registerElementType('advcheckbox', "{$CFG->libdir}/form/advcheckbox.php", 'MoodleQuickForm_advcheckbox');
Пример #19
0
// 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/>.
/**
 * The form used at the rubric editor page is defined here
 *
 * @package    gradingform_rubric
 * @copyright  2011 Marina Glancy <*****@*****.**>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
defined('MOODLE_INTERNAL') || die;
require_once $CFG->dirroot . '/lib/formslib.php';
require_once dirname(__FILE__) . '/rubriceditor.php';
MoodleQuickForm::registerElementType('rubriceditor', $CFG->dirroot . '/grade/grading/form/rubric/rubriceditor.php', 'MoodleQuickForm_rubriceditor');
/**
 * Defines the rubric edit form
 *
 * @package    gradingform_rubric
 * @copyright  2011 Marina Glancy <*****@*****.**>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class gradingform_rubric_editrubric extends moodleform
{
    /**
     * Form element definition
     */
    public function definition()
    {
        $form = $this->_form;
Пример #20
0
 *   - intro: one htmlarea element to describe the activity
 *            (will be showed in the list of activities of
 *             podcaster type (index.php) and in the header 
 *             of the podcaster main page (view.php).
 *   - introformat: The format used to write the contents
 *             of the intro field. It automatically defaults 
 *             to HTML when the htmleditor is used and can be
 *             manually selected if the htmleditor is not used
 *             (standard formats are: MOODLE, HTML, PLAIN, MARKDOWN)
 *             See lib/weblib.php Constants and the format_text()
 *             function for more info
 */
require_once 'moodleform_mod.php';
require_once 'locallib.php';
require_once $CFG->dirroot . '/lib/formslib.php';
MoodleQuickForm::registerElementType('chooserepositoryfile', $CFG->dirroot . '/mod/podcaster/lib/chooserepositoryfile.php', 'podcaster_chooserepositoryfile');
class mod_podcaster_mod_form extends moodleform_mod
{
    var $initial_data;
    function mod_podcaster_mod_form($instance, $section, $cm)
    {
        if ($instance != '' && (!isset($GLOBALS['form']) || !isset($GLOBALS['form']->id) || $GLOBALS['form']->id != $instance)) {
            $this->initial_data = get_record('podcaster', 'id', $instance);
        } else {
            if ($instance != '') {
                $this->initial_data = $GLOBALS['form'];
            }
        }
        $this->moodleform_mod($instance, $section, $cm);
    }
    function &parseTypeOptions()
Пример #21
0
    /**
     * Adds format options elements to the course/section edit form
     *
     * This function is called from {@link course_edit_form::definition_after_data()}
     *
     * @param MoodleQuickForm $mform form the elements are added to
     * @param bool $forsection 'true' if this is a section edit form, 'false' if this is course edit form
     * @return array array of references to the added form elements
     */
    public function create_edit_form_elements(&$mform, $forsection = false) {
        global $CFG, $OUTPUT;
        MoodleQuickForm::registerElementType('tccolourpopup', "$CFG->dirroot/course/format/topcoll/js/tc_colourpopup.php",
                                             'MoodleQuickForm_tccolourpopup');

        $elements = parent::create_edit_form_elements($mform, $forsection);
        if ($forsection == false) {
            global $COURSE, $USER;
            /*
             Increase the number of sections combo box values if the user has increased the number of sections
             using the icon on the course page beyond course 'maxsections' or course 'maxsections' has been
             reduced below the number of sections already set for the course on the site administration course
             defaults page.  This is so that the number of sections is not reduced leaving unintended orphaned
             activities / resources.
             */
            $maxsections = get_config('moodlecourse', 'maxsections');
            $numsections = $mform->getElementValue('numsections');
            $numsections = $numsections[0];
            if ($numsections > $maxsections) {
                $element = $mform->getElement('numsections');
                for ($i = $maxsections+1; $i <= $numsections; $i++) {
                    $element->addOption("$i", $i);
                }
            }

            $coursecontext = context_course::instance($COURSE->id);

            $changelayout = has_capability('format/topcoll:changelayout', $coursecontext);
            $changecolour = has_capability('format/topcoll:changecolour', $coursecontext);
            $changetogglealignment = has_capability('format/topcoll:changetogglealignment', $coursecontext);
            $changetoggleiconset = has_capability('format/topcoll:changetoggleiconset', $coursecontext);
            $resetall = is_siteadmin($USER); // Site admins only.

            $elements[] = $mform->addElement('header', 'ctreset', get_string('ctreset', 'format_topcoll'));
            $mform->addHelpButton('ctreset', 'ctreset', 'format_topcoll', '', true);

            $resetelements = array();
            $checkboxname = get_string('resetdisplayinstructions', 'format_topcoll').$OUTPUT->help_icon('resetdisplayinstructions', 'format_topcoll');
            $resetelements[] =& $mform->createElement('checkbox', 'resetdisplayinstructions', '', $checkboxname);

            if ($changelayout) {
                $checkboxname = get_string('resetlayout', 'format_topcoll').$OUTPUT->help_icon('resetlayout', 'format_topcoll');
                $resetelements[] =& $mform->createElement('checkbox', 'resetlayout', '', $checkboxname);
            }

            if ($changecolour) {
                $checkboxname = get_string('resetcolour', 'format_topcoll').$OUTPUT->help_icon('resetcolour', 'format_topcoll');
                $resetelements[] =& $mform->createElement('checkbox', 'resetcolour', '', $checkboxname);
            }

            if ($changetogglealignment) {
                $checkboxname = get_string('resettogglealignment', 'format_topcoll').$OUTPUT->help_icon('resettogglealignment', 'format_topcoll');
                $resetelements[] =& $mform->createElement('checkbox', 'resettogglealignment', '', $checkboxname);
            }

            if ($changetoggleiconset) {
                $checkboxname = get_string('resettoggleiconset', 'format_topcoll').$OUTPUT->help_icon('resettoggleiconset', 'format_topcoll');
                $resetelements[] =& $mform->createElement('checkbox', 'resettoggleiconset', '', $checkboxname);
            }
            $elements[] = $mform->addGroup($resetelements, 'resetgroup', get_string('resetgrp', 'format_topcoll'), null, false);

            if ($resetall) {
                $resetallelements = array();

                $checkboxname = get_string('resetalldisplayinstructions', 'format_topcoll').$OUTPUT->help_icon('resetalldisplayinstructions', 'format_topcoll');
                $resetallelements[] =& $mform->createElement('checkbox', 'resetalldisplayinstructions', '', $checkboxname);

                $checkboxname = get_string('resetalllayout', 'format_topcoll').$OUTPUT->help_icon('resetalllayout', 'format_topcoll');
                $resetallelements[] =& $mform->createElement('checkbox', 'resetalllayout', '', $checkboxname);

                $checkboxname = get_string('resetallcolour', 'format_topcoll').$OUTPUT->help_icon('resetallcolour', 'format_topcoll');
                $resetallelements[] =& $mform->createElement('checkbox', 'resetallcolour', '', $checkboxname);

                $checkboxname = get_string('resetalltogglealignment', 'format_topcoll').$OUTPUT->help_icon('resetalltogglealignment', 'format_topcoll');
                $resetallelements[] =& $mform->createElement('checkbox', 'resetalltogglealignment', '', $checkboxname);

                $checkboxname = get_string('resetalltoggleiconset', 'format_topcoll').$OUTPUT->help_icon('resetalltoggleiconset', 'format_topcoll');
                $resetallelements[] =& $mform->createElement('checkbox', 'resetalltoggleiconset', '', $checkboxname);

                $elements[] = $mform->addGroup($resetallelements, 'resetallgroup', get_string('resetallgrp', 'format_topcoll'), null, false);
            }
        }

        return $elements;
    }
Пример #22
0
/**
 * HTML class for a push button
 */
class elis_MoodleQuickForm_xbutton extends HTML_QuickForm_xbutton
{
    function elis_MoodleQuickForm_xbutton($elementName = null, $elementContent = null, $attributes = null)
    {
        parent::HTML_QuickForm_xbutton($elementName, $elementContent, $attributes);
    }
    /**
     * Slightly different container template when frozen. Don't want to display a submit
     * button if the form is frozen.
     *
     * @return string
     */
    function getElementTemplateType()
    {
        if ($this->_flagFrozen) {
            return 'nodisplay';
        } else {
            return 'default';
        }
    }
    function freeze()
    {
        $this->_flagFrozen = true;
    }
}
global $CFG;
MoodleQuickForm::registerElementType('xbutton', "{$CFG->dirroot}/local/eliscore/lib/form/xbutton.php", 'elis_MoodleQuickForm_xbutton');
Пример #23
0
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// 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/>.
/**
 * Library code for the edit roles by capability tool.
 *
 * @package    tool_editrolesbycap
 * @copyright  2012 The Open University
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once $CFG->libdir . '/formslib.php';
require_once dirname(__FILE__) . '/capabilityformfield.php';
MoodleQuickForm::registerElementType('capability', dirname(__FILE__) . '/capabilityformfield.php', 'MoodleQuickForm_capability');
/**
 * Editing form to let the user select a capability.
 *
 * @copyright  2012 The Open University
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class tool_editrolesbycap_capability_form extends moodleform
{
    protected function definition()
    {
        if (empty($this->_customdata['cap'])) {
            $label = get_string('selectacapability', 'tool_editrolesbycap');
        } else {
            $label = get_string('selectadifferentcapability', 'tool_editrolesbycap');
        }
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Defines authors tool widgets class.
 *
 * @copyright  2012 Oleg Sychev, Volgograd State Technical University
 * @author Pahomov Dmitry, Terechov Grigory, Volgograd State Technical University
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
 * @package questions
 */
defined('MOODLE_INTERNAL') || die;
global $CFG;
require_once $CFG->libdir . '/formslib.php';
require_once $CFG->libdir . '/form/textarea.php';
MoodleQuickForm::registerElementType('qtype_poasquestion_text_and_button', $CFG->dirroot . '/question/type/poasquestion/poasquestion_text_and_button.php', 'qtype_poasquestion_text_and_button');
class qtype_poasquestion_text_and_button extends MoodleQuickForm_textarea
{
    protected $buttonName = '';
    protected $linkToPage = '';
    protected $linkToBtnImage = '';
    protected $jsmodule = array('name' => 'poasquestion_text_and_button', 'fullpath' => '/question/type/poasquestion/poasquestion_text_and_button.js');
    protected static $_poasquestion_text_and_button_included = false;
    /**
     * Constructor
     * @param string $textareaName (optional) name of the text field
     * @param string $textareaLabel (optional) text field label
     * @param array $attributes (optional) Either a typical HTML attribute string or an associative array
     * @param string $buttonName (optional) name of the button
     * @param array $elementLinks (optional) link on button image and link on new page
     */
Пример #25
0
// 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/>.
/**
 * The form used at the guide editor page is defined here
 *
 * @package    gradingform_guide
 * @copyright  2012 Dan Marsden <*****@*****.**>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
defined('MOODLE_INTERNAL') || die;
require_once $CFG->dirroot . '/lib/formslib.php';
require_once dirname(__FILE__) . '/guideeditor.php';
MoodleQuickForm::registerElementType('guideeditor', $CFG->dirroot . '/grade/grading/form/guide/guideeditor.php', 'moodlequickform_guideeditor');
/**
 * Defines the guide edit form
 *
 * @package    gradingform_guide
 * @copyright  2012 Dan Marsden <*****@*****.**>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class gradingform_guide_editguide extends moodleform
{
    /**
     * Form element definition
     */
    public function definition()
    {
        $form = $this->_form;
Пример #26
0
                $checkbox = '<input type="checkbox" name="' . $this->_attributes['name'] . '[]" value="' . $file->get_pathnamehash() . '"';
                if (in_array($file->get_pathnamehash(), $this->_value)) {
                    $checkbox .= ' checked="checked"';
                }
                $checkbox .= " />";
                //actions
                $icon = file_file_icon($file);
                $file_url = file_encode_url($CFG->wwwroot . '/pluginfile.php', "/{$this->_contextid}/mod_wiki/attachments/{$this->_fileareaitemid}/" . $file->get_filename());
                $action_icons = "";
                if (!empty($tags['attach'])) {
                    $action_icons .= "<a href=\"javascript:void(0)\" class=\"wiki-attachment-attach\" " . $this->printInsertTags($tags['attach'], $file->get_filename()) . " title=\"" . get_string('attachmentattach', 'wiki') . "\">" . $OUTPUT->pix_icon($icon, "Attach") . "</a>";
                    //TODO: localize
                }
                $action_icons .= "&nbsp;&nbsp;<a href=\"javascript:void(0)\" class=\"wiki-attachment-link\" " . $this->printInsertTags($tags['link'], $file_url) . " title=\"" . get_string('attachmentlink', 'wiki') . "\">" . $OUTPUT->pix_icon($icon, "Link") . "</a>";
                if (file_mimetype_in_typegroup($file->get_mimetype(), 'web_image')) {
                    $action_icons .= "&nbsp;&nbsp;<a href=\"javascript:void(0)\" class=\"wiki-attachment-image\" " . $this->printInsertTags($tags['image'], $file->get_filename()) . " title=\"" . get_string('attachmentimage', 'wiki') . "\">" . $OUTPUT->pix_icon($icon, "Image") . "</a>";
                    //TODO: localize
                }
                $htmltable->data[] = array($checkbox, '<a href="' . $file_url . '">' . $file->get_filename() . '</a>', $action_icons);
            }
        }
        return html_writer::table($htmltable);
    }
    private function printInsertTags($tags, $value)
    {
        return "onclick=\"javascript:insertTags('{$tags[0]}', '{$tags[1]}', '{$value}');\"";
    }
}
//register wikieditor
MoodleQuickForm::registerElementType('wikifiletable', $CFG->dirroot . "/mod/wiki/editors/wikifiletable.php", 'MoodleQuickForm_wikifiletable');
Пример #27
0
/**
 * Inject the competencies elements into all moodle module settings forms.
 *
 * @param moodleform $formwrapper The moodle quickforms wrapper object.
 * @param MoodleQuickForm $mform The actual form object (required to modify the form).
 */
function tool_lp_coursemodule_standard_elements($formwrapper, $mform)
{
    global $CFG, $COURSE;
    if (!get_config('core_competency', 'enabled')) {
        return;
    } else {
        if (!has_capability('moodle/competency:coursecompetencymanage', $formwrapper->get_context())) {
            return;
        }
    }
    $mform->addElement('header', 'competenciessection', get_string('competencies', 'core_competency'));
    MoodleQuickForm::registerElementType('course_competencies', "{$CFG->dirroot}/admin/tool/lp/classes/course_competencies_form_element.php", 'tool_lp_course_competencies_form_element');
    $cmid = null;
    if ($cm = $formwrapper->get_coursemodule()) {
        $cmid = $cm->id;
    }
    $options = array('courseid' => $COURSE->id, 'cmid' => $cmid);
    $mform->addElement('course_competencies', 'competencies', get_string('modcompetencies', 'tool_lp'), $options);
    $mform->addHelpButton('competencies', 'modcompetencies', 'tool_lp');
    MoodleQuickForm::registerElementType('course_competency_rule', "{$CFG->dirroot}/admin/tool/lp/classes/course_competency_rule_form_element.php", 'tool_lp_course_competency_rule_form_element');
    // Reuse the same options.
    $mform->addElement('course_competency_rule', 'competency_rule', get_string('uponcoursemodulecompletion', 'tool_lp'), $options);
}
Пример #28
0
                if (isset($this->_options[$name])) {
                    if (is_array($value) && is_array($this->_options[$name])) {
                        $this->_options[$name] = @array_merge($this->_options[$name], $value);
                    } else {
                        $this->_options[$name] = $value;
                    }
                }
            }
        }
    }
    public function toHtml()
    {
        if (!$this->_flagFrozen) {
            $this->_generateId();
            $id = $this->getAttribute('id');
            global $PAGE;
            $options = array('textelemid' => $id, 'courseid' => $this->_options['courseid'], 'lockcourse' => $this->_options['lockcourse'], 'nocoursestring' => $this->_options['nocoursestring']);
            $PAGE->requires->string_for_js('browse', 'editor');
            $PAGE->requires->string_for_js('loading', 'repository');
            $PAGE->requires->strings_for_js(array('activities', 'gradeitems'), 'grades');
            $PAGE->requires->yui_module('moodle-local_eliscore-gradebook_popup', 'M.local_eliscore.init_gradebook_popup', array($options));
        }
        return parent::toHtml();
    }
}
/* first argument is the string that will be used to identify the element.
 * second argument is the filename that contains the class definition
 * third argument is the class name
 */
MoodleQuickForm::registerElementType(elis_gradebook_idnumber_selector::NAME, __FILE__, 'elis_gradebook_idnumber_selector');
Пример #29
0
MoodleQuickForm::registerElementType('date_time_selector', "{$CFG->libdir}/form/datetimeselector.php", 'MoodleQuickForm_date_time_selector');
MoodleQuickForm::registerElementType('duration', "{$CFG->libdir}/form/duration.php", 'MoodleQuickForm_duration');
MoodleQuickForm::registerElementType('editor', "{$CFG->libdir}/form/editor.php", 'MoodleQuickForm_editor');
MoodleQuickForm::registerElementType('filemanager', "{$CFG->libdir}/form/filemanager.php", 'MoodleQuickForm_filemanager');
MoodleQuickForm::registerElementType('filepicker', "{$CFG->libdir}/form/filepicker.php", 'MoodleQuickForm_filepicker');
MoodleQuickForm::registerElementType('grading', "{$CFG->libdir}/form/grading.php", 'MoodleQuickForm_grading');
MoodleQuickForm::registerElementType('group', "{$CFG->libdir}/form/group.php", 'MoodleQuickForm_group');
MoodleQuickForm::registerElementType('header', "{$CFG->libdir}/form/header.php", 'MoodleQuickForm_header');
MoodleQuickForm::registerElementType('hidden', "{$CFG->libdir}/form/hidden.php", 'MoodleQuickForm_hidden');
MoodleQuickForm::registerElementType('htmleditor', "{$CFG->libdir}/form/htmleditor.php", 'MoodleQuickForm_htmleditor');
MoodleQuickForm::registerElementType('listing', "{$CFG->libdir}/form/listing.php", 'MoodleQuickForm_listing');
MoodleQuickForm::registerElementType('modgrade', "{$CFG->libdir}/form/modgrade.php", 'MoodleQuickForm_modgrade');
MoodleQuickForm::registerElementType('modvisible', "{$CFG->libdir}/form/modvisible.php", 'MoodleQuickForm_modvisible');
MoodleQuickForm::registerElementType('password', "{$CFG->libdir}/form/password.php", 'MoodleQuickForm_password');
MoodleQuickForm::registerElementType('passwordunmask', "{$CFG->libdir}/form/passwordunmask.php", 'MoodleQuickForm_passwordunmask');
MoodleQuickForm::registerElementType('questioncategory', "{$CFG->libdir}/form/questioncategory.php", 'MoodleQuickForm_questioncategory');
MoodleQuickForm::registerElementType('radio', "{$CFG->libdir}/form/radio.php", 'MoodleQuickForm_radio');
MoodleQuickForm::registerElementType('recaptcha', "{$CFG->libdir}/form/recaptcha.php", 'MoodleQuickForm_recaptcha');
MoodleQuickForm::registerElementType('select', "{$CFG->libdir}/form/select.php", 'MoodleQuickForm_select');
MoodleQuickForm::registerElementType('selectgroups', "{$CFG->libdir}/form/selectgroups.php", 'MoodleQuickForm_selectgroups');
MoodleQuickForm::registerElementType('selectwithlink', "{$CFG->libdir}/form/selectwithlink.php", 'MoodleQuickForm_selectwithlink');
MoodleQuickForm::registerElementType('selectyesno', "{$CFG->libdir}/form/selectyesno.php", 'MoodleQuickForm_selectyesno');
MoodleQuickForm::registerElementType('static', "{$CFG->libdir}/form/static.php", 'MoodleQuickForm_static');
MoodleQuickForm::registerElementType('submit', "{$CFG->libdir}/form/submit.php", 'MoodleQuickForm_submit');
MoodleQuickForm::registerElementType('submitlink', "{$CFG->libdir}/form/submitlink.php", 'MoodleQuickForm_submitlink');
MoodleQuickForm::registerElementType('tags', "{$CFG->libdir}/form/tags.php", 'MoodleQuickForm_tags');
MoodleQuickForm::registerElementType('text', "{$CFG->libdir}/form/text.php", 'MoodleQuickForm_text');
MoodleQuickForm::registerElementType('textarea', "{$CFG->libdir}/form/textarea.php", 'MoodleQuickForm_textarea');
MoodleQuickForm::registerElementType('url', "{$CFG->libdir}/form/url.php", 'MoodleQuickForm_url');
MoodleQuickForm::registerElementType('warning', "{$CFG->libdir}/form/warning.php", 'MoodleQuickForm_warning');
MoodleQuickForm::registerRule('required', null, 'MoodleQuickForm_Rule_Required', "{$CFG->libdir}/formslib.php");
Пример #30
0
$GLOBALS['_HTML_QuickForm_default_renderer'] =& new MoodleQuickForm_Renderer();
MoodleQuickForm::registerElementType('checkbox', "{$CFG->libdir}/form/checkbox.php", 'MoodleQuickForm_checkbox');
MoodleQuickForm::registerElementType('file', "{$CFG->libdir}/form/file.php", 'MoodleQuickForm_file');
MoodleQuickForm::registerElementType('group', "{$CFG->libdir}/form/group.php", 'MoodleQuickForm_group');
MoodleQuickForm::registerElementType('password', "{$CFG->libdir}/form/password.php", 'MoodleQuickForm_password');
MoodleQuickForm::registerElementType('passwordunmask', "{$CFG->libdir}/form/passwordunmask.php", 'MoodleQuickForm_passwordunmask');
MoodleQuickForm::registerElementType('radio', "{$CFG->libdir}/form/radio.php", 'MoodleQuickForm_radio');
MoodleQuickForm::registerElementType('select', "{$CFG->libdir}/form/select.php", 'MoodleQuickForm_select');
MoodleQuickForm::registerElementType('selectgroups', "{$CFG->libdir}/form/selectgroups.php", 'MoodleQuickForm_selectgroups');
MoodleQuickForm::registerElementType('submitlink', "{$CFG->libdir}/form/submitlink.php", 'MoodleQuickForm_submitlink');
MoodleQuickForm::registerElementType('text', "{$CFG->libdir}/form/text.php", 'MoodleQuickForm_text');
MoodleQuickForm::registerElementType('textarea', "{$CFG->libdir}/form/textarea.php", 'MoodleQuickForm_textarea');
MoodleQuickForm::registerElementType('date_selector', "{$CFG->libdir}/form/dateselector.php", 'MoodleQuickForm_date_selector');
MoodleQuickForm::registerElementType('date_time_selector', "{$CFG->libdir}/form/datetimeselector.php", 'MoodleQuickForm_date_time_selector');
MoodleQuickForm::registerElementType('htmleditor', "{$CFG->libdir}/form/htmleditor.php", 'MoodleQuickForm_htmleditor');
MoodleQuickForm::registerElementType('format', "{$CFG->libdir}/form/format.php", 'MoodleQuickForm_format');
MoodleQuickForm::registerElementType('static', "{$CFG->libdir}/form/static.php", 'MoodleQuickForm_static');
MoodleQuickForm::registerElementType('hidden', "{$CFG->libdir}/form/hidden.php", 'MoodleQuickForm_hidden');
MoodleQuickForm::registerElementType('modvisible', "{$CFG->libdir}/form/modvisible.php", 'MoodleQuickForm_modvisible');
MoodleQuickForm::registerElementType('selectyesno', "{$CFG->libdir}/form/selectyesno.php", 'MoodleQuickForm_selectyesno');
MoodleQuickForm::registerElementType('modgrade', "{$CFG->libdir}/form/modgrade.php", 'MoodleQuickForm_modgrade');
MoodleQuickForm::registerElementType('cancel', "{$CFG->libdir}/form/cancel.php", 'MoodleQuickForm_cancel');
MoodleQuickForm::registerElementType('button', "{$CFG->libdir}/form/button.php", 'MoodleQuickForm_button');
MoodleQuickForm::registerElementType('choosecoursefile', "{$CFG->libdir}/form/choosecoursefile.php", 'MoodleQuickForm_choosecoursefile');
MoodleQuickForm::registerElementType('choosecoursefileorimsrepo', "{$CFG->libdir}/form/choosecoursefileorimsrepo.php", 'MoodleQuickForm_choosecoursefileorimsrepo');
MoodleQuickForm::registerElementType('header', "{$CFG->libdir}/form/header.php", 'MoodleQuickForm_header');
MoodleQuickForm::registerElementType('submit', "{$CFG->libdir}/form/submit.php", 'MoodleQuickForm_submit');
MoodleQuickForm::registerElementType('questioncategory', "{$CFG->libdir}/form/questioncategory.php", 'MoodleQuickForm_questioncategory');
MoodleQuickForm::registerElementType('advcheckbox', "{$CFG->libdir}/form/advcheckbox.php", 'MoodleQuickForm_advcheckbox');
MoodleQuickForm::registerElementType('recaptcha', "{$CFG->libdir}/form/recaptcha.php", 'MoodleQuickForm_recaptcha');