• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP file_rewrite_pluginfile_urls函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中file_rewrite_pluginfile_urls函数的典型用法代码示例。如果您正苦于以下问题:PHP file_rewrite_pluginfile_urls函数的具体用法?PHP file_rewrite_pluginfile_urls怎么用?PHP file_rewrite_pluginfile_urls使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了file_rewrite_pluginfile_urls函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get_content

 function get_content()
 {
     global $CFG;
     require_once $CFG->libdir . '/filelib.php';
     if ($this->content !== NULL) {
         return $this->content;
     }
     $filteropt = new stdClass();
     $filteropt->overflowdiv = true;
     if ($this->content_is_trusted()) {
         // fancy html allowed only on course, category and system blocks.
         $filteropt->noclean = true;
     }
     $this->content = new stdClass();
     $this->content->footer = '';
     if (isset($this->config->text)) {
         // rewrite url
         $this->config->text = file_rewrite_pluginfile_urls($this->config->text, 'pluginfile.php', $this->context->id, 'block_html', 'content', NULL);
         // Default to FORMAT_HTML which is what will have been used before the
         // editor was properly implemented for the block.
         $format = FORMAT_HTML;
         // Check to see if the format has been properly set on the config
         if (isset($this->config->format)) {
             $format = $this->config->format;
         }
         $this->content->text = format_text($this->config->text, $format, $filteropt);
     } else {
         $this->content->text = '';
     }
     unset($filteropt);
     // memory footprint
     return $this->content;
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:33,代码来源:block_html.php


示例2: course_info_box

 /**
  * Renders course info box.
  *
  * @param stdClass $course
  * @return string
  */
 public function course_info_box(stdClass $course)
 {
     global $CFG;
     $context = context_course::instance($course->id);
     $content = '';
     $content .= $this->output->box_start('generalbox info');
     $summary = file_rewrite_pluginfile_urls($course->summary, 'pluginfile.php', $context->id, 'course', 'summary', null);
     $content .= format_text($summary, $course->summaryformat, array('overflowdiv' => true), $course->id);
     if (!empty($CFG->coursecontact)) {
         $coursecontactroles = explode(',', $CFG->coursecontact);
         foreach ($coursecontactroles as $roleid) {
             if ($users = get_role_users($roleid, $context, true)) {
                 foreach ($users as $teacher) {
                     $role = new stdClass();
                     $role->id = $teacher->roleid;
                     $role->name = $teacher->rolename;
                     $role->shortname = $teacher->roleshortname;
                     $role->coursealias = $teacher->rolecoursealias;
                     $fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
                     $namesarray[] = role_get_name($role, $context) . ': <a href="' . $CFG->wwwroot . '/user/view.php?id=' . $teacher->id . '&amp;course=' . SITEID . '">' . $fullname . '</a>';
                 }
             }
         }
         if (!empty($namesarray)) {
             $content .= "<ul class=\"teachers\">\n<li>";
             $content .= implode('</li><li>', $namesarray);
             $content .= "</li></ul>";
         }
     }
     $content .= $this->output->box_end();
     return $content;
 }
开发者ID:vinoth4891,项目名称:clinique,代码行数:38,代码来源:renderer.php


示例3: available_courses

 /**
  * Returns list of courses that we offer to the caller for remote enrolment of their users
  *
  * Since Moodle 2.0, courses are made available for MNet peers by creating an instance
  * of enrol_mnet plugin for the course. Hidden courses are not returned. If there are two
  * instances - one specific for the host and one for 'All hosts', the setting of the specific
  * one is used. The id of the peer is kept in customint1, no other custom fields are used.
  *
  * @uses mnet_remote_client Callable via XML-RPC only
  * @return array
  */
 public function available_courses()
 {
     global $CFG, $DB;
     require_once $CFG->libdir . '/filelib.php';
     if (!($client = get_mnet_remote_client())) {
         die('Callable via XML-RPC only');
     }
     // we call our id as 'remoteid' because it will be sent to the peer
     // the column aliases are required by MNet protocol API for clients 1.x and 2.0
     $sql = "SELECT c.id AS remoteid, c.fullname, c.shortname, c.idnumber, c.summary, c.summaryformat,\n                       c.sortorder, c.startdate, cat.id AS cat_id, cat.name AS cat_name,\n                       cat.description AS cat_description, cat.descriptionformat AS cat_descriptionformat,\n                       e.cost, e.currency, e.roleid AS defaultroleid, r.name AS defaultrolename,\n                       e.customint1\n                  FROM {enrol} e\n            INNER JOIN {course} c ON c.id = e.courseid\n            INNER JOIN {course_categories} cat ON cat.id = c.category\n            INNER JOIN {role} r ON r.id = e.roleid\n                 WHERE e.enrol = 'mnet'\n                       AND (e.customint1 = 0 OR e.customint1 = ?)\n                       AND c.visible = 1\n              ORDER BY cat.sortorder, c.sortorder, c.shortname";
     $rs = $DB->get_recordset_sql($sql, array($client->id));
     $courses = array();
     foreach ($rs as $course) {
         // use the record if it does not exist yet or is host-specific
         if (empty($courses[$course->remoteid]) or $course->customint1 > 0) {
             unset($course->customint1);
             // the client does not need to know this
             $context = get_context_instance(CONTEXT_COURSE, $course->remoteid);
             // Rewrite file URLs so that they are correct
             $course->summary = file_rewrite_pluginfile_urls($course->summary, 'pluginfile.php', $context->id, 'course', 'summary', false);
             $courses[$course->remoteid] = $course;
         }
     }
     $rs->close();
     return array_values($courses);
     // can not use keys for backward compatibility
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:38,代码来源:enrol.php


示例4: get_content

 function get_content()
 {
     global $CFG;
     require_once $CFG->libdir . '/filelib.php';
     if ($this->content !== NULL) {
         return $this->content;
     }
     $filteropt = new stdClass();
     $filteropt->overflowdiv = true;
     if ($this->content_is_trusted()) {
         // fancy html allowed only on course, category and system blocks.
         $filteropt->noclean = true;
     }
     $this->content = new stdClass();
     $this->content->footer = '';
     if (isset($this->config->text)) {
         // rewrite url
         $this->config->text = file_rewrite_pluginfile_urls($this->config->text, 'pluginfile.php', $this->context->id, 'block_html', 'content', NULL);
         $this->content->text = format_text($this->config->text, $this->config->format, $filteropt);
     } else {
         $this->content->text = '';
     }
     unset($filteropt);
     // memory footprint
     return $this->content;
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:26,代码来源:block_html.php


示例5: format_message_text

 /**
  * The HTML version of the e-mail message.
  *
  * @param \stdClass $cm
  * @param \stdClass $post
  * @return string
  */
 public function format_message_text($cm, $post)
 {
     $message = file_rewrite_pluginfile_urls($post->message, 'pluginfile.php', \context_module::instance($cm->id)->id, 'mod_forum', 'post', $post->id);
     $options = new \stdClass();
     $options->para = true;
     return format_text($message, $post->messageformat, $options);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:14,代码来源:renderer.php


示例6: get_content

 function get_content()
 {
     global $CFG, $OUTPUT;
     require_once $CFG->libdir . '/filelib.php';
     if ($this->content !== NULL) {
         return $this->content;
     }
     if (empty($this->instance)) {
         return '';
     }
     $this->content = new stdClass();
     $options = new stdClass();
     $options->noclean = true;
     // Don't clean Javascripts etc
     $options->overflowdiv = true;
     $context = context_course::instance($this->page->course->id);
     $this->page->course->summary = file_rewrite_pluginfile_urls($this->page->course->summary, 'pluginfile.php', $context->id, 'course', 'summary', NULL);
     $this->content->text = format_text($this->page->course->summary, $this->page->course->summaryformat, $options);
     if ($this->page->user_is_editing()) {
         if ($this->page->course->id == SITEID) {
             $editpage = $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=frontpagesettings';
         } else {
             $editpage = $CFG->wwwroot . '/course/edit.php?id=' . $this->page->course->id;
         }
         $this->content->text .= "<div class=\"editbutton\"><a href=\"{$editpage}\"><img src=\"" . $OUTPUT->pix_url('t/edit') . "\" alt=\"" . get_string('edit') . "\" /></a></div>";
     }
     $this->content->footer = '';
     return $this->content;
 }
开发者ID:bobpuffer,项目名称:moodleUCLA-LUTH,代码行数:29,代码来源:block_course_summary.php


示例7: format_summary_text

 /**
  * Generate html for a section summary text
  *
  * @param stdClass $section The course_section entry from DB
  * @return string HTML to output.
  */
 protected function format_summary_text($section)
 {
     $context = context_course::instance($section->course);
     $summarytext = file_rewrite_pluginfile_urls($section->summary, 'pluginfile.php', $context->id, 'course', 'section', $section->id);
     $options = new stdClass();
     $options->noclean = true;
     $options->overflowdiv = true;
     return format_text($summarytext, $section->summaryformat, $options);
 }
开发者ID:etarrillo,项目名称:pvflbl,代码行数:15,代码来源:renderer.php


示例8: groupselect_get_group_info

function groupselect_get_group_info($group)
{
    $group = clone $group;
    $context = context_course::instance($group->courseid);
    $group->description = file_rewrite_pluginfile_urls($group->description, 'pluginfile.php', $context->id, 'group', 'description', $group->id);
    if (!isset($group->descriptionformat)) {
        $group->descriptionformat = FORMAT_MOODLE;
    }
    $options = new stdClass();
    $options->overflowdiv = true;
    return format_text($group->description, $group->descriptionformat, array('filter' => false, 'overflowdiv' => true, 'context' => $context));
}
开发者ID:BLC-HTWChur,项目名称:moodle-mod_groupselect,代码行数:12,代码来源:locallib.php


示例9: realtimequiz_send_question

function realtimequiz_send_question($quizid, $context, $preview = false)
{
    global $DB;
    if (!($quiz = $DB->get_record('realtimequiz', array('id' => $quizid)))) {
        realtimequiz_send_error(get_string('badquizid', 'realtimequiz') . $quizid);
    } else {
        $questionid = $quiz->currentquestion;
        if (!($question = $DB->get_record('realtimequiz_question', array('id' => $questionid)))) {
            realtimequiz_send_error(get_string('badcurrentquestion', 'realtimequiz') . $questionid);
        } else {
            $answers = $DB->get_records('realtimequiz_answer', array('questionid' => $questionid), 'id');
            $questioncount = $DB->count_records('realtimequiz_question', array('quizid' => $quizid));
            echo '<status>showquestion</status>';
            echo "<question><questionnumber>{$question->questionnum}</questionnumber>";
            echo "<questioncount>{$questioncount}</questioncount>";
            $questiontext = format_text($question->questiontext, $question->questiontextformat);
            $questiontext = file_rewrite_pluginfile_urls($questiontext, 'pluginfile.php', $context->id, 'mod_realtimequiz', 'question', $questionid);
            echo "<questiontext><![CDATA[{$questiontext}]]></questiontext>";
            if ($preview) {
                $previewtime = $quiz->nextendtime - time();
                if ($previewtime > 0) {
                    echo "<delay>{$previewtime}</delay>";
                }
                $questiontime = $question->questiontime;
                if ($questiontime == 0) {
                    $questiontime = $quiz->questiontime;
                }
                echo "<questiontime>{$questiontime}</questiontime>";
            } else {
                $questiontime = $quiz->nextendtime - time();
                if ($questiontime < 0) {
                    $questiontime = 0;
                }
                echo "<questiontime>{$questiontime}</questiontime>";
            }
            echo '<answers>';
            foreach ($answers as $answer) {
                $answertext = $answer->answertext;
                echo "<answer id='{$answer->id}'><![CDATA[{$answertext}]]></answer>";
            }
            echo '</answers>';
            echo '</question>';
        }
    }
}
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:45,代码来源:locallib.php


示例10: search_result

 public function search_result($records, $subwiki) {
     global $CFG, $PAGE;
     $table = new html_table();
     $context = get_context_instance(CONTEXT_MODULE, $PAGE->cm->id);
     $strsearchresults = get_string('searchresult', 'wiki');
     $totalcount = count($records);
     $html = $this->output->heading("$strsearchresults $totalcount");
     foreach ($records as $page) {
         $table->head = array('title' => format_string($page->title) . ' (' . html_writer::link($CFG->wwwroot . '/mod/wiki/view.php?pageid=' . $page->id, get_string('view', 'wiki')) . ')');
         $table->align = array('title' => 'left');
         $table->width = '100%';
         $table->data = array(array(file_rewrite_pluginfile_urls(format_text($page->cachedcontent, FORMAT_HTML), 'pluginfile.php', $context->id, 'mod_wiki', 'attachments', $subwiki->id)));
         $table->colclasses = array('wikisearchresults');
         $html .= html_writer::table($table);
     }
     $html = html_writer::tag('div', $html, array('class'=>'no-overflow'));
     return $this->output->container($html);
 }
开发者ID:nigeldaley,项目名称:moodle,代码行数:18,代码来源:renderer.php


示例11: get_content

 function get_content()
 {
     global $CFG, $OUTPUT;
     require_once $CFG->libdir . '/filelib.php';
     if ($this->content !== NULL) {
         return $this->content;
     }
     if (empty($this->instance)) {
         return '';
     }
     $this->content = new stdClass();
     $options = new stdClass();
     $options->noclean = true;
     // Don't clean Javascripts etc
     $options->overflowdiv = true;
     $context = context_course::instance($this->page->course->id);
     $this->page->course->summary = file_rewrite_pluginfile_urls($this->page->course->summary, 'pluginfile.php', $context->id, 'course', 'summary', NULL);
     $this->content->text = format_text($this->page->course->summary, $this->page->course->summaryformat, $options);
     $this->content->footer = '';
     return $this->content;
 }
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:21,代码来源:block_course_summary.php


示例12: customlabel_set_instance

/**
 * implements a hook for the page_module block to add
 * the link allowing live refreshing of the content
 *
 *
 */
function customlabel_set_instance(&$block)
{
    global $USER, $CFG, $COURSE, $DB;
    // Transfer content from title to content.
    $block->title = '';
    // Fake unpacks object's load.
    $data = json_decode(base64_decode($block->moduleinstance->content));
    // If failed in getting content. It happens sometimes, ... do nothing to let content be safed manually
    if (is_null($data) || !is_object($data)) {
        return false;
    }
    // Realize a pseudo update.
    $data->title = $block->moduleinstance->title;
    $data->content = $block->moduleinstance->content;
    $data->labelclass = $block->moduleinstance->labelclass;
    // fixes broken serialized contents
    $context = context_module::instance($block->cm->id);
    if (!has_capability('customlabeltype/' . $data->labelclass . ':view', $context)) {
        return false;
    }
    if (!isset($block->moduleinstance->title)) {
        // Fixes broken serialized contents.
        $block->moduleinstance->title = '';
    }
    $instance = customlabel_load_class($data);
    $block->moduleinstance->processedcontent = $instance->make_content();
    $block->moduleinstance->name = $instance->title;
    // this realizes the template
    $block->moduleinstance->timemodified = time();
    $block->content->text = $block->moduleinstance->processedcontent;
    $block->moduleinstance->title = str_replace("'", "''", $block->moduleinstance->title);
    $result = $DB->update_record('customlabel', $block->moduleinstance);
    $context = context_module::instance($block->cm->id);
    $block->content->text = file_rewrite_pluginfile_urls($block->content->text, 'pluginfile.php', $context->id, 'mod_customlabel', 'contentfiles', 0);
    return true;
}
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:42,代码来源:pageitem.php


示例13: forum_print_post

/**
 * Print a forum post
 *
 * @global object
 * @global object
 * @uses FORUM_MODE_THREADED
 * @uses PORTFOLIO_FORMAT_PLAINHTML
 * @uses PORTFOLIO_FORMAT_FILE
 * @uses PORTFOLIO_FORMAT_RICHHTML
 * @uses PORTFOLIO_ADD_TEXT_LINK
 * @uses CONTEXT_MODULE
 * @param object $post The post to print.
 * @param object $discussion
 * @param object $forum
 * @param object $cm
 * @param object $course
 * @param boolean $ownpost Whether this post belongs to the current user.
 * @param boolean $reply Whether to print a 'reply' link at the bottom of the message.
 * @param boolean $link Just print a shortened version of the post as a link to the full post.
 * @param string $footer Extra stuff to print after the message.
 * @param string $highlight Space-separated list of terms to highlight.
 * @param int $post_read true, false or -99. If we already know whether this user
 *          has read this post, pass that in, otherwise, pass in -99, and this
 *          function will work it out.
 * @param boolean $dummyifcantsee When forum_user_can_see_post says that
 *          the current user can't see this post, if this argument is true
 *          (the default) then print a dummy 'you can't see this post' post.
 *          If false, don't output anything at all.
 * @param bool|null $istracked
 * @return void
 */
function forum_print_post($post, $discussion, $forum, &$cm, $course, $ownpost=false, $reply=false, $link=false,
                          $footer="", $highlight="", $postisread=null, $dummyifcantsee=true, $istracked=null, $return=false) {
    global $USER, $CFG, $OUTPUT;

    require_once($CFG->libdir . '/filelib.php');

    // String cache
    static $str;

    $modcontext = context_module::instance($cm->id);

    $post->course = $course->id;
    $post->forum  = $forum->id;
    $post->message = file_rewrite_pluginfile_urls($post->message, 'pluginfile.php', $modcontext->id, 'mod_forum', 'post', $post->id);
    if (!empty($CFG->enableplagiarism)) {
        require_once($CFG->libdir.'/plagiarismlib.php');
        $post->message .= plagiarism_get_links(array('userid' => $post->userid,
            'content' => $post->message,
            'cmid' => $cm->id,
            'course' => $post->course,
            'forum' => $post->forum));
    }

    // caching
    if (!isset($cm->cache)) {
        $cm->cache = new stdClass;
    }

    if (!isset($cm->cache->caps)) {
        $cm->cache->caps = array();
        $cm->cache->caps['mod/forum:viewdiscussion']   = has_capability('mod/forum:viewdiscussion', $modcontext);
        $cm->cache->caps['moodle/site:viewfullnames']  = has_capability('moodle/site:viewfullnames', $modcontext);
        $cm->cache->caps['mod/forum:editanypost']      = has_capability('mod/forum:editanypost', $modcontext);
        $cm->cache->caps['mod/forum:splitdiscussions'] = has_capability('mod/forum:splitdiscussions', $modcontext);
        $cm->cache->caps['mod/forum:deleteownpost']    = has_capability('mod/forum:deleteownpost', $modcontext);
        $cm->cache->caps['mod/forum:deleteanypost']    = has_capability('mod/forum:deleteanypost', $modcontext);
        $cm->cache->caps['mod/forum:viewanyrating']    = has_capability('mod/forum:viewanyrating', $modcontext);
        $cm->cache->caps['mod/forum:exportpost']       = has_capability('mod/forum:exportpost', $modcontext);
        $cm->cache->caps['mod/forum:exportownpost']    = has_capability('mod/forum:exportownpost', $modcontext);
    }

    if (!isset($cm->uservisible)) {
        $cm->uservisible = coursemodule_visible_for_user($cm);
    }

    if ($istracked && is_null($postisread)) {
        $postisread = forum_tp_is_post_read($USER->id, $post);
    }

    if (!forum_user_can_see_post($forum, $discussion, $post, NULL, $cm)) {
        $output = '';
        if (!$dummyifcantsee) {
            if ($return) {
                return $output;
            }
            echo $output;
            return;
        }
        $output .= html_writer::tag('a', '', array('id'=>'p'.$post->id));
        $output .= html_writer::start_tag('div', array('class'=>'forumpost clearfix'));
        $output .= html_writer::start_tag('div', array('class'=>'row header'));
        $output .= html_writer::tag('div', '', array('class'=>'left picture')); // Picture
        if ($post->parent) {
            $output .= html_writer::start_tag('div', array('class'=>'topic'));
        } else {
            $output .= html_writer::start_tag('div', array('class'=>'topic starter'));
        }
        $output .= html_writer::tag('div', get_string('forumsubjecthidden','forum'), array('class'=>'subject')); // Subject
        $output .= html_writer::tag('div', get_string('forumauthorhidden','forum'), array('class'=>'author')); // author
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:lib.php


示例14: format_module_intro

/**
 * Formats activity intro text
 *
 * @global object
 * @uses CONTEXT_MODULE
 * @param string $module name of module
 * @param object $activity instance of activity
 * @param int $cmid course module id
 * @param bool $filter filter resulting html text
 * @return text
 */
function format_module_intro($module, $activity, $cmid, $filter = true)
{
    global $CFG;
    require_once "{$CFG->libdir}/filelib.php";
    $context = get_context_instance(CONTEXT_MODULE, $cmid);
    $options = array('noclean' => true, 'para' => false, 'filter' => $filter, 'context' => $context, 'overflowdiv' => true);
    $intro = file_rewrite_pluginfile_urls($activity->intro, 'pluginfile.php', $context->id, 'mod_' . $module, 'intro', null);
    return trim(format_text($intro, $activity->introformat, $options, null));
}
开发者ID:hatone,项目名称:moodle,代码行数:20,代码来源:weblib.php


示例15: print_version_view

    /**
     * Given an old page version, output the version content
     *
     * @global object $CFG
     * @global object $OUTPUT
     * @global object $PAGE
     */
    private function print_version_view() {
        global $CFG, $OUTPUT, $PAGE;
        $pageversion = wiki_get_version($this->version->id);

        if ($pageversion) {
            $restorelink = new moodle_url('/mod/wiki/restoreversion.php', array('pageid' => $this->page->id, 'versionid' => $this->version->id));
            echo $OUTPUT->heading(get_string('viewversion', 'wiki', $pageversion->version) . '<br />' . html_writer::link($restorelink->out(false), '(' . get_string('restorethis', 'wiki') . ')', array('class' => 'wiki_restore')) . '&nbsp;', 4);
            $userinfo = wiki_get_user_info($pageversion->userid);
            $heading = '<p><strong>' . get_string('modified', 'wiki') . ':</strong>&nbsp;' . userdate($pageversion->timecreated, get_string('strftimedatetime', 'langconfig'));
            $viewlink = new moodle_url('/user/view.php', array('id' => $userinfo->id));
            $heading .= '&nbsp;&nbsp;&nbsp;<strong>' . get_string('user') . ':</strong>&nbsp;' . html_writer::link($viewlink->out(false), fullname($userinfo));
            $heading .= '&nbsp;&nbsp;&rarr;&nbsp;' . $OUTPUT->user_picture(wiki_get_user_info($pageversion->userid), array('popup' => true)) . '</p>';
            print_container($heading, false, 'mdl-align wiki_modifieduser wiki_headingtime');
            $options = array('swid' => $this->subwiki->id, 'pretty_print' => true, 'pageid' => $this->page->id);

            $pageversion->content = file_rewrite_pluginfile_urls($pageversion->content, 'pluginfile.php', $this->modcontext->id, 'mod_wiki', 'attachments', $this->subwiki->id);

            $parseroutput = wiki_parse_content($pageversion->contentformat, $pageversion->content, $options);
            $content = print_container(format_text($parseroutput['parsed_text'], FORMAT_HTML, array('overflowdiv'=>true)), false, '', '', true);
            echo $OUTPUT->box($content, 'generalbox wiki_contentbox');

        } else {
            print_error('versionerror', 'wiki');
        }
    }
开发者ID:Burick,项目名称:moodle,代码行数:32,代码来源:pagelib.php


示例16: profile_view

}

// Trigger a user profile viewed event.
profile_view($user, $usercontext);

// TODO WORK OUT WHERE THE NAV BAR IS!
echo $OUTPUT->header();
echo '<div class="userprofile">';

if ($user->description && !isset($hiddenfields['description'])) {
    echo '<div class="description">';
    if (!empty($CFG->profilesforenrolledusersonly) && !$currentuser &&
        !$DB->record_exists('role_assignments', array('userid' => $user->id))) {
        echo get_string('profilenotshown', 'moodle');
    } else {
        $user->description = file_rewrite_pluginfile_urls($user->description, 'pluginfile.php', $usercontext->id, 'user',
                                                          'profile', null);
        echo format_text($user->description, $user->descriptionformat);
    }
    echo '</div>';
}

echo $OUTPUT->custom_block_region('content');

// Render custom blocks.
$renderer = $PAGE->get_renderer('core_user', 'myprofile');
$tree = core_user\output\myprofile\manager::build_tree($user, $currentuser);
echo $renderer->render($tree);

echo '</div>';  // Userprofile class.

echo $OUTPUT->footer();
开发者ID:kmahesh541,项目名称:mitclone,代码行数:32,代码来源:profile.php


示例17: get_content

 public function get_content()
 {
     global $CFG, $DB;
     require_once $CFG->libdir . '/filelib.php';
     $this->page->requires->js('/blocks/slideshow/js/jquery.cycle2.min.js');
     $this->page->requires->js('/blocks/slideshow/js/spectrum.js');
     if ($this->content !== null) {
         return $this->content;
     }
     $this->content = new stdClass();
     if (!empty($this->config->text)) {
         $this->content->text = $this->config->text;
     } else {
         $this->content->text = '';
     }
     if (!empty($this->config->background)) {
         $this->content->background = $this->config->background;
     } else {
         $this->content->background = '#000000';
     }
     if (!empty($this->config->transparent)) {
         $this->content->transparent = $this->config->transparent;
     } else {
         $this->content->transparent = '';
     }
     if (!empty($this->config->normalblock)) {
         $this->content->normalblock = $this->config->normalblock;
     } else {
         $this->content->normalblock = '';
     }
     if (!empty($this->config->transition)) {
         $this->content->transition = $this->config->transition;
     } else {
         $this->content->transition = 'fade';
     }
     if (!empty($this->config->slidedelay)) {
         $this->content->slidedelay = $this->config->slidedelay;
     } else {
         $this->content->slidedelay = '4000';
     }
     if (!empty($this->config->slidespeed)) {
         $this->content->slidespeed = $this->config->slidespeed;
     } else {
         $this->content->slidespeed = '1000';
     }
     $this->content->text = '<div id="page-slideshow">';
     file_rewrite_pluginfile_urls($this->content->text, 'pluginfile.php', $this->context->id, 'block_slideshow', 'content', NULL);
     $table = 'files';
     $select = "component = 'block_slideshow' AND contextid = '" . $this->context->id . "' AND filename != '.'";
     $fields = 'filename';
     $sort = 'filename';
     $images = $DB->get_records_select($table, $select, NULL, $sort, $fields);
     foreach ($images as $image) {
         $imagefile = $image->filename;
         $url = $CFG->wwwroot . '/pluginfile.php/' . $this->context->id . '/block_slideshow/content/' . $imagefile;
         $this->content->text .= '<img src="' . $url . '" class="slide" />';
     }
     $this->content->text .= '</div><div style="clear:both;"> </div>';
     if ($this->content->transparent) {
         $ssbackground = 'transparent';
     } else {
         $ssbackground = $this->content->background;
     }
     $node = 'page-header';
     $currenttheme = $CFG->theme;
     switch ($currenttheme) {
         default:
             $node = 'page-header';
             break;
         case 'fusion':
         case 'nimble':
             $node = 'region-header';
             break;
         case 'magazine':
             $node = 'textcontainer-wrap';
             break;
         case 'overlay':
             $node = 'newheader';
             break;
         case 'splash':
             $node = 'page-header-wrapper';
             break;
     }
     $script = "\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\$(document).ready(function() {\n    \t\t\t\t\t\$('#page-slideshow').cycle({\n\t\t\t\t\t\t\tfx: '" . $this->content->transition . "',\n\t\t\t\t\t\t\tspeed: " . $this->content->slidespeed . ",\n\t\t\t\t\t\t\ttimeout: " . $this->content->slidedelay . ",\n\t\t\t\t\t  }); ";
     if (!$this->content->normalblock) {
         $script .= "\$('#inst" . $this->instance->id . "') .appendTo('#" . $node . "');\n\t\t\t\t\t\t\$('#page-header').css('height', 'auto');\n            \$('.block.block_slideshow').css({'margin':'0','border':'0','width':'100%','clear':'both','border-radius':'0','padding':'0','background':'" . $ssbackground . "'});\n            \$('.block.block_slideshow .corner-box').css({'margin':'0','border':'0','width':'100%','clear':'both','border-radius':'0','padding':'0','background':'" . $ssbackground . "'});";
     }
     $script .= "\n\t\t\t\t\t\t\$('#page-slideshow').width(\$('#inst" . $this->instance->id . "').width());\n\t\t\t\t\t\t\$('#page-slideshow').css('background', '" . $ssbackground . "');\n\t\t\t\t\t\t// \$('.block.block_slideshow .content #page-slideshow').css();\n\t\t\t\t\t\t// \$('.block.block_slideshow .content #page-slideshow img').css();\n\t\t\t\t\t});\n\n\t\t\t\t</script>";
     $this->content->text .= $script;
     // . "<h1>Normal Block:" . $this->content->normalblock . ";</h1>";
     return $this->content;
 }
开发者ID:ptabak,项目名称:moodle-block_slideshow,代码行数:92,代码来源:block_slideshow.php


示例18: display_browse_field

    /**
     * Display the content of the field in browse mode
     *
     * @param int $recordid
     * @param object $template
     * @return bool|string
     */
    function display_browse_field($recordid, $template) {
        global $DB;

        if ($content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid))) {
            if (isset($content->content)) {
                $options = new stdClass();
                if ($this->field->param1 == '1') {  // We are autolinking this field, so disable linking within us
                    $options->filter = false;
                }
                $options->para = false;
                $str = file_rewrite_pluginfile_urls($content->content, 'pluginfile.php', $this->context->id, 'mod_data', 'content', $content->id, $this->get_options());
                $str = format_text($str, $content->content1, $options);
            } else {
                $str = '';
            }
            return $str;
        }
        return false;
    }
开发者ID:nicusX,项目名称:moodle,代码行数:26,代码来源:field.class.php


示例19: render_editor_content

 /**
  * Render the content in editor that is often used by plugin.
  *
  * @param string $filearea
  * @param int  $submissionid
  * @param string $plugintype
  * @param string $editor
  * @param string $component
  * @return string
  */
 public function render_editor_content($filearea, $submissionid, $plugintype, $editor, $component)
 {
     global $CFG;
     $result = '';
     $plugin = $this->get_submission_plugin_by_type($plugintype);
     $text = $plugin->get_editor_text($editor, $submissionid);
     $format = $plugin->get_editor_format($editor, $submissionid);
     $finaltext = file_rewrite_pluginfile_urls($text, 'pluginfile.php', $this->get_context()->id, $component, $filearea, $submissionid);
     $params = array('overflowdiv' => true, 'context' => $this->get_context());
     $result .= format_text($finaltext, $format, $params);
     if ($CFG->enableportfolios) {
         require_once $CFG->libdir . '/portfoliolib.php';
         $button = new portfolio_add_button();
         $portfolioparams = array('cmid' => $this->get_course_module()->id, 'sid' => $submissionid, 'plugin' => $plugintype, 'editor' => $editor, 'area' => $filearea);
         $button->set_callback_options('assign_portfolio_caller', $portfolioparams, 'mod_assign');
         $fs = get_file_storage();
         if ($files = $fs->get_area_files($this->context->id, $component, $filearea, $submissionid, 'timemodified', false)) {
             $button->set_formats(PORTFOLIO_FORMAT_RICHHTML);
         } else {
             $button->set_formats(PORTFOLIO_FORMAT_PLAINHTML);
         }
         $result .= $button->to_html();
     }
     return $result;
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:35,代码来源:locallib.php


示例20: array

                echo '</span></pre>';
                echo '<br>';
                echo '</td></tr>';
            }
            $x++;
        }
        echo '</table></center>';
        echo '<br><p><p>';
        echo '<h2><center><b>Average class score is ' . $classaverage . '%</b></center></h2>';
    }
} else {
    // Show a single question
    echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter realtimequizplainbox');
    $question = $DB->get_record('realtimequiz_question', array('id' => $questionid));
    echo '<h2>' . get_string('question', 'realtimequiz') . $question->questionnum . '</h2>';
    $questiontext = file_rewrite_pluginfile_urls($question->questiontext, 'pluginfile.php', $context->id, 'mod_realtimequiz', 'question', $question->id);
    $questiontext = format_text($questiontext, $question->questiontextformat);
    echo '<p>' . $questiontext . '</p><br />';
    echo '<table border="1" class="realtimequiz_report_answer"><tr class="realtimequiz_report_question"><td width="30%">&nbsp;</td>';
    $answers = $DB->get_records('realtimequiz_answer', array('questionid' => $questionid), 'id');
    if (!empty($answers)) {
        foreach ($answers as $answer) {
            if ($answer->correct == 1) {
                echo '<td width="10%"><b>' . s($answer->answertext) . '</b></td>';
            } else {
                echo '<td width="10%">' . s($answer->answertext) . '</td>';
            }
        }
    }
    echo '</tr>';
    if ($showsession == 0) {
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:31,代码来源:responses.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP file_rewrite_urls_to_pluginfile函数代码示例发布时间:2022-05-15
下一篇:
PHP file_read函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap