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


PHP html_writer::label方法代码示例

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


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

示例1: 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

示例2: display_options_adv

 public function display_options_adv()
 {
     echo "<br />\n";
     echo html_writer::label(get_string('searchtext', 'local_searchquestions'), 'searchtext');
     echo html_writer::empty_tag('input', array('name' => 'searchtext', 'id' => 'searchtext', 'class' => 'searchoptions', 'value' => $this->searchtext));
     echo "<br />\n";
     echo html_writer::empty_tag('input', array('type' => 'checkbox', 'name' => 'searchanswers', 'id' => 'searchanswers', 'class' => 'searchoptions', 'value' => 1));
     echo html_writer::label(get_string('searchanswers', 'local_searchquestions'), 'searchanswers');
 }
开发者ID:advancingdesign,项目名称:moodle_local_searchquestions,代码行数:9,代码来源:lib.php

示例3: 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

示例4: 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) {
         $latitude = format_float($latlong->la, 4);
         $longitude = format_float($latlong->lo, 4);
         $options[$latlong->la . ',' . $latlong->lo] = $latitude . ' ' . $longitude;
     }
     $latlongsrs->close();
     $return = html_writer::label(get_string('latlong', 'data'), 'menuf_' . $this->field->id, false, array('class' => 'accesshide'));
     $return .= html_writer::select($options, 'f_' . $this->field->id, $value);
     return $return;
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:17,代码来源:field.class.php

示例5: display_options_adv

 public function display_options_adv()
 {
     global $DB;
     global $output;
     require_login();
     $tags = $this->get_tags_used();
     $attr = array('multiple' => 'true', 'class' => 'searchoptions large searchbytags');
     if (count($tags) > 10) {
         $attr['size'] = 10;
     }
     echo html_writer::label('Show questions with tags:', 'tags[]');
     echo "<br />\n";
     echo html_writer::select($tags, 'tags[]', $this->tags, array('' => '--show all--'), $attr);
     echo "<br />\n";
     echo html_writer::label('Show questions WITHOUT tags:', 'tags[]');
     echo "<br />\n";
     echo html_writer::select($tags, 'nottags[]', $this->nottags, array('' => '--show all--'), $attr);
     echo "<br />\n";
 }
开发者ID:advancingdesign,项目名称:moodle_local_searchbytags,代码行数:19,代码来源:lib.php

示例6: formulation_and_controls

 public function formulation_and_controls(question_attempt $qa, question_display_options $options)
 {
     $question = $qa->get_question();
     $stemorder = $question->get_stem_order();
     $response = $qa->get_last_qt_data();
     $choices = $this->format_choices($question);
     $result = '';
     $result .= html_writer::tag('div', $question->format_questiontext($qa), array('class' => 'qtext'));
     $result .= html_writer::start_tag('div', array('class' => 'ablock'));
     $result .= html_writer::start_tag('table', array('class' => 'answer'));
     $result .= html_writer::start_tag('tbody');
     $parity = 0;
     $i = 1;
     foreach ($stemorder as $key => $stemid) {
         $result .= html_writer::start_tag('tr', array('class' => 'r' . $parity));
         $fieldname = 'sub' . $key;
         $result .= html_writer::tag('td', $this->format_stem_text($qa, $stemid), array('class' => 'text'));
         $classes = 'control';
         $feedbackimage = '';
         if (array_key_exists($fieldname, $response)) {
             $selected = $response[$fieldname];
         } else {
             $selected = 0;
         }
         $fraction = (int) ($selected && $selected == $question->get_right_choice_for($stemid));
         if ($options->correctness && $selected) {
             $classes .= ' ' . $this->feedback_class($fraction);
             $feedbackimage = $this->feedback_image($fraction);
         }
         $result .= html_writer::tag('td', html_writer::label(get_string('answer', 'qtype_match', $i), 'menu' . $qa->get_qt_field_name('sub' . $key), false, array('class' => 'accesshide')) . html_writer::select($choices, $qa->get_qt_field_name('sub' . $key), $selected, array('0' => 'choose'), array('disabled' => $options->readonly)) . ' ' . $feedbackimage, array('class' => $classes));
         $result .= html_writer::end_tag('tr');
         $parity = 1 - $parity;
         $i++;
     }
     $result .= html_writer::end_tag('tbody');
     $result .= html_writer::end_tag('table');
     $result .= html_writer::end_tag('div');
     // Closes <div class="ablock">.
     if ($qa->get_state() == question_state::$invalid) {
         $result .= html_writer::nonempty_tag('div', $question->get_validation_error($response), array('class' => 'validationerror'));
     }
     return $result;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:43,代码来源:renderer.php

示例7: output_html

 /**
  * Returns XHTML select field and wrapping div(s)
  *
  * @see output_select_html()
  *
  * @param string $data the option to show as selected
  * @param string $query
  * @return string XHTML field and wrapping div
  */
 public function output_html($data, $query = '')
 {
     $html = '';
     $baseid = $this->get_id();
     $inputname = $this->get_full_name();
     foreach ($this->flowtypes as $flowtype) {
         $html .= \html_writer::start_div();
         $flowtypeid = $baseid . '_' . $flowtype;
         $radioattrs = ['type' => 'radio', 'name' => $inputname, 'id' => $flowtypeid, 'value' => $flowtype];
         if ($data === $flowtype || empty($data) && $flowtype === $this->get_defaultsetting()) {
             $radioattrs['checked'] = 'checked';
         }
         $typename = get_string('cfg_loginflow_' . $flowtype, 'auth_oidc');
         $typedesc = get_string('cfg_loginflow_' . $flowtype . '_desc', 'auth_oidc');
         $html .= \html_writer::empty_tag('input', $radioattrs);
         $html .= \html_writer::label($typename, $flowtypeid, false);
         $html .= '<br />';
         $html .= \html_writer::span($typedesc);
         $html .= '<br /><br />';
         $html .= \html_writer::end_div();
     }
     return format_admin_setting($this, $this->visiblename, $html, $this->description, true, '', null, $query);
 }
开发者ID:eugeneventer,项目名称:o365-moodle,代码行数:32,代码来源:loginflow.php

示例8: render_rating

    /**
     * Produces the html that represents this rating in the UI
     *
     * @param rating $rating the page object on which this rating will appear
     * @return string
     */
    function render_rating(rating $rating) {
        global $CFG, $USER;

        if ($rating->settings->aggregationmethod == RATING_AGGREGATE_NONE) {
            return null;//ratings are turned off
        }

        $ratingmanager = new rating_manager();
        // Initialise the JavaScript so ratings can be done by AJAX.
        $ratingmanager->initialise_rating_javascript($this->page);

        $strrate = get_string("rate", "rating");
        $ratinghtml = ''; //the string we'll return

        // permissions check - can they view the aggregate?
        if ($rating->user_can_view_aggregate()) {

            $aggregatelabel = $ratingmanager->get_aggregate_label($rating->settings->aggregationmethod);
            $aggregatestr   = $rating->get_aggregate_string();

            $aggregatehtml  = html_writer::tag('span', $aggregatestr, array('id' => 'ratingaggregate'.$rating->itemid, 'class' => 'ratingaggregate')).' ';
            if ($rating->count > 0) {
                $countstr = "({$rating->count})";
            } else {
                $countstr = '-';
            }
            $aggregatehtml .= html_writer::tag('span', $countstr, array('id'=>"ratingcount{$rating->itemid}", 'class' => 'ratingcount')).' ';

            $ratinghtml .= html_writer::tag('span', $aggregatelabel, array('class'=>'rating-aggregate-label'));
            if ($rating->settings->permissions->viewall && $rating->settings->pluginpermissions->viewall) {

                $nonpopuplink = $rating->get_view_ratings_url();
                $popuplink = $rating->get_view_ratings_url(true);

                $action = new popup_action('click', $popuplink, 'ratings', array('height' => 400, 'width' => 600));
                $ratinghtml .= $this->action_link($nonpopuplink, $aggregatehtml, $action);
            } else {
                $ratinghtml .= $aggregatehtml;
            }
        }

        $formstart = null;
        // if the item doesn't belong to the current user, the user has permission to rate
        // and we're within the assessable period
        if ($rating->user_can_rate()) {

            $rateurl = $rating->get_rate_url();
            $inputs = $rateurl->params();

            //start the rating form
            $formattrs = array(
                'id'     => "postrating{$rating->itemid}",
                'class'  => 'postratingform',
                'method' => 'post',
                'action' => $rateurl->out_omit_querystring()
            );
            $formstart  = html_writer::start_tag('form', $formattrs);
            $formstart .= html_writer::start_tag('div', array('class' => 'ratingform'));

            // add the hidden inputs
            foreach ($inputs as $name => $value) {
                $attributes = array('type' => 'hidden', 'class' => 'ratinginput', 'name' => $name, 'value' => $value);
                $formstart .= html_writer::empty_tag('input', $attributes);
            }

            if (empty($ratinghtml)) {
                $ratinghtml .= $strrate.': ';
            }
            $ratinghtml = $formstart.$ratinghtml;

            $scalearray = array(RATING_UNSET_RATING => $strrate.'...') + $rating->settings->scale->scaleitems;
            $scaleattrs = array('class'=>'postratingmenu ratinginput','id'=>'menurating'.$rating->itemid);
            $ratinghtml .= html_writer::label($rating->rating, 'menurating'.$rating->itemid, false, array('class' => 'accesshide'));
            $ratinghtml .= html_writer::select($scalearray, 'rating', $rating->rating, false, $scaleattrs);

            //output submit button
            $ratinghtml .= html_writer::start_tag('span', array('class'=>"ratingsubmit"));

            $attributes = array('type' => 'submit', 'class' => 'postratingmenusubmit', 'id' => 'postratingsubmit'.$rating->itemid, 'value' => s(get_string('rate', 'rating')));
            $ratinghtml .= html_writer::empty_tag('input', $attributes);

            if (!$rating->settings->scale->isnumeric) {
                // If a global scale, try to find current course ID from the context
                if (empty($rating->settings->scale->courseid) and $coursecontext = $rating->context->get_course_context(false)) {
                    $courseid = $coursecontext->instanceid;
                } else {
                    $courseid = $rating->settings->scale->courseid;
                }
                $ratinghtml .= $this->help_icon_scale($courseid, $rating->settings->scale);
            }
            $ratinghtml .= html_writer::end_tag('span');
            $ratinghtml .= html_writer::end_tag('div');
            $ratinghtml .= html_writer::end_tag('form');
        }
//.........这里部分代码省略.........
开发者ID:afgal,项目名称:moodle-1,代码行数:101,代码来源:outputrenderers.php

示例9: sesskey

echo $OUTPUT->header();
// This will contain all available the based On select options, but we'll disable some on them on a per user basis.
echo $OUTPUT->heading($straddnote);
echo '<form method="post" action="addnote.php">';
echo '<fieldset class="invisiblefieldset">';
echo '<input type="hidden" name="id" value="' . $course->id . '" />';
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
echo '</fieldset>';
$table = new html_table();
$table->head = array(get_string('fullnameuser'), get_string('content', 'notes'), get_string('publishstate', 'notes') . $OUTPUT->help_icon('publishstate', 'notes'));
$table->align = array('left', 'center', 'center');
$statenames = note_get_state_names();
// The first time list hack.
if (empty($users) and $post = data_submitted()) {
    foreach ($post as $k => $v) {
        if (preg_match('/^user(\\d+)$/', $k, $m)) {
            $users[] = $m[1];
        }
    }
}
foreach ($users as $k => $v) {
    if (!($user = $DB->get_record('user', array('id' => $v)))) {
        continue;
    }
    $checkbox = html_writer::label(get_string('selectnotestate', 'notes'), 'menustates_' . $v, false, array('class' => 'accesshide'));
    $checkbox .= html_writer::select($statenames, 'states[' . $k . ']', empty($states[$k]) ? NOTES_STATE_PUBLIC : $states[$k], false, array('id' => 'menustates_' . $v));
    $table->data[] = array('<input type="hidden" name="userid[' . $k . ']" value="' . $v . '" />' . fullname($user, true), '<textarea name="contents[' . $k . ']" rows="2" cols="40" spellcheck="true">' . strip_tags(@$contents[$k]) . '</textarea>', $checkbox);
}
echo html_writer::table($table);
echo '<div style="width:100%;text-align:center;"><input type="submit" value="' . get_string('savechanges') . '" /></div></form>';
echo $OUTPUT->footer();
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:addnote.php

示例10: display_submissions


//.........这里部分代码省略.........
                     if ($final_grade->overridden) {
                         $locked_overridden = 'overridden';
                     }
                     // TODO add here code if advanced grading grade must be reviewed => $auser->status=0
                     $picture = $OUTPUT->user_picture($auser);
                     if (empty($auser->submissionid)) {
                         $auser->grade = -1;
                         //no submission yet
                     }
                     if (!empty($auser->submissionid)) {
                         $hassubmission = true;
                         ///Prints student answer and student modified date
                         ///attach file or print link to student answer, depending on the type of the assignment.
                         ///Refer to print_student_answer in inherited classes.
                         if ($auser->timemodified > 0) {
                             $studentmodifiedcontent = $this->print_student_answer($auser->id) . userdate($auser->timemodified);
                             if ($assignment->timedue && $auser->timemodified > $assignment->timedue && $this->supports_lateness()) {
                                 $studentmodifiedcontent .= $this->display_lateness($auser->timemodified);
                                 $rowclass = 'late';
                             }
                         } else {
                             $studentmodifiedcontent = '&nbsp;';
                         }
                         $studentmodified = html_writer::tag('div', $studentmodifiedcontent, array('id' => 'ts' . $auser->id));
                         ///Print grade, dropdown or text
                         if ($auser->timemarked > 0) {
                             $teachermodified = '<div id="tt' . $auser->id . '">' . userdate($auser->timemarked) . '</div>';
                             if ($final_grade->locked or $final_grade->overridden) {
                                 $grade = '<div id="g' . $auser->id . '" class="' . $locked_overridden . '">' . $final_grade->formatted_grade . '</div>';
                             } else {
                                 if ($quickgrade) {
                                     $attributes = array();
                                     $attributes['tabindex'] = $tabindex++;
                                     $menu = html_writer::label(get_string('assignment:grade', 'assignment'), 'menumenu' . $auser->id, false, array('class' => 'accesshide'));
                                     $menu .= html_writer::select(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, array(-1 => get_string('nograde')), $attributes);
                                     $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>';
                                 } else {
                                     $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>';
                                 }
                             }
                         } else {
                             $teachermodified = '<div id="tt' . $auser->id . '">&nbsp;</div>';
                             if ($final_grade->locked or $final_grade->overridden) {
                                 $grade = '<div id="g' . $auser->id . '" class="' . $locked_overridden . '">' . $final_grade->formatted_grade . '</div>';
                             } else {
                                 if ($quickgrade) {
                                     $attributes = array();
                                     $attributes['tabindex'] = $tabindex++;
                                     $menu = html_writer::label(get_string('assignment:grade', 'assignment'), 'menumenu' . $auser->id, false, array('class' => 'accesshide'));
                                     $menu .= html_writer::select(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, array(-1 => get_string('nograde')), $attributes);
                                     $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>';
                                 } else {
                                     $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>';
                                 }
                             }
                         }
                         ///Print Comment
                         if ($final_grade->locked or $final_grade->overridden) {
                             $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($final_grade->str_feedback), 15) . '</div>';
                         } else {
                             if ($quickgrade) {
                                 $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>';
                             } else {
                                 $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($auser->submissioncomment), 15) . '</div>';
                             }
                         }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:67,代码来源:lib.php

示例11: calendar_print_month_selector

/**
 * Display month selector options
 *
 * @param string $name for the select element
 * @param string|array $selected options for select elements
 */
function calendar_print_month_selector($name, $selected)
{
    $months = array();
    for ($i = 1; $i <= 12; $i++) {
        $months[$i] = userdate(gmmktime(12, 0, 0, $i, 15, 2000), '%B');
    }
    echo html_writer::label(get_string('months'), 'menu' . $name, false, array('class' => 'accesshide'));
    echo html_writer::select($months, $name, $selected, false);
}
开发者ID:miguelangelUvirtual,项目名称:uEducon,代码行数:15,代码来源:lib.php

示例12: report_plog_print_selector_form


//.........这里部分代码省略.........
        $showusers = 0;
    }
    //probably remove this - not currently worried about groups (should we be though?)
    /// Setup for group handling.
    if ($course->groupmode == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) {
        $selectedgroup = -1;
        $showgroups = false;
    } else {
        if ($course->groupmode) {
            $showgroups = true;
        } else {
            $selectedgroup = 0;
            $showgroups = false;
        }
    }
    if ($selectedgroup === -1) {
        if (isset($SESSION->currentgroup[$course->id])) {
            $selectedgroup = $SESSION->currentgroup[$course->id];
        } else {
            $selectedgroup = groups_get_all_groups($course->id, $USER->id);
            if (is_array($selectedgroup)) {
                $selectedgroup = array_shift(array_keys($selectedgroup));
                $SESSION->currentgroup[$course->id] = $selectedgroup;
            } else {
                $selectedgroup = 0;
            }
        }
    }
    // Get all the possible users
    $users = array();
    // Define limitfrom and limitnum for queries below
    // If $showusers is enabled... don't apply limitfrom and limitnum
    $limitfrom = empty($showusers) ? 0 : '';
    $limitnum = empty($showusers) ? COURSE_MAX_USERS_PER_DROPDOWN + 1 : '';
    //this needs to be modified so we don't include admin and tutors for this course in the list?
    $courseusers = get_enrolled_users($context, '', $selectedgroup, 'u.id, u.firstname, u.lastname', null, $limitfrom, $limitnum);
    if ($showusers) {
        if ($courseusers) {
            foreach ($courseusers as $courseuser) {
                $users[$courseuser->id] = fullname($courseuser, has_capability('moodle/site:viewfullnames', $context));
            }
        }
        $users[$CFG->siteguest] = get_string('guestuser');
    }
    //echo $course->id;
    //$n = "select distinct clusteringname from cluster_runs r where r.courseid = $course->id";
    $n = "select distinct clusteringname from cluster_runs r where r.courseid = {$course->id}";
    $metrica = $DB->get_records_sql($n);
    //there has to be a better way of doing this...
    $metrics = array();
    foreach ($metrica as $row) {
        $metrics[] = $row->clusteringname;
    }
    $strftimedate = get_string("strftimedate");
    $strftimedaydate = get_string("strftimedaydate");
    asort($users);
    $timenow = time();
    // GMT
    // What day is it now for the user, and when is midnight that day (in GMT).
    $timemidnight = $today = usergetmidnight($timenow);
    // Put today up the top of the list
    //$dates = array("$timemidnight" => get_string("today").", ".userdate($timenow, $strftimedate) );
    $dates = array();
    if (!$course->startdate or $course->startdate > $timenow) {
        $course->startdate = $course->timecreated;
    }
    //want to change this so we have a number of intervals
    //from start of course
    //last week
    //last fortnight
    //last month
    $numdates = 1;
    while ($timemidnight > $course->startdate and $numdates < 5) {
        $timemidnight = $timemidnight - 604800;
        //number of seconds in a week
        $timenow = $timenow - 604800;
        $dates["{$timemidnight}"] = $numdates . " weeks:" . userdate($timenow, $strftimedaydate);
        $numdates++;
    }
    echo "<form class=\"logselectform\" action=\"{$CFG->wwwroot}/report/plog/index.php\" method=\"get\">\n";
    echo "<div>\n";
    echo "<input type=\"hidden\" name=\"chooselog\" value=\"1\" />\n";
    echo "<input type=\"hidden\" name=\"showusers\" value=\"{$showusers}\" />\n";
    echo "<input type=\"hidden\" name=\"test\" value=\"{$test}\" />\n";
    if ($showusers) {
        echo html_writer::label(get_string('selctauser'), 'menuuser', false, array('class' => 'accesshide'));
        echo html_writer::select($users, "student", $student);
    }
    echo html_writer::label(get_string('date'), 'menudate', false, array('class' => 'accesshide'));
    echo html_writer::select($dates, "startdate", $startdate, get_string("alldays"));
    echo '<select id="menumetric" class="select menumetric" name="metric">';
    foreach ($metrics as $metric) {
        echo "<option value='{$metric}'>{$metric}</option>";
    }
    echo '</select>';
    //echo html_writer::select($metrics, "metric", $metric, "metric");
    echo '<input type="submit" value="' . get_string('gettheselogs') . '" />';
    echo '</div>';
    echo '</form>';
}
开发者ID:sashavor,项目名称:i-tutor-timeline,代码行数:101,代码来源:locallib.php

示例13: render_url_select

 /**
  * Internal implementation of url_select rendering
  * @param single_select $select
  * @return string HTML fragment
  */
 protected function render_url_select(url_select $select)
 {
     global $CFG;
     $select = clone $select;
     if (empty($select->formid)) {
         $select->formid = html_writer::random_id('url_select_f');
     }
     if (empty($select->attributes['id'])) {
         $select->attributes['id'] = html_writer::random_id('url_select');
     }
     if ($select->disabled) {
         $select->attributes['disabled'] = 'disabled';
     }
     if ($select->tooltip) {
         $select->attributes['title'] = $select->tooltip;
     }
     $output = '';
     if ($select->label) {
         $output .= html_writer::label($select->label, $select->attributes['id']);
     }
     if ($select->helpicon instanceof help_icon) {
         $output .= $this->render($select->helpicon);
     } else {
         if ($select->helpicon instanceof old_help_icon) {
             $output .= $this->render($select->helpicon);
         }
     }
     // For security reasons, the script course/jumpto.php requires URL starting with '/'. To keep
     // backward compatibility, we are removing heading $CFG->wwwroot from URLs here.
     $urls = array();
     foreach ($select->urls as $k => $v) {
         if (is_array($v)) {
             // optgroup structure
             foreach ($v as $optgrouptitle => $optgroupoptions) {
                 foreach ($optgroupoptions as $optionurl => $optiontitle) {
                     if (empty($optionurl)) {
                         $safeoptionurl = '';
                     } else {
                         if (strpos($optionurl, $CFG->wwwroot . '/') === 0) {
                             // debugging('URLs passed to url_select should be in local relative form - please fix the code.', DEBUG_DEVELOPER);
                             $safeoptionurl = str_replace($CFG->wwwroot, '', $optionurl);
                         } else {
                             if (strpos($optionurl, '/') !== 0) {
                                 debugging("Invalid url_select urls parameter inside optgroup: url '{$optionurl}' is not local relative url!");
                                 continue;
                             } else {
                                 $safeoptionurl = $optionurl;
                             }
                         }
                     }
                     $urls[$k][$optgrouptitle][$safeoptionurl] = $optiontitle;
                 }
             }
         } else {
             // plain list structure
             if (empty($k)) {
                 // nothing selected option
             } else {
                 if (strpos($k, $CFG->wwwroot . '/') === 0) {
                     $k = str_replace($CFG->wwwroot, '', $k);
                 } else {
                     if (strpos($k, '/') !== 0) {
                         debugging("Invalid url_select urls parameter: url '{$k}' is not local relative url!");
                         continue;
                     }
                 }
             }
             $urls[$k] = $v;
         }
     }
     $selected = $select->selected;
     if (!empty($selected)) {
         if (strpos($select->selected, $CFG->wwwroot . '/') === 0) {
             $selected = str_replace($CFG->wwwroot, '', $selected);
         } else {
             if (strpos($selected, '/') !== 0) {
                 debugging("Invalid value of parameter 'selected': url '{$selected}' is not local relative url!");
             }
         }
     }
     $output .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
     $output .= html_writer::select($urls, 'jump', $selected, $select->nothing, $select->attributes);
     if (!$select->showbutton) {
         $go = html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('go')));
         $output .= html_writer::tag('noscript', html_writer::tag('div', $go), array('style' => 'inline'));
         $nothing = empty($select->nothing) ? false : key($select->nothing);
         $output .= $this->page->requires->js_init_call('M.util.init_url_select', array($select->formid, $select->attributes['id'], $nothing));
     } else {
         $output .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => $select->showbutton));
     }
     // then div wrapper for xhtml strictness
     $output = html_writer::tag('div', $output);
     // now the form itself around it
     $formattributes = array('method' => 'post', 'action' => new moodle_url('/course/jumpto.php'), 'id' => $select->formid);
     $output = html_writer::tag('form', $output, $formattributes);
//.........这里部分代码省略.........
开发者ID:nfreear,项目名称:moodle,代码行数:101,代码来源:outputrenderers.php

示例14: output_html

 /**
  * Returns XHTML field(s) as required by choices
  *
  * Relies on data being an array should data ever be another valid vartype with
  * acceptable value this may cause a warning/error
  * if (!is_array($data)) would fix the problem
  *
  * @todo Add vartype handling to ensure $data is an array
  *
  * @param array $data An array of checked values
  * @param string $query
  * @return string XHTML field
  */
 public function output_html($data, $query = '')
 {
     $return = html_writer::start_tag('div', array('style' => 'float:left; width:auto; margin-right: 0.5em;'));
     $return .= html_writer::tag('div', get_string('roles', 'role'), array('style' => 'height: 2em;'));
     foreach ($data as $role) {
         $return .= html_writer::tag('div', s($role['name']), array('style' => 'height: 2em;'));
     }
     $return .= html_writer::end_tag('div');
     $return .= html_writer::start_tag('div', array('style' => 'float:left; width:auto; margin-right: 0.5em;'));
     $return .= html_writer::tag('div', get_string('contexts', 'enrol_ldap'), array('style' => 'height: 2em;'));
     foreach ($data as $role) {
         $contextid = $this->get_id() . '[' . $role['id'] . '][contexts]';
         $contextname = $this->get_full_name() . '[' . $role['id'] . '][contexts]';
         $return .= html_writer::start_tag('div', array('style' => 'height: 2em;'));
         $return .= html_writer::label(get_string('role_mapping_context', 'enrol_ldap', $role['name']), $contextid, false, array('class' => 'accesshide'));
         $attrs = array('type' => 'text', 'size' => '40', 'id' => $contextid, 'name' => $contextname, 'value' => s($role['contexts']));
         $return .= html_writer::empty_tag('input', $attrs);
         $return .= html_writer::end_tag('div');
     }
     $return .= html_writer::end_tag('div');
     $return .= html_writer::start_tag('div', array('style' => 'float:left; width:auto; margin-right: 0.5em;'));
     $return .= html_writer::tag('div', get_string('memberattribute', 'enrol_ldap'), array('style' => 'height: 2em;'));
     foreach ($data as $role) {
         $memberattrid = $this->get_id() . '[' . $role['id'] . '][memberattribute]';
         $memberattrname = $this->get_full_name() . '[' . $role['id'] . '][memberattribute]';
         $return .= html_writer::start_tag('div', array('style' => 'height: 2em;'));
         $return .= html_writer::label(get_string('role_mapping_attribute', 'enrol_ldap', $role['name']), $memberattrid, false, array('class' => 'accesshide'));
         $attrs = array('type' => 'text', 'size' => '15', 'id' => $memberattrid, 'name' => $memberattrname, 'value' => s($role['memberattribute']));
         $return .= html_writer::empty_tag('input', $attrs);
         $return .= html_writer::end_tag('div');
     }
     $return .= html_writer::end_tag('div');
     $return .= html_writer::tag('div', '', array('style' => 'clear:both;'));
     return format_admin_setting($this, $this->visiblename, $return, $this->description, true, '', '', $query);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:48,代码来源:settingslib.php

示例15: file_get_drafarea_folders

     $home_url->param('action', 'movefile');
     $home_url->param('draftpath', $draftpath);
     $home_url->param('filename', $filename);
     file_get_drafarea_folders($itemid, '/', $data);
     print_draft_area_tree($data, true, $home_url);
     echo $OUTPUT->footer();
     break;
 case 'mkdirform':
     echo $OUTPUT->header();
     echo $OUTPUT->container_start();
     echo html_writer::link($home_url, get_string('back', 'repository'));
     echo $OUTPUT->container_end();
     $home_url->param('draftpath', $draftpath);
     $home_url->param('action', 'mkdir');
     echo ' <form method="post" action="' . $home_url->out() . '">';
     echo html_writer::label(get_string('entername', 'repository'), 'newdirname', array('class' => 'accesshide'));
     echo '  <input name="newdirname" id="newdirname" type="text" />';
     echo '  <input name="draftpath" type="hidden" value="' . s($draftpath) . '" />';
     echo '  <input type="submit" value="' . s(get_string('makeafolder', 'moodle')) . '" />';
     echo ' </form>';
     echo $OUTPUT->footer();
     break;
 case 'mkdir':
     $newfolderpath = $draftpath . trim($newdirname, '/') . '/';
     $fs->create_directory($user_context->id, 'user', 'draft', $itemid, $newfolderpath);
     $home_url->param('action', 'browse');
     if (!empty($newdirname)) {
         $home_url->param('draftpath', $newfolderpath);
         $str = get_string('createfoldersuccess', 'repository');
     } else {
         $home_url->param('draftpath', $draftpath);
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:draftfiles_manager.php


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