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


PHP html_select::make方法代码示例

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


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

示例1: display_search_field

 function display_search_field($content = '')
 {
     global $CFG, $DB, $OUTPUT;
     $usedoptions = array();
     $sql = "SELECT DISTINCT content\n                  FROM {data_content}\n                 WHERE fieldid=: AND content IS NOT NULL";
     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 $OUTPUT->select(html_select::make($options, 'f_' . $this->field->id, $content, ' '));
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:28,代码来源:field.class.php

示例2: output_quiz_info_table

 function output_quiz_info_table($course, $cm, $quiz, $quizstats, $usingattemptsstring, $currentgroup, $groupstudents, $useallattempts, $download, $reporturl, $everything)
 {
     global $DB, $OUTPUT;
     // Print information on the number of existing attempts
     $quizinformationtablehtml = $OUTPUT->heading(get_string('quizinformation', 'quiz_statistics'), 2, 'main');
     $quizinformationtable = new html_table();
     $quizinformationtable->align = array('center', 'center');
     $quizinformationtable->width = '60%';
     $quizinformationtable->class = 'generaltable titlesleft';
     $quizinformationtable->data = array();
     $quizinformationtable->data[] = array(get_string('quizname', 'quiz_statistics'), $quiz->name);
     $quizinformationtable->data[] = array(get_string('coursename', 'quiz_statistics'), $course->fullname);
     if ($cm->idnumber) {
         $quizinformationtable->data[] = array(get_string('idnumbermod'), $cm->idnumber);
     }
     if ($quiz->timeopen) {
         $quizinformationtable->data[] = array(get_string('quizopen', 'quiz'), userdate($quiz->timeopen));
     }
     if ($quiz->timeclose) {
         $quizinformationtable->data[] = array(get_string('quizclose', 'quiz'), userdate($quiz->timeclose));
     }
     if ($quiz->timeopen && $quiz->timeclose) {
         $quizinformationtable->data[] = array(get_string('duration', 'quiz_statistics'), format_time($quiz->timeclose - $quiz->timeopen));
     }
     $format = array('firstattemptscount' => '', 'allattemptscount' => '', 'firstattemptsavg' => 'sumgrades_as_percentage', 'allattemptsavg' => 'sumgrades_as_percentage', 'median' => 'sumgrades_as_percentage', 'standarddeviation' => 'sumgrades_as_percentage', 'skewness' => '', 'kurtosis' => '', 'cic' => 'number_format', 'errorratio' => 'number_format', 'standarderror' => 'sumgrades_as_percentage');
     foreach ($quizstats as $property => $value) {
         if (!isset($format[$property])) {
             continue;
         }
         if (!is_null($value)) {
             switch ($format[$property]) {
                 case 'sumgrades_as_percentage':
                     $formattedvalue = quiz_report_scale_sumgrades_as_percentage($value, $quiz);
                     break;
                 case 'number_format':
                     $formattedvalue = quiz_format_grade($quiz, $value) . '%';
                     break;
                 default:
                     $formattedvalue = $value;
             }
             $quizinformationtable->data[] = array(get_string($property, 'quiz_statistics', $usingattemptsstring), $formattedvalue);
         }
     }
     if (!$this->table->is_downloading()) {
         if (isset($quizstats->timemodified)) {
             list($fromqa, $whereqa, $qaparams) = quiz_report_attempts_sql($quiz->id, $currentgroup, $groupstudents, $useallattempts);
             $sql = 'SELECT COUNT(1) ' . 'FROM ' . $fromqa . ' ' . 'WHERE ' . $whereqa . ' AND qa.timefinish > :time';
             $a = new object();
             $a->lastcalculated = format_time(time() - $quizstats->timemodified);
             if (!($a->count = $DB->count_records_sql($sql, array('time' => $quizstats->timemodified) + $qaparams))) {
                 $a->count = 0;
             }
             $quizinformationtablehtml .= $OUTPUT->box_start('boxaligncenter generalbox boxwidthnormal mdl-align');
             $quizinformationtablehtml .= get_string('lastcalculated', 'quiz_statistics', $a);
             $quizinformationtablehtml .= $OUTPUT->button(html_form::make_button($reporturl->out(true), $reporturl->params() + array('recalculate' => 1), get_string('recalculatenow', 'quiz_statistics')));
             $quizinformationtablehtml .= $OUTPUT->box_end();
         }
         $downloadoptions = $this->table->get_download_menu();
         $quizinformationtablehtml .= '<form action="' . $this->table->baseurl . '" method="post">';
         $quizinformationtablehtml .= '<div class="mdl-align">';
         $quizinformationtablehtml .= '<input type="hidden" name="everything" value="1"/>';
         $quizinformationtablehtml .= '<input type="submit" value="' . get_string('downloadeverything', 'quiz_statistics') . '"/>';
         $select = html_select::make($downloadoptions, 'download', $this->table->defaultdownloadformat, false);
         $select->nothingvalue = '';
         $quizinformationtablehtml .= $OUTPUT->select($select);
         $quizinformationtablehtml .= $OUTPUT->help_icon(moodle_help_icon::make('tableexportformats', get_string('tableexportformats', 'table')));
         $quizinformationtablehtml .= '</div></form>';
     }
     $quizinformationtablehtml .= $OUTPUT->table($quizinformationtable);
     if (!$this->table->is_downloading()) {
         echo $quizinformationtablehtml;
     } elseif ($everything) {
         $exportclass =& $this->table->export_class_instance();
         if ($download == 'xhtml') {
             echo $quizinformationtablehtml;
         } else {
             $exportclass->start_table(get_string('quizinformation', 'quiz_statistics'));
             $headers = array();
             $row = array();
             foreach ($quizinformationtable->data as $data) {
                 $headers[] = $data[0];
                 $row[] = $data[1];
             }
             $exportclass->output_headers($headers);
             $exportclass->add_data($row);
             $exportclass->finish_table();
         }
     }
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:89,代码来源:report.php

示例3: hotpot_print_report_selector

function hotpot_print_report_selector(&$course, &$hotpot, &$formdata)
{
    global $CFG, $DB, $OUTPUT;
    $reports = hotpot_get_report_names('overview,simplestat,fullstat');
    print '<form method="post" action="' . "{$CFG->wwwroot}/mod/hotpot/report.php?hp={$hotpot->id}" . '">';
    print '<table cellpadding="2" align="center">';
    $menus = array();
    $menus['mode'] = array();
    foreach ($reports as $name) {
        if ($name == 'overview' || $name == 'simplestat' || $name == 'fullstat') {
            $module = "quiz";
            // standard reports
        } else {
            if ($name == 'click' && empty($hotpot->clickreporting)) {
                $module = "";
                // clickreporting is disabled
            } else {
                $module = "hotpot";
                // custom reports
            }
        }
        if ($module) {
            $menus['mode'][$name] = get_string("report{$name}", $module);
        }
    }
    $menus['reportusers'] = array('allusers' => get_string('allusers', 'hotpot'), 'allparticipants' => get_string('allparticipants'));
    // groups
    if ($groups = groups_get_all_groups($course->id)) {
        foreach ($groups as $gid => $group) {
            $menus['reportusers']["group{$gid}"] = get_string('group') . ': ' . format_string($group->name);
        }
    }
    // get users who have ever atetmpted this HotPot
    $users = $DB->get_records_sql("\n        SELECT \n            u.id, u.firstname, u.lastname\n        FROM \n            {user} u,\n            {hotpot_attempts} ha\n        WHERE\n            u.id = ha.userid AND ha.hotpot=?\n        ORDER BY\n            u.lastname\n    ", array($hotpot->id));
    if (!empty($users)) {
        // get context
        $cm = get_coursemodule_from_instance('hotpot', $hotpot->id);
        $modulecontext = get_context_instance(CONTEXT_MODULE, $cm->id);
        $teachers = hotpot_get_users_by_capability($modulecontext, 'mod/hotpot:viewreport');
        $students = hotpot_get_users_by_capability($modulecontext, 'mod/hotpot:attempt');
        // current students
        if (!empty($students)) {
            $firsttime = true;
            foreach ($users as $user) {
                if (array_key_exists($user->id, $teachers)) {
                    continue;
                    // skip teachers
                }
                if (array_key_exists($user->id, $students)) {
                    if ($firsttime) {
                        $firsttime = false;
                        // so we only do this once
                        $menus['reportusers']['existingstudents'] = get_string('existingstudents');
                        $menus['reportusers'][] = '------';
                    }
                    $menus['reportusers']["{$user->id}"] = fullname($user);
                    unset($users[$user->id]);
                }
            }
            unset($students);
        }
        // others (former students, teachers, admins, course creators)
        $firsttime = true;
        foreach ($users as $user) {
            if ($firsttime) {
                $firsttime = false;
                // so we only do this once
                $menus['reportusers'][] = '======';
            }
            $menus['reportusers']["{$user->id}"] = fullname($user);
        }
    }
    $menus['reportattempts'] = array('all' => get_string('attemptsall', 'hotpot'), 'best' => get_string('attemptsbest', 'hotpot'), 'first' => get_string('attemptsfirst', 'hotpot'), 'last' => get_string('attemptslast', 'hotpot'));
    print '<tr><td>';
    echo $OUTPUT->help_icon(moodle_help_icon::make('reportcontent', get_string('reportcontent', 'hotpot'), 'hotpot'));
    print '</td><th align="right" scope="col">' . get_string('reportcontent', 'hotpot') . ':</th><td colspan="7">';
    foreach ($menus as $name => $options) {
        $value = $formdata[$name];
        print $OUTPUT->select(html_select::make($options, $name, $value, false));
    }
    print '<input type="submit" value="' . get_string('reportbutton', 'hotpot') . '" /></td></tr>';
    $menus = array();
    $menus['reportformat'] = array();
    $menus['reportformat']['htm'] = get_string('reportformathtml', 'hotpot');
    if (file_exists("{$CFG->libdir}/excel") || file_exists("{$CFG->libdir}/excellib.class.php")) {
        $menus['reportformat']['xls'] = get_string('reportformatexcel', 'hotpot');
    }
    $menus['reportformat']['txt'] = get_string('reportformattext', 'hotpot');
    if (trim($CFG->hotpot_excelencodings)) {
        $menus['reportencoding'] = array(get_string('none') => '');
        $encodings = explode(',', $CFG->hotpot_excelencodings);
        foreach ($encodings as $encoding) {
            $encoding = trim($encoding);
            if ($encoding) {
                $menus['reportencoding'][$encoding] = $encoding;
            }
        }
    }
    $menus['reportwrapdata'] = array('1' => get_string('yes'), '0' => get_string('no'));
    $menus['reportshowlegend'] = array('1' => get_string('yes'), '0' => get_string('no'));
//.........这里部分代码省略.........
开发者ID:ajv,项目名称:Offline-Caching,代码行数:101,代码来源:report.php

示例4: get_studentshtml

 /**
  * Builds and return the HTML rows of the table (grades headed by student).
  * @return string HTML
  */
 public function get_studentshtml()
 {
     global $CFG, $USER, $DB, $OUTPUT;
     $studentshtml = '';
     $strfeedback = $this->get_lang_string("feedback");
     $strgrade = $this->get_lang_string('grade');
     $gradetabindex = 1;
     $numusers = count($this->users);
     $showuserimage = $this->get_pref('showuserimage');
     $showuseridnumber = $this->get_pref('showuseridnumber');
     $fixedstudents = $this->is_fixed_students();
     // Preload scale objects for items with a scaleid
     $scales_list = array();
     $tabindices = array();
     foreach ($this->gtree->get_items() as $item) {
         if (!empty($item->scaleid)) {
             $scales_list[] = $item->scaleid;
         }
         $tabindices[$item->id]['grade'] = $gradetabindex;
         $tabindices[$item->id]['feedback'] = $gradetabindex + $numusers;
         $gradetabindex += $numusers * 2;
     }
     $scales_array = array();
     if (!empty($scales_list)) {
         $scales_array = $DB->get_records_list('scale', 'id', $scales_list);
     }
     $row_classes = array(' even ', ' odd ');
     $row_classes = array(' even ', ' odd ');
     foreach ($this->users as $userid => $user) {
         if ($this->canviewhidden) {
             $altered = array();
             $unknown = array();
         } else {
             $hiding_affected = grade_grade::get_hiding_affected($this->grades[$userid], $this->gtree->get_items());
             $altered = $hiding_affected['altered'];
             $unknown = $hiding_affected['unknown'];
             unset($hiding_affected);
         }
         $columncount = 0;
         if ($fixedstudents) {
             $studentshtml .= '<tr class="r' . $this->rowcount++ . $row_classes[$this->rowcount % 2] . '">';
         } else {
             // Student name and link
             $user_pic = null;
             if ($showuserimage) {
                 $user_pic = '<div class="userpic">' . $OUTPUT->user_picture(moodle_user_picture::make($user, $this->courseid)) . '</div>';
             }
             $studentshtml .= '<tr class="r' . $this->rowcount++ . $row_classes[$this->rowcount % 2] . '">' . '<th class="c' . $columncount++ . ' user" scope="row" onclick="set_row(this.parentNode.rowIndex);">' . $user_pic . '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&amp;course=' . $this->course->id . '">' . fullname($user) . '</a></th>';
             if ($showuseridnumber) {
                 $studentshtml .= '<th class="c' . $columncount++ . ' useridnumber" onclick="set_row(this.parentNode.rowIndex);">' . $user->idnumber . '</th>';
             }
         }
         foreach ($this->gtree->items as $itemid => $unused) {
             $item =& $this->gtree->items[$itemid];
             $grade = $this->grades[$userid][$item->id];
             // Get the decimal points preference for this item
             $decimalpoints = $item->get_decimals();
             if (in_array($itemid, $unknown)) {
                 $gradeval = null;
             } else {
                 if (array_key_exists($itemid, $altered)) {
                     $gradeval = $altered[$itemid];
                 } else {
                     $gradeval = $grade->finalgrade;
                 }
             }
             // MDL-11274
             // Hide grades in the grader report if the current grader doesn't have 'moodle/grade:viewhidden'
             if (!$this->canviewhidden and $grade->is_hidden()) {
                 if (!empty($CFG->grade_hiddenasdate) and $grade->get_datesubmitted() and !$item->is_category_item() and !$item->is_course_item()) {
                     // the problem here is that we do not have the time when grade value was modified, 'timemodified' is general modification date for grade_grades records
                     $studentshtml .= '<td class="cell c' . $columncount++ . '"><span class="datesubmitted">' . userdate($grade->get_datesubmitted(), get_string('strftimedatetimeshort')) . '</span></td>';
                 } else {
                     $studentshtml .= '<td class="cell c' . $columncount++ . '">-</td>';
                 }
                 continue;
             }
             // emulate grade element
             $eid = $this->gtree->get_grade_eid($grade);
             $element = array('eid' => $eid, 'object' => $grade, 'type' => 'grade');
             $cellclasses = 'grade cell c' . $columncount++;
             if ($item->is_category_item()) {
                 $cellclasses .= ' cat';
             }
             if ($item->is_course_item()) {
                 $cellclasses .= ' course';
             }
             if ($grade->is_overridden()) {
                 $cellclasses .= ' overridden';
             }
             if ($grade->is_excluded()) {
                 // $cellclasses .= ' excluded';
             }
             $grade_title = '<div class="fullname">' . fullname($user) . '</div>';
             $grade_title .= '<div class="itemname">' . $item->get_name(true) . '</div>';
             if (!empty($grade->feedback) && !$USER->gradeediting[$this->courseid]) {
//.........这里部分代码省略.........
开发者ID:ajv,项目名称:Offline-Caching,代码行数:101,代码来源:lib.php

示例5: get_content


//.........这里部分代码省略.........
                q1 = Math.pow(1 + ir,-np);
                q2 = Math.pow(1 + ir,np);
                pv = -(q1 * (fv * ir - pmt + q2 * pmt))/ir;
            }
            x.LOANAMOUNT.value = num_format(pv);
        }

        if (v == "np") {
            if(ir == 0) {
                if(pmt != 0) {
                    np = - (fv + pv)/pmt;
                }
                else {
                    alert("Divide by zero error.");
                }
            }
            else {
                np = Math.log((-fv * ir + pmt)/(pmt + ir * pv))/ Math.log(1 + ir);
            }
            if(np == 0) {
                alert("Can\'t compute Number of Periods for the present values.");
            }
            else {
                np = (np / lpp)
                if (isNaN(np)) {
                    alert("The repayment amount is less than the interest. You must increase your repayments to pay off this loan!");
                } else {
                    x.LOANTERM.value = num_format(np);
                }
            }
        }

        if (v == "pmt") {
            if(ir == 0.0) {
                if(np != 0) {
                    pmt = (fv + pv)/np;
                }
                else {
                    alert("Divide by zero error.");
                }
            }
            else {
                q = Math.pow(1 + ir,np);
                pmt = ((ir * (fv + q * pv))/(-1 + q));
            }
            x.LOANREPAYMENT.value = num_format(pmt);
        }


    }
} // function comp
//]]>
</script>
<form method="post" id="vbankform" action="">
            <table>
                <tr>
                    <td colspan="2">' . get_string('amountofloan', 'block_loancalc') . '</td>
                </tr>
                <tr>
                    <td><input name="LOANAMOUNT" id="LOANAMOUNT" size="17" /></td>
                    <td><a href="JavaScript:comp(\'pv\');"><img src="' . $calc . '" alt="calculate" /></a></td>
                </tr>
                <tr>
                    <td colspan="2">' . get_string('repaymentamount', 'block_loancalc') . '</td>
                </tr>
                <tr>
                    <td><input name="LOANREPAYMENT" id="LOANREPAYMENT" size="17" /></td>
                    <td><a href="JavaScript:comp(\'pmt\');"><img src="' . $calc . '" alt="calculate" /></a></td>
                </tr>
                <tr>
                    <td colspan="2">' . get_string('loanterm', 'block_loancalc') . '</td>
                </tr>
                <tr>
                    <td><input name="LOANTERM" id="LOANTERM" size="17" /></td>
                    <td><a href="JavaScript:comp(\'np\');"><img src="' . $calc . '" alt="calculate" /></a></td>
                </tr>    
                <tr>
                    <td colspan="2">' . get_string('interestrate', 'block_loancalc') . '</td>
                </tr>
                <tr>
                    <td><input name="LOANINTRATE" id="LOANINTRATE" size="17" /></td>
                    <td></td>
                </tr>    
                <tr>
                    <td colspan="2">' . get_string('repaymentfreq', 'block_loancalc') . '</td>
                </tr>
                <tr>
                    <td>';
        $options[52] = get_string('weekly', 'block_loancalc');
        $options[26] = get_string('fortnightly', 'block_loancalc');
        $options[12] = get_string('monthly', 'block_loancalc');
        $this->content->text .= $OUTPUT->select(html_select::make($options, 'LOANPAYPERIOD', '12'));
        $this->content->text .= '</td>
                    <td></td>
                </tr>
            </table>
            </form>';
        $this->content->footer = '';
        return $this->content;
    }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:101,代码来源:block_loancalc.php

示例6: array

$navlinks = array();
$navlinks[] = array('name' => $strfeedbacks, 'link' => "index.php?id={$course->id}", 'type' => 'activity');
$navlinks[] = array('name' => format_string($feedback->name), 'link' => "", 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
print_header_simple(format_string($feedback->name), "", $navigation, "", "", true, $buttontext, navmenu($course, $cm));
include 'tabs.php';
echo $OUTPUT->box(get_string('mapcourseinfo', 'feedback'), 'generalbox boxaligncenter boxwidthwide');
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
echo '<form method="post">';
echo '<input type="hidden" name="id" value="' . $id . '" />';
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
$sql = "select c.id, c.shortname\n              from {course} c\n             where c.shortname " . $DB->sql_ilike() . " ?\n                   OR c.fullname " . $DB->sql_ilike() . " ?";
$params = array("%{$searchcourse}%", "%{$searchcourse}%");
if (($courses = $DB->get_records_sql_menu($sql, $params)) && !empty($searchcourse)) {
    echo ' ' . get_string('courses') . ': ';
    echo $OUTPUT->select(html_select::make($courses, 'coursefilter', $coursefilter));
    echo '<input type="submit" value="' . get_string('mapcourse', 'feedback') . '"/>';
    echo $OUTPUT->help_icon(moodle_help_icon::make('mapcourses', '', 'feedback', true));
    echo '<input type="button" value="' . get_string('searchagain') . '" onclick="document.location=\'mapcourse.php?id=' . $id . '\'"/>';
    echo '<input type="hidden" name="searchcourse" value="' . $searchcourse . '"/>';
    echo '<input type="hidden" name="feedbackid" value="' . $feedback->id . '"/>';
    echo $OUTPUT->help_icon(moodle_help_icon::make('searchcourses', '', 'feedback', true));
} else {
    echo '<input type="text" name="searchcourse" value="' . $searchcourse . '"/> <input type="submit" value="' . get_string('searchcourses') . '"/>';
    echo $OUTPUT->help_icon(moodle_help_icon::make('searchcourses', '', 'feedback', true));
}
echo '</form>';
if ($coursemap = feedback_get_courses_from_sitecourse_map($feedback->id)) {
    $table = new flexible_table('coursemaps');
    $table->define_columns(array('course'));
    $table->define_headers(array(get_string('mappedcourses', 'feedback')));
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:mapcourse.php

示例7: role_fix_names

if (empty($roleoptions[$guestrole->id])) {
    $roleoptions[$guestrole->id] = $guestrole->name;
}
$roleoptions = role_fix_names($roleoptions, $context);
// print first controls.
echo '<form class="participationselectform" action="index.php" method="get"><div>' . "\n" . '<input type="hidden" name="id" value="' . $course->id . '" />' . "\n";
echo '<label for="menuinstanceid">' . get_string('activitymodule') . '</label>' . "\n";
$select = html_select::make($instanceoptions, 'instanceid', $instanceid);
$select->nested = true;
echo $OUTPUT->select($select);
echo '<label for="menutimefrom">' . get_string('lookback') . '</label>' . "\n";
echo $OUTPUT->select(html_select::make($timeoptions, 'timefrom', $timefrom));
echo '<label for="menuroleid">' . get_string('showonly') . '</label>' . "\n";
echo $OUTPUT->select(html_select::make($roleoptions, 'roleid', $roleid, false));
echo '<label for="menuaction">' . get_string('showactions') . '</label>' . "\n";
echo $OUTPUT->select(html_select::make($actionoptions, 'action', $action, false));
echo $OUTPUT->help_icon(moodle_help_icon::make('participationreport', get_string('participationreport')));
echo '<input type="submit" value="' . get_string('go') . '" />' . "\n</div></form>\n";
$baseurl = $CFG->wwwroot . '/course/report/participation/index.php?id=' . $course->id . '&amp;roleid=' . $roleid . '&amp;instanceid=' . $instanceid . '&amp;timefrom=' . $timefrom . '&amp;action=' . $action . '&amp;perpage=' . $perpage;
if (!empty($instanceid) && !empty($roleid)) {
    // from here assume we have at least the module we're using.
    $cm = $modinfo->cms[$instanceid];
    $modulename = get_string('modulename', $cm->modname);
    include_once $CFG->dirroot . '/mod/' . $cm->modname . '/lib.php';
    $viewfun = $cm->modname . '_get_view_actions';
    $postfun = $cm->modname . '_get_post_actions';
    if (!function_exists($viewfun) || !function_exists($postfun)) {
        print_error('modulemissingcode', 'error', $baseurl, $cm->modname);
    }
    $viewnames = $viewfun();
    $postnames = $postfun();
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:index.php

示例8: print_auth_lock_options

function print_auth_lock_options($auth, $user_fields, $helptext, $retrieveopts, $updateopts)
{
    global $OUTPUT;
    echo '<tr><td colspan="3">';
    if ($retrieveopts) {
        echo $OUTPUT->heading(get_string('auth_data_mapping', 'auth'));
    } else {
        echo $OUTPUT->heading(get_string('auth_fieldlocks', 'auth'));
    }
    echo '</td></tr>';
    $lockoptions = array('unlocked' => get_string('unlocked', 'auth'), 'unlockedifempty' => get_string('unlockedifempty', 'auth'), 'locked' => get_string('locked', 'auth'));
    $updatelocaloptions = array('oncreate' => get_string('update_oncreate', 'auth'), 'onlogin' => get_string('update_onlogin', 'auth'));
    $updateextoptions = array('0' => get_string('update_never', 'auth'), '1' => get_string('update_onupdate', 'auth'));
    $pluginconfig = get_config("auth/{$auth}");
    // helptext is on a field with rowspan
    if (empty($helptext)) {
        $helptext = '&nbsp;';
    }
    foreach ($user_fields as $field) {
        // Define some vars we'll work with
        if (!isset($pluginconfig->{"field_map_{$field}"})) {
            $pluginconfig->{"field_map_{$field}"} = '';
        }
        if (!isset($pluginconfig->{"field_updatelocal_{$field}"})) {
            $pluginconfig->{"field_updatelocal_{$field}"} = '';
        }
        if (!isset($pluginconfig->{"field_updateremote_{$field}"})) {
            $pluginconfig->{"field_updateremote_{$field}"} = '';
        }
        if (!isset($pluginconfig->{"field_lock_{$field}"})) {
            $pluginconfig->{"field_lock_{$field}"} = '';
        }
        // define the fieldname we display to the  user
        $fieldname = $field;
        if ($fieldname === 'lang') {
            $fieldname = get_string('language');
        } elseif (preg_match('/^(.+?)(\\d+)$/', $fieldname, $matches)) {
            $fieldname = get_string($matches[1]) . ' ' . $matches[2];
        } elseif ($fieldname == 'url') {
            $fieldname = get_string('webpage');
        } else {
            $fieldname = get_string($fieldname);
        }
        if ($retrieveopts) {
            $varname = 'field_map_' . $field;
            echo '<tr valign="top"><td align="right">';
            echo '<label for="lockconfig_' . $varname . '">' . $fieldname . '</label>';
            echo '</td><td>';
            echo "<input id=\"lockconfig_{$varname}\" name=\"lockconfig_{$varname}\" type=\"text\" size=\"30\" value=\"{$pluginconfig->{$varname}}\" />";
            echo '<div style="text-align: right">';
            echo '<label for="menulockconfig_field_updatelocal_' . $field . '">' . get_string('auth_updatelocal', 'auth') . '</label>&nbsp;';
            echo $OUTPUT->select(html_select::make($updatelocaloptions, "lockconfig_field_updatelocal_{$field}", $pluginconfig->{"field_updatelocal_{$field}"}, false));
            echo '<br />';
            if ($updateopts) {
                echo '<label for="menulockconfig_field_updateremote_' . $field . '">' . get_string('auth_updateremote', 'auth') . '</label>&nbsp;';
                echo $OUTPUT->select(html_select::make($updateextoptions, "lockconfig_field_updateremote_{$field}", $pluginconfig->{"field_updateremote_{$field}"}, false));
                echo '<br />';
            }
            echo '<label for="menulockconfig_field_lock_' . $field . '">' . get_string('auth_fieldlock', 'auth') . '</label>&nbsp;';
            echo $OUTPUT->select(html_select::make($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_{$field}"}, false));
            echo '</div>';
        } else {
            echo '<tr valign="top"><td align="right">';
            echo '<label for="menulockconfig_field_lock_' . $field . '">' . $fieldname . '</label>';
            echo '</td><td>';
            echo $OUTPUT->select(html_select::make($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_{$field}"}, false));
        }
        echo '</td>';
        if (!empty($helptext)) {
            echo '<td rowspan="' . count($user_fields) . '">' . $helptext . '</td>';
            $helptext = '';
        }
        echo '</tr>';
    }
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:75,代码来源:auth_config.php

示例9: print_grade_menu

/**
 * Prints a grade menu (as part of an existing form) with help
 * Showing all possible numerical grades and scales
 *
 * @todo Finish documenting this function
 * @todo Deprecate: this is only used in a few contrib modules
 *
 * @global object
 * @param int $courseid The course ID
 * @param string $name
 * @param string $current
 * @param boolean $includenograde Include those with no grades
 * @param boolean $return If set to true returns rather than echo's
 * @return string|bool Depending on value of $return
 */
function print_grade_menu($courseid, $name, $current, $includenograde = true, $return = false)
{
    global $CFG, $OUTPUT;
    $output = '';
    $strscale = get_string('scale');
    $strscales = get_string('scales');
    $scales = get_scales_menu($courseid);
    foreach ($scales as $i => $scalename) {
        $grades[-$i] = $strscale . ': ' . $scalename;
    }
    if ($includenograde) {
        $grades[0] = get_string('nograde');
    }
    for ($i = 100; $i >= 1; $i--) {
        $grades[$i] = $i;
    }
    $output .= $OUTPUT->select(html_select::make($grades, $name, $current, false));
    $linkobject = '<span class="helplink"><img class="iconhelp" alt="' . $strscales . '" src="' . $OUTPUT->old_icon_url('help') . '" /></span>';
    $link = html_link::make('/course/scales.php?id=' . $courseid . '&list=true', $linkobject);
    $link->add_action(new popup_action('click', $link->url, 'ratingscales', array('height' => 400, 'width' => 500)));
    $link->title = $strscales;
    $output .= $OUTPUT->link($link);
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:43,代码来源:weblib.php

示例10: get_import_export_formats

        }
        echo "<hr>";
        echo $OUTPUT->continue_button("view.php?id={$cm->id}");
        echo $OUTPUT->footer();
        exit;
    }
}
/// Print upload form
$fileformatnames = get_import_export_formats('import');
print_heading_with_help($strimportquestions, "import", "lesson");
echo $OUTPUT->box_start('generalbox boxaligncenter');
echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"import.php\">";
echo "<input type=\"hidden\" name=\"id\" value=\"{$cm->id}\" />\n";
echo "<input type=\"hidden\" name=\"pageid\" value=\"{$pageid}\" />\n";
echo "<table cellpadding=\"5\">";
echo "<tr><td align=\"right\">";
print_string("fileformat", "lesson");
echo ":</td><td>";
echo $OUTPUT->select(html_select::make($fileformatnames, "format", "gift", false));
echo "</td></tr>";
echo "<tr><td align=\"right\">";
print_string("upload");
echo ":</td><td>";
echo "<input name=\"newfile\" type=\"file\" size=\"50\" />";
echo "</td></tr><tr><td>&nbsp;</td><td>";
echo "<input type=\"submit\" name=\"save\" value=\"" . get_string("uploadthisfile") . "\" />";
echo "</td></tr>";
echo "</table>";
echo "</form>";
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:import.php

示例11: get_legacy_type_field

 protected function get_legacy_type_field($id)
 {
     global $OUTPUT;
     $options = array();
     $options[''] = get_string('none');
     foreach ($this->legacyroles as $type => $cap) {
         $options[$type] = get_string('legacy:' . $type, 'role');
     }
     return $OUTPUT->select(html_select::make($options, 'legacytype', $this->role->legacytype, false));
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:10,代码来源:lib.php

示例12: array

     $table->align[] = 'left';
 }
 $table->width = ' ';
 $table->data = array();
 // iterate through filters adding to display table
 foreach ($availablefilters as $filter => $filterinfo) {
     $row = array();
     // Filter name.
     $row[] = filter_get_name($filter);
     // Default/on/off choice.
     if ($filterinfo->inheritedstate == TEXTFILTER_ON) {
         $activechoices[TEXTFILTER_INHERIT] = $strdefaulton;
     } else {
         $activechoices[TEXTFILTER_INHERIT] = $strdefaultoff;
     }
     $select = html_select::make($activechoices, str_replace('/', '_', $filter), $filterinfo->localstate, false);
     $select->nothingvalue = '';
     $row[] = $OUTPUT->select($select);
     // Settings link, if required
     if ($settingscol) {
         $settings = '';
         if ($filterinfo->hassettings) {
             $settings = '<a href="' . $baseurl . '&amp;filter=' . $filter . '">' . $strsettings . '</a>';
         }
         $row[] = $settings;
     }
     $table->data[] = $row;
 }
 echo $OUTPUT->table($table);
 echo '<div class="buttons">' . "\n";
 echo '<input type="submit" name="savechanges" value="' . get_string('savechanges') . '" />';
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:manage.php

示例13: test_html_select

 public function test_html_select()
 {
     $options = array('var1' => 'value1', 'var2' => 'value2', 'var3' => 'value3');
     $select = html_select::make($options, 'mymenu', 'var2');
     $html = $this->renderer->select($select);
     $this->assert(new ContainsTagWithAttributes('select', array('name' => 'mymenu')), $html);
     $this->assert(new ContainsTagWithAttributes('option', array('value' => 'var1'), array('selected' => 'selected')), $html);
     $this->assert(new ContainsTagWithAttributes('option', array('value' => 'var2', 'selected' => 'selected')), $html);
     $this->assert(new ContainsTagWithAttributes('option', array('value' => 'var3'), array('selected' => 'selected')), $html);
     $this->assert(new ContainsTagWithContents('option', 'value1'), $html);
     $this->assert(new ContainsTagWithContents('option', 'value2'), $html);
     $this->assert(new ContainsTagWithContents('option', 'value3'), $html);
     $options = array('group1' => '--group1', 'var1' => 'value1', 'var2' => 'value2', 'group2' => '--', 'group2' => '--group2', 'var3' => 'value3', 'var4' => 'value4');
     $select = html_select::make($options, 'mymenu', 'var2');
     $html = $this->renderer->select($select);
     $this->assert(new ContainsTagWithAttributes('select', array('name' => 'mymenu')), $html);
     $this->assert(new ContainsTagWithAttributes('optgroup', array('label' => 'group1')), $html);
     $this->assert(new ContainsTagWithAttributes('optgroup', array('label' => 'group2')), $html);
     $this->assert(new ContainsTagWithAttributes('option', array('value' => 'var1'), array('selected' => 'selected')), $html);
     $this->assert(new ContainsTagWithAttributes('option', array('value' => 'var2', 'selected' => 'selected')), $html);
     $this->assert(new ContainsTagWithAttributes('option', array('value' => 'var3'), array('selected' => 'selected')), $html);
     $this->assert(new ContainsTagWithAttributes('option', array('value' => 'var4'), array('selected' => 'selected')), $html);
     $this->assert(new ContainsTagWithContents('option', 'value1'), $html);
     $this->assert(new ContainsTagWithContents('option', 'value2'), $html);
     $this->assert(new ContainsTagWithContents('option', 'value3'), $html);
     $this->assert(new ContainsTagWithContents('option', 'value4'), $html);
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:27,代码来源:testoutputlib.php

示例14: message_print_settings

function message_print_settings()
{
    global $USER, $OUTPUT;
    if ($frm = data_submitted() and confirm_sesskey()) {
        $pref = array();
        $pref['message_showmessagewindow'] = isset($frm->showmessagewindow) ? '1' : '0';
        $pref['message_beepnewmessage'] = isset($frm->beepnewmessage) ? '1' : '0';
        $pref['message_blocknoncontacts'] = isset($frm->blocknoncontacts) ? '1' : '0';
        $pref['message_usehtmleditor'] = isset($frm->usehtmleditor) ? '1' : '0';
        $pref['message_noframesjs'] = isset($frm->noframesjs) ? '1' : '0';
        $pref['message_emailmessages'] = isset($frm->emailmessages) ? '1' : '0';
        $pref['message_emailtimenosee'] = (int) $frm->emailtimenosee > 0 ? (int) $frm->emailtimenosee : '10';
        $pref['message_emailaddress'] = !empty($frm->emailaddress) ? $frm->emailaddress : $USER->email;
        $pref['message_emailformat'] = isset($frm->emailformat) ? $frm->emailformat : FORMAT_PLAIN;
        set_user_preferences($pref);
        redirect('index.php', get_string('settingssaved', 'message'), 1);
    }
    $cbshowmessagewindow = get_user_preferences('message_showmessagewindow', 1) == '1' ? 'checked="checked"' : '';
    $cbbeepnewmessage = get_user_preferences('message_beepnewmessage', 0) == '1' ? 'checked="checked"' : '';
    $cbblocknoncontacts = get_user_preferences('message_blocknoncontacts', 0) == '1' ? 'checked="checked"' : '';
    $cbusehtmleditor = get_user_preferences('message_usehtmleditor', 0) == '1' ? 'checked="checked"' : '';
    $cbnoframesjs = get_user_preferences('message_noframesjs', 0) == '1' ? 'checked="checked"' : '';
    $cbemailmessages = get_user_preferences('message_emailmessages', 1) == '1' ? 'checked="checked"' : '';
    $txemailaddress = get_user_preferences('message_emailaddress', $USER->email);
    $txemailtimenosee = get_user_preferences('message_emailtimenosee', 10);
    $format_select = $OUTPUT->select(html_select::make(array(FORMAT_PLAIN => get_string('formatplain'), FORMAT_HTML => get_string('formathtml')), 'emailformat', get_user_preferences('message_emailformat', FORMAT_PLAIN)));
    include 'settings.html';
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:28,代码来源:lib.php

示例15: print_question_formulation_and_controls

 function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options)
 {
     global $CFG, $OUTPUT;
     $subquestions = $state->options->subquestions;
     $correctanswers = $this->get_correct_responses($question, $state);
     $nameprefix = $question->name_prefix;
     $answers = array();
     // Answer choices formatted ready for output.
     $allanswers = array();
     // This and the next used to detect identical answers
     $answerids = array();
     // and adjust ids.
     $responses =& $state->responses;
     // Prepare a list of answers, removing duplicates.
     foreach ($subquestions as $subquestion) {
         foreach ($subquestion->options->answers as $ans) {
             $allanswers[$ans->id] = $ans->answer;
             if (!in_array($ans->answer, $answers)) {
                 $answers[$ans->id] = strip_tags(format_string($ans->answer, false));
                 $answerids[$ans->answer] = $ans->id;
             }
         }
     }
     // Fix up the ids of any responses that point the the eliminated duplicates.
     foreach ($responses as $subquestionid => $ignored) {
         if ($responses[$subquestionid]) {
             $responses[$subquestionid] = $answerids[$allanswers[$responses[$subquestionid]]];
         }
     }
     foreach ($correctanswers as $subquestionid => $ignored) {
         $correctanswers[$subquestionid] = $answerids[$allanswers[$correctanswers[$subquestionid]]];
     }
     // Shuffle the answers
     $answers = draw_rand_array($answers, count($answers));
     // Print formulation
     $questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions);
     $image = get_question_image($question);
     // Print the input controls
     foreach ($subquestions as $key => $subquestion) {
         if ($subquestion->questiontext !== '' && !is_null($subquestion->questiontext)) {
             // Subquestion text:
             $a = new stdClass();
             $a->text = $this->format_text($subquestion->questiontext, $question->questiontextformat, $cmoptions);
             // Drop-down list:
             $menuname = $nameprefix . $subquestion->id;
             $response = isset($state->responses[$subquestion->id]) ? $state->responses[$subquestion->id] : '0';
             $a->class = ' ';
             $a->feedbackimg = ' ';
             if ($options->readonly and $options->correct_responses) {
                 if (isset($correctanswers[$subquestion->id]) and $correctanswers[$subquestion->id] == $response) {
                     $correctresponse = 1;
                 } else {
                     $correctresponse = 0;
                 }
                 if ($options->feedback && $response) {
                     $a->class = question_get_feedback_class($correctresponse);
                     $a->feedbackimg = question_get_feedback_image($correctresponse);
                 }
             }
             $select = html_select::make($answers, $menuname, $response);
             $select->disabled = $options->readonly;
             $a->control = $OUTPUT->select($select);
             // Neither the editing interface or the database allow to provide
             // fedback for this question type.
             // However (as was pointed out in bug bug 3294) the randomsamatch
             // type which reuses this method can have feedback defined for
             // the wrapped shortanswer questions.
             //if ($options->feedback
             // && !empty($subquestion->options->answers[$responses[$key]]->feedback)) {
             //    print_comment($subquestion->options->answers[$responses[$key]]->feedback);
             //}
             $anss[] = $a;
         }
     }
     include "{$CFG->dirroot}/question/type/match/display.html";
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:76,代码来源:questiontype.php


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