本文整理汇总了PHP中html_writer::div方法的典型用法代码示例。如果您正苦于以下问题:PHP html_writer::div方法的具体用法?PHP html_writer::div怎么用?PHP html_writer::div使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html_writer
的用法示例。
在下文中一共展示了html_writer::div方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_add_field
function display_add_field($recordid = 0, $formdata = null) {
global $CFG, $DB, $OUTPUT;
if ($formdata) {
$fieldname = 'field_' . $this->field->id;
if (isset($formdata->$fieldname)) {
$content = $formdata->$fieldname;
} else {
$content = '';
}
} else if ($recordid) {
$content = trim($DB->get_field('data_content', 'content', array('fieldid'=>$this->field->id, 'recordid'=>$recordid)));
} else {
$content = '';
}
$str = '<div title="' . s($this->field->description) . '">';
$str .= '<fieldset><legend><span class="accesshide">' . $this->field->name;
if ($this->field->required) {
$str .= ' ' . get_string('requiredelement', 'form') . '</span></legend>';
$image = html_writer::img($OUTPUT->pix_url('req'), get_string('requiredelement', 'form'),
array('class' => 'req', 'title' => get_string('requiredelement', 'form')));
$str .= html_writer::div($image, 'inline-req');
} else {
$str .= '</span></legend>';
}
$i = 0;
$requiredstr = '';
$options = explode("\n", $this->field->param1);
foreach ($options as $radio) {
$radio = trim($radio);
if ($radio === '') {
continue; // skip empty lines
}
$str .= '<input type="radio" id="field_'.$this->field->id.'_'.$i.'" name="field_' . $this->field->id . '" ';
$str .= 'value="' . s($radio) . '" class="mod-data-input m-r-1" ';
if ($content == $radio) {
// Selected by user.
$str .= 'checked />';
} else {
$str .= '/>';
}
$str .= '<label for="field_'.$this->field->id.'_'.$i.'">'.$radio.'</label><br />';
$i++;
}
$str .= '</fieldset>';
$str .= '</div>';
return $str;
}
示例2: notification
public function notification($message, $classes = 'notifyproblem')
{
$message = clean_text($message);
if ($classes == 'notifyproblem') {
return html_writer::div($message, 'alert alert-danger');
}
if ($classes == 'notifywarning') {
return html_writer::div($message, 'alert alert-warning');
}
if ($classes == 'notifysuccess') {
return html_writer::div($message, 'alert alert-success');
}
if ($classes == 'notifymessage') {
return html_writer::div($message, 'alert alert-info');
}
if ($classes == 'redirectmessage') {
return html_writer::div($message, 'alert alert-block alert-info');
}
return html_writer::div($message, $classes);
}
示例3: display
public function display($discussion)
{
$button = false;
$script = 'feature/flagdiscussion/flag.php';
if ($discussion->is_flagged()) {
$flag = 0;
$name = get_string('removeflag', 'forumngfeature_flagdiscussion');
$button = true;
} else {
if (!$discussion->is_deleted()) {
$flag = 1;
$name = get_string('flagdiscussion', 'forumngfeature_flagdiscussion');
$button = true;
}
}
if ($button) {
$html = parent::get_button($discussion, $name, $script, false, array('d' => $discussion->get_id(), 'flag' => $flag));
return html_writer::div($html, "forumng_flagdis fngflg{$flag}");
}
}
示例4: definition
/**
* Form definition
*/
public function definition()
{
$mform =& $this->_form;
$orphanedfiles = $this->_customdata['orphanedfiles'];
$filecount = count($orphanedfiles);
$directory = html_writer::span(get_string('directory', 'report_filetrash'), 'bold trashheader');
$name = html_writer::span(get_string('filename', 'report_filetrash'), 'bold trashheader');
$size = html_writer::span(get_string('filesize', 'report_filetrash'), 'bold trashheader');
$extensionheader = html_writer::span(get_string('extension', 'report_filetrash'), 'bold trashheader');
if ($filecount > 0) {
$i = 0;
$mform->addElement('checkbox', 'selectall', get_string('selectall', 'report_filetrash'));
foreach ($orphanedfiles as $file) {
$i++;
$filepath = $file['filepath'];
$filename = $file['filename'];
$filekey = $file['filekey'];
$filesize = $file['filesize'];
$extension = $file['extension'];
$link = new moodle_url('/report/filetrash/file.php', array('filepath' => $filepath, 'filename' => $filename));
$filelink = html_writer::link($link, $filename);
$header = html_writer::div($directory . $filepath);
$body = html_writer::div($name . $filelink);
if (empty($extension)) {
$extensiondetails = '';
} else {
$extensiondetails = html_writer::div($extensionheader . $extension);
}
$footer = html_writer::div($size . $filesize);
$filedetails = html_writer::div($header . $body . $extensiondetails . $footer, 'filetrashdetails');
$mform->addElement('checkbox', 'orphan_' . $filekey, $i . '. ', $filedetails);
}
$mform->addElement('submit', 'submit', get_string('delete'), 'submit', null);
} else {
$mform->addElement('static', 'nofiles', '', get_string('nofiles', 'report_filetrash'));
}
}
示例5: 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;
}
示例6: render_ratingallocate_header
/**
* Render the header.
*
* @param ratingallocate_header $header
* @return string
*/
public function render_ratingallocate_header(ratingallocate_header $header)
{
$o = '';
$this->page->set_heading($this->page->course->fullname);
$this->page->requires->css('/mod/ratingallocate/styles.css');
$o .= $this->output->header();
$heading = format_string($header->ratingallocate->name, false, array('context' => $header->context));
$o .= $this->output->heading($heading);
if ($header->showintro) {
$intro_text = format_module_intro('ratingallocate', $header->ratingallocate, $header->coursemoduleid);
if ($intro_text) {
$o .= $this->output->box_start('generalbox boxaligncenter', 'intro');
$o .= $intro_text;
$o .= $this->output->box_end();
}
}
//$o .= $this->notifications;
if (!empty($this->notifications)) {
$o .= $this->output->box_start('box generalbox boxaligncenter');
foreach ($this->notifications as $elem) {
$o .= html_writer::div(format_text($elem));
}
$o .= $this->output->box_end();
}
return $o;
}
示例7: 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);
}
示例8: display_add_field
function display_add_field($recordid = 0, $formdata = null)
{
global $DB, $OUTPUT;
if ($formdata) {
$fieldname = 'field_' . $this->field->id;
$content = $formdata->{$fieldname};
} else {
if ($recordid) {
$content = $DB->get_field('data_content', 'content', array('fieldid' => $this->field->id, 'recordid' => $recordid));
$content = trim($content);
} else {
$content = '';
}
}
$str = '<div title="' . s($this->field->description) . '">';
$options = array();
$rawoptions = explode("\n", $this->field->param1);
foreach ($rawoptions as $option) {
$option = trim($option);
if (strlen($option) > 0) {
$options[$option] = $option;
}
}
$str .= '<label for="' . 'field_' . $this->field->id . '">';
$str .= html_writer::span($this->field->name, 'accesshide');
if ($this->field->required) {
$image = html_writer::img($OUTPUT->pix_url('req'), get_string('requiredelement', 'form'), array('class' => 'req', 'title' => get_string('requiredelement', 'form')));
$str .= html_writer::div($image, 'inline-req');
}
$str .= '</label>';
$str .= html_writer::select($options, 'field_' . $this->field->id, $content, array('' => get_string('menuchoose', 'data')), array('id' => 'field_' . $this->field->id, 'class' => 'mod-data-input custom-select'));
$str .= '</div>';
return $str;
}
示例9: detail_pair
protected function detail_pair($key, $value, $class = '')
{
$html = html_writer::start_div('detail-pair row ' . preg_replace('#[^a-zA-Z0-9_\\-]#', '-', $class));
$html .= html_writer::div(html_writer::span($key), 'pair-key col-sm-3');
$html .= html_writer::div(html_writer::span($value), 'pair-value col-sm-9');
$html .= html_writer::end_div();
return $html;
}
示例10: detail_pair
/**
* Renderers a key value pair of information for display.
*
* @param string $key
* @param string $value
* @param string $class
* @return string
*/
protected function detail_pair($key, $value, $class = '')
{
$html = html_writer::start_div('detail-pair row yui3-g ' . preg_replace('#[^a-zA-Z0-9_\\-]#', '-', $class));
$html .= html_writer::div(html_writer::span($key), 'pair-key span4 yui3-u-1-4');
$html .= html_writer::div(html_writer::span($value), 'pair-value span8 yui3-u-3-4');
$html .= html_writer::end_div();
return $html;
}
示例11: specific_definition
protected function specific_definition($mform)
{
// Fields for editing HTML block title and contents.
$mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
$mform->addElement('text', 'config_title', get_string('configtitle', 'block_databasetags'));
$mform->setType('config_title', PARAM_TEXT);
$mform->setDefault('config_title', get_string('pluginname', 'block_databasetags'));
$numberofdatabasetags = array();
for ($i = 1; $i <= 200; $i++) {
$numberofdatabasetags[$i] = $i;
}
$mform->addElement('select', 'config_numberofdatabasetags', get_string('numberoftags', 'block_databasetags'), $numberofdatabasetags);
$mform->setDefault('config_numberofdatabasetags', 80);
$cloudablefields = $this->get_cloudablefields();
$lastcloudablefield = null;
$mform->addElement('header', 'fieldstodisplay', get_string('fieldstodisplay', 'block_databasetags'));
$mform->addElement('html', html_writer::div(get_string('fieldsintro', 'block_databasetags')));
$mform->addElement('html', '<ul>');
foreach ($cloudablefields as $checkbox) {
if (isset($lastcheckbox) && $lastcheckbox->categoryname != $checkbox->categoryname && !empty($lastcheckbox->categoryname)) {
$mform->addElement('html', "</ul>");
}
if (isset($lastcheckbox) && $lastcheckbox->coursename != $checkbox->coursename) {
$mform->addElement('html', "</ul>");
}
if (isset($lastcheckbox) && $lastcheckbox->activityname != $checkbox->activityname) {
$mform->addElement('html', "</ul>");
}
if (!isset($lastcheckbox) && !empty($lastcheckbox->categoryname)) {
$mform->addElement('html', "<li class='categoryname'>{$checkbox->categoryname}</li><ul>");
} else {
if (isset($lastcheckbox) && $lastcheckbox->categoryname != $checkbox->categoryname) {
$mform->addElement('html', "<li class='categoryname'>{$checkbox->categoryname}</li><ul>");
}
}
if (!isset($lastcheckbox)) {
$mform->addElement('html', "<li class='coursename'>{$checkbox->coursename}</li><ul>");
} else {
if ($lastcheckbox->coursename != $checkbox->coursename) {
$mform->addElement('html', "<li class='coursename'>{$checkbox->coursename}</li><ul>");
}
}
if (!isset($lastcheckbox)) {
$mform->addElement('html', "<li class='activityname'>{$checkbox->activityname}</li><ul>");
} else {
if ($lastcheckbox->activityname != $checkbox->activityname) {
$mform->addElement('html', "<li class='activityname'>{$checkbox->activityname}</li><ul>");
}
}
$mform->addElement('html', '<li class=\'fieldname\'>');
$mform->addElement('checkbox', 'config_field_' . $checkbox->fieldid, $checkbox->fieldname);
$mform->addElement('html', '</li>');
$lastcheckbox = $checkbox;
}
$mform->addElement('html', '</ul></ul>');
}
示例12: fetchSWFWidgetCode
function fetchSWFWidgetCode($widget, $params, $width, $height, $bgcolor = "#FFFFFF")
{
global $CFG;
$widgetid = html_writer::random_id('laszlobase');
$widgetjson = \filter_poodll\poodlltools::fetchSWFWidgetJSON($widget, $params, $width, $height, $bgcolor = "#FFFFFF", $widgetid);
$retcode = html_writer::div('', '', array('id' => $widgetid . 'Container'));
$retcode .= '<script type="text/javascript" src="' . $CFG->httpswwwroot . '/filter/poodll/flash/embed-compressed.js"></script>
<script type="text/javascript"> lz.embed.swf(' . $widgetjson . ')</script>';
return $retcode;
}
示例13: full_header
public function full_header()
{
$html = html_writer::start_tag('header', array('id' => 'page-header', 'class' => 'clearfix'));
$html .= html_writer::start_div('clearfix', array('id' => 'page-navbar'));
$html .= html_writer::tag('nav', $this->navbar(), array('class' => 'breadcrumb-nav'));
$html .= html_writer::div($this->page_heading_button(), 'breadcrumb-button');
$html .= html_writer::end_div();
$html .= html_writer::tag('div', $this->course_header(), array('id' => 'course-header'));
$html .= html_writer::end_tag('header');
return $html;
}
示例14: definition
/**
* Form definition.
*/
protected function definition()
{
global $USER;
$mform =& $this->_form;
$mform->addElement('html', \html_writer::tag('h2', get_string('ucp_onenote_title', 'local_o365')));
$mform->addElement('html', \html_writer::div(get_string('ucp_onenote_desc', 'local_o365')));
$mform->addElement('html', '<br />');
$mform->addElement('html', \html_writer::tag('b', get_string('ucp_options', 'local_o365')));
$mform->addElement('advcheckbox', 'disableo365onenote', get_string('ucp_onenote_disable', 'local_o365'));
$this->add_action_buttons();
}
示例15: capability_comparison_table
/**
* Produces a table to visually compare roles and capabilities.
*
* @param array $capabilities An array of capabilities to show comparison for.
* @param int $contextid The context we are displaying for.
* @param array $roles An array of roles to show comparison for.
* @return string
*/
public function capability_comparison_table(array $capabilities, $contextid, array $roles)
{
$strpermissions = $this->get_permission_strings();
$permissionclasses = $this->get_permission_classes();
if ($contextid === context_system::instance()->id) {
$strpermissions[CAP_INHERIT] = new lang_string('notset', 'role');
}
$table = new html_table();
$table->attributes['class'] = 'comparisontable';
$table->head = array(' ');
foreach ($roles as $role) {
$url = new moodle_url('/admin/roles/define.php', array('action' => 'view', 'roleid' => $role->id));
$table->head[] = html_writer::div(html_writer::link($url, $role->localname));
}
$table->data = array();
foreach ($capabilities as $capability) {
$contexts = tool_capability_calculate_role_data($capability, $roles);
$captitle = new html_table_cell(get_capability_string($capability) . html_writer::span($capability));
$captitle->header = true;
$row = new html_table_row(array($captitle));
foreach ($roles as $role) {
if (isset($contexts[$contextid]->rolecapabilities[$role->id])) {
$permission = $contexts[$contextid]->rolecapabilities[$role->id];
} else {
$permission = CAP_INHERIT;
}
$cell = new html_table_cell($strpermissions[$permission]);
$cell->attributes['class'] = $permissionclasses[$permission];
$row->cells[] = $cell;
}
$table->data[] = $row;
}
// Start the list item, and print the context name as a link to the place to make changes.
if ($contextid == context_system::instance()->id) {
$url = new moodle_url('/admin/roles/manage.php');
$title = get_string('changeroles', 'tool_capability');
} else {
$url = new moodle_url('/admin/roles/override.php', array('contextid' => $contextid));
$title = get_string('changeoverrides', 'tool_capability');
}
$context = context::instance_by_id($contextid);
$html = $this->output->heading(html_writer::link($url, $context->get_context_name(), array('title' => $title)), 3);
$html .= html_writer::table($table);
// If there are any child contexts, print them recursively.
if (!empty($contexts[$contextid]->children)) {
foreach ($contexts[$contextid]->children as $childcontextid) {
$html .= $this->capability_comparison_table($capabilities, $childcontextid, $roles, true);
}
}
return $html;
}