本文整理汇总了PHP中html_writer::start_tag方法的典型用法代码示例。如果您正苦于以下问题:PHP html_writer::start_tag方法的具体用法?PHP html_writer::start_tag怎么用?PHP html_writer::start_tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html_writer
的用法示例。
在下文中一共展示了html_writer::start_tag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_section_links
/**
* Render a series of section links.
*
* @param stdClass $course The course we are rendering for.
* @param array $sections An array of section objects to render.
* @param bool|int The section to provide a jump to link for.
* @return string The HTML to display.
*/
public function render_section_links(stdClass $course, array $sections, $jumptosection = false)
{
$html = html_writer::start_tag('ol', array('class' => 'inline-list'));
foreach ($sections as $section) {
$attributes = array();
if (!$section->visible) {
$attributes['class'] = 'dimmed';
}
$html .= html_writer::start_tag('li');
$sectiontext = $section->section;
if ($section->highlight) {
$sectiontext = html_writer::tag('strong', $sectiontext);
}
$html .= html_writer::link(course_get_url($course, $section->section), $sectiontext, $attributes);
$html .= html_writer::end_tag('li') . ' ';
}
$html .= html_writer::end_tag('ol');
if ($jumptosection && isset($sections[$jumptosection])) {
if ($course->format == 'weeks') {
$linktext = new lang_string('jumptocurrentweek', 'block_section_links');
} else {
if ($course->format == 'topics') {
$linktext = new lang_string('jumptocurrenttopic', 'block_section_links');
}
}
$attributes = array();
if (!$sections[$jumptosection]->visible) {
$attributes['class'] = 'dimmed';
}
$html .= html_writer::link(course_get_url($course, $jumptosection), $linktext, $attributes);
}
return $html;
}
示例2: filter
function filter($text, array $options = array())
{
$coursectx = $this->context->get_course_context(false);
if (!$coursectx) {
return $text;
}
$courseid = $coursectx->instanceid;
// Initialise/invalidate our trivial cache if dealing with a different course
if (!isset(self::$cachedcourseid) || self::$cachedcourseid !== (int) $courseid) {
self::$activitylist = null;
}
self::$cachedcourseid = (int) $courseid;
/// It may be cached
if (is_null(self::$activitylist)) {
self::$activitylist = array();
$modinfo = get_fast_modinfo($courseid);
if (!empty($modinfo->cms)) {
self::$activitylist = array();
// We will store all the created filters here.
// Create array of visible activities sorted by the name length (we are only interested in properties name and url).
$sortedactivities = array();
foreach ($modinfo->cms as $cm) {
// Exclude labels, hidden activities and activities for group members only.
if ($cm->visible and empty($cm->groupmembersonly) and $cm->has_view()) {
$sortedactivities[] = (object) array('name' => $cm->name, 'url' => $cm->url, 'id' => $cm->id, 'namelen' => strlen($cm->name));
}
}
core_collator::asort_objects_by_property($sortedactivities, 'namelen', SORT_NUMERIC);
foreach ($sortedactivities as $cm) {
$title = s(trim(strip_tags($cm->name)));
$currentname = trim($cm->name);
$entitisedname = s($currentname);
// Avoid empty or unlinkable activity names.
if (!empty($title)) {
$href_tag_begin = html_writer::start_tag('a', array('class' => 'autolink', 'title' => $title, 'href' => $cm->url));
self::$activitylist[$cm->id] = new filterobject($currentname, $href_tag_begin, '</a>', false, true);
if ($currentname != $entitisedname) {
// If name has some entity (& " < >) add that filter too. MDL-17545.
self::$activitylist[$cm->id . '-e'] = new filterobject($entitisedname, $href_tag_begin, '</a>', false, true);
}
}
}
}
}
$filterslist = array();
if (self::$activitylist) {
$cmid = $this->context->instanceid;
if ($this->context->contextlevel == CONTEXT_MODULE && isset(self::$activitylist[$cmid])) {
// remove filterobjects for the current module
$filterslist = array_values(array_diff_key(self::$activitylist, array($cmid => 1, $cmid . '-e' => 1)));
} else {
$filterslist = array_values(self::$activitylist);
}
}
if ($filterslist) {
return $text = filter_phrases($text, $filterslist);
} else {
return $text;
}
}
示例3: virtualclass_online_server
function virtualclass_online_server($url, $authusername, $authpassword, $role, $rid, $room,
$popupoptions, $popupwidth, $popupheight, $upload, $down, $debug = false,
$anyonepresenter = 0, $audio = 0, $pushtotalk = 0, $themecolor = 'black') {
global $USER;
$form = html_writer::start_tag('form', array('id' => 'overrideform', 'action' => $url, 'method' => 'post',
'onsubmit' => 'return virtualclass_online_popup(this)', 'data-popupoption' => $popupoptions,
'data-popupwidth' => $popupwidth, 'data-popupheight' => $popupheight));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'uid', 'value' => $USER->id));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'name', 'value' => $USER->username));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'role', 'value' => $role));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'room', 'value' => $room));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sid', 'value' => $USER->sesskey));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'user', 'value' => $authusername));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'pass', 'value' => $authpassword));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'rid', 'value' => $rid));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'upload', 'value' => $upload));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'down', 'value' => $down));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'debug', 'value' => $debug));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'audio', 'value' => $audio));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'themecolor', 'value' => $themecolor));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'pushtotalk', 'value' => $pushtotalk));
$form .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'anyonepresenter', 'value' => $anyonepresenter));
$form .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'submit',
'value' => get_string('joinroom', 'virtualclass')));
$form .= html_writer::end_tag('form');
return $form;
}
示例4: modify_questionresults_duringquiz
/**
* Updating output to include javascript to initiate a lightbox effect on drawing type questions
* so that the images are smaller unless clicked on for review
*
* @param \mod_activequiz\activequiz_question $question The realtime quiz question
* @param array $attempts An array of \mod_activequiz\activequiz_attempt classes
* @param string $output The current output from getting the results
* @return string Return the updated output to be passed to the client
*/
public function modify_questionresults_duringquiz($question, $attempts, $output)
{
global $DB;
// if no attempts just return the output
if (empty($attempts)) {
return $output;
}
// get the question definition to determine response format
reset($attempts);
$attempt = current($attempts);
/** @var \mod_activequiz\activequiz_attempt $attempt */
$quba = $attempt->get_quba();
$slot = $attempt->get_question_slot($question);
$qa = $quba->get_question_attempt($slot);
// now get question definition
$questiondef = $qa->get_question();
if ($questiondef->responseformat == 'picture') {
// if the response format is a picture, meaning drawing type add the js for lightbox stuff
$picturejs = \html_writer::start_tag('script', array('type' => 'text/javascript', 'id' => 'poodllrecording_js'));
$picturejs .= '
activequiz.questionmodifiers.poodllrecording.lightbox_images();
';
$picturejs .= \html_writer::end_tag('script');
$newoutput = $output . $picturejs;
$newoutput = \html_writer::div($newoutput, '', array('id' => 'poodllrecording-picture'));
} else {
$newoutput = $output;
}
return $newoutput;
}
示例5: construct_ablock_select
private function construct_ablock_select(question_attempt $qa, question_display_options $options)
{
$question = $qa->get_question();
$response = $qa->get_last_qt_data();
$stemorder = $question->get_stem_order();
$choices = $this->format_choices($question);
$o = html_writer::start_tag('table', array('class' => 'answer'));
$o .= html_writer::start_tag('tbody');
$parity = 0;
foreach ($stemorder as $key => $stemid) {
$o .= html_writer::start_tag('tr', array('class' => 'r' . $parity));
$o .= html_writer::tag('td', $question->format_text($question->stems[$stemid], $question->stemformat[$stemid], $qa, 'qtype_order', 'subquestion', $stemid), array('class' => 'text'));
$classes = 'control';
$feedback = $this->get_feedback_class_image($qa, $options, $key);
if ($feedback->class) {
$classes .= ' ' . $feedback->class;
}
$selected = $this->get_selected($question, $response, $key);
$o .= html_writer::tag('td', html_writer::select($choices, $qa->get_qt_field_name($question->get_field_name($key)), $selected, array('0' => 'choose'), array('disabled' => $options->readonly)) . ' ' . $feedback->image, array('class' => $classes));
$o .= html_writer::end_tag('tr');
$parity = 1 - $parity;
}
$o .= html_writer::end_tag('tbody');
$o .= html_writer::end_tag('table');
return $o;
}
示例6: commenthtmlform
function commenthtmlform($loginuserid = '') {
$popup = html_writer:: start_tag('div',array('id'=>"basicModal$loginuserid",'style'=>'display:none;'));
$popup .= html_writer:: tag('h4','Add Comment',array('class'=>'formheading'));
$popup .= html_writer:: start_tag('form',array('name'=>'commentsform','onsubmit'=>'mycommentpopupform('.$loginuserid.')','action'=>''));
//$popup .= html_writer:: empty_tag('input',array('type'=>'hidden','name'=>'queryid'));
$popup .= html_writer:: start_tag('div',array('class'=>'summerylabel'));
$popup .= html_writer:: tag('label','Summery',array('for'=>'summery'));
$popup .= html_writer:: start_tag('span',array('class'=>'summerytextbox'));
$popup .= html_writer:: empty_tag('input',array('type'=>'text','name'=>'summery','class'=>'textbox'));
$popup .= html_writer:: end_tag('span');
$popup .= html_writer:: end_tag('div');
$popup .= html_writer:: start_tag('div',array('class'=>'summerylabel'));
$popup .= html_writer:: tag('label','Comment',array('for'=>'comment'));
$popup .= html_writer:: start_tag('span',array('class'=>'summerytextbox'));
$popup .= html_writer:: tag('textarea','comment',array('class'=>'commentfield'));
$popup .= html_writer:: end_tag('span');
$popup .= html_writer:: end_tag('div');
$popup .= html_writer:: start_tag('div',array('class'=>'submitbutton'));
$popup .= html_writer:: empty_tag('input',array('type'=>'submit','name'=>'summery','value'=>'submit'));
$popup .= html_writer:: end_tag('div');
$popup .= html_writer:: end_tag('form');
$popup .= html_writer:: end_tag('div');
return $popup;
}
示例7: facetoface_send_admin_upgrade_msg
/**
*
* Sends message to administrator listing all updated
* duplicate custom fields
* @param array $data
*/
function facetoface_send_admin_upgrade_msg($data)
{
global $SITE;
// No data - no need to send email.
if (empty($data)) {
return;
}
$table = new html_table();
$table->head = array('Custom field ID', 'Custom field original shortname', 'Custom field new shortname');
$table->data = $data;
$table->align = array('center', 'center', 'center');
$title = "{$SITE->fullname}: Face to Face upgrade info";
$note = 'During the last site upgrade the face-to-face module has been modified. It now
requires session custom fields to have unique shortnames. Since some of your
custom fields had duplicate shortnames, they have been renamed to remove
duplicates (see table below). This could impact on your email messages if you
reference those custom fields in the message templates.';
$message = html_writer::start_tag('html');
$message .= html_writer::start_tag('head') . html_writer::tag('title', $title) . html_writer::end_tag('head');
$message .= html_writer::start_tag('body');
$message .= html_writer::tag('p', $note) . html_writer::table($table, true);
$message .= html_writer::end_tag('body');
$message .= html_writer::end_tag('html');
$admin = get_admin();
email_to_user($admin, $admin, $title, '', $message);
}
示例8: make
/**
* Runs the entire 'make' process.
*
* @return int Course id
*/
public function make()
{
global $DB, $CFG;
raise_memory_limit(MEMORY_EXTRA);
if ($this->progress && !CLI_SCRIPT) {
echo html_writer::start_tag('ul');
}
$entirestart = microtime(true);
// Create courses.
$prevchdir = getcwd();
chdir($CFG->dirroot);
$ncourse = self::get_last_testcourse_id();
foreach (self::$sitecourses as $coursesize => $ncourses) {
for ($i = 1; $i <= $ncourses[$this->size]; $i++) {
// Non language-dependant shortname.
$ncourse++;
$this->run_create_course(self::SHORTNAMEPREFIX . $ncourse, $coursesize);
}
}
chdir($prevchdir);
// Store last course id to return it (will be the bigger one).
$lastcourseid = $DB->get_field('course', 'id', array('shortname' => self::SHORTNAMEPREFIX . $ncourse));
// Log total time.
$this->log('sitecompleted', round(microtime(true) - $entirestart, 1));
if ($this->progress && !CLI_SCRIPT) {
echo html_writer::end_tag('ul');
}
return $lastcourseid;
}
示例9: block_advance_print_page
function block_advance_print_page($advance, $return = false)
{
//add page title
global $OUTPUT, $COURSE;
$display = $OUTPUT->heading($advance->pagetitle);
$display .= $OUTPUT->box_start();
//date display
if ($advance->displaydate) {
$display .= html_writer::start_tag('div', array('class' => 'advance displaydate'));
$display .= userdate($advance->displaydate);
$display .= html_writer::end_tag('div');
}
//display text
$display .= clean_text($advance->displaytext);
//close the box
$display .= $OUTPUT->box_end();
//display picture
if ($advance->displaypicture) {
$display .= $OUTPUT->box_start();
$images = block_advance_images();
$display .= $images[$advance->picture];
$display .= html_writer::start_tag('p');
$display .= clean_text($advance->description);
$display .= html_writer::end_tag('p');
$display .= $OUTPUT->box_end();
}
//display it
if ($return) {
return $display;
} else {
echo $display;
}
}
示例10: 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));
}
示例11: render_custom_menu_item
/**
* Renders a custom menu node as part of a submenu
*
* The custom menu this method override the render_custom_menu_item function
* in outputrenderers.php
*
* @see render_custom_menu()
*
* @staticvar int $submenucount
* @param custom_menu_item $menunode
* @return string
*/
protected function render_custom_menu_item(custom_menu_item $menunode)
{
// Required to ensure we get unique trackable id's
static $submenucount = 0;
$content = html_writer::start_tag('li');
if ($menunode->has_children()) {
// If the child has menus render it as a sub menu
$submenucount++;
if ($menunode->get_url() !== null) {
$url = $menunode->get_url();
} else {
$url = '#cm_submenu_' . $submenucount;
}
$content .= html_writer::start_tag('span', array('class' => 'customitem'));
$content .= html_writer::link($url, $menunode->get_text(), array('title' => $menunode->get_title()));
$content .= html_writer::end_tag('span');
$content .= html_writer::start_tag('ul');
foreach ($menunode->get_children() as $menunode) {
$content .= $this->render_custom_menu_item($menunode);
}
$content .= html_writer::end_tag('ul');
} else {
// The node doesn't have children so produce a final menuitem
if ($menunode->get_url() !== null) {
$url = $menunode->get_url();
} else {
$url = '#';
}
$content .= html_writer::link($url, $menunode->get_text(), array('title' => $menunode->get_title()));
}
$content .= html_writer::end_tag('li');
// Return the sub menu
return $content;
}
示例12: 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;
}
示例13: 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;
}
示例14: block_campusclash_print_page
function block_campusclash_print_page($campusclash, $return = false)
{
//Add Page Title
global $OUTPUT, $COURSE;
$display = $OUTPUT->heading($campusclash->pagetitle);
//Open a box
$display .= $OUTPUT->box_start();
//Display the Date
if ($campusclash->displaydate) {
$display .= html_writer::start_tag('div', array('class' => 'displaydate'));
$display .= userdate($campusclash->displaydate);
$display .= html_writer::end_tag('div');
}
//Display Text
$display .= clean_text($campusclash->displaytext);
//close the box
$display .= $OUTPUT->box_end();
//Display the Picture
if ($campusclash->displaypicture) {
$display .= $OUTPUT->box_start();
$images = block_campusclash_images();
$display .= $images[$campusclash->picture];
$display .= html_writer::start_tag('p');
$display .= clean_text($campusclash->description);
$display .= html_writer::end_tag('p');
$display .= $OUTPUT->box_end();
}
//Check to ensure that it was set before trying to output it
if ($return) {
return $display;
} else {
echo $display;
}
}
示例15: apply
public function apply($discussion, $all, $selected, $formdata)
{
global $COURSE, $USER, $CFG, $PAGE;
$d = $discussion->get_id();
$forum = $discussion->get_forum();
$PAGE->set_pagelayout('embedded');
$out = mod_forumng_utils::get_renderer();
print $out->header();
$backlink = new moodle_url('/mod/forumng/discuss.php', $discussion->get_link_params_array());
print html_writer::start_tag('div', array('class' => 'forumng-printable-header'));
print html_writer::tag('div', link_arrow_left($discussion->get_subject(), $backlink), array('class' => 'forumng-printable-backlink'));
print html_writer::tag('div', get_string('printedat', 'forumngfeature_print', userdate(time())), array('class' => 'forumng-printable-date'));
print html_writer::tag('div', '', array('class' => 'clearer'));
print "\n";
print $out->box(get_string('back', 'forumngfeature_print', $backlink->out()), 'generalbox forumng-donotprint');
print html_writer::start_tag('div', array('class' => 'forumng-showprintable'));
if ($all) {
print $out->render_discussion($discussion, array(mod_forumng_post::OPTION_NO_COMMANDS => true, mod_forumng_post::OPTION_CHILDREN_EXPANDED => true, mod_forumng_post::OPTION_PRINTABLE_VERSION => true));
} else {
$allhtml = '';
$alltext = '';
$discussion->build_selected_posts_email($selected, $alltext, $allhtml, array(mod_forumng_post::OPTION_PRINTABLE_VERSION));
print $allhtml;
}
print html_writer::end_tag('div');
$forum->print_js(0, false);
print $out->footer();
}