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

PHP file_encode_url函数代码示例

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

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



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

示例1: block_my_course_progress_get_course_image_url

/**
 * Returns the url of the first image contained in the course summary file area
 * @param  int $id the course id
 * @return string     the url to the image
 */
function block_my_course_progress_get_course_image_url($id)
{
    global $CFG;
    require_once $CFG->libdir . "/filelib.php";
    $course = get_course($id);
    if ($course instanceof stdClass) {
        require_once $CFG->libdir . '/coursecatlib.php';
        $course = new course_in_list($course);
    }
    foreach ($course->get_course_overviewfiles() as $file) {
        $isimage = $file->is_valid_image();
        if ($isimage) {
            return file_encode_url("{$CFG->wwwroot}/pluginfile.php", '/' . $file->get_contextid() . '/' . $file->get_component() . '/' . $file->get_filearea() . $file->get_filepath() . $file->get_filename(), !$isimage);
        }
    }
    return false;
}
开发者ID:Regaez,项目名称:moodle-block_my_course_progress,代码行数:22,代码来源:locallib.php


示例2: coursecat_coursebox_content

 protected function coursecat_coursebox_content(coursecat_helper $chelper, $course)
 {
     global $CFG;
     if ($chelper->get_show_courses() < self::COURSECAT_SHOW_COURSES_EXPANDED) {
         return '';
     }
     if ($course instanceof stdClass) {
         require_once $CFG->libdir . '/coursecatlib.php';
         $course = new course_in_list($course);
     }
     $content = '';
     // Display course overview files.
     $contentimages = $contentfiles = '';
     foreach ($course->get_course_overviewfiles() as $file) {
         $isimage = $file->is_valid_image();
         $url = file_encode_url("{$CFG->wwwroot}/pluginfile.php", '/' . $file->get_contextid() . '/' . $file->get_component() . '/' . $file->get_filearea() . $file->get_filepath() . $file->get_filename(), !$isimage);
         if ($isimage) {
             $contentimages .= html_writer::start_tag('div', array('class' => 'imagebox'));
             $images = html_writer::empty_tag('img', array('src' => $url, 'alt' => 'Course Image ' . $course->fullname, 'class' => 'courseimage'));
             $contentimages .= html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)), $images);
             $contentimages .= html_writer::end_tag('div');
         } else {
             $image = $this->output->pix_icon(file_file_icon($file, 24), $file->get_filename(), 'moodle');
             $filename = html_writer::tag('span', $image, array('class' => 'fp-icon')) . html_writer::tag('span', $file->get_filename(), array('class' => 'fp-filename'));
             $contentfiles .= html_writer::tag('span', html_writer::link($url, $filename), array('class' => 'coursefile fp-filename-icon'));
         }
     }
     $content .= $contentimages . $contentfiles;
     // Display course summary.
     if ($course->has_summary()) {
         $content .= $chelper->get_course_formatted_summary($course);
     }
     // Display course contacts. See course_in_list::get_course_contacts().
     if ($course->has_course_contacts()) {
         $content .= html_writer::start_tag('ul', array('class' => 'teachers'));
         foreach ($course->get_course_contacts() as $userid => $coursecontact) {
             $name = $coursecontact['rolename'] . ': ' . html_writer::link(new moodle_url('/user/view.php', array('id' => $userid, 'course' => SITEID)), $coursecontact['username']);
             $content .= html_writer::tag('li', $name);
         }
         $content .= html_writer::end_tag('ul');
         // ...Teachers!.
     }
     return $content;
 }
开发者ID:vidyamantra,项目名称:moodle-theme_eduhub,代码行数:44,代码来源:course_renderer.php


示例3: mycourses

 protected function mycourses($CFG, $sidebar)
 {
     $mycourses = enrol_get_users_courses($_SESSION['USER']->id);
     $courselist = array();
     foreach ($mycourses as $key => $val) {
         $courselist[] = $val->id;
     }
     $content = '';
     for ($x = 1; $x <= sizeof($courselist); $x++) {
         $course = get_course($courselist[$x - 1]);
         $title = $course->fullname;
         if ($course instanceof stdClass) {
             require_once $CFG->libdir . '/coursecatlib.php';
             $course = new course_in_list($course);
         }
         $url = $CFG->wwwroot . "/theme/keats/pix/coursenoimage.jpg";
         foreach ($course->get_course_overviewfiles() as $file) {
             $isimage = $file->is_valid_image();
             $url = file_encode_url("{$CFG->wwwroot}/pluginfile.php", '/' . $file->get_contextid() . '/' . $file->get_component() . '/' . $file->get_filearea() . $file->get_filepath() . $file->get_filename(), !$isimage);
             if (!$isimage) {
                 $url = $CFG->wwwroot . "/theme/keats/pix/coursenoimage.jpg";
             }
         }
         $content .= '<div class="view view-second view-mycourse ' . ($x % 3 == 0 ? 'view-nomargin' : '') . '">
                         <img src="' . $url . '" />
                         <div class="mask">
                             <h2>' . $title . '</h2>
                             <a href="' . $CFG->wwwroot . '/course/view.php?id=' . $courselist[$x - 1] . '" class="info">Enter</a>
                         </div>
                     </div>';
     }
     return $content;
 }
开发者ID:simonsCatalyst,项目名称:simonsCatalyst-keats,代码行数:33,代码来源:renderers.php


示例4: htmllize_tree

 /**
  * Internal function - creates htmls structure suitable for YUI tree.
  */
 protected function htmllize_tree($tree, $dir)
 {
     global $CFG;
     $yuiconfig = array();
     $yuiconfig['type'] = 'html';
     if (empty($dir['subdirs']) and empty($dir['files'])) {
         return '';
     }
     $result = '<ul>';
     foreach ($dir['subdirs'] as $subdir) {
         $image = $this->output->pix_icon("f/folder", $subdir['dirname'], 'moodle', array('class' => 'icon'));
         $result .= '<li yuiConfig=\'' . json_encode($yuiconfig) . '\'><div>' . $image . ' ' . s($subdir['dirname']) . '</div> ' . $this->htmllize_tree($tree, $subdir) . '</li>';
     }
     foreach ($dir['files'] as $file) {
         $url = file_encode_url("{$CFG->wwwroot}/blocks/csv_enrol/getfile.php", '/' . $tree->context->id . '/user/csvenrol' . $file->get_filepath() . $file->get_filename(), true);
         $filename = $file->get_filename();
         $icon = mimeinfo("icon", $filename);
         if (strlen($filename) > 10) {
             $pi = pathinfo($filename);
             $txt = $pi['filename'];
             $ext = $pi['extension'];
             $filename = substr($filename, 0, 14) . '...' . $ext;
         }
         $image = $this->output->pix_icon("f/{$icon}", $filename, 'moodle', array('class' => 'icon'));
         $result .= '<li yuiConfig=\'' . json_encode($yuiconfig) . '\'><div>' . html_writer::link($url, $image . '&nbsp;' . $filename) . '</div></li>';
     }
     $result .= '</ul>';
     return $result;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:32,代码来源:renderer.php


示例5: imscp_htmllize_item

/**
 * Internal function - creates htmls structure suitable for YUI tree.
 */
function imscp_htmllize_item($item, $imscp, $cm)
{
    global $CFG;
    if ($item['href']) {
        if (preg_match('|^https?://|', $item['href'])) {
            $url = $item['href'];
        } else {
            $context = context_module::instance($cm->id);
            $urlbase = "{$CFG->wwwroot}/pluginfile.php";
            $path = '/' . $context->id . '/mod_imscp/content/' . $imscp->revision . '/' . $item['href'];
            $url = file_encode_url($urlbase, $path, false);
        }
        $result = "<li><a href=\"{$url}\">" . $item['title'] . '</a>';
    } else {
        $result = '<li>' . $item['title'];
    }
    if ($item['subitems']) {
        $result .= '<ul>';
        foreach ($item['subitems'] as $subitem) {
            $result .= imscp_htmllize_item($subitem, $imscp, $cm);
        }
        $result .= '</ul>';
    }
    $result .= '</li>';
    return $result;
}
开发者ID:pzhu2004,项目名称:moodle,代码行数:29,代码来源:locallib.php


示例6: get_content

 public function get_content()
 {
     global $CFG;
     if ($this->content !== null) {
         return $this->content;
     }
     if (empty($this->instance)) {
         $this->content = '';
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     $this->content->text = '';
     // The user/index.php expect course context, so get one if page has module context.
     $currentcontext = $this->page->context->get_course_context(false);
     if (empty($currentcontext)) {
         return $this->content;
     }
     if ($this->page->course->id == SITEID) {
         $courses = self::get_featured_courses();
         require_once $CFG->libdir . '/coursecatlib.php';
         $chelper = new coursecat_helper();
         foreach ($courses as $course) {
             $course = new course_in_list($course);
             $this->content->text .= '<div class="container-fluid coursebox">';
             $content = '';
             $coursename = $chelper->get_course_formatted_name($course);
             $coursenamelink = html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)), $coursename, array('class' => $course->visible ? '' : 'dimmed'));
             $content .= html_writer::tag('div', $coursenamelink, array('class' => 'coursename'));
             if ($course->has_summary()) {
                 $content .= html_writer::start_tag('div', array('class' => 'summary'));
                 $content .= $chelper->get_course_formatted_summary($course, array('overflowdiv' => true, 'noclean' => true, 'para' => false));
                 $content .= html_writer::end_tag('div');
             }
             // Display course overview files.
             $contentimages = $contentfiles = '';
             foreach ($course->get_course_overviewfiles() as $file) {
                 $isimage = $file->is_valid_image();
                 $url = file_encode_url("{$CFG->wwwroot}/pluginfile.php", '/' . $file->get_contextid() . '/' . $file->get_component() . '/' . $file->get_filearea() . $file->get_filepath() . $file->get_filename(), !$isimage);
                 if ($isimage) {
                     $contentimages .= html_writer::tag('div', html_writer::empty_tag('img', array('src' => $url, 'style' => 'max-height: 150px')), array('class' => 'courseimage'));
                 } else {
                     $image = $this->output->pix_icon(file_file_icon($file, 24), $file->get_filename(), 'moodle');
                     $filename = html_writer::tag('span', $image, array('class' => 'fp-icon')) . html_writer::tag('span', $file->get_filename(), array('class' => 'fp-filename'));
                     $contentfiles .= html_writer::tag('span', html_writer::link($url, $filename), array('class' => 'coursefile fp-filename-icon'));
                 }
             }
             $content .= $contentimages . $contentfiles;
             $this->content->text .= $content . '</div>';
         }
     }
     return $this->content;
 }
开发者ID:danielneis,项目名称:moodle-block_featuredcourses,代码行数:55,代码来源:block_featuredcourses.php


示例7: folder_get_file_link

/**
 * Returns file link
 * @param object $file
 * @param object $folder
 * @param object $context
 * @return string html link
 */
function folder_get_file_link($file, $folder, $context)
{
    global $CFG;
    $strfile = get_string('file');
    $strdownload = get_string('download');
    $icon = mimeinfo_from_type("icon", $file->get_mimetype());
    $urlbase = "{$CFG->wwwroot}/pluginfile.php";
    $path = '/' . $context->id . '/folder_content/' . $folder->revision . $file->get_filepath() . $file->get_filename();
    $viewurl = file_encode_url($urlbase, $path, false);
    $downloadurl = file_encode_url($urlbase, $path, true);
    $downloadurl = "&nbsp;<a href=\"{$downloadurl}\" title=\"" . get_string('downloadfile') . "\"><img src=\"{$CFG->pixpath}/t/down.gif\" class=\"iconsmall\" alt=\"{$strdownload}\" /></a>";
    return "<a href=\"{$viewurl}\" title=\"\"><img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfile}\" />&nbsp;" . s($file->get_filename()) . '</a>' . $downloadurl;
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:20,代码来源:locallib.php


示例8: get_url

 /**
  * Returns file download url
  * @param bool $forcedownload
  * @param bool $htts force https
  * @return string url
  */
 public function get_url($forcedownload = false, $https = false)
 {
     global $CFG;
     if (!$this->is_readable()) {
         return null;
     }
     if ($this->lf->is_directory()) {
         return null;
     }
     $filepath = $this->lf->get_filepath();
     $filename = $this->lf->get_filename();
     $courseid = $this->context->instanceid;
     $path = '/' . $courseid . $filepath . $filename;
     return file_encode_url($this->urlbase, $path, $forcedownload, $https);
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:21,代码来源:file_info_coursefile.php


示例9: print_student_answer

 function print_student_answer($userid, $return = false)
 {
     global $CFG, $USER, $OUTPUT;
     $fs = get_file_storage();
     $browser = get_file_browser();
     $output = '';
     if ($files = $fs->get_area_files($this->context->id, 'assignment_submission', $userid, "timemodified", false)) {
         foreach ($files as $file) {
             $filename = $file->get_filename();
             $found = true;
             $mimetype = $file->get_mimetype();
             $path = file_encode_url($CFG->wwwroot . '/pluginfile.php', '/' . $this->context->id . '/assignment_submission/' . $userid . '/' . $filename);
             $output .= '<a href="' . $path . '" ><img class="icon" src="' . $OUTPUT->old_icon_url(file_mimetype_icon($mimetype)) . '" alt="' . $mimetype . '" />' . s($filename) . '</a><br />';
         }
     }
     $output = '<div class="files">' . $output . '</div>';
     return $output;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:18,代码来源:assignment.class.php


示例10: imscp_htmllize_item

/**
 * Internal function - creates htmls structure suitable for YUI tree.
 */
function imscp_htmllize_item($item, $imscp, $cm)
{
    global $CFG;
    $context = get_context_instance(CONTEXT_MODULE, $cm->id);
    $urlbase = "{$CFG->wwwroot}/pluginfile.php";
    $path = '/' . $context->id . '/mod_imscp/content/' . $imscp->revision . '/' . $item['href'];
    $url = file_encode_url($urlbase, $path, false);
    $result = "<li><a href=\"{$url}\">" . $item['title'] . '</a>';
    if ($item['subitems']) {
        $result .= '<ul>';
        foreach ($item['subitems'] as $subitem) {
            $result .= imscp_htmllize_item($subitem, $imscp, $cm);
        }
        $result .= '</ul>';
    }
    $result .= '</li>';
    return $result;
}
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:21,代码来源:locallib.php


示例11: htmllize_tree

 /**
  * Internal function - creates htmls structure suitable for YUI tree.
  */
 protected function htmllize_tree($tree, $dir)
 {
     global $CFG;
     if (empty($dir['subdirs']) and empty($dir['files'])) {
         return '';
     }
     $result = '<ul>';
     foreach ($dir['subdirs'] as $subdir) {
         $result .= '<li>' . s($subdir['dirname']) . ' ' . $this->htmllize_tree($tree, $subdir) . '</li>';
     }
     foreach ($dir['files'] as $file) {
         $url = file_encode_url("{$CFG->wwwroot}/pluginfile.php", '/' . $tree->context->id . '/mod_ubikc/content/' . $tree->ubikc->kcrevision . $file->get_filepath() . $file->get_filename(), true);
         $filename = $file->get_filename();
         $result .= '<li><span>' . html_writer::link($url, $filename) . '</span></li>';
     }
     $result .= '</ul>';
     return $result;
 }
开发者ID:hsihohuang,项目名称:ubikc,代码行数:21,代码来源:renderer.php


示例12: print_student_answer

 function print_student_answer($userid, $return = false)
 {
     global $CFG, $USER, $OUTPUT;
     $fs = get_file_storage();
     $browser = get_file_browser();
     $output = '';
     if ($submission = $this->get_submission($userid)) {
         if ($files = $fs->get_area_files($this->context->id, 'mod_assignment', 'submission', $submission->id, "timemodified", false)) {
             foreach ($files as $file) {
                 $filename = $file->get_filename();
                 $found = true;
                 $mimetype = $file->get_mimetype();
                 $path = file_encode_url($CFG->wwwroot . '/pluginfile.php', '/' . $this->context->id . '/mod_assignment/submission/' . $submission->id . '/' . $filename);
                 $output .= '<a href="' . $path . '" >' . $OUTPUT->pix_icon(file_file_icon($file), get_mimetype_description($file), 'moodle', array('class' => 'icon')) . s($filename) . '</a><br />';
                 $output .= plagiarism_get_links(array('userid' => $userid, 'file' => $file, 'cmid' => $this->cm->id, 'course' => $this->course, 'assignment' => $this->assignment));
                 $output .= '<br/>';
             }
         }
     }
     $output = '<div class="files">' . $output . '</div>';
     return $output;
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:22,代码来源:assignment.class.php


示例13: htmllize_tree

 /**
  * Internal function - creates htmls structure suitable for YUI tree.
  * @param user_files_tree $tree
  * @param array $dir
  * @return string HTML
  */
 protected function htmllize_tree($tree, $dir)
 {
     global $CFG;
     $yuiconfig = array();
     $yuiconfig['type'] = 'html';
     if (empty($dir['subdirs']) and empty($dir['files'])) {
         return '';
     }
     $result = '<ul>';
     foreach ($dir['subdirs'] as $subdir) {
         $image = $this->output->pix_icon(file_folder_icon(), $subdir['dirname'], 'moodle', array('class' => 'icon'));
         $result .= '<li yuiConfig=\'' . json_encode($yuiconfig) . '\'><div>' . $image . ' ' . s($subdir['dirname']) . '</div> ' . $this->htmllize_tree($tree, $subdir) . '</li>';
     }
     foreach ($dir['files'] as $file) {
         $url = file_encode_url("{$CFG->wwwroot}/pluginfile.php", '/' . $tree->context->id . '/user/private' . $file->get_filepath() . $file->get_filename(), true);
         $filename = $file->get_filename();
         $image = $this->output->pix_icon(file_file_icon($file), $filename, 'moodle', array('class' => 'icon'));
         $result .= '<li yuiConfig=\'' . json_encode($yuiconfig) . '\'><div>' . $image . ' ' . html_writer::link($url, $filename) . '</div></li>';
     }
     $result .= '</ul>';
     return $result;
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:28,代码来源:renderer.php


示例14: folder_export_contents

/**
 * Export folder resource contents
 *
 * @return array of file content
 */
function folder_export_contents($cm, $baseurl)
{
    global $CFG, $DB;
    $contents = array();
    $context = context_module::instance($cm->id);
    $folder = $DB->get_record('folder', array('id' => $cm->instance), '*', MUST_EXIST);
    $fs = get_file_storage();
    $files = $fs->get_area_files($context->id, 'mod_folder', 'content', 0, 'sortorder DESC, id ASC', false);
    foreach ($files as $fileinfo) {
        $file = array();
        $file['type'] = 'file';
        $file['filename'] = $fileinfo->get_filename();
        $file['filepath'] = $fileinfo->get_filepath();
        $file['filesize'] = $fileinfo->get_filesize();
        $file['fileurl'] = file_encode_url("{$CFG->wwwroot}/" . $baseurl, '/' . $context->id . '/mod_folder/content/' . $folder->revision . $fileinfo->get_filepath() . $fileinfo->get_filename(), true);
        $file['timecreated'] = $fileinfo->get_timecreated();
        $file['timemodified'] = $fileinfo->get_timemodified();
        $file['sortorder'] = $fileinfo->get_sortorder();
        $file['userid'] = $fileinfo->get_userid();
        $file['author'] = $fileinfo->get_author();
        $file['license'] = $fileinfo->get_license();
        $contents[] = $file;
    }
    return $contents;
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:30,代码来源:lib.php


示例15: top_promoted_courses

 public function top_promoted_courses()
 {
     global $CFG, $OUTPUT, $DB, $PAGE;
     $featuredcontent = '';
     /* Get Featured courses id from DB */
     $featuredids = theme_pioneer_get_setting('toppromotedcourses');
     $rcourseids = !empty($featuredids) ? explode(",", $featuredids, 10) : array();
     if (empty($rcourseids)) {
         return false;
     }
     $hcourseids = theme_pioneer_hidden_courses_ids();
     if (!empty($hcourseids)) {
         foreach ($rcourseids as $key => $val) {
             if (in_array($val, $hcourseids)) {
                 unset($rcourseids[$key]);
             }
         }
     }
     foreach ($rcourseids as $key => $val) {
         $ccourse = $DB->get_record('course', array('id' => $val));
         if (empty($ccourse)) {
             unset($rcourseids[$key]);
             continue;
         }
     }
     if (empty($rcourseids)) {
         return false;
     }
     $fcourseids = array_chunk($rcourseids, 10);
     $totalfcourse = count($fcourseids);
     $promotedtitle = theme_pioneer_get_setting('toppromotedtitle', 'format_text');
     $promotedtitle = theme_pioneer_lang($promotedtitle);
     $closelisting = theme_pioneer_get_setting('topclosefeatured', 'format_text');
     $topshowfeatured = theme_pioneer_get_setting('topshowfeatured', 'format_text');
     $featuredheader = '<div class="custom-courses-list" id="topPromoted-Courses">
                           <div class="container-fluid">
                          <div class="promoted_courses" data-crow="' . $totalfcourse . '">';
     $featuredfooter = ' </div>
                         </div>
                         </div>';
     if (!empty($fcourseids)) {
         echo '<div id="featured-listing" class="collapse out">';
         echo '<div data-toggle="collapse" data-target="#featured-listing" class="btn-link"style="text-align:center;">' . $closelisting . '</div>';
         foreach ($fcourseids as $courseids) {
             $rowcontent = '<div><div class="row-fluid topcarousel">';
             foreach ($courseids as $courseid) {
                 $course = get_course($courseid);
                 $no = get_config('theme_pioneer', 'toppatternselect');
                 $nimgp = empty($no) || $no == "default" ? 'no-image' : 'cs0' . $no . '/no-image';
                 $noimgurl = $OUTPUT->pix_url($nimgp, 'theme');
                 $courseurl = new moodle_url('/course/view.php', array('id' => $courseid));
                 if ($course instanceof stdClass) {
                     require_once $CFG->libdir . '/coursecatlib.php';
                     $course = new course_in_list($course);
                 }
                 $imgurl = '';
                 $summary = theme_pioneer_strip_html_tags($course->summary);
                 $summary = theme_pioneer_course_trim_char($summary, 125);
                 $trimtitle = theme_pioneer_course_trim_char($course->fullname, 90);
                 $context = context_course::instance($course->id);
                 $nostudents = count_role_users(5, $context);
                 foreach ($course->get_course_overviewfiles() as $file) {
                     $isimage = $file->is_valid_image();
                     $imgurl = file_encode_url("{$CFG->wwwroot}/pluginfile.php", '/' . $file->get_contextid() . '/' . $file->get_component() . '/' . $file->get_filearea() . $file->get_filepath() . $file->get_filename(), !$isimage);
                     if (!$isimage) {
                         $imgurl = $noimgurl;
                     }
                 }
                 if (empty($imgurl)) {
                     $imgurl = $PAGE->theme->setting_file_url('headerbackgroundimage', 'headerbackgroundimage', true);
                     if (!$imgurl) {
                         $imgurl = $noimgurl;
                     }
                 }
                 $listitems = '
                 <div class="row-fluid">
                 <div class="span3">
                 <img src="' . $imgurl . '" width="100%" height="75px" alt="' . $course->fullname . '">
                 </div>
                 <div class="span5">
                 <h5><a href="' . $courseurl . '" >' . $trimtitle . '</a></h5>
                 </div>
                 <div class="span4">
                 <p>' . $summary . '</p>
                 </div>
                 </div>';
                 $coursehtml = '
                     <div style="background-image: url(' . $imgurl . ');background-repeat: no-repeat;background-size:cover; background-position:center;" class="promowrap">
                         <div class="fp-coursebox">
                             <div class="fp-courseinfo">
                                 <p style="font-size:24px;font-weight:bold;"><a href="' . $courseurl . '" id="button" data-toggle="tooltip" data-placement="bottom"title="' . $summary . '" >' . $trimtitle . '</a></p>
                             <div class="titlebar"> <h5>' . $promotedtitle . '</h5> </div>
                             <div data-toggle="collapse" data-target="#featured-listing" class="btn-link">' . $topshowfeatured . '</div>
                             </div>
                         </div>
                     </div>';
                 $rowcontent .= $coursehtml;
                 echo $listitems;
             }
             $rowcontent .= '</div></div> ';
//.........这里部分代码省略.........
开发者ID:kennibc,项目名称:moodle-theme_pioneer,代码行数:101,代码来源:course_renderer.php


示例16: __construct

 /**
  * Gets the file data
  *
  * @param stored_file $file
  * @param int $entryid Attachment entry id
  */
 public function __construct($file, $entryid)
 {
     global $CFG;
     $this->file = $file;
     $this->filename = $file->get_filename();
     $this->url = file_encode_url($CFG->wwwroot . '/pluginfile.php', '/' . SYSCONTEXTID . '/blog/attachment/' . $entryid . '/' . $this->filename);
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:13,代码来源:locallib.php


示例17: display_browse_field

 function display_browse_field($recordid, $template)
 {
     global $CFG, $DB;
     if (!($content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid)))) {
         return false;
     }
     if (empty($content->content)) {
         return '';
     }
     $alt = $content->content1;
     $title = $alt;
     if ($template == 'listtemplate') {
         $src = file_encode_url($CFG->wwwroot . '/pluginfile.php', '/' . $this->context->id . '/mod_data/content/' . $content->id . '/' . 'thumb_' . $content->content);
         // no need to add width/height, because the thumb is resized properly
         $str = '<a href="view.php?d=' . $this->field->dataid . '&amp;rid=' . $recordid . '"><img src="' . $src . '" alt="' . s($alt) . '" title="' . s($title) . '" class="list_picture"/></a>';
     } else {
         $src = file_encode_url($CFG->wwwroot . '/pluginfile.php', '/' . $this->context->id . '/mod_data/content/' . $content->id . '/' . $content->content);
         $width = $this->field->param1 ? ' width="' . s($this->field->param1) . '" ' : ' ';
         $height = $this->field->param2 ? ' height="' . s($this->field->param2) . '" ' : ' ';
         $str = '<a href="' . $src . '"><img ' . $width . $height . ' src="' . $src . '" alt="' . s($alt) . '" title="' . s($title) . '" class="list_picture"/></a>';
     }
     return $str;
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:23,代码来源:field.class.php


示例18: get_response_file_url

 /**
  * Get the URL of a file that belongs to a response variable of this
  * question_attempt.
  * @param stored_file $file the file to link to.
  * @return string the URL of that file.
  */
 public function get_response_file_url(stored_file $file)
 {
     return file_encode_url(new moodle_url('/pluginfile.php'), '/' . implode('/', array($file->get_contextid(), $file->get_component(), $file->get_filearea(), $this->usageid, $this->slot, $file->get_itemid())) . $file->get_filepath() . $file->get_filename(), true);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:10,代码来源:questionattempt.php


示例19: get_submissions

 /**
  * Returns submissions for the requested seplment ids
  *
  * @param int[] $seplmentids
  * @param string $status only return submissions with this status
  * @param int $since only return submissions with timemodified >= since
  * @param int $before only return submissions with timemodified <= before
  * @return array of submissions for each requested seplment
  * @since Moodle 2.5
  */
 public static function get_submissions($seplmentids, $status = '', $since = 0, $before = 0)
 {
     global $DB, $CFG;
     require_once "{$CFG->dirroot}/mod/sepl/locallib.php";
     $params = self::validate_parameters(self::get_submissions_parameters(), array('seplmentids' => $seplmentids, 'status' => $status, 'since' => $since, 'before' => $before));
     $warnings = array();
     $seplments = array();
     // Check the user is allowed to get the submissions for the seplments requested.
     $placeholders = array();
     list($inorequalsql, $placeholders) = $DB->get_in_or_equal($params['seplmentids'], SQL_PARAMS_NAMED);
     $sql = "SELECT cm.id, cm.instance FROM {course_modules} cm JOIN {modules} md ON md.id = cm.module " . "WHERE md.name = :modname AND cm.instance " . $inorequalsql;
     $placeholders['modname'] = 'sepl';
     $cms = $DB->get_records_sql($sql, $placeholders);
     $sepls = array();
     foreach ($cms as $cm) {
         try {
             $context = context_module::instance($cm->id);
             self::validate_context($context);
             require_capability('mod/sepl:grade', $context);
             $sepl = new sepl($context, null, null);
             $sepls[] = $sepl;
         } catch (Exception $e) {
             $warnings[] = array('item' => 'seplment', 'itemid' => $cm->instance, 'warningcode' => '1', 'message' => 'No access rights in module context');
         }
     }
     foreach ($sepls as $sepl) {
         $submissions = array();
         $submissionplugins = $sepl->get_submission_plugins();
         $placeholders = array('seplid1' => $sepl->get_instance()->id, 'seplid2' => $sepl->get_instance()->id);
         $submissionmaxattempt = 'SELECT mxs.userid, MAX(mxs.attemptnumber) AS maxattempt
                                  FROM {sepl_submission} mxs
                                  WHERE mxs.seplment = :seplid1 GROUP BY mxs.userid';
         $sql = "SELECT mas.id, mas.seplment,mas.userid," . "mas.timecreated,mas.timemodified,mas.status,mas.groupid,mas.attemptnumber " . "FROM {sepl_submission} mas " . "JOIN ( " . $submissionmaxattempt . " ) smx ON mas.userid = smx.userid " . "WHERE mas.seplment = :seplid2 AND mas.attemptnumber = smx.maxattempt";
         if (!empty($params['status'])) {
             $placeholders['status'] = $params['status'];
             $sql = $sql . " AND mas.status = :status";
         }
         if (!empty($params['before'])) {
             $placeholders['since'] = $params['since'];
             $placeholders['before'] = $params['before'];
             $sql = $sql . " AND mas.timemodified BETWEEN :since AND :before";
         } else {
             $placeholders['since'] = $params['since'];
             $sql = $sql . " AND mas.timemodified >= :since";
         }
         $submissionrecords = $DB->get_records_sql($sql, $placeholders);
         if (!empty($submissionrecords)) {
             $fs = get_file_storage();
             foreach ($submissionrecords as $submissionrecord) {
                 $submission = array('id' => $submissionrecord->id, 'userid' => $submissionrecord->userid, 'timecreated' => $submissionrecord->timecreated, 'timemodified' => $submissionrecord->timemodified, 'status' => $submissionrecord->status, 'attemptnumber' => $submissionrecord->attemptnumber, 'groupid' => $submissionrecord->groupid);
                 foreach ($submissionplugins as $submissionplugin) {
                     $plugin = array('name' => $submissionplugin->get_name(), 'type' => $submissionplugin->get_type());
                     // Subtype is 'seplsubmission', type is currently 'file' or 'onlinetext'.
                     $component = $submissionplugin->get_subtype() . '_' . $submissionplugin->get_type();
                     $fileareas = $submissionplugin->get_file_areas();
                     foreach ($fileareas as $filearea => $name) {
                         $fileareainfo = array('area' => $filearea);
                         $files = $fs->get_area_files($sepl->get_context()->id, $component, $filearea, $submissionrecord->id, "timemodified", false);
                         foreach ($files as $file) {
                             $filepath = $file->get_filepath() . $file->get_filename();
                             $fileurl = file_encode_url($CFG->wwwroot . '/webservice/pluginfile.php', '/' . $sepl->get_context()->id . '/' . $component . '/' . $filearea . '/' . $submissionrecord->id . $filepath);
                             $fileinfo = array('filepath' => $filepath, 'fileurl' => $fileurl);
                             $fileareainfo['files'][] = $fileinfo;
                         }
                         $plugin['fileareas'][] = $fileareainfo;
                     }
                     $editorfields = $submissionplugin->get_editor_fields();
                     foreach ($editorfields as $name => $description) {
                         $editorfieldinfo = array('name' => $name, 'description' => $description, 'text' => $submissionplugin->get_editor_text($name, $submissionrecord->id), 'format' => $submissionplugin->get_editor_format($name, $submissionrecord->id));
                         $plugin['editorfields'][] = $editorfieldinfo;
                     }
                     $submission['plugins'][] = $plugin;
                 }
                 $submissions[] = $submission;
             }
         } else {
             $warnings[] = array('item' => 'module', 'itemid' => $sepl->get_instance()->id, 'warningcode' => '3', 'message' => 'No submissions found');
         }
         $seplments[] = array('seplmentid' => $sepl->get_instance()->id, 'submissions' => $submissions);
     }
     $result = array('seplments' => $seplments, 'warnings' => $warnings);
     return $result;
 }
开发者ID:krzpassrl,项目名称:SRL_Moodle_Baseline,代码行数:93,代码来源:externallib.php


示例20: print_user_files

 /**
  * Produces a list of links to the files uploaded by a user
  *
  * @param $userid int optional id of the user. If 0 then $USER->id is used.
  * @param $return boolean optional defaults to false. If true the list is returned rather than printed
  * @return string optional
  */
 function print_user_files($userid = 0, $return = false)
 {
     global $CFG, $USER, $OUTPUT;
     if (!$userid) {
         if (!isloggedin()) {
             return '';
         }
         $userid = $USER->id;
     }
     $output = '';
     $fs = get_file_storage();
     $browser = get_file_browser();
     $found = false;
     if ($files = $fs->get_area_files($this->context->id, 'assignment_submission', $userid, "timemodified", false)) {
         $button = new portfolio_add_button();
         foreach ($files as $file) {
             $filename = $file->get_filename();
             $found = true;
             $mimetype = $file->get_mimetype();
             $path = file_encode_url($CFG->wwwroot . '/pluginfile.php', '/' . $this->context->id . '/assignment_submission/' . $userid . '/' . $filename);
             $output .= '<a href="' . $path . '" ><img src="' . $OUTPUT->old_icon_url(file_mimetype_icon($mimetype)) . '" class="icon" alt="' . $mimetype . '" />' . s($filename) . '</a>';
 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP file_ensure_valid_upload_path函数代码示例发布时间:2022-05-15
下一篇:
PHP file_download函数代码示例发布时间: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