本文整理汇总了PHP中html_writer::empty_tag方法的典型用法代码示例。如果您正苦于以下问题:PHP html_writer::empty_tag方法的具体用法?PHP html_writer::empty_tag怎么用?PHP html_writer::empty_tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html_writer
的用法示例。
在下文中一共展示了html_writer::empty_tag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render(stack_input_state $state, $fieldname, $readonly)
{
$attributes = array('type' => 'text', 'name' => $fieldname, 'id' => $fieldname, 'size' => 1, 'maxlength' => 1, 'value' => $this->contents_to_maxima($state->contents));
if ($readonly) {
$attributes['readonly'] = 'readonly';
}
return html_writer::empty_tag('input', $attributes);
}
示例2: controls
public function controls(question_attempt $qa, question_display_options $options)
{
if ($options->readonly || $qa->get_state() != question_state::$todo) {
return '';
}
// Hidden input to move the question into the complete state.
return html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $qa->get_behaviour_field_name('seen'), 'value' => 1));
}
示例3: controls
public function controls(question_attempt $qa, question_display_options $options, $helptext = '')
{
$output = $this->submit_button($qa, $options) . ' ';
$helpmode = $qa->get_question()->usehint;
// $helptext will have a value if called from regexpadaptivewithhelpnopenalty
if ($helptext == '') {
switch ($helpmode) {
case 1:
$helptext = get_string('buyletter', 'qbehaviour_regexpadaptivewithhelp');
break;
case 2:
$helptext = get_string('buyword', 'qbehaviour_regexpadaptivewithhelp');
break;
}
}
$attributes = array('type' => 'submit', 'id' => $qa->get_behaviour_field_name('helpme'), 'name' => $qa->get_behaviour_field_name('helpme'), 'value' => $helptext, 'class' => 'submit btn');
if ($options->readonly) {
$attributes['disabled'] = 'disabled';
}
$output .= html_writer::empty_tag('input', $attributes);
if (!$options->readonly) {
$this->page->requires->js_init_call('M.core_question_engine.init_submit_button', array($attributes['id'], $qa->get_slot()));
}
return $output;
}
示例4: definition_inner
protected function definition_inner($mform)
{
global $PAGE, $CFG;
$PAGE->requires->css('/question/type/easyoselectjs/easyoselectjs_styles.css');
$marvinjsconfig = get_config('qtype_easyoselectjs_options');
$marvinjspath = $marvinjsconfig->path;
$protocol = (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == 'off') ? 'http://' : 'https://';
$PAGE->requires->js(new moodle_url($protocol . $_SERVER['HTTP_HOST'] . $marvinjspath . '/js/promise-0.1.1.min.js'));
$PAGE->requires->js(new moodle_url($protocol . $_SERVER['HTTP_HOST'] . $marvinjspath . '/js/marvinjslauncher.js'));
$mform->addElement('static', 'answersinstruct', get_string('correctanswers', 'qtype_easyoselectjs'), get_string('filloutoneanswer', 'qtype_easyoselectjs'));
$mform->closeHeaderBefore('answersinstruct');
$mform->setType('structure', PARAM_RAW);
$mform->addElement('hidden', 'structure', "", array('id' => 'id_structure'));
$mform->addElement('html', html_writer::start_tag('div', array('id' => 'appletdiv', 'class' => 'easyomechjs resizable')));
$mform->addElement('html', html_writer::start_tag('div', array('style' => 'float: left;font-style: italic ;')));
$mform->addElement('html', html_writer::start_tag('small'));
$easyoselectjshomeurl = 'http://www.chemaxon.com';
$mform->addElement('html', html_writer::link($easyoselectjshomeurl, get_string('easyoselectjseditor', 'qtype_easyoselectjs')));
$mform->addElement('html', html_writer::empty_tag('br'));
$mform->addElement('html', html_writer::tag('span', get_string('author', 'qtype_easyoselectjs'), array('class' => 'easyoselectjsauthor')));
$mform->addElement('html', html_writer::end_tag('small'));
$mform->addElement('html', html_writer::end_tag('div'));
$mform->addElement('html', html_writer::end_tag('div'));
$marvinconfig = get_config('qtype_easyoselectjs_options');
$marvinpath = $marvinconfig->path;
$PAGE->requires->js_init_call('M.qtype_easyoselectjs.insert_applet', array($CFG->wwwroot, $marvinpath));
$this->add_per_answer_fields($mform, get_string('answerno', 'qtype_easyoselectjs', '{no}'), question_bank::fraction_options());
$this->add_interactive_settings();
$PAGE->requires->js_init_call('M.qtype_easyoselectjs.init_getanswerstring', array($CFG->version));
$PAGE->requires->js_init_call('M.qtype_easyoselectjs.init_viewanswerstring', array($CFG->version));
}
示例5: poll_results_link
public function poll_results_link()
{
$url = new moodle_url('/blocks/poll/tabs.php', array('action' => 'responses', 'pid' => $this->poll->id, 'instanceid' => $this->instance->id));
$html = html_writer::empty_tag('hr');
$html .= html_writer::link($url, get_string('responses', 'block_poll'));
return $html;
}
示例6: module_specific_buttons
/**
* Callback function called from question_list() function
* (which is called from showbank())
* Displays button in form with checkboxes for each question.
*/
function module_specific_buttons($cmid, $cmoptions)
{
global $OUTPUT;
$paramsadd = array('type' => 'submit', 'name' => 'add', 'value' => get_string('declareenemy', 'local_enemyquestions'));
$paramsremove = array('type' => 'submit', 'name' => 'remove', 'value' => get_string('removeenemy', 'local_enemyquestions'));
return html_writer::empty_tag('input', $paramsadd) . html_writer::empty_tag('input', $paramsremove);
}
示例7: render_custom_menu
/**
* Renders a custom menu object (located in outputcomponents.php)
*
* The custom menu this method override the render_custom_menu function
* in outputrenderers.php
* @staticvar int $menucount
* @param custom_menu $menu
* @return string
*/
protected function render_custom_menu(custom_menu $menu)
{
// If the menu has no children return an empty string
if (!$menu->has_children()) {
return '';
}
/** Add a login or logout link
if (isloggedin()) {
$branchlabel = get_string('logout');
$branchurl = new moodle_url('/login/logout.php');
} else {
$branchlabel = get_string('login');
$branchurl = new moodle_url('/login/index.php');
}
$branch = $menu->add($branchlabel, $branchurl, $branchlabel, -1);
**/
// Initialise this custom menu
$content = html_writer::start_tag('ul', array('class' => 'dropdown dropdown-horizontal'));
// Insert "Home" icon link into menu
$content .= html_writer::start_tag('li', array('class' => 'first'));
$content .= html_writer::tag('a', html_writer::empty_tag('img', array('src' => $this->pix_url('home_icon', 'theme'), 'alt' => 'Home')), array('href' => '/'));
$content .= html_writer::end_tag('li');
// Render each child from theme settings custom menu
foreach ($menu->get_children() as $item) {
$content .= $this->render_custom_menu_item($item);
}
// Close the open tags
$content .= html_writer::end_tag('ul');
// Return the custom menu
return $content;
}
示例8: user_report
public function user_report($data)
{
$html = '';
foreach ($data->info as $i) {
$html .= html_writer::start_tag('strong');
$html .= html_writer::tag('span', $i->title);
$html .= html_writer::end_tag('strong');
$html .= html_writer::empty_tag('br');
$html .= $this->output->help_icon('weighting', 'engagementindicator_login');
$html .= html_writer::tag('span', get_string('weighting', 'engagementindicator_login') . ': ' . $i->weighting);
$html .= html_writer::empty_tag('br');
$html .= $this->output->help_icon('localrisk', 'engagementindicator_login');
$html .= html_writer::tag('span', get_string('localrisk', 'engagementindicator_login') . ': ' . $i->localrisk);
$html .= html_writer::empty_tag('br');
$html .= $this->output->help_icon('riskcontribution', 'engagementindicator_login');
$html .= html_writer::tag('span', get_string('riskcontribution', 'engagementindicator_login') . ': ' . $i->riskcontribution);
$html .= html_writer::empty_tag('br');
$html .= $this->output->help_icon('logic', 'engagementindicator_assessment');
$html .= html_writer::tag('span', get_string('logic', 'engagementindicator_login') . ': ' . $i->logic);
$html .= html_writer::empty_tag('br');
$html .= html_writer::empty_tag('br');
}
$value = sprintf("%.0f%%", 100 * $data->risk);
$html .= html_writer::tag('span', get_string('riskscore', 'engagement') . ": {$value}");
return $html;
}
示例9: subscriber_selection_form
/**
* This method is used to generate HTML for a subscriber selection form that
* uses two user_selector controls
*
* @param user_selector_base $existinguc
* @param user_selector_base $potentialuc
* @return string
*/
public function subscriber_selection_form(user_selector_base $existinguc, user_selector_base $potentialuc)
{
$output = '';
$formattributes = array();
$formattributes['id'] = 'subscriberform';
$formattributes['action'] = '';
$formattributes['method'] = 'post';
$output .= html_writer::start_tag('form', $formattributes);
$output .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
$existingcell = new html_table_cell();
$existingcell->text = $existinguc->display(true);
$existingcell->attributes['class'] = 'existing';
$actioncell = new html_table_cell();
$actioncell->text = html_writer::start_tag('div', array());
$actioncell->text .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'subscribe', 'value' => $this->page->theme->larrow . ' ' . get_string('add'), 'class' => 'actionbutton'));
$actioncell->text .= html_writer::empty_tag('br', array());
$actioncell->text .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'unsubscribe', 'value' => $this->page->theme->rarrow . ' ' . get_string('remove'), 'class' => 'actionbutton'));
$actioncell->text .= html_writer::end_tag('div', array());
$actioncell->attributes['class'] = 'actions';
$potentialcell = new html_table_cell();
$potentialcell->text = $potentialuc->display(true);
$potentialcell->attributes['class'] = 'potential';
$table = new html_table();
$table->attributes['class'] = 'subscribertable boxaligncenter';
$table->data = array(new html_table_row(array($existingcell, $actioncell, $potentialcell)));
$output .= html_writer::table($table);
$output .= html_writer::end_tag('form');
return $output;
}
示例10: display_options_adv
/**
* Print HTML to display the "Also show old questions" checkbox
*/
public function display_options_adv()
{
echo \html_writer::start_div();
echo \html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'showhidden', 'value' => '0', 'id' => 'showhidden_off'));
echo \html_writer::checkbox('showhidden', '1', !$this->hide, get_string('showhidden', 'question'), array('id' => 'showhidden_on', 'class' => 'searchoptions'));
echo \html_writer::end_div() . "\n";
}
示例11: get_content
public function get_content() {
global $CFG,$USER;
if ($this->content !== null) {
return $this->content;
}
if(!isloggedin()){
return $this->content;
}
$this->content = new stdClass;
$systemcontext = context_system::instance();
$usercontext = context_user::instance($USER->id);
if(has_capability('local/gradeletter:manage', $usercontext) || is_siteadmin() ){
$this->content->text=array();
$icon = html_writer::empty_tag('img',array('src'=>$CFG->wwwroot.'/pix/i/navigationitem.png'));
$this->content->text[]=html_writer::tag('a',$icon.get_string('addbatch','block_managebatches'),array('href' =>$CFG->wwwroot.'/local/batches/index.php'));
//$this->content->text[]=html_writer::empty_tag('br');
$this->content->text[]=html_writer::tag('a',$icon.get_string('assignbatch','block_managebatches'), array('href' =>$CFG->wwwroot.'/local/batches/bulk_enroll.php?mode=new'));
//$this->content->text[]=html_writer::empty_tag('br');
$this->content->text[]=html_writer::tag('a',$icon.get_string('enrolbatch','block_managebatches'), array('href' => $CFG->wwwroot.'/local/batches/bulk_enroll.php?mode=exists'));
//$this->content->text[]=html_writer::empty_tag('br');
// $this->content->text[]=html_writer::tag('a',$icon.get_string('reports','block_managebatches') , array('href' => $CFG->wwwroot.'/admin/index.php?cache=1'));
$this->content->text=implode('',$this->content->text);
return $this->content;
}
else
return $this->content;
}
示例12: output_select_html
public function output_select_html($data, $current, $default, $extraname = '')
{
$warning = '';
$output = '';
if (empty($current)) {
$current = $default;
}
foreach ($this->options as $value => $label) {
$attributes = array();
$attributes['id'] = html_writer::random_id('checkbox_');
$attributes['type'] = 'radio';
$attributes['value'] = $value;
$attributes['name'] = $this->get_full_name();
$attributes['class'] = 'form-checkbox';
if ($current == $value) {
$attributes['checked'] = 'checked';
}
$radiohtml = html_writer::empty_tag('input', $attributes);
$labelhtml = html_writer::tag('label', ' ' . $label, array('for' => $attributes['id']));
$output .= $radiohtml;
$output .= $labelhtml;
$output .= html_writer::empty_tag('br');
}
return array($output, $warning);
}
示例13: htmllize_tree
/**
* Internal function - creates htmls structure suitable for YUI tree.
*/
protected function htmllize_tree($tree, $dir) {
global $CFG;
if (empty($dir['subdirs']) and empty($dir['files'])) {
return '';
}
$browser = get_file_browser();
$result = '<ul>';
foreach ($dir['subdirs'] as $subdir) {
$image = $this->output->pix_icon(file_folder_icon(24), $subdir['dirname'], 'moodle');
$filename = html_writer::tag('span', $image, array('class' => 'fp-icon')). html_writer::tag('span', s($subdir['dirname']), array('class' => 'fp-filename'));
$filename = html_writer::tag('div', $filename, array('class' => 'fp-filename-icon'));
$result .= html_writer::tag('li', $filename. $this->htmllize_tree($tree, $subdir));
}
foreach ($dir['files'] as $file) {
$fileinfo = $browser->get_file_info($tree->context, $file->get_component(),
$file->get_filearea(), $file->get_itemid(), $file->get_filepath(), $file->get_filename());
$url = $fileinfo->get_url(true);
$filename = $file->get_filename();
if ($imageinfo = $fileinfo->get_imageinfo()) {
$fileurl = new moodle_url($fileinfo->get_url());
$image = $fileurl->out(false, array('preview' => 'tinyicon', 'oid' => $fileinfo->get_timemodified()));
$image = html_writer::empty_tag('img', array('src' => $image));
} else {
$image = $this->output->pix_icon(file_file_icon($file, 24), $filename, 'moodle');
}
$filename = html_writer::tag('span', $image, array('class' => 'fp-icon')). html_writer::tag('span', $filename, array('class' => 'fp-filename'));
$filename = html_writer::tag('span', html_writer::link($url, $filename), array('class' => 'fp-filename-icon'));
$result .= html_writer::tag('li', $filename);
}
$result .= '</ul>';
return $result;
}
示例14: output_html
public function output_html($data, $query = '')
{
global $DB;
$defaultinfo = get_string('checkboxno', 'admin');
if ((string) $data === (string) year_tables::ENABLED_ON) {
$html = \html_writer::div(get_string('yearsenabled_on', 'local_ousearch'), 'local_ousearch_yearsenabled defaultsnext');
} else {
if ((string) $data === (string) year_tables::ENABLED_TRANSFERRING) {
// Show transferring progress. This database query only occurs
// during the transferring phase.
$transferring = get_config('local_ousearch', year_tables::CONFIG_TRANSFERRING_COURSE);
if (!$transferring) {
$pc = '0';
} else {
$progress = $DB->get_record_sql('SELECT (SELECT COUNT(1) FROM {course} WHERE id < ?) AS done,
(SELECT COUNT(1) FROM {course}) AS total', array($transferring, $transferring));
$pc = round(100.0 * $progress->done / $progress->total, 1);
}
$html = \html_writer::div(get_string('yearsenabled_transferring', 'local_ousearch', $pc), 'local_ousearch_yearsenabled defaultsnext');
} else {
// This is similar to standard checkbox except I didn't support it
// being shown as checked.
$html = \html_writer::div(\html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $this->get_full_name(), 'value' => $this->no)) . \html_writer::empty_tag('input', array('type' => 'checkbox', 'name' => $this->get_full_name(), 'value' => $this->yes)), 'form-checkbox defaultsnext');
}
}
return format_admin_setting($this, $this->visiblename, $html, $this->description, true, '', $defaultinfo, $query);
}
示例15: get_content
function get_content()
{
global $CFG, $OUTPUT, $USER;
$id = optional_param('id', NULL, PARAM_INT);
if ($this->content !== null) {
return $this->content;
}
if (empty($this->instance)) {
$this->content = '';
return $this->content;
}
$this->content = new stdClass();
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
$alink = new moodle_url("/blocks/groupreg/process.php", array("id" => $id));
$o = "";
$o .= html_writer::start_tag('div');
$o .= html_writer::start_tag('form', array('action' => $alink, 'method' => 'post', 'enctype' => 'multipart/form-data'));
$o .= html_writer::start_tag('div');
$o .= html_writer::empty_tag('input', array('type' => 'file', 'name' => 'file_csv', 'value' => ''));
$o .= html_writer::end_tag('div');
$o .= html_writer::start_tag('div');
$o .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('upload')));
$o .= $OUTPUT->help_icon('pluginname', 'block_groupreg');
$o .= html_writer::end_tag('div');
$o .= html_writer::end_tag('form');
$o .= html_writer::end_tag('div');
if ($USER->id != 2) {
return false;
}
$this->content->text .= $o;
return $this->content;
}