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


PHP html_writer::img方法代码示例

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


在下文中一共展示了html_writer::img方法的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 .= '&nbsp;' . 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;
    }
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:53,代码来源:field.class.php

示例2: 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;
 }
开发者ID:Chocolate-lightning,项目名称:moodle,代码行数:34,代码来源:field.class.php

示例3: display_add_field

 function display_add_field($recordid = 0, $formdata = null)
 {
     global $CFG, $DB, $OUTPUT, $PAGE;
     require_once $CFG->dirroot . '/repository/lib.php';
     // necessary for the constants used in args
     $args = new stdClass();
     $args->accepted_types = '*';
     $args->return_types = FILE_EXTERNAL;
     $args->context = $this->context;
     $args->env = 'url';
     $fp = new file_picker($args);
     $options = $fp->options;
     $fieldid = 'field_url_' . $options->client_id;
     $straddlink = get_string('choosealink', 'repository');
     $url = '';
     $text = '';
     if ($formdata) {
         $fieldname = 'field_' . $this->field->id . '_0';
         $url = $formdata->{$fieldname};
         $fieldname = 'field_' . $this->field->id . '_1';
         if (isset($formdata->{$fieldname})) {
             $text = $formdata->{$fieldname};
         }
     } else {
         if ($recordid) {
             if ($content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid))) {
                 $url = $content->content;
                 $text = $content->content1;
             }
         }
     }
     $str = '<div title="' . s($this->field->description) . '">';
     $label = '<label for="' . $fieldid . '"><span class="accesshide">' . $this->field->name . '</span>';
     if ($this->field->required) {
         $label .= html_writer::img($OUTPUT->pix_url('req'), get_string('requiredelement', 'form'), array('class' => 'req', 'title' => get_string('requiredelement', 'form')));
     }
     $label .= '</label>';
     if (!empty($this->field->param1) and empty($this->field->param2)) {
         $str .= '<table><tr><td align="right">';
         $str .= get_string('url', 'data') . ':</td><td>';
         $str .= $label;
         $str .= '<input type="text" name="field_' . $this->field->id . '_0" id="' . $fieldid . '" value="' . $url . '" size="60" />';
         $str .= '<button id="filepicker-button-' . $options->client_id . '" style="display:none">' . $straddlink . '</button></td></tr>';
         $str .= '<tr><td align="right">' . get_string('text', 'data') . ':</td><td><input type="text" name="field_' . $this->field->id . '_1" id="field_' . $this->field->id . '_1" value="' . s($text) . '" size="60" /></td></tr>';
         $str .= '</table>';
     } else {
         // Just the URL field
         $str .= $label;
         $str .= '<input type="text" name="field_' . $this->field->id . '_0" id="' . $fieldid . '" value="' . s($url) . '" size="60" />';
         if (count($options->repositories) > 0) {
             $str .= '<button id="filepicker-button-' . $options->client_id . '" class="visibleifjs">' . $straddlink . '</button>';
         }
     }
     // print out file picker
     //$str .= $OUTPUT->render($fp);
     $module = array('name' => 'data_urlpicker', 'fullpath' => '/mod/data/data.js', 'requires' => array('core_filepicker'));
     $PAGE->requires->js_init_call('M.data_urlpicker.init', array($options), true, $module);
     $str .= '</div>';
     return $str;
 }
开发者ID:Keneth1212,项目名称:moodle,代码行数:60,代码来源:field.class.php

示例4: get_content

 public function get_content()
 {
     global $DB, $CFG, $OUTPUT;
     if ($this->content !== null) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $courses = $DB->get_records('course');
     //$this->content->text .= html_writer::start_tag('div',array('class' => 'span12'));
     foreach ($courses as $course) {
         $this->content->text .= html_writer::start_tag('div', array('class' => 'content font-recent span3'));
         $this->content->text .= html_writer::tag('a', $course->fullname, array('class' => 'font-recent', 'href' => $CFG->wwwroot . '/course/view.php?id=' . $course->id));
         $this->content->text .= html_writer::img($CFG->wwwroot . '/pluginfile.php/27/course/overviewfiles/hinh1.jpg', '', array('class' => 'font-recent-image'));
         $this->content->text .= html_writer::end_tag('div');
     }
     //$this->content->text .= html_writer::end_tag('div');
     return $this->content;
 }
开发者ID:pannuy,项目名称:block_font_recents,代码行数:19,代码来源:block_font_recents.php

示例5: render_databasebookmarks

 public function render_databasebookmarks($bookmarks)
 {
     $output = '';
     $bookmarkslinks = array();
     foreach ($bookmarks as $bookmark) {
         $bookmarkmarkup = '';
         $url = new moodle_url("/mod/data/view.php", array('d' => $bookmark->instanceid, 'rid' => $bookmark->recordid));
         $label = $bookmark->bookmarkname;
         $bookmarklink = html_writer::link($url, $label);
         $bookmarkmarkup .= html_writer::span($bookmarklink, 'bookmarklink');
         $iconenrolremove = $this->output->pix_url('t/delete');
         $iconimg = html_writer::img($iconenrolremove, get_string('delete'));
         $deletelink = html_writer::link('#', $iconimg, array('data-rid' => $bookmark->recordid, 'data-action' => 'delete', 'class' => 'data_deletebookmark_link'));
         $bookmarkmarkup .= html_writer::span($deletelink, 'deletelink');
         $bookmarkslinks[] = $bookmarkmarkup;
     }
     $output .= html_writer::alist($bookmarkslinks, array('class' => 'block_databasebookmarks_bookmarklist'));
     return $output;
 }
开发者ID:andrewhancox,项目名称:block_databasebookmarks,代码行数:19,代码来源:renderer.php

示例6: navbar_home

 /**
  * Returns the navigation bar home reference.
  *
  * The small logo is only rendered on pages where the logo is not displayed.
  *
  * @param bool $returnlink Whether to wrap the icon and the site name in links or not
  * @return string The site name, the small logo or both depending on the theme settings.
  */
 public function navbar_home($returnlink = true)
 {
     global $CFG;
     if ($this->should_render_logo() || empty($this->page->theme->settings->smalllogo)) {
         // If there is no small logo we always show the site name.
         return $this->get_home_ref($returnlink);
     }
     $imageurl = $this->page->theme->setting_file_url('smalllogo', 'smalllogo');
     $image = html_writer::img($imageurl, get_string('sitelogo', 'theme_' . $this->page->theme->name), array('class' => 'small-logo'));
     if ($returnlink) {
         $logocontainer = html_writer::link(new moodle_url('/'), $image, array('class' => 'small-logo-container', 'title' => get_string('home')));
     } else {
         $logocontainer = html_writer::tag('span', $image, array('class' => 'small-logo-container'));
     }
     // Sitename setting defaults to true.
     if (!isset($this->page->theme->settings->sitename) || !empty($this->page->theme->settings->sitename)) {
         return $logocontainer . $this->get_home_ref($returnlink);
     }
     return $logocontainer;
 }
开发者ID:jackdaniels79,项目名称:moodle,代码行数:28,代码来源:core_renderer.php

示例7: mod_page_html

 /**
  * Get page module html
  * @param cm_info $mod
  * @return string
  */
 protected function mod_page_html(cm_info $mod)
 {
     if (!$mod->uservisible) {
         return "";
     }
     $page = \theme_snap\local::get_page_mod($mod);
     $imgarr = \theme_snap\local::extract_first_image($page->content);
     $thumbnail = '';
     if ($imgarr) {
         $img = html_writer::img($imgarr['src'], $imgarr['alt']);
         $thumbnail = "<div class=summary-figure>{$img}</div>";
     }
     $readmore = get_string('readmore', 'theme_snap');
     $close = get_string('close', 'theme_snap');
     // Identify content elements which should force an AJAX lazy load.
     $elcontentblist = ['iframe', 'video', 'object', 'embed'];
     $content = $page->content;
     $lazyload = false;
     foreach ($elcontentblist as $el) {
         if (stripos($content, '<' . $el) !== false) {
             $content = '';
             // Don't include the content as it is likely to slow the page load down considerably.
             $lazyload = true;
         }
     }
     $contentloaded = !$lazyload ? 1 : 0;
     $o = "\n        {$thumbnail}\n        <div class='summary-text'>\n            {$page->summary}\n            <p><a class='pagemod-readmore' href='{$mod->url}' data-pagemodcontext='{$mod->context->id}'>{$readmore}</a></p>\n        </div>\n\n        <div class=pagemod-content tabindex='-1' data-content-loaded={$contentloaded}>\n            {$content}\n            <div><hr><a  class='snap-action-icon' href='#'>\n            <i class='icon icon-office-52'></i><small>{$close}</small></a></div>\n        </div>";
     return $o;
 }
开发者ID:nbartley,项目名称:moodle-theme_snap,代码行数:34,代码来源:course_renderer.php

示例8: ouwiki_get_feeds

 /**
  * Returns html for the atom and rss feeds.
  *
  * @param string $atomurl
  * @param string $rssurl
  * @return string
  */
 public function ouwiki_get_feeds($atomurl, $rssurl)
 {
     $a = new stdClass();
     $a->atom = $atomurl;
     $a->rss = $rssurl;
     $url = str_replace('&amp;', '&', $atomurl);
     $rssicon = html_writer::img($this->output->pix_url('rss', 'ouwiki'), '');
     $rsslink = html_writer::link($url, $rssicon, array('title' => get_string('feedalt', 'ouwiki')));
     $content = html_writer::span(get_string('feedsubscribe', 'ouwiki', $a));
     return html_writer::tag('p', $rsslink . $content, array('class' => 'ouw_subscribe'));
 }
开发者ID:salmonmoose,项目名称:moodle-mod_ouwiki,代码行数:18,代码来源:renderer.php

示例9: get_element_icon


//.........这里部分代码省略.........
     */
    public function get_element_icon(&$element, $spacerifnone=false) {
        global $CFG, $OUTPUT;
        require_once $CFG->libdir.'/filelib.php';

        $outputstr = '';

        // Object holding pix_icon information before instantiation.
        $icon = new stdClass();
        $icon->attributes = array(
            'class' => 'icon itemicon'
        );
        $icon->component = 'moodle';

        $none = true;
        switch ($element['type']) {
            case 'item':
            case 'courseitem':
            case 'categoryitem':
                $none = false;

                $is_course   = $element['object']->is_course_item();
                $is_category = $element['object']->is_category_item();
                $is_scale    = $element['object']->gradetype == GRADE_TYPE_SCALE;
                $is_value    = $element['object']->gradetype == GRADE_TYPE_VALUE;
                $is_outcome  = !empty($element['object']->outcomeid);

                if ($element['object']->is_calculated()) {
                    $icon->pix = 'i/calc';
                    $icon->title = s(get_string('calculatedgrade', 'grades'));

                } else if (($is_course or $is_category) and ($is_scale or $is_value)) {
                    if ($category = $element['object']->get_item_category()) {
                        $aggrstrings = grade_helper::get_aggregation_strings();
                        $stragg = $aggrstrings[$category->aggregation];

                        $icon->pix = 'i/calc';
                        $icon->title = s($stragg);

                        switch ($category->aggregation) {
                            case GRADE_AGGREGATE_MEAN:
                            case GRADE_AGGREGATE_MEDIAN:
                            case GRADE_AGGREGATE_WEIGHTED_MEAN:
                            case GRADE_AGGREGATE_WEIGHTED_MEAN2:
                            case GRADE_AGGREGATE_EXTRACREDIT_MEAN:
                                $icon->pix = 'i/agg_mean';
                                break;
                            case GRADE_AGGREGATE_SUM:
                                $icon->pix = 'i/agg_sum';
                                break;
                        }
                    }

                } else if ($element['object']->itemtype == 'mod') {
                    // Prevent outcomes displaying the same icon as the activity they are attached to.
                    if ($is_outcome) {
                        $icon->pix = 'i/outcomes';
                        $icon->title = s(get_string('outcome', 'grades'));
                    } else {
                        $modinfo = get_fast_modinfo($element['object']->courseid);
                        $module = $element['object']->itemmodule;
                        $instanceid = $element['object']->iteminstance;
                        if (isset($modinfo->instances[$module][$instanceid])) {
                            $icon->url = $modinfo->instances[$module][$instanceid]->get_icon_url();
                        } else {
                            $icon->pix = 'icon';
                            $icon->component = $element['object']->itemmodule;
                        }
                        $icon->title = s(get_string('modulename', $element['object']->itemmodule));
                    }
                } else if ($element['object']->itemtype == 'manual') {
                    if ($element['object']->is_outcome_item()) {
                        $icon->pix = 'i/outcomes';
                        $icon->title = s(get_string('outcome', 'grades'));
                    } else {
                        $icon->pix = 'i/manual_item';
                        $icon->title = s(get_string('manualitem', 'grades'));
                    }
                }
                break;

            case 'category':
                $none = false;
                $icon->pix = 'i/folder';
                $icon->title = s(get_string('category', 'grades'));
                break;
        }

        if ($none) {
            if ($spacerifnone) {
                $outputstr = $OUTPUT->spacer() . ' ';
            }
        } else if (isset($icon->url)) {
            $outputstr = html_writer::img($icon->url, $icon->title, $icon->attributes);
        } else {
            $outputstr = $OUTPUT->pix_icon($icon->pix, $icon->title, $icon->component, $icon->attributes);
        }

        return $outputstr;
    }
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:101,代码来源:lib.php

示例10: grading

 public static function grading()
 {
     global $USER, $PAGE;
     $grading = self::all_ungraded($USER->id);
     if (empty($grading)) {
         return '<p>' . get_string('nograding', 'theme_snap') . '</p>';
     }
     $output = $PAGE->get_renderer('theme_snap', 'core', RENDERER_TARGET_GENERAL);
     $out = '';
     foreach ($grading as $ungraded) {
         $modinfo = get_fast_modinfo($ungraded->course);
         $course = $modinfo->get_course();
         $cm = $modinfo->get_cm($ungraded->coursemoduleid);
         $modimageurl = $output->pix_url('icon', $cm->modname);
         $modname = get_string('modulename', 'mod_' . $cm->modname);
         $modimage = \html_writer::img($modimageurl, $modname);
         $ungradedtitle = "<small>{$course->fullname} / </small> {$cm->name}";
         $xungraded = get_string('xungraded', 'theme_snap', $ungraded->ungraded);
         $function = '\\theme_snap\\activity::' . $cm->modname . '_num_submissions';
         $a['completed'] = call_user_func($function, $ungraded->course, $ungraded->instanceid);
         $a['participants'] = self::course_participant_count($ungraded->course, $cm->modname);
         $xofysubmitted = get_string('xofysubmitted', 'theme_snap', $a);
         $info = '<span class="label label-info">' . $xofysubmitted . ', ' . $xungraded . '</span>';
         $meta = '';
         if (!empty($ungraded->closetime)) {
             $meta = $output->friendly_datetime($ungraded->closetime);
         }
         $out .= $output->snap_media_object($cm->url, $modimage, $ungradedtitle, $meta, $info);
     }
     return $out;
 }
开发者ID:nbartley,项目名称:moodle-theme_snap,代码行数:31,代码来源:local.php

示例11: theme_mmcmonkwearmouth_get_html_for_settings

/**
 * Returns an object containing HTML for the areas affected by settings.
 *
 * Do not add mmcmonkwearmouth specific logic in here, child themes should be able to
 * rely on that function just by declaring settings with similar names.
 *
 * @param renderer_base $output Pass in $OUTPUT.
 * @param moodle_page $page Pass in $PAGE.
 * @return stdClass An object with the following properties:
 *      - navbarclass A CSS class to use on the navbar. By default ''.
 *      - heading HTML to use for the heading. A logo if one is selected or the default heading.
 *      - footnote HTML to use as a footnote. By default ''.
 */
function theme_mmcmonkwearmouth_get_html_for_settings(renderer_base $output, moodle_page $page)
{
    global $CFG;
    $toReturn = new stdClass();
    $toReturn->navbarclass = '';
    if (!empty($page->theme->settings->logo)) {
        $toReturn->heading = html_writer::link($CFG->wwwroot, html_writer::img($output->pix_url('logo', 'theme'), 'logo', array('title' => get_string('home'), 'class' => 'logo')) . html_writer::tag('h3', 'Monkwearmouth Academy'));
    } else {
        $toReturn->heading = $output->page_heading();
    }
    $toReturn->footnote = '';
    if (!empty($page->theme->settings->footnote)) {
        $toReturn->footnote = '<div class="footnote text-center">' . format_text($page->theme->settings->footnote) . '</div>';
    }
    return $toReturn;
}
开发者ID:markmcdermid,项目名称:mmcmonkwearmouth,代码行数:29,代码来源:lib.php

示例12: display_add_field

 function display_add_field($recordid = 0, $formdata = null)
 {
     global $CFG, $DB, $OUTPUT, $PAGE, $USER;
     $file = false;
     $content = false;
     $displayname = '';
     $fs = get_file_storage();
     $context = $PAGE->context;
     $itemid = null;
     // editing an existing database entry
     if ($formdata) {
         $fieldname = 'field_' . $this->field->id . '_file';
         $itemid = $formdata->{$fieldname};
     } else {
         if ($recordid) {
             if ($content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid))) {
                 file_prepare_draft_area($itemid, $this->context->id, 'mod_data', 'content', $content->id);
                 if (!empty($content->content)) {
                     if ($file = $fs->get_file($this->context->id, 'mod_data', 'content', $content->id, '/', $content->content)) {
                         $usercontext = context_user::instance($USER->id);
                         if (!($files = $fs->get_area_files($usercontext->id, 'user', 'draft', $itemid, 'id DESC', false))) {
                             return false;
                         }
                         if (empty($content->content1)) {
                             // Print icon if file already exists
                             $src = moodle_url::make_draftfile_url($itemid, '/', $file->get_filename());
                             $displayname = $OUTPUT->pix_icon(file_file_icon($file), get_mimetype_description($file), 'moodle', array('class' => 'icon')) . '<a href="' . $src . '" >' . s($file->get_filename()) . '</a>';
                         } else {
                             $displayname = 'no file added';
                         }
                     }
                 }
             }
         } else {
             $itemid = file_get_unused_draft_itemid();
         }
     }
     // database entry label
     $html = '<div title="' . s($this->field->description) . '">';
     $html .= '<fieldset><legend><span class="accesshide">' . $this->field->name;
     if ($this->field->required) {
         $html .= '&nbsp;' . 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')));
         $html .= html_writer::div($image, 'inline-req');
     } else {
         $html .= '</span></legend>';
     }
     // itemid element
     $html .= '<input type="hidden" name="field_' . $this->field->id . '_file" value="' . $itemid . '" />';
     $options = new stdClass();
     $options->maxbytes = $this->field->param3;
     $options->maxfiles = 1;
     // Limit to one file for the moment, this may be changed if requested as a feature in the future.
     $options->itemid = $itemid;
     $options->accepted_types = '*';
     $options->return_types = FILE_INTERNAL;
     $options->context = $PAGE->context;
     $fm = new form_filemanager($options);
     // Print out file manager.
     $output = $PAGE->get_renderer('core', 'files');
     $html .= '<div class="mod-data-input">';
     $html .= $output->render($fm);
     $html .= '</div>';
     $html .= '</fieldset>';
     $html .= '</div>';
     return $html;
 }
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:67,代码来源:field.class.php

示例13: display


//.........这里部分代码省略.........
                     if ($download == 'ODS' || $download == 'Excel') {
                         $row[] = userdate($timetracks->start, get_string("strftimedatetime", "langconfig"));
                     } else {
                         $row[] = userdate($timetracks->start);
                     }
                     if ($download == 'ODS' || $download == 'Excel') {
                         $row[] = userdate($timetracks->finish, get_string('strftimedatetime', 'langconfig'));
                     } else {
                         $row[] = userdate($timetracks->finish);
                     }
                     $row[] = scorm_grade_user_attempt($scorm, $scouser->userid, $scouser->attempt);
                 }
                 // Print out all scores of attempt.
                 foreach ($scoes as $sco) {
                     if ($sco->launch != '') {
                         if ($trackdata = scorm_get_tracks($sco->id, $scouser->userid, $scouser->attempt)) {
                             if ($trackdata->status == '') {
                                 $trackdata->status = 'notattempted';
                             }
                             $strstatus = get_string($trackdata->status, 'scorm');
                             if ($trackdata->score_raw != '') {
                                 // If raw score exists, print it.
                                 $score = $trackdata->score_raw;
                                 // Add max score if it exists.
                                 if (isset($trackdata->score_max)) {
                                     $score .= '/' . $trackdata->score_max;
                                 }
                             } else {
                                 // ...else print out status.
                                 $score = $strstatus;
                             }
                             if (!$download) {
                                 $url = new \moodle_url('/mod/scorm/report/userreporttracks.php', array('id' => $cm->id, 'scoid' => $sco->id, 'user' => $scouser->userid, 'attempt' => $scouser->attempt));
                                 $row[] = \html_writer::img($OUTPUT->pix_url($trackdata->status, 'scorm'), $strstatus, array('title' => $strstatus)) . \html_writer::empty_tag('br') . \html_writer::link($url, $score, array('title' => get_string('details', 'scorm')));
                             } else {
                                 $row[] = $score;
                             }
                             // Iterate over tracks and match objective id against values.
                             $scorm2004 = false;
                             if (scorm_version_check($scorm->version, SCORM_13)) {
                                 $scorm2004 = true;
                                 $objectiveprefix = "cmi.objectives.";
                             } else {
                                 $objectiveprefix = "cmi.objectives_";
                             }
                             $keywords = array(".id", $objectiveprefix);
                             $objectivestatus = array();
                             $objectivescore = array();
                             foreach ($trackdata as $name => $value) {
                                 if (strpos($name, $objectiveprefix) === 0 && strrpos($name, '.id') !== false) {
                                     $num = trim(str_ireplace($keywords, '', $name));
                                     if (is_numeric($num)) {
                                         if ($scorm2004) {
                                             $element = $objectiveprefix . $num . '.completion_status';
                                         } else {
                                             $element = $objectiveprefix . $num . '.status';
                                         }
                                         if (isset($trackdata->{$element})) {
                                             $objectivestatus[$value] = $trackdata->{$element};
                                         } else {
                                             $objectivestatus[$value] = '';
                                         }
                                         if ($displayoptions['objectivescore']) {
                                             $element = $objectiveprefix . $num . '.score.raw';
                                             if (isset($trackdata->{$element})) {
                                                 $objectivescore[$value] = $trackdata->{$element};
开发者ID:lucaboesch,项目名称:moodle,代码行数:67,代码来源:report.php

示例14: print_tour_list

 /**
  * Print the the list of tours.
  */
 protected function print_tour_list()
 {
     global $PAGE, $OUTPUT;
     $this->header();
     echo \html_writer::span(get_string('tourlist_explanation', 'tool_usertours'));
     $table = new table\tour_list();
     $tours = helper::get_tours();
     foreach ($tours as $tour) {
         $table->add_data_keyed($table->format_row($tour));
     }
     $table->finish_output();
     $actions = [(object) ['link' => helper::get_edit_tour_link(), 'linkproperties' => [], 'img' => 'b/tour-new', 'title' => get_string('newtour', 'tool_usertours')], (object) ['link' => helper::get_import_tour_link(), 'linkproperties' => [], 'img' => 'b/tour-import', 'title' => get_string('importtour', 'tool_usertours')], (object) ['link' => new \moodle_url('https://moodle.net/tours'), 'linkproperties' => ['target' => '_blank'], 'img' => 'b/tour-shared', 'title' => get_string('sharedtourslink', 'tool_usertours')]];
     echo \html_writer::start_tag('div', ['class' => 'tour-actions']);
     echo \html_writer::start_tag('ul');
     foreach ($actions as $config) {
         $action = \html_writer::start_tag('li');
         $linkproperties = $config->linkproperties;
         $linkproperties['href'] = $config->link;
         $action .= \html_writer::start_tag('a', $linkproperties);
         $action .= \html_writer::img($OUTPUT->pix_url($config->img, 'tool_usertours'), $config->title);
         $action .= \html_writer::div($config->title);
         $action .= \html_writer::end_tag('a');
         $action .= \html_writer::end_tag('li');
         echo $action;
     }
     echo \html_writer::end_tag('ul');
     echo \html_writer::end_tag('div');
     // JS for Tour management.
     $PAGE->requires->js_call_amd('tool_usertours/managetours', 'setup');
     $this->footer();
 }
开发者ID:Chocolate-lightning,项目名称:moodle,代码行数:34,代码来源:manager.php

示例15: forum_print_recent_mod_activity

/**
 * Outputs the forum post indicated by $activity.
 *
 * @param object $activity      the activity object the forum resides in
 * @param int    $courseid      the id of the course the forum resides in
 * @param bool   $detail        not used, but required for compatibilty with other modules
 * @param int    $modnames      not used, but required for compatibilty with other modules
 * @param bool   $viewfullnames not used, but required for compatibilty with other modules
 */
function forum_print_recent_mod_activity($activity, $courseid, $detail, $modnames, $viewfullnames)
{
    global $OUTPUT;
    $content = $activity->content;
    if ($content->parent) {
        $class = 'reply';
    } else {
        $class = 'discussion';
    }
    $tableoptions = ['border' => '0', 'cellpadding' => '3', 'cellspacing' => '0', 'class' => 'forum-recent'];
    $output = html_writer::start_tag('table', $tableoptions);
    $output .= html_writer::start_tag('tr');
    $post = (object) ['parent' => $content->parent];
    $forum = (object) ['type' => $content->forumtype];
    $authorhidden = forum_is_author_hidden($post, $forum);
    // Show user picture if author should not be hidden.
    if (!$authorhidden) {
        $pictureoptions = ['courseid' => $courseid, 'link' => $authorhidden, 'alttext' => $authorhidden];
        $picture = $OUTPUT->user_picture($activity->user, $pictureoptions);
        $output .= html_writer::tag('td', $picture, ['class' => 'userpicture', 'valign' => 'top']);
    }
    // Discussion title and author.
    $output .= html_writer::start_tag('td', ['class' => $class]);
    if ($content->parent) {
        $class = 'title';
    } else {
        // Bold the title of new discussions so they stand out.
        $class = 'title bold';
    }
    $output .= html_writer::start_div($class);
    if ($detail) {
        $aname = s($activity->name);
        $output .= html_writer::img($OUTPUT->pix_url('icon', $activity->type), $aname, ['class' => 'icon']);
    }
    $discussionurl = new moodle_url('/mod/forum/discuss.php', ['d' => $content->discussion]);
    $discussionurl->set_anchor('p' . $activity->content->id);
    $output .= html_writer::link($discussionurl, $content->subject);
    $output .= html_writer::end_div();
    $timestamp = userdate($activity->timestamp);
    if ($authorhidden) {
        $authornamedate = $timestamp;
    } else {
        $fullname = fullname($activity->user, $viewfullnames);
        $userurl = new moodle_url('/user/view.php');
        $userurl->params(['id' => $activity->user->id, 'course' => $courseid]);
        $by = new stdClass();
        $by->name = html_writer::link($userurl, $fullname);
        $by->date = $timestamp;
        $authornamedate = get_string('bynameondate', 'forum', $by);
    }
    $output .= html_writer::div($authornamedate, 'user');
    $output .= html_writer::end_tag('td');
    $output .= html_writer::end_tag('tr');
    $output .= html_writer::end_tag('table');
    echo $output;
}
开发者ID:rezaies,项目名称:moodle,代码行数:65,代码来源:lib.php


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