Exemplo n.º 1
0
 /**
  * Renders the list of available steps according to the submitted filters
  *
  * @param string     $stepsdefinitions HTML from behat with the available steps
  * @param moodleform $form
  * @return string HTML code
  */
 public function render_stepsdefinitions($stepsdefinitions, $form)
 {
     $title = get_string('pluginname', 'tool_behat');
     // Header.
     $html = $this->output->header();
     $html .= $this->output->heading($title);
     // Info.
     $installurl = behat_command::DOCS_URL . '#Installation';
     $installlink = html_writer::tag('a', $installurl, array('href' => $installurl, 'target' => '_blank'));
     $writetestsurl = behat_command::DOCS_URL . '#Writting_features';
     $writetestslink = html_writer::tag('a', $writetestsurl, array('href' => $writetestsurl, 'target' => '_blank'));
     $writestepsurl = behat_command::DOCS_URL . '#Adding_steps_definitions';
     $writestepslink = html_writer::tag('a', $writestepsurl, array('href' => $writestepsurl, 'target' => '_blank'));
     $infos = array(get_string('installinfo', 'tool_behat', $installlink), get_string('newtestsinfo', 'tool_behat', $writetestslink), get_string('newstepsinfo', 'tool_behat', $writestepslink));
     // List of steps
     $html .= $this->output->box_start();
     $html .= html_writer::tag('h1', 'Info');
     $html .= html_writer::empty_tag('div');
     $html .= html_writer::empty_tag('ul');
     $html .= html_writer::empty_tag('li');
     $html .= implode(html_writer::end_tag('li') . html_writer::empty_tag('li'), $infos);
     $html .= html_writer::end_tag('li');
     $html .= html_writer::end_tag('ul');
     $html .= html_writer::end_tag('div');
     $html .= $this->output->box_end();
     // Form.
     ob_start();
     $form->display();
     $html .= ob_get_contents();
     ob_end_clean();
     // Steps definitions.
     $html .= html_writer::tag('div', $stepsdefinitions, array('class' => 'steps-definitions'));
     $html .= $this->output->footer();
     return $html;
 }
Exemplo n.º 2
0
 /**
  * Use this since we can't fetch the output of a moodle form
  * @param moodleform $mform
  * @return type string HTML
  */
 protected function moodleform(moodleform $mform)
 {
     ob_start();
     $mform->display();
     $o = ob_get_contents();
     ob_end_clean();
     return $o;
 }
Exemplo n.º 3
0
 /**
  * Render a formslib form.
  * @param moodleform $form
  * @return string the HTML to output.
  */
 protected function capability_form(moodleform $form)
 {
     ob_start();
     $form->display();
     $output = ob_get_contents();
     ob_end_clean();
     return $output;
 }
Exemplo n.º 4
0
 /**
  * Renders the list of available steps according to the submitted filters.
  *
  * @param mixed $stepsdefinitions Available steps array.
  * @param moodleform $form
  * @return string HTML code
  */
 public function render_stepsdefinitions($stepsdefinitions, $form)
 {
     $title = get_string('pluginname', 'tool_behat');
     // Header.
     $html = $this->output->header();
     $html .= $this->output->heading($title);
     // Info.
     $installurl = behat_command::DOCS_URL . '#Installation';
     $installlink = html_writer::tag('a', $installurl, array('href' => $installurl, 'target' => '_blank'));
     $writetestsurl = behat_command::DOCS_URL . '#Writting_features';
     $writetestslink = html_writer::tag('a', $writetestsurl, array('href' => $writetestsurl, 'target' => '_blank'));
     $writestepsurl = behat_command::DOCS_URL . '#Adding_steps_definitions';
     $writestepslink = html_writer::tag('a', $writestepsurl, array('href' => $writestepsurl, 'target' => '_blank'));
     $infos = array(get_string('installinfo', 'tool_behat', $installlink), get_string('newtestsinfo', 'tool_behat', $writetestslink), get_string('newstepsinfo', 'tool_behat', $writestepslink));
     // List of steps.
     $html .= $this->output->box_start();
     $html .= html_writer::tag('h1', get_string('infoheading', 'tool_behat'));
     $html .= html_writer::tag('div', get_string('aim', 'tool_behat'));
     $html .= html_writer::start_tag('div');
     $html .= html_writer::start_tag('ul');
     $html .= html_writer::start_tag('li');
     $html .= implode(html_writer::end_tag('li') . html_writer::start_tag('li'), $infos);
     $html .= html_writer::end_tag('li');
     $html .= html_writer::end_tag('ul');
     $html .= html_writer::end_tag('div');
     $html .= $this->output->box_end();
     // Form.
     ob_start();
     $form->display();
     $html .= ob_get_contents();
     ob_end_clean();
     if (empty($stepsdefinitions)) {
         $stepsdefinitions = get_string('nostepsdefinitions', 'tool_behat');
     } else {
         $stepsdefinitions = implode('', $stepsdefinitions);
         // Replace text selector type arguments with a user-friendly select.
         $stepsdefinitions = preg_replace_callback('/(TEXT_SELECTOR\\d?_STRING)/', function ($matches) {
             return html_writer::select(behat_selectors::get_allowed_text_selectors(), uniqid());
         }, $stepsdefinitions);
         // Replace selector type arguments with a user-friendly select.
         $stepsdefinitions = preg_replace_callback('/(SELECTOR\\d?_STRING)/', function ($matches) {
             return html_writer::select(behat_selectors::get_allowed_selectors(), uniqid());
         }, $stepsdefinitions);
         // Replace simple OR options.
         $regex = '#\\(\\?P<[^>]+>([^\\)|]+\\|[^\\)]+)\\)#';
         $stepsdefinitions = preg_replace_callback($regex, function ($matches) {
             return html_writer::select(explode('|', $matches[1]), uniqid());
         }, $stepsdefinitions);
     }
     // Steps definitions.
     $html .= html_writer::tag('div', $stepsdefinitions, array('class' => 'steps-definitions'));
     $html .= $this->output->footer();
     return $html;
 }
Exemplo n.º 5
0
 /**
  * Intercept the display of form so can format errors as notifications
  *
  * @global type $OUTPUT
  */
 public function display()
 {
     global $OUTPUT;
     if ($this->_form->_errors) {
         foreach ($this->_form->_errors as $error) {
             echo $OUTPUT->notification($error, 'notifyproblem');
         }
         unset($this->_form->_errors);
     }
     parent::display();
 }
Exemplo n.º 6
0
    /**
     * Renders the list of available steps according to the submitted filters.
     *
     * @param mixed $stepsdefinitions Available steps array.
     * @param moodleform $form
     * @return string HTML code
     */
    public function render_stepsdefinitions($stepsdefinitions, $form) {

        $html = $this->generic_info();

        // Form.
        ob_start();
        $form->display();
        $html .= ob_get_contents();
        ob_end_clean();

        if (empty($stepsdefinitions)) {
            $stepsdefinitions = get_string('nostepsdefinitions', 'tool_behat');
        } else {

            $stepsdefinitions = implode('', $stepsdefinitions);

            // Replace text selector type arguments with a user-friendly select.
            $stepsdefinitions = preg_replace_callback('/(TEXT_SELECTOR\d?_STRING)/',
                function ($matches) {
                    return html_writer::select(behat_selectors::get_allowed_text_selectors(), uniqid());
                },
                $stepsdefinitions
            );

            // Replace selector type arguments with a user-friendly select.
            $stepsdefinitions = preg_replace_callback('/(SELECTOR\d?_STRING)/',
                function ($matches) {
                    return html_writer::select(behat_selectors::get_allowed_selectors(), uniqid());
                },
                $stepsdefinitions
            );

            // Replace simple OR options.
            $regex = '#\(\?P<[^>]+>([^\)|]+\|[^\)]+)\)#';
            $stepsdefinitions = preg_replace_callback($regex,
                function($matches){
                    return html_writer::select(explode('|', $matches[1]), uniqid());
                },
                $stepsdefinitions
            );

        }

        // Steps definitions.
        $html .= html_writer::tag('div', $stepsdefinitions, array('class' => 'steps-definitions'));

        $html .= $this->output->footer();

        return $html;
    }
Exemplo n.º 7
0
function organizer_display_form(moodleform $mform, $title, $addcalendar = true)
{
    global $OUTPUT;
    if ($addcalendar) {
        organizer_add_calendar();
    }
    echo $OUTPUT->header();
    echo $OUTPUT->heading($title);
    echo $OUTPUT->box_start('', 'organizer_main_cointainer');
    $mform->display();
    echo $OUTPUT->box_end();
    echo $OUTPUT->footer();
    die;
}
Exemplo n.º 8
0
 /**
  * Renders the list of available steps according to the submitted filters.
  *
  * @param mixed $stepsdefinitions Available steps array.
  * @param moodleform $form
  * @return string HTML code
  */
 public function render_stepsdefinitions($stepsdefinitions, $form)
 {
     $html = $this->generic_info();
     // Form.
     ob_start();
     $form->display();
     $html .= ob_get_contents();
     ob_end_clean();
     if (empty($stepsdefinitions)) {
         $stepsdefinitions = get_string('nostepsdefinitions', 'tool_behat');
     } else {
         $stepsdefinitions = implode('', $stepsdefinitions);
         // Replace text selector type arguments with a user-friendly select.
         $stepsdefinitions = preg_replace_callback('/(TEXT_SELECTOR\\d?_STRING)/', function ($matches) {
             return html_writer::select(behat_selectors::get_allowed_text_selectors(), uniqid());
         }, $stepsdefinitions);
         // Replace selector type arguments with a user-friendly select.
         $stepsdefinitions = preg_replace_callback('/(SELECTOR\\d?_STRING)/', function ($matches) {
             return html_writer::select(behat_selectors::get_allowed_selectors(), uniqid());
         }, $stepsdefinitions);
         // Replace simple OR options.
         $regex = '#\\(\\?P<[^>]+>([^\\)|]+\\|[^\\)]+)\\)#';
         $stepsdefinitions = preg_replace_callback($regex, function ($matches) {
             return html_writer::select(explode('|', $matches[1]), uniqid());
         }, $stepsdefinitions);
         $stepsdefinitions = preg_replace_callback('/(FIELD_VALUE_STRING)/', function ($matches) {
             global $CFG;
             // Creating a link to a popup with the help.
             $url = new moodle_url('/help.php', array('component' => 'tool_behat', 'identifier' => 'fieldvalueargument', 'lang' => current_language()));
             // Note: this title is displayed only if JS is disabled,
             // otherwise the link will have the new ajax tooltip.
             $title = get_string('fieldvalueargument', 'tool_behat');
             $title = get_string('helpprefix2', '', trim($title, ". \t"));
             $attributes = array('href' => $url, 'title' => $title, 'aria-haspopup' => 'true', 'target' => '_blank');
             $output = html_writer::tag('a', 'FIELD_VALUE_STRING', $attributes);
             return html_writer::tag('span', $output, array('class' => 'helptooltip'));
         }, $stepsdefinitions);
     }
     // Steps definitions.
     $html .= html_writer::tag('div', $stepsdefinitions, array('class' => 'steps-definitions'));
     $html .= $this->output->footer();
     return $html;
 }
Exemplo n.º 9
0
 function display()
 {
     parent::display();
     form_init_date_js();
 }
Exemplo n.º 10
0
 /**
  * Displays the form
  */
 public function display()
 {
     global $PAGE, $COURSE;
     $this->require_definition_after_data();
     $config = new stdClass();
     $config->title = get_string('confirmcancel', 'backup');
     $config->question = get_string('confirmcancelquestion', 'backup');
     $config->yesLabel = get_string('confirmcancelyes', 'backup');
     $config->noLabel = get_string('confirmcancelno', 'backup');
     $config->closeButtonTitle = get_string('close', 'editor');
     $PAGE->requires->yui_module('moodle-backup-confirmcancel', 'M.core_backup.confirmcancel.watch_cancel_buttons', array($config));
     // Get list of module types on course.
     $modinfo = get_fast_modinfo($COURSE);
     $modnames = $modinfo->get_used_module_names(true);
     $PAGE->requires->yui_module('moodle-backup-backupselectall', 'M.core_backup.backupselectall', array($modnames));
     $PAGE->requires->strings_for_js(array('select', 'all', 'none'), 'moodle');
     $PAGE->requires->strings_for_js(array('showtypes', 'hidetypes'), 'backup');
     parent::display();
 }
Exemplo n.º 11
0
 function display()
 {
     parent::display();
     echo "<script>\n\t        function showFullForm(form) {\n\t           var e = document.getElementById('id_period');\n               if(!e) {\n                  return;\n               }\n               var period = e.options[e.selectedIndex].value;\n            // Custom period shows dates\n\t           if (period == 50) {\n                    document.getElementById('fitem_id_startdate').style.display = 'block';\n                    document.getElementById('fitem_id_enddate').style.display = 'block';\n                    document.getElementById('fitem_id_submitbutton').style.display = 'block';\t        \n                } else {\n                    document.getElementById('fitem_id_startdate').style.display = 'none';\n                    document.getElementById('fitem_id_enddate').style.display = 'none';\n                    document.getElementById('fitem_id_submitbutton').style.display = 'none';\t        \n\t                if(period > 0)\n\t                   form.submit();\n                }\t\n\t       }\n            showFullForm();\n\t        </script>";
 }
Exemplo n.º 12
0
 /**
  * Displays the form
  */
 public function display()
 {
     global $PAGE;
     $this->require_definition_after_data();
     $config = new stdClass();
     $config->title = get_string('confirmcancel', 'backup');
     $config->question = get_string('confirmcancelquestion', 'backup');
     $config->yesLabel = get_string('confirmcancelyes', 'backup');
     $config->noLabel = get_string('confirmcancelno', 'backup');
     $PAGE->requires->yui_module('moodle-backup-confirmcancel', 'M.core_backup.watch_cancel_buttons', array($config));
     parent::display();
 }
Exemplo n.º 13
0
 /**
  * Displays the form
  */
 public function display()
 {
     $this->require_definition_after_data();
     parent::display();
 }
Exemplo n.º 14
0
 /**
  * renders the add question form
  *
  * @param moodleform $mform
  */
 public function editrender_addquestionform($mform)
 {
     echo $mform->display();
 }
 /**
  * Display the form, saving the contents of the output buffer overiding Moodle's
  * display function that prints to screen when called
  *
  * @return the form as an object to print to screen at our convenience
  */
 public function display()
 {
     ob_start();
     parent::display();
     $form = ob_get_contents();
     ob_end_clean();
     return $form;
 }
Exemplo n.º 16
0
 /**
  * Displays the form
  */
 public function display()
 {
     global $PAGE;
     $this->require_definition_after_data();
     $config = new stdClass();
     $config->title = get_string('confirmcancel', 'backup');
     $config->question = get_string('confirmcancelquestion', 'backup');
     $config->yesLabel = get_string('confirmcancelyes', 'backup');
     $config->noLabel = get_string('confirmcancelno', 'backup');
     $config->closeButtonTitle = get_string('close', 'editor');
     $PAGE->requires->yui_module('moodle-backup-confirmcancel', 'M.core_backup.watch_cancel_buttons', array($config));
     $PAGE->requires->yui_module('moodle-backup-backupselectall', 'M.core_backup.select_all_init', array(array('select' => get_string('select'), 'all' => get_string('all'), 'none' => get_string('none'))));
     parent::display();
 }
Exemplo n.º 17
0
 function display()
 {
     parent::display();
     echo $this->extraScript;
 }