当前位置: 首页>>代码示例>>PHP>>正文


PHP html_writer::select方法代码示例

本文整理汇总了PHP中html_writer::select方法的典型用法代码示例。如果您正苦于以下问题:PHP html_writer::select方法的具体用法?PHP html_writer::select怎么用?PHP html_writer::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在html_writer的用法示例。


在下文中一共展示了html_writer::select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: definition

 /**
  * Form definition.
  */
 public function definition()
 {
     global $CFG, $PAGE;
     $mform =& $this->_form;
     $mform->addElement('header', 'general', '');
     $mform->addElement('hidden', 'type', $this->_customdata['type']);
     $mform->setType('type', PARAM_ALPHA);
     // This is similar to how the selects are created for the role tables,
     // without using a Moodle form element.
     $select = html_writer::select(array(13 => 'ArrayOpt13', 42 => 'ArrayOpt4', 666 => 'ArrayOpt666'), 'arraytest[]', array(13, 42), false, array('multiple' => 'multiple', 'size' => 10));
     $mform->addElement('static', 'arraybit', $select);
     switch ($this->_customdata['control']) {
         case 'c':
             // Create a whole stack of checkboxes.
             for ($i = 0; $i < $this->_customdata['fieldcount']; $i++) {
                 $mform->addElement('advcheckbox', 'test_c' . $i, 'Checkbox ' . $i);
             }
             break;
         case 'a':
             // Create a very large array input type field.
             $options = array();
             $values = array();
             for ($i = 0; $i < $this->_customdata['fieldcount']; $i++) {
                 $options[$i] = 'BigArray ' . $i;
                 if ($i !== 3) {
                     $values[] = $i;
                 }
             }
             $select = html_writer::select($options, 'test_a[]', $values, false, array('multiple' => 'multiple', 'size' => 50));
             $mform->addElement('static', 'bigarraybit', $select);
             break;
     }
     // For the sake of it, let's have a second array.
     $select = html_writer::select(array(13 => 'Array2Opt13', 42 => 'Array2Opt4', 666 => 'Array2Opt666'), 'array2test[]', array(13, 42), false, array('multiple' => 'multiple', 'size' => 10));
     $mform->addElement('static', 'array2bit', $select);
     $mform->addElement('submit', 'submitbutton', 'Submit here!');
 }
开发者ID:evltuma,项目名称:moodle,代码行数:40,代码来源:max_input_vars.php

示例2: module_specific_controls

/**
 * Callback function called from question_list() function
 * (which is called from showbank())
 */
function module_specific_controls($totalnumber, $recurse, $category, $cmid, $cmoptions)
{
    global $OUTPUT;
    $out = '';
    $catcontext = get_context_instance_by_id($category->contextid);
    if (has_capability('moodle/question:useall', $catcontext)) {
        if ($cmoptions->hasattempts) {
            $disabled = ' disabled="disabled"';
        } else {
            $disabled = '';
        }
        $randomusablequestions = question_bank::get_qtype('random')->get_available_questions_from_category($category->id, $recurse);
        $maxrand = count($randomusablequestions);
        if ($maxrand > 0) {
            for ($i = 1; $i <= min(10, $maxrand); $i++) {
                $randomcount[$i] = $i;
            }
            for ($i = 20; $i <= min(100, $maxrand); $i += 10) {
                $randomcount[$i] = $i;
            }
        } else {
            $randomcount[0] = 0;
            $disabled = ' disabled="disabled"';
        }
        $out = '<strong><label for="menurandomcount">' . get_string('addrandomfromcategory', 'quiz') . '</label></strong><br />';
        $attributes = array();
        $attributes['disabled'] = $disabled ? 'disabled' : null;
        $select = html_writer::select($randomcount, 'randomcount', '1', null, $attributes);
        $out .= get_string('addrandom', 'quiz', $select);
        $out .= '<input type="hidden" name="recurse" value="' . $recurse . '" />';
        $out .= '<input type="hidden" name="categoryid" value="' . $category->id . '" />';
        $out .= ' <input type="submit" name="addrandom" value="' . get_string('addtoquiz', 'quiz') . '"' . $disabled . ' />';
        $out .= $OUTPUT->help_icon('addarandomquestion', 'quiz');
    }
    return $out;
}
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:40,代码来源:edit.php

示例3: get_string

    }
    $table->print_html();
}
if ($bulkoperations) {
    echo '<br /><div class="buttons">';
    echo '<input type="button" id="checkall" value="' . get_string('selectall') . '" /> ';
    echo '<input type="button" id="checknone" value="' . get_string('deselectall') . '" /> ';
    $displaylist = array();
    $displaylist['messageselect.php'] = get_string('messageselectadd');
    if (!empty($CFG->enablenotes) && has_capability('moodle/notes:manage', $context) && $context->id != $frontpagectx->id) {
        $displaylist['addnote.php'] = get_string('addnewnote', 'notes');
        $displaylist['groupaddnote.php'] = get_string('groupaddnewnote', 'notes');
    }
    echo $OUTPUT->help_icon('withselectedusers');
    echo html_writer::tag('label', get_string("withselectedusers"), array('for' => 'formactionid'));
    echo html_writer::select($displaylist, 'formaction', '', array('' => 'choosedots'), array('id' => 'formactionid'));
    echo '<input type="hidden" name="id" value="' . $course->id . '" />';
    echo '<noscript style="display:inline">';
    echo '<div><input type="submit" value="' . get_string('ok') . '" /></div>';
    echo '</noscript>';
    echo '</div></div>';
    echo '</form>';
    $module = array('name' => 'core_user', 'fullpath' => '/user/module.js');
    $PAGE->requires->js_init_call('M.core_user.init_participation', null, false, $module);
}
// Show a search box if all participants don't fit on a single screen.
if ($totalcount > $perpage) {
    echo '<form action="index.php" class="searchform"><div><input type="hidden" name="id" value="' . $course->id . '" />';
    echo '<label for="search">' . get_string('search', 'search') . ' </label>';
    echo '<input type="text" id="search" name="search" value="' . s($search) . '" />&nbsp;<input type="submit" value="' . get_string('search') . '" /></div></form>' . "\n";
}
开发者ID:educakanchay,项目名称:campus,代码行数:31,代码来源:index.php

示例4: display

 public function display($discussion)
 {
     // Obtain list of other forums in this course where the user has the
     // 'move discussion' feature
     $course = $discussion->get_forum()->get_course();
     $modinfo = get_fast_modinfo($course);
     $results = array();
     foreach ($modinfo->instances['forumng'] as $other) {
         // Don't let user move discussion to its current forum
         if ($other->instance == $discussion->get_forum()->get_id() || $other->id == $discussion->get_forum()->get_course_module_id()) {
             continue;
         }
         $othercontext = context_module::instance($other->id);
         if (has_capability('mod/forumng:movediscussions', $othercontext)) {
             $results[$other->id] = $other->name;
         }
     }
     if (count($results) == 0) {
         return '';
     }
     // Make list alphabetical
     uasort($results, array('forumngfeature_move', 'sort_ignore_case'));
     // Build select using the list
     $out = mod_forumng_utils::get_renderer();
     $select = html_writer::select($results, 'target', '', array('' => get_string('movethisdiscussionto', 'forumngfeature_move')));
     return '<form method="post" action="feature/move/move.php"><div>' . $discussion->get_link_params(mod_forumng::PARAM_FORM) . $select . '<input class="forumng-zero-disable" ' . 'type="submit" value="' . get_string('move') . '" /></div></form>';
 }
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:27,代码来源:forumngfeature_move.php

示例5: display_search_field

 function display_search_field($content = '')
 {
     global $CFG, $DB;
     $varcharcontent = $DB->sql_compare_text('content', 255);
     $sql = "SELECT DISTINCT {$varcharcontent} AS content\n                  FROM {data_content}\n                 WHERE fieldid=? AND content IS NOT NULL";
     $usedoptions = array();
     if ($used = $DB->get_records_sql($sql, array($this->field->id))) {
         foreach ($used as $data) {
             $value = $data->content;
             if ($value === '') {
                 continue;
             }
             $usedoptions[$value] = $value;
         }
     }
     $options = array();
     foreach (explode("\n", $this->field->param1) as $option) {
         $option = trim($option);
         if (!isset($usedoptions[$option])) {
             continue;
         }
         $options[$option] = $option;
     }
     if (!$options) {
         // oh, nothing to search for
         return '';
     }
     $return = html_writer::label(get_string('namemenu', 'data'), 'menuf_' . $this->field->id, false, array('class' => 'accesshide'));
     $return .= html_writer::select($options, 'f_' . $this->field->id, $content);
     return $return;
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:31,代码来源:field.class.php

示例6: embedded_element

 protected function embedded_element(question_attempt $qa, $place, question_display_options $options)
 {
     $question = $qa->get_question();
     $group = $question->places[$place];
     $fieldname = $question->field($place);
     $value = $qa->get_last_qt_var($question->field($place));
     $attributes = array('id' => $this->box_id($qa, 'p' . $place));
     $groupclass = 'group' . $group;
     if ($options->readonly) {
         $attributes['disabled'] = 'disabled';
     }
     $orderedchoices = $question->get_ordered_choices($group);
     $selectoptions = array();
     foreach ($orderedchoices as $orderedchoicevalue => $orderedchoice) {
         $selectoptions[$orderedchoicevalue] = $orderedchoice->text;
     }
     $feedbackimage = '';
     if ($options->correctness) {
         $response = $qa->get_last_qt_data();
         if (array_key_exists($fieldname, $response)) {
             $fraction = (int) ($response[$fieldname] == $question->get_right_choice_for($place));
             $attributes['class'] = $this->feedback_class($fraction);
             $feedbackimage = $this->feedback_image($fraction);
         }
     }
     $selecthtml = html_writer::select($selectoptions, $qa->get_qt_field_name($fieldname), $value, get_string('choosedots'), $attributes) . ' ' . $feedbackimage;
     return html_writer::tag('span', $selecthtml, array('class' => 'control ' . $groupclass));
 }
开发者ID:ndunand,项目名称:moodle-qtype_gapselect,代码行数:28,代码来源:renderer.php

示例7: display_options_adv

 public function display_options_adv()
 {
     echo "<br />\n";
     $options = array(self::ONLYUNUSED => get_string('onlyunused', 'local_unusedquestions'), self::ONLYUSED => get_string('onlyused', 'local_unusedquestions'));
     $attr = array('class' => 'searchoptions');
     echo html_writer::select($options, 'onlyused', $this->onlyused, array(self::ONLYANY => get_string('usedandunused', 'local_unusedquestions')), $attr);
 }
开发者ID:actXc,项目名称:moodle_local_unusedquestions,代码行数:7,代码来源:lib.php

示例8: construct_ablock_select

 private function construct_ablock_select(question_attempt $qa, question_display_options $options)
 {
     $question = $qa->get_question();
     $response = $qa->get_last_qt_data();
     $stemorder = $question->get_stem_order();
     $choices = $this->format_choices($question);
     $o = html_writer::start_tag('table', array('class' => 'answer'));
     $o .= html_writer::start_tag('tbody');
     $parity = 0;
     foreach ($stemorder as $key => $stemid) {
         $o .= html_writer::start_tag('tr', array('class' => 'r' . $parity));
         $o .= html_writer::tag('td', $question->format_text($question->stems[$stemid], $question->stemformat[$stemid], $qa, 'qtype_order', 'subquestion', $stemid), array('class' => 'text'));
         $classes = 'control';
         $feedback = $this->get_feedback_class_image($qa, $options, $key);
         if ($feedback->class) {
             $classes .= ' ' . $feedback->class;
         }
         $selected = $this->get_selected($question, $response, $key);
         $o .= html_writer::tag('td', html_writer::select($choices, $qa->get_qt_field_name($question->get_field_name($key)), $selected, array('0' => 'choose'), array('disabled' => $options->readonly)) . ' ' . $feedback->image, array('class' => $classes));
         $o .= html_writer::end_tag('tr');
         $parity = 1 - $parity;
     }
     $o .= html_writer::end_tag('tbody');
     $o .= html_writer::end_tag('table');
     return $o;
 }
开发者ID:jacac,项目名称:qtype_order,代码行数:26,代码来源:renderer.php

示例9: subquestion

 public function subquestion(question_attempt $qa, question_display_options $options, qtype_combined_combinable_base $subq, $placeno)
 {
     $question = $subq->question;
     $place = $placeno + 1;
     $group = $question->places[$place];
     $fieldname = $subq->step_data_name($question->field($place));
     $value = $qa->get_last_qt_var($fieldname);
     $attributes = array('id' => str_replace(':', '_', $qa->get_qt_field_name($fieldname)));
     if ($options->readonly) {
         $attributes['disabled'] = 'disabled';
     }
     $orderedchoices = $question->get_ordered_choices($group);
     $selectoptions = array();
     foreach ($orderedchoices as $orderedchoicevalue => $orderedchoice) {
         $selectoptions[$orderedchoicevalue] = $orderedchoice->text;
     }
     $feedbackimage = '';
     if ($options->correctness) {
         $response = $qa->get_last_qt_data();
         if (array_key_exists($fieldname, $response)) {
             $fraction = (int) ($response[$fieldname] == $question->get_right_choice_for($place));
             $attributes['class'] = $this->feedback_class($fraction);
             $feedbackimage = $this->feedback_image($fraction);
         }
     }
     $selecthtml = html_writer::select($selectoptions, $qa->get_qt_field_name($fieldname), $value, get_string('choosedots'), $attributes) . ' ' . $feedbackimage;
     return html_writer::tag('span', $selecthtml, array('class' => 'control'));
 }
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:28,代码来源:renderer.php

示例10: render

 public function render(stack_input_state $state, $fieldname, $readonly)
 {
     $attributes = array();
     if ($readonly) {
         $attributes['disabled'] = 'disabled';
     }
     return html_writer::select(self::get_choices(), $fieldname, $this->contents_to_maxima($state->contents), '', $attributes);
 }
开发者ID:sowirepo,项目名称:moodle-qtype_stack,代码行数:8,代码来源:boolean.class.php

示例11: render

 public function render(stack_input_state $state, $fieldname, $readonly)
 {
     $values = $this->get_choices();
     if (empty($values)) {
         return stack_string('ddl_empty');
     }
     $attributes = array();
     if ($readonly) {
         $attributes['disabled'] = 'disabled';
     }
     return html_writer::select($values, $fieldname, $this->contents_to_maxima($state->contents), array('' => stack_string('notanswered')), $attributes);
 }
开发者ID:sowirepo,项目名称:moodle-qtype_stack,代码行数:12,代码来源:dropdown.class.php

示例12: display_search_field

 function display_search_field($value = '')
 {
     global $CFG, $DB;
     $varcharlat = $DB->sql_compare_text('content');
     $varcharlong = $DB->sql_compare_text('content1');
     $latlongsrs = $DB->get_recordset_sql("SELECT DISTINCT {$varcharlat} AS la, {$varcharlong} AS lo\n               FROM {data_content}\n              WHERE fieldid = ?\n             ORDER BY {$varcharlat}, {$varcharlong}", array($this->field->id));
     $options = array();
     foreach ($latlongsrs as $latlong) {
         $options[$latlong->la . ',' . $latlong->lo] = $latlong->la . ',' . $latlong->lo;
     }
     $latlongsrs->close();
     return html_writer::select($options, 'f_' . $this->field->id, $value);
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:13,代码来源:field.class.php

示例13: render_stepsdefinitions

    /**
     * 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;
    }
开发者ID:rwijaya,项目名称:moodle,代码行数:57,代码来源:renderer.php

示例14: render_stepsdefinitions

 /**
  * 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);
     }
     // Steps definitions.
     $html .= html_writer::tag('div', $stepsdefinitions, array('class' => 'steps-definitions'));
     $html .= $this->output->footer();
     return $html;
 }
开发者ID:verbazend,项目名称:AWFA,代码行数:56,代码来源:renderer.php

示例15: display_search_field

 function display_search_field($value = '')
 {
     global $CFG, $DB;
     $varcharcontent = $DB->sql_compare_text('content', 255);
     $used = $DB->get_records_sql("SELECT DISTINCT {$varcharcontent} AS content\n               FROM {data_content}\n              WHERE fieldid=?\n             ORDER BY {$varcharcontent}", array($this->field->id));
     $options = array();
     if (!empty($used)) {
         foreach ($used as $rec) {
             $options[$rec->content] = $rec->content;
             //Build following indicies from the sql.
         }
     }
     $return = html_writer::label(get_string('nameradiobutton', 'data'), 'menuf_' . $this->field->id, false, array('class' => 'accesshide'));
     $return .= html_writer::select($options, 'f_' . $this->field->id, $value);
     return $return;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:16,代码来源:field.class.php


注:本文中的html_writer::select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。