當前位置: 首頁>>代碼示例>>PHP>>正文


PHP html_writer類代碼示例

本文整理匯總了PHP中html_writer的典型用法代碼示例。如果您正苦於以下問題:PHP html_writer類的具體用法?PHP html_writer怎麽用?PHP html_writer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了html_writer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_content

    function get_content() {
        global $USER,$DB;
        if ($this->content !== NULL) {
            return $this->content;
        }
	$this->content = new stdClass();
	$this->content->items = array();
	$is_manager = $DB->record_exists_sql("select cp.* from {local_costcenter_permissions} as cp 
                             JOIN {role_assignments} as ra ON ra.userid=cp.userid and cp.userid=$USER->id
                             JOIN {role} as r ON r.id=ra.roleid
                             where r.archetype='manager'");
	$is_teammanager = $DB->record_exists('local_teammanager_employee', array('teammanagerid'=>$USER->id));
	if($is_manager || is_siteadmin())
	$link = array(html_writer::link(new moodle_url('/local/users/index.php'),get_string('pluginname','local_users')));
	if(is_siteadmin())
	$link[] =  html_writer::link(new moodle_url('/local/costcenter/index.php'),get_string('pluginname','local_costcenter'));
        
	if($is_manager || is_siteadmin())
	$link[] =  html_writer::link(new moodle_url('/local/teammanager/index.php'),get_string('pluginname', 'local_teammanager'));
	if($is_teammanager && !is_siteadmin())
	$link[] =  html_writer::link(new moodle_url('/local/teammanager/myteam.php'),get_string('viewmyteam', 'local_teammanager'));
	if($is_manager || is_siteadmin())
	$link[] = html_writer::link(new moodle_url('/local/costcenter/courses.php'),get_string('course'));
	$this->content->items =  $link;
	$this->content->icons = '';
        $this->content->footer = '';
        return $this->content;
    }
開發者ID:narasimhaeabyas,項目名稱:tataaiapro,代碼行數:28,代碼來源:block_quicklinks.php

示例2: 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;
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:41,代碼來源:renderer.php

示例3: display_browse_field

 public function display_browse_field($recordid, $template)
 {
     global $DB, $CFG;
     if ($content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid))) {
         if (empty($content->content)) {
             return false;
         }
         $options = explode("\n", $this->field->param1);
         $options = array_map('trim', $options);
         $contentarray = explode('##', $content->content);
         $str = '';
         foreach ($contentarray as $line) {
             if (!in_array($line, $options)) {
                 // Somebody edited the field definition.
                 continue;
             }
             $params = array("f_{$this->field->id}" => $line, 'd' => $this->data->id, 'advanced' => 1);
             $url = new moodle_url('/mod/data/view.php', $params);
             $link = html_writer::link($url, $line);
             $str .= $link . "<br />\n";
         }
         return $str;
     }
     return false;
 }
開發者ID:andrewhancox,項目名稱:datafield_linkedradiobutton,代碼行數:25,代碼來源:field.class.php

示例4: get_submission_status

 /**
  * Search a list of modules.
  *
  * @param $modulecode
  * @return array [string]
  * @throws \invalid_parameter_exception
  */
 public static function get_submission_status($submissionid)
 {
     global $DB, $USER;
     $params = self::validate_parameters(self::get_submission_status_parameters(), array('submissionid' => $submissionid));
     $submissionid = $params['submissionid'];
     $submission = $DB->get_record('turnitintooltwo_submissions', array('id' => $submissionid));
     if (!$submission) {
         return array('status' => 'error');
     }
     // Grab more data.
     $turnitintooltwo = $DB->get_record('turnitintooltwo', array('id' => $submission->turnitintooltwoid));
     list($course, $cm) = get_course_and_cm_from_instance($turnitintooltwo, 'turnitintooltwo');
     // Check this is our submission.
     if ($USER->id !== $submission->userid && !has_capability('mod/turnitintooltwo:grade', \context_module::instance($cm->id))) {
         return array('status' => 'nopermission');
     }
     // What is the status?
     $status = $DB->get_record('turnitintooltwo_sub_status', array('submissionid' => $submissionid));
     if (!$status) {
         return array('status' => 'queued');
     }
     // Decode the receipt.
     $digitalreceipt = (array) json_decode($status->receipt);
     // Woo!
     if ($status->status == \mod_turnitintooltwo\task\submit_assignment::STATUS_SUCCESS) {
         $turnitintooltwoview = new \turnitintooltwo_view();
         $digitalreceipt = $turnitintooltwoview->show_digital_receipt($digitalreceipt);
         $digitalreceipt = \html_writer::tag("div", $digitalreceipt, array("id" => "box_receipt"));
         return array('status' => 'success', 'message' => $digitalreceipt);
     }
     return array('status' => 'failed', 'message' => \html_writer::tag("div", $digitalreceipt["message"], array("class" => "alert alert-danger")));
 }
開發者ID:SkylarKelty,項目名稱:moodle-mod_turnitintooltwo,代碼行數:39,代碼來源:external.php

示例5: 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;
 }
開發者ID:djplaner,項目名稱:moodle-mod_engagement,代碼行數:26,代碼來源:renderer.php

示例6: get_details

 /**
  * Get criteria details for displaying to users
  *
  * @return string
  */
 public function get_details($short = '')
 {
     global $DB, $OUTPUT;
     $output = array();
     foreach ($this->params as $p) {
         $coursename = $DB->get_field('course', 'fullname', array('id' => $p['course']));
         if (!$coursename) {
             $str = $OUTPUT->error_text(get_string('error:nosuchcourse', 'badges'));
         } else {
             $str = html_writer::tag('b', '"' . $coursename . '"');
             if (isset($p['bydate'])) {
                 $str .= get_string('criteria_descr_bydate', 'badges', userdate($p['bydate'], get_string('strftimedate', 'core_langconfig')));
             }
             if (isset($p['grade'])) {
                 $str .= get_string('criteria_descr_grade', 'badges', $p['grade']);
             }
         }
         $output[] = $str;
     }
     if ($short) {
         return implode(', ', $output);
     } else {
         return html_writer::alist($output, array(), 'ul');
     }
 }
開發者ID:Jtgadbois,項目名稱:Pedadida,代碼行數:30,代碼來源:award_criteria_courseset.php

示例7: get_course_detail_array

 /**
  * Returns course details in an array ready to be printed.
  *
  * @global \moodle_database $DB
  * @param \course_in_list $course
  * @return array
  */
 public static function get_course_detail_array(\course_in_list $course)
 {
     global $DB;
     $canaccess = $course->can_access();
     $format = \course_get_format($course->id);
     $modinfo = \get_fast_modinfo($course->id);
     $modules = $modinfo->get_used_module_names();
     $sections = array();
     if ($format->uses_sections()) {
         foreach ($modinfo->get_section_info_all() as $section) {
             if ($section->uservisible) {
                 $sections[] = $format->get_section_name($section);
             }
         }
     }
     $category = \coursecat::get($course->category);
     $categoryurl = new \moodle_url('/course/management.php', array('categoryid' => $course->category));
     $categoryname = $category->get_formatted_name();
     $details = array('fullname' => array('key' => \get_string('fullname'), 'value' => $course->get_formatted_fullname()), 'shortname' => array('key' => \get_string('shortname'), 'value' => $course->get_formatted_shortname()), 'idnumber' => array('key' => \get_string('idnumber'), 'value' => s($course->idnumber)), 'category' => array('key' => \get_string('category'), 'value' => \html_writer::link($categoryurl, $categoryname)));
     if (has_capability('moodle/site:accessallgroups', $course->get_context())) {
         $groups = \groups_get_course_data($course->id);
         $details += array('groupings' => array('key' => \get_string('groupings', 'group'), 'value' => count($groups->groupings)), 'groups' => array('key' => \get_string('groups'), 'value' => count($groups->groups)));
     }
     if ($canaccess) {
         $names = \role_get_names($course->get_context());
         $sql = 'SELECT ra.roleid, COUNT(ra.id) AS rolecount
                   FROM {role_assignments} ra
                  WHERE ra.contextid = :contextid
               GROUP BY ra.roleid';
         $rolecounts = $DB->get_records_sql($sql, array('contextid' => $course->get_context()->id));
         $roledetails = array();
         foreach ($rolecounts as $result) {
             $a = new \stdClass();
             $a->role = $names[$result->roleid]->localname;
             $a->count = $result->rolecount;
             $roledetails[] = \get_string('assignedrolecount', 'moodle', $a);
         }
         $details['roleassignments'] = array('key' => \get_string('roleassignments'), 'value' => join('<br />', $roledetails));
     }
     if ($course->can_review_enrolments()) {
         $enrolmentlines = array();
         $instances = \enrol_get_instances($course->id, true);
         $plugins = \enrol_get_plugins(true);
         foreach ($instances as $instance) {
             if (!isset($plugins[$instance->enrol])) {
                 // Weird.
                 continue;
             }
             $plugin = $plugins[$instance->enrol];
             $enrolmentlines[] = $plugin->get_instance_name($instance);
         }
         $details['enrolmentmethods'] = array('key' => \get_string('enrolmentmethods'), 'value' => join('<br />', $enrolmentlines));
     }
     if ($canaccess) {
         $details['format'] = array('key' => \get_string('format'), 'value' => \course_get_format($course)->get_format_name());
         $details['sections'] = array('key' => \get_string('sections'), 'value' => join('<br />', $sections));
         $details['modulesused'] = array('key' => \get_string('modulesused'), 'value' => join('<br />', $modules));
     }
     return $details;
 }
開發者ID:EsdrasCaleb,項目名稱:moodle,代碼行數:67,代碼來源:helper.php

示例8: definition

    function definition() {
        $mform =& $this->_form;
        $contextid = $this->_customdata['contextid'];

        $export = $mform->addElement('hidden', 'export', ''); // Will be overwritten below

        $table = new html_table();
        /* Styling done using HTML table and CSS */
        $table->attributes['class'] = 'export_form_table';
        $table->align = array('left', 'left', 'left', 'center');
        $table->wrap = array('nowrap', '', 'nowrap', 'nowrap');
        $table->data = array();

        $table->head = array(get_string('name'),
                            get_string('description'),
                            get_string('shortname'),
                            get_string('export', 'report_rolesmigration'));

        $roles = get_all_roles();
        foreach ($roles as $role) {
            $row = array();
            $roleurl = new moodle_url('/admin/roles/define.php', array('roleid' => $role->id, 'action' => 'view'));
            $row[0] = '<a href="'.$roleurl.'">'.format_string($role->name).'</a>';
            $row[1] = format_text($role->description, FORMAT_HTML);
            $row[2] = ($role->shortname);
            /* Export values are added from role checkboxes */
            $row[3] = '<input type="checkbox" name="export[]" value="'.$role->shortname.'" />';

            $table->data[] = $row;
        }

        $mform->addElement('html', html_writer::table($table));
        $mform->addElement('hidden', 'contextid', $contextid);
        $this->add_action_buttons(false, get_string('submitexport', 'report_rolesmigration'));
    }
開發者ID:ncsu-delta,項目名稱:moodle-report_rolesmigration,代碼行數:35,代碼來源:exportroles_form.php

示例9: 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();
 }
開發者ID:ULCC-QMUL,項目名稱:moodle-mod_forumng,代碼行數:28,代碼來源:print.php

示例10: poll_get_graphbar

function poll_get_graphbar($img = '0', $width = '100')
{
    global $CFG, $OUTPUT;
    $html = $OUTPUT->pix_icon("graph{$img}", '', 'block_poll', array('style' => "width: {$width}px; height: 15px;"));
    $html .= html_writer::empty_tag('br');
    return $html;
}
開發者ID:netspotau,項目名稱:moodle-block_poll,代碼行數:7,代碼來源:lib.php

示例11: init

    public function init() {
		global $CFG;
	$icon = html_writer::empty_tag('img', array('title' => 'Add new blog', 'alt' => 'Add new blog', 'src' => $CFG->wwwroot.'/blocks/my_blog/pix/plus.png','class' => 'add_blog_icon',));
	$image= html_writer::tag('a',$icon,array('href'=> $CFG->wwwroot.'/blog/edit.php?action=add'));
	
        $this->title = get_string('pluginname', 'block_my_blog').$image;
    }
開發者ID:narasimhaeabyas,項目名稱:tataaiapro,代碼行數:7,代碼來源:block_my_blog.php

示例12: 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);
}
開發者ID:CWRTP,項目名稱:facetoface-2.0,代碼行數:32,代碼來源:upgrade.php

示例13: user_rss_token_box

    /**
     * Display user tokens with buttons to reset them
     * @param object $tokens
     * @param int $userid
     * @return string html code
     */
    public function user_rss_token_box($token) {
        global $OUTPUT, $CFG;

        // display strings
        $stroperation = get_string('operation', 'webservice');
        $strtoken = get_string('key', 'webservice');

        $return = $OUTPUT->heading(get_string('rss'), 3, 'main', true);
        $return .= $OUTPUT->box_start('generalbox webservicestokenui');

        $return .= get_string('rsskeyshelp');

        $table = new html_table();
        $table->head  = array($strtoken, $stroperation);
        $table->align = array('left', 'center');
        $table->width = '100%';
        $table->data  = array();

        if (!empty($token)) {
            $reset = "<a href=\"".$CFG->wwwroot."/user/managetoken.php?sesskey=".sesskey().
                    "&amp;action=resetrsstoken\">".get_string('reset')."</a>";

            $table->data[] = array($token, $reset);

            $return .= html_writer::table($table);
        } else {
            $return .= get_string('notoken', 'webservice');
        }

        $return .= $OUTPUT->box_end();
        return $return;
    }
開發者ID:rolandovanegas,項目名稱:moodle,代碼行數:38,代碼來源:renderer.php

示例14: config_form_criteria

 /**
  * Add appropriate form elements to the criteria form
  *
  * @param stdClass $data details of overall criterion
  */
 public function config_form_criteria($data)
 {
     global $OUTPUT;
     $prefix = 'criteria-' . $this->id;
     if (count($data->criteria) > 2) {
         echo $OUTPUT->box_start();
         if (!empty($this->description)) {
             $badge = new badge($this->badgeid);
             echo $OUTPUT->box(format_text($this->description, $this->descriptionformat, array('context' => $badge->get_context())), 'criteria-description');
         }
         echo $OUTPUT->heading($this->get_title(), 2);
         $agg = $data->get_aggregation_methods();
         if (!$data->is_locked() && !$data->is_active()) {
             $editurl = new moodle_url('/badges/criteria_settings.php', array('badgeid' => $this->badgeid, 'edit' => true, 'type' => $this->criteriatype, 'crit' => $this->id));
             $editaction = $OUTPUT->action_icon($editurl, new pix_icon('t/edit', get_string('edit')), null, array('class' => 'criteria-action'));
             echo $OUTPUT->box($editaction, array('criteria-header'));
             $url = new moodle_url('criteria.php', array('id' => $data->id, 'sesskey' => sesskey()));
             echo $OUTPUT->single_select($url, 'update', $agg, $data->get_aggregation_method($this->criteriatype), null, null, array('aria-describedby' => 'overall'));
             echo html_writer::span(get_string('overallcrit', 'badges'), '', array('id' => 'overall'));
         } else {
             echo $OUTPUT->box(get_string('criteria_descr_' . $this->criteriatype, 'badges', core_text::strtoupper($agg[$data->get_aggregation_method()])), 'clearfix');
         }
         echo $OUTPUT->box_end();
     }
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:30,代碼來源:award_criteria_overall.php

示例15: display_search_field

 function display_search_field($value = '')
 {
     global $CFG, $DB;
     if (is_array($value)) {
         $content = $value['checked'];
         $allrequired = $value['allrequired'] ? true : false;
     } else {
         $content = array();
         $allrequired = false;
     }
     $str = '';
     $found = false;
     foreach (explode("\n", $this->field->param1) as $checkbox) {
         $checkbox = trim($checkbox);
         if (in_array($checkbox, $content)) {
             $str .= html_writer::checkbox('f_' . $this->field->id . '[]', s($checkbox), true, $checkbox);
         } else {
             $str .= html_writer::checkbox('f_' . $this->field->id . '[]', s($checkbox), false, $checkbox);
         }
         $found = true;
     }
     if (!$found) {
         return '';
     }
     $str .= html_writer::checkbox('f_' . $this->field->id . '_allreq', null, $allrequired, get_string('selectedrequired', 'data'));
     return $str;
 }
開發者ID:janaece,項目名稱:globalclassroom4_clean,代碼行數:27,代碼來源:field.class.php


注:本文中的html_writer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。