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

PHP file_mimetype_icon函数代码示例

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

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



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

示例1: files_read_only

 /**
  * Displays any attached files when the question is in read-only mode.
  * @param question_attempt $qa the question attempt to display.
  * @param question_display_options $options controls what should and should
  *      not be displayed. Used to get the context.
  */
 public function files_read_only(question_attempt $qa, question_display_options $options)
 {
     $files = $qa->get_last_qt_files('attachments', $options->context->id);
     $output = array();
     foreach ($files as $file) {
         $mimetype = $file->get_mimetype();
         $output[] = html_writer::tag('p', html_writer::link($qa->get_response_file_url($file), $this->output->pix_icon(file_mimetype_icon($mimetype), $mimetype, 'moodle', array('class' => 'icon')) . ' ' . s($file->get_filename())));
     }
     return implode($output);
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:16,代码来源:renderer.php


示例2: 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


示例3: displaydir

function displaydir($file_info)
{
    global $CFG, $OUTPUT;
    $children = $file_info->get_children();
    $parent_info = $file_info->get_parent();
    $strname = get_string('name');
    $strsize = get_string('size');
    $strmodified = get_string('modified');
    $strfolder = get_string('folder');
    $strfile = get_string('file');
    $strdownload = get_string('download');
    $strdelete = get_string('delete');
    $straction = get_string('action');
    $path = array();
    $params = $file_info->get_params_rawencoded();
    $params = implode('&amp;', $params);
    $path[] = $file_info->get_visible_name();
    $level = $parent_info;
    while ($level) {
        $params = $level->get_params_rawencoded();
        $params = implode('&amp;', $params);
        $path[] = '<a href="index.php?' . $params . '">' . $level->get_visible_name() . '</a>';
        $level = $level->get_parent();
    }
    $path = array_reverse($path);
    $path = implode(' / ', $path);
    echo $path . ' /';
    echo "<div>";
    echo "<hr/>";
    echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"740\" class=\"files\">";
    echo "<tr>";
    echo "<th class=\"header\" scope=\"col\"></th>";
    echo "<th class=\"header name\" scope=\"col\">{$strname}</th>";
    echo "<th class=\"header size\" scope=\"col\">{$strsize}</th>";
    echo "<th class=\"header date\" scope=\"col\">{$strmodified}</th>";
    echo "<th class=\"header commands\" scope=\"col\">{$straction}</th>";
    echo "</tr>\n";
    $parentwritable = $file_info->is_writable();
    if ($parent_info) {
        $params = $parent_info->get_params_rawencoded();
        $params = implode('&amp;', $params);
        echo "<tr class=\"folder\">";
        print_cell();
        print_cell('left', '<a href="index.php?' . $params . '"><img src="' . $OUTPUT->old_icon_url('f/parent') . '" class="icon" alt="" />&nbsp;' . get_string('parentfolder') . '</a>', 'name');
        print_cell();
        print_cell();
        print_cell();
        echo "</tr>";
    }
    if ($children) {
        foreach ($children as $child_info) {
            $filename = $child_info->get_visible_name();
            $filesize = $child_info->get_filesize();
            $filesize = $filesize ? display_size($filesize) : '';
            $filedate = $child_info->get_timemodified();
            $filedate = $filedate ? userdate($filedate) : '';
            $mimetype = $child_info->get_mimetype();
            $params = $child_info->get_params_rawencoded();
            $params = implode('&amp;', $params);
            if ($child_info->is_directory()) {
                echo "<tr class=\"folder\">";
                print_cell();
                print_cell("left", "<a href=\"index.php?{$params}\"><img src=\"" . $OUTPUT->old_icon_url('f/folder') . "\" class=\"icon\" alt=\"{$strfolder}\" />&nbsp;" . s($filename) . "</a>", 'name');
                print_cell("right", $filesize, 'size');
                print_cell("right", $filedate, 'date');
                if ($parentwritable) {
                    print_cell("right", "<a href=\"index.php?{$params}&amp;sesskey=" . sesskey() . "&amp;delete=1\"><img src=\"" . $OUTPUT->old_icon_url('t/delete') . "\" class=\"iconsmall\" alt=\"{$strdelete}\" /></a>", 'command');
                } else {
                    print_cell();
                }
                echo "</tr>";
            } else {
                if ($downloadurl = $child_info->get_url(true)) {
                    $downloadurl = "&nbsp;<a href=\"{$downloadurl}\" title=\"" . get_string('downloadfile') . "\"><img src=\"" . $OUTPUT->old_icon_url('t/down') . "\" class=\"iconsmall\" alt=\"{$strdownload}\" /></a>";
                } else {
                    $downloadurl = '';
                }
                if ($viewurl = $child_info->get_url()) {
                    $link = html_link::make($viewurl, "display", "<img src=\"" . $OUTPUT->old_icon_url('t/preview') . "\" class=\"iconsmall\" alt=\"{$strfile}\" />&nbsp;");
                    $link->add_action(new popup_action('click', $link->url, 'display', array('height' => 480, 'width' => 640)));
                    $viewurl = "&nbsp;" . $OUTPUT->link($link);
                } else {
                    $viewurl = '';
                }
                echo "<tr class=\"file\">";
                print_cell();
                print_cell("left", "<img src=\"" . $OUTPUT->old_icon_url(file_mimetype_icon($mimetype)) . "\" class=\"icon\" alt=\"{$strfile}\" />&nbsp;" . s($filename) . $downloadurl . $viewurl, 'name');
                print_cell("right", $filesize, 'size');
                print_cell("right", $filedate, 'date');
                if ($parentwritable) {
                    print_cell("right", "<a href=\"index.php?{$params}&amp;sesskey=" . sesskey() . "&amp;delete=1\"><img src=\"" . $OUTPUT->old_icon_url('t/delete') . "\" class=\"iconsmall\" alt=\"{$strdelete}\" /></a>", 'command');
                } else {
                    print_cell();
                }
                echo "</tr>";
            }
        }
    }
    echo "</table>";
    echo "</div>";
//.........这里部分代码省略.........
开发者ID:ajv,项目名称:Offline-Caching,代码行数:101,代码来源:index.php


示例4: forum_print_attachments

/**
 * Returns attachments as formated text/html optionally with separate images
 *
 * @global object
 * @global object
 * @global object
 * @param object $post
 * @param object $cm
 * @param string $type html/text/separateimages
 * @return mixed string or array of (html text withouth images and image HTML)
 */
function forum_print_attachments($post, $cm, $type) {
    global $CFG, $DB, $USER, $OUTPUT;

    if (empty($post->attachment)) {
        return $type !== 'separateimages' ? '' : array('', '');
    }

    if (!in_array($type, array('separateimages', 'html', 'text'))) {
        return $type !== 'separateimages' ? '' : array('', '');
    }

    if (!$context = get_context_instance(CONTEXT_MODULE, $cm->id)) {
        return $type !== 'separateimages' ? '' : array('', '');
    }
    $strattachment = get_string('attachment', 'forum');

    $fs = get_file_storage();

    $imagereturn = '';
    $output = '';

    $canexport = (has_capability('mod/forum:exportpost', $context) || ($post->userid == $USER->id && has_capability('mod/forum:exportownpost', $context)));

    require_once($CFG->libdir.'/portfoliolib.php');
    if ($files = $fs->get_area_files($context->id, 'mod_forum', 'attachment', $post->id, "timemodified", false)) {
        $button = new portfolio_add_button();
        foreach ($files as $file) {
            $filename = $file->get_filename();
            $mimetype = $file->get_mimetype();
            $iconimage = '<img src="'.$OUTPUT->pix_url(file_mimetype_icon($mimetype)).'" class="icon" alt="'.$mimetype.'" />';
            $path = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.$context->id.'/mod_forum/attachment/'.$post->id.'/'.$filename);

            if ($type == 'html') {
                $output .= "<a href=\"$path\">$iconimage</a> ";
                $output .= "<a href=\"$path\">".s($filename)."</a>";
                if ($canexport) {
                    $button->set_callback_options('forum_portfolio_caller', array('postid' => $post->id, 'attachment' => $file->get_id()), '/mod/forum/locallib.php');
                    $button->set_format_by_file($file);
                    $output .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                }
                $output .= "<br />";

            } else if ($type == 'text') {
                $output .= "$strattachment ".s($filename).":\n$path\n";

            } else { //'returnimages'
                if (in_array($mimetype, array('image/gif', 'image/jpeg', 'image/png'))) {
                    // Image attachments don't get printed as links
                    $imagereturn .= "<br /><img src=\"$path\" alt=\"\" />";
                    if ($canexport) {
                        $button->set_callback_options('forum_portfolio_caller', array('postid' => $post->id, 'attachment' => $file->get_id()), '/mod/forum/locallib.php');
                        $button->set_format_by_file($file);
                        $imagereturn .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                    }
                } else {
                    $output .= "<a href=\"$path\">$iconimage</a> ";
                    $output .= format_text("<a href=\"$path\">".s($filename)."</a>", FORMAT_HTML, array('context'=>$context));
                    if ($canexport) {
                        $button->set_callback_options('forum_portfolio_caller', array('postid' => $post->id, 'attachment' => $file->get_id()), '/mod/forum/locallib.php');
                        $button->set_format_by_file($file);
                        $output .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                    }
                    $output .= '<br />';
                }
            }
        }
    }

    if ($type !== 'separateimages') {
        return $output;

    } else {
        return array($output, $imagereturn);
    }
}
开发者ID:nfreear,项目名称:moodle,代码行数:86,代码来源:lib.php


示例5: 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>';
             if ($this->portfolio_exportable() && has_capability('mod/assignment:exportownsubmission', $this->context)) {
                 $button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id, 'fileid' => $file->get_id()));
                 $button->set_formats(portfolio_format_from_file($file));
                 $output .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
             }
             $output .= '<br />';
         }
         if (count($files) > 1 && $this->portfolio_exportable() && has_capability('mod/assignment:exportownsubmission', $this->context)) {
             $button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id));
             $button->set_formats(PORTFOLIO_PORMAT_FILE);
             $output .= '<br />' . $button->to_html();
         }
     }
     $output = '<div class="files">' . $output . '</div>';
     if ($return) {
         return $output;
     }
     echo $output;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:47,代码来源:lib.php


示例6: helper_submission_attachments

 /**
  * Renders a list of files attached to the submission
  *
  * If format==html, then format a html string. If format==text, then format a text-only string.
  * Otherwise, returns html for non-images and html to display the image inline.
  *
  * @param int $submissionid submission identifier
  * @param string format the format of the returned string - html|text
  * @return string formatted text to be echoed
  */
 protected function helper_submission_attachments($submissionid, $format = 'html')
 {
     global $CFG;
     require_once $CFG->libdir . '/filelib.php';
     $fs = get_file_storage();
     $ctx = $this->page->context;
     $files = $fs->get_area_files($ctx->id, 'mod_workshop', 'submission_attachment', $submissionid);
     $outputimgs = '';
     // images to be displayed inline
     $outputfiles = '';
     // list of attachment files
     foreach ($files as $file) {
         if ($file->is_directory()) {
             continue;
         }
         $filepath = $file->get_filepath();
         $filename = $file->get_filename();
         $fileurl = file_encode_url($CFG->wwwroot . '/pluginfile.php', '/' . $ctx->id . '/mod_workshop/submission_attachment/' . $submissionid . $filepath . $filename, true);
         $type = $file->get_mimetype();
         $type = mimeinfo_from_type('type', $type);
         $image = html_writer::empty_tag('img', array('src' => $this->output->pix_url(file_mimetype_icon($type)), 'alt' => $type, 'class' => 'icon'));
         $linkhtml = html_writer::link($fileurl, $image) . substr($filepath, 1) . html_writer::link($fileurl, $filename);
         $linktxt = "{$filename} [{$fileurl}]";
         if ($format == 'html') {
             if (in_array($type, array('image/gif', 'image/jpeg', 'image/png'))) {
                 $preview = html_writer::empty_tag('img', array('src' => $fileurl, 'alt' => '', 'class' => 'preview'));
                 $preview = html_writer::tag('a', $preview, array('href' => $fileurl));
                 $outputimgs .= $this->output->container($preview);
             } else {
                 $outputfiles .= html_writer::tag('li', $linkhtml, array('class' => $type));
             }
         } else {
             if ($format == 'text') {
                 $outputfiles .= $linktxt . PHP_EOL;
             }
         }
     }
     if ($format == 'html') {
         if ($outputimgs) {
             $outputimgs = $this->output->container($outputimgs, 'images');
         }
         if ($outputfiles) {
             $outputfiles = html_writer::tag('ul', $outputfiles, array('class' => 'files'));
         }
         return $this->output->container($outputimgs . $outputfiles, 'attachments');
     } else {
         return $outputfiles;
     }
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:59,代码来源:renderer.php


示例7: extend_settings_navigation

    function extend_settings_navigation($node) {
        global $CFG, $USER, $OUTPUT;

        // get users submission if there is one
        $submission = $this->get_submission();
        if (is_enrolled($this->context, $USER, 'mod/assignment:submit')) {
            $editable = $this->isopen() && (!$submission || $this->assignment->resubmit || !$submission->timemarked);
        } else {
            $editable = false;
        }

        // If the user has submitted something add some related links and data
        if (isset($submission->data2) AND $submission->data2 == 'submitted') {
            // Add a view link to the settings nav
            $link = new moodle_url('/mod/assignment/view.php', array('id'=>$this->cm->id));
            $node->add(get_string('viewmysubmission', 'assignment'), $link, navigation_node::TYPE_SETTING);
            if (!empty($submission->timemodified)) {
                $submittednode = $node->add(get_string('submitted', 'assignment') . ' ' . userdate($submission->timemodified));
                $submittednode->text = preg_replace('#([^,])\s#', '$1&nbsp;', $submittednode->text);
                $submittednode->add_class('note');
                if ($submission->timemodified <= $this->assignment->timedue || empty($this->assignment->timedue)) {
                    $submittednode->add_class('early');
                } else {
                    $submittednode->add_class('late');
                }
            }
        }

        // Check if the user has uploaded any files, if so we can add some more stuff to the settings nav
        if ($submission && is_enrolled($this->context, $USER, 'mod/assignment:submit') && $this->count_user_files($submission->id)) {
            $fs = get_file_storage();
            if ($files = $fs->get_area_files($this->context->id, 'mod_assignment', 'submission', $submission->id, "timemodified", false)) {
                if (!$this->drafts_tracked() or !$this->isopen() or $this->is_finalized($submission)) {
                    $filenode = $node->add(get_string('submission', 'assignment'));
                } else {
                    $filenode = $node->add(get_string('submissiondraft', 'assignment'));
                }
                foreach ($files as $file) {
                    $filename = $file->get_filename();
                    $mimetype = $file->get_mimetype();
                    $link = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.$this->context->id.'/mod_assignment/submission/'.$submission->id.'/'.$filename);
                    $filenode->add($filename, $link, navigation_node::TYPE_SETTING, null, null, new pix_icon(file_mimetype_icon($mimetype),''));
                }
            }
        }

        // Show a notes link if they are enabled
        if ($this->notes_allowed()) {
            $link = new moodle_url('/mod/assignment/upload.php', array('id'=>$this->cm->id, 'action'=>'editnotes', 'sesskey'=>sesskey()));
            $node->add(get_string('notes', 'assignment'), $link);
        }
    }
开发者ID:numbas,项目名称:moodle,代码行数:52,代码来源:assignment.class.php


示例8: pcast_display_mediafile_link

/**
 * Print the podcast attachment and the media player if appropriate
 *
 * @global stdClass $CFG
 * @global stdClass $DB
 * @global stdClass $OUTPUT
 * @param object $episode
 * @param object $cm
 * @return string image string or nothing depending on $type param
 */
function pcast_display_mediafile_link($episode, $cm, $audioonly = false)
{
    global $CFG, $DB, $OUTPUT;
    if (!($context = get_context_instance(CONTEXT_MODULE, $cm->id))) {
        return '';
    }
    $fs = get_file_storage();
    $imagereturn = '';
    if ($files = $fs->get_area_files($context->id, 'mod_pcast', 'episode', $episode->id, "timemodified", false)) {
        foreach ($files as $file) {
            $filename = $file->get_filename();
            $mimetype = $file->get_mimetype();
            $iconimage = html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url(file_mimetype_icon($mimetype)), 'class' => 'icon', 'alt' => $mimetype));
            $path = file_encode_url($CFG->wwwroot . '/pluginfile.php', '/' . $context->id . '/mod_pcast/episode/' . $episode->id . '/' . $filename);
        }
    }
    $templink = get_string('nopcastmediafile', 'pcast');
    // Make sure there is actually an attachment before trying to render the file link and player
    if (!empty($filename)) {
        $out = html_writer::start_tag('div');
        $out .= html_writer::tag('a', $iconimage, array('href' => $path));
        //Icon
        $out .= html_writer::tag('a', s($filename), array('href' => $path));
        //File
        $out .= html_writer::end_tag('div');
        //Add Media player if enabled
        if ($CFG->pcast_usemediafilter) {
            $templink = $out;
        } else {
            //Add nolink tags to prevent autolinking.
            $templink = html_writer::start_tag('div', array('class' => 'nolink'));
            $templink .= $out;
            $templink .= html_writer::end_tag('div');
        }
        $templink = format_text($templink, FORMAT_HTML, array('context' => $context));
    }
    return $templink;
}
开发者ID:rtsfc,项目名称:moodle-mod_pcast,代码行数:48,代码来源:locallib.php


示例9: referentiel_get_manage_archives

function referentiel_get_manage_archives($contextid, $titre, $appli, $userid_filtre = 0, $instanceid = 0, $ok_portfolio = false, $report = false, $export_format = '')
{
    // retourne la liste des liens vers des fichiers stockes dans le filearea
    // propose la suppression
    global $CFG;
    global $OUTPUT;
    // Archives older than REFERENTIEL_ARCHIVE_OBSOLETE days will be deleted.
    $delai_destruction = REFERENTIEL_ARCHIVE_OBSOLETE * 24 * 3600;
    $date_obsolete = time() - $delai_destruction;
    $msg = get_string('archive_deleted', 'referentiel', date("Y-m-d H:i:s.", $date_obsolete));
    $s = '';
    $total_size = 0;
    $nfile = 0;
    // fileareas autorisees
    $filearea = 'archive';
    $strauthor = get_string('auteur', 'referentiel');
    $strfilename = get_string('filename', 'referentiel');
    $strfilesize = get_string('filesize', 'referentiel');
    $strtimecreated = get_string('timecreated', 'referentiel');
    $strtimemodified = get_string('timemodified', 'referentiel');
    $strmimetype = get_string('mimetype', 'referentiel');
    $strmenu = get_string('delete');
    $strportfolio = get_string('publishporttfolio', 'referentiel');
    $strurl = get_string('url');
    // publication via potfolio
    if ($ok_portfolio) {
        require_once $CFG->libdir . '/portfoliolib.php';
    }
    $fs = get_file_storage();
    if ($files = $fs->get_area_files($contextid, 'mod_referentiel', $filearea, 0, "timemodified", false)) {
        $table = new html_table();
        if ($ok_portfolio) {
            $table->head = array($strauthor, $strfilename, $strfilesize, $strtimecreated, $strtimemodified, $strmimetype, $strmenu, $strportfolio);
            $table->align = array("right", "center", "left", "left", "left", "center", "center", "center");
        } else {
            $table->head = array($strauthor, $strfilename, $strfilesize, $strtimecreated, $strtimemodified, $strmimetype, $strmenu);
            $table->align = array("right", "center", "left", "left", "left", "center", "center");
        }
        $ok = false;
        //drapeau d'affichage
        foreach ($files as $file) {
            // print_object($file);
            $filesize = $file->get_filesize();
            $filename = $file->get_filename();
            $mimetype = $file->get_mimetype();
            $filepath = $file->get_filepath();
            $iconimage = '<img src="' . $OUTPUT->pix_url(file_mimetype_icon($mimetype)) . '" class="icon" alt="' . $mimetype . '" />';
            $userid = 0;
            $author = '';
            $parts = explode('/', $filepath);
            if (is_array($parts)) {
                $refrefid = $parts[1];
                if (isset($parts[2])) {
                    $userid = trim($parts[2]);
                    // echo "<br />USER:$userid\n";
                    $author = '#' . $userid . ' ' . referentiel_get_user_info($userid);
                }
            }
            $fullpath = '/' . $contextid . '/mod_referentiel/' . $filearea . '/' . '0' . $filepath . $filename;
            // echo "<br />FULPATH :: $fullpath \n";
            $timecreated = userdate($file->get_timecreated(), "%Y/%m/%d-%H:%M", 99, false);
            $timemodified = userdate($file->get_timemodified(), "%Y/%m/%d-%H:%M", 99, false);
            $link = new moodle_url($CFG->wwwroot . '/pluginfile.php' . $fullpath);
            $url = ' <a href="' . $link . '" target="_blank">' . $iconimage . $filename . '</a><br />' . "\n";
            $delete_link = '<input type="checkbox" name="deletefile[]"  value="' . $fullpath . '" />' . "\n";
            if ($userid && ($userid_filtre == 0 || $userid == $userid_filtre)) {
                // afficher ce fichier
                $ok = true;
                $output_button = '';
                // Publish button
                if ($ok_portfolio) {
                    $params = array('instanceid' => $instanceid, 'attachment' => $file->get_id(), 'report' => $report, 'export_format' => $export_format);
                    // DEBUG
                    /*
                    echo "<br />DEBUG :: lib_archive.php :: 585 :: PARAM PORTFOLIO<br />\n";
                    print_object($params);
                    echo "<br />\n";
                    // exit;
                    */
                    $button = new portfolio_add_button();
                    // Version anterieure à Moodle 2.4
                    //                    $button->set_callback_options('referentiel_portfolio_caller',
                    //                        $params, '/mod/referentiel/portfolio/mahara/locallib_portfolio.php');
                    // Version Moodle 2.4
                    $button->set_callback_options('referentiel_portfolio_caller', $params, 'mod_referentiel');
                    $button->set_format_by_file($file);
                    // $button->set_formats(array(PORTFOLIO_FORMAT_FILE));
                    // $output_button = "<a href=\"$path\">$iconimage</a> ";
                    $output_button .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                    $table->data[] = array($author, $url, display_size($filesize), $timecreated, $timemodified, $mimetype, $delete_link, $output_button);
                } else {
                    $table->data[] = array($author, $url, display_size($filesize), $timecreated, $timemodified, $mimetype, $delete_link);
                }
                $total_size += $filesize;
                $nfile++;
            }
        }
        if ($ok) {
            if ($ok_portfolio) {
                $table->data[] = array('', get_string('nbfile', 'referentiel', $nfile), get_string('totalsize', 'referentiel', display_size($total_size)), '', '', '', '');
//.........这里部分代码省略.........
开发者ID:jfruitet,项目名称:moodle_referentiel,代码行数:101,代码来源:lib_archive.php


示例10: icon

 public function icon()
 {
     global $OUTPUT;
     return $OUTPUT->pix_icon(file_mimetype_icon($this->row->mimetype), '');
 }
开发者ID:papillon326,项目名称:moodle-block_search,代码行数:5,代码来源:FileInFolderResult.php


示例11: full

 /**
  * Return full message
  * @return object Message
  */
 public function full()
 {
     global $DB, $USER, $OUTPUT, $CFG;
     require_once $CFG->libdir . '/filelib.php';
     $user = $DB->get_record('user', array('id' => $this->sender, 'deleted' => 0));
     $message = new stdClass();
     $message->id = $this->id;
     $message->from = fullname($user);
     $message->sender = $this->sender;
     $message->subject = format_string($this->subject);
     if ($this->timesent) {
         $message->date = userdate($this->timesent);
     } else {
         $message->date = userdate($this->timecreated);
     }
     $message->body = $this->body;
     $message->approved = $this->approved;
     $message->deleted = $this->deleted;
     $message->destinataries = array();
     $message->attachments = array();
     $message->labels = array();
     if (isset($SESSION->jmailcache->courses[$this->courseid])) {
         $course = $SESSION->jmailcache->courses[$this->courseid];
     } else {
         $course = $DB->get_record('course', array('id' => $this->courseid), 'id, fullname, shortname', MUST_EXIST);
         $SESSION->jmailcache->courses[$this->courseid] = $course;
     }
     $message->courseid = $course->id;
     $message->courseshortname = $course->shortname;
     // Destinataries
     if ($destinataries = $DB->get_records('block_jmail_sent', array('messageid' => $this->id))) {
         foreach ($destinataries as $dest) {
             if ($dest->type == 'bcc' and $this->sender != $USER->id) {
                 continue;
             }
             if ($user = $DB->get_record('user', array('id' => $dest->userid, 'deleted' => 0))) {
                 $dest->fullname = fullname($user);
                 $message->destinataries[$dest->type][] = $dest;
             }
         }
     }
     // Attachments
     $context = block_jmail_get_context(CONTEXT_COURSE, $this->courseid);
     // We need the block instance for getting the attachments
     if ($instance = $DB->get_record('block_instances', array('blockname' => 'jmail', 'parentcontextid' => $context->id))) {
         $context = block_jmail_get_context(CONTEXT_BLOCK, $instance->id);
         $fs = get_file_storage();
         if ($files = $fs->get_area_files($context->id, 'block_jmail', 'attachment', $this->id, "timemodified", false)) {
             foreach ($files as $file) {
                 $mimetype = $file->get_mimetype();
                 $attachment = new stdClass();
                 $attachment->filename = $file->get_filename();
                 $attachment->iconimage = '<img src="' . $OUTPUT->pix_url(file_mimetype_icon($mimetype)) . '" class="icon" alt="' . $mimetype . '" />';
                 $attachment->path = file_encode_url($CFG->wwwroot . '/pluginfile.php', '/' . $context->id . '/block_jmail/attachment/' . $this->id . '/' . $attachment->filename);
                 $message->attachments[] = $attachment;
             }
         }
         $message->body = file_rewrite_pluginfile_urls($message->body, 'pluginfile.php', $context->id, 'block_jmail', 'body', $this->id);
         $message->body = format_text($message->body);
     }
     // Labels
     $sql = "SELECT l.id, l.name\n                FROM\n                    {block_jmail_label} l\n                    JOIN {block_jmail_m_label} m\n                    ON l.id = m.labelid\n                WHERE\n                    m.messagesentid = ?\n                ";
     if ($labels = $DB->get_records_sql($sql, array($this->sentid))) {
         foreach ($labels as $label) {
             $message->labels[] = $label;
         }
     }
     if ($this->timesent and $this->sender == $USER->id) {
         $message->labels[] = 'sent';
     }
     if (!$this->timesent and $this->sender == $USER->id) {
         $message->labels[] = 'draft';
     }
     if ($message->deleted) {
         $message->labels[] = 'trash';
     }
     if (!$message->approved) {
         $message->labels[] = 'toapprove';
     }
     if (empty($message->labels)) {
         $message->labels[] = 'inbox';
     }
     return $message;
 }
开发者ID:borrown,项目名称:moodle-block_jmail,代码行数:88,代码来源:block_jmail_message.class.php


示例12: format_string

// Print blog posts.
?>
<div id="middle-column">
    <div class="oublog-post">
        <h3><?php 
print format_string($edit->oldtitle);
?>
</h3>
        <?php 
$fs = get_file_storage();
if ($files = $fs->get_area_files($context->id, 'mod_oublog', 'edit', $edit->id, "timemodified", false)) {
    echo '<div class="oublog-post-attachments">';
    foreach ($files as $file) {
        $filename = $file->get_filename();
        $mimetype = $file->get_mimetype();
        $iconimage = '<img src="' . $OUTPUT->pix_url(file_mimetype_icon($mimetype)) . '" class="icon" alt="' . $mimetype . '" />';
        $path = file_encode_url($CFG->wwwroot . '/pluginfile.php', '/' . $context->id . '/mod_oublog/edit/' . $edit->id . '/' . $filename);
        echo "<a href=\"{$path}\">{$iconimage}</a> ";
        echo "<a href=\"{$path}\">" . s($filename) . "</a><br />";
    }
    echo '</div>';
}
?>
        <div class="oublog-post-date">
            <?php 
print oublog_date($edit->timeupdated);
?>
        </div>
        <p>
<?php 
$text = file_rewrite_pluginfile_urls($edit->oldmessage, 'pluginfile.php', $context->id, 'mod_oublog', 'message', $edit->postid);
开发者ID:eugeneventer,项目名称:moodle-mod_oublog,代码行数:31,代码来源:viewedit.php


示例13: file_file_icon

/**
 * Return the relative icon path for a given file
 *
 * Usage:
 * <code>
 * // $file - instance of stored_file or file_info
 * $icon = $OUTPUT->pix_url(file_file_icon($file))->out();
 * echo html_writer::empty_tag('img', array('src' => $icon, 'alt' => get_mimetype_description($file)));
 * </code>
 * or
 * <code>
 * echo $OUTPUT->pix_icon(file_file_icon($file), get_mimetype_description($file));
 * </code>
 *
 * @param stored_file|file_info|stdClass|array $file (in case of object attributes $file->filename
 *     and $file->mimetype are expected)
 * @param int $size The size of the icon. Defaults to 16 can also be 24, 32, 64, 128, 256
 * @return string
 */
function file_file_icon($file, $size = null)
{
    if (!is_object($file)) {
        $file = (object) $file;
    }
    if (isset($file->filename)) {
        $filename = $file->filename;
    } else {
        if (method_exists($file, 'get_filename')) {
            $filename = $file->get_filename();
        } else {
            if (method_exists($file, 'get_visible_name')) {
                $filename = $file->get_visible_name();
            } else {
                $filename = '';
            }
        }
    }
    if (isset($file->mimetype)) {
        $mimetype = $file->mimetype;
    } else {
        if (method_exists($file, 'get_mimetype')) {
            $mimetype = $file->get_mimetype();
        } else {
            $mimetype = '';
        }
    }
    if ($filename && pathinfo($filename, PATHINFO_EXTENSION) && (!$mimetype || mimeinfo('type', $filename) === $mimetype)) {
        // files with different extensions sharing the same mimetype (i.e. 'text/plain') may have different icons
        return file_extension_icon($filename, $size);
    } else {
        // if mimetype and extension do not match we assume that mimetype is more correct
        return file_mimetype_icon($mimetype, $size);
    }
}
开发者ID:nmicha,项目名称:moodle,代码行数:54,代码来源:filelib.php


示例14: equella_guess_icon

/**
 * Optimised mimetype detection from general URL.
 * Copied from /mod/url/locallib.php
 *
 * @param $equella stdclass
 * @param $size int
 * @return string
 */
function equella_guess_icon($equella, $size = 24)
{
    global $CFG;
    $icon = null;
    if (!empty($equella->filename)) {
        if ('document/unknown' != mimeinfo('type', $equella->filename)) {
            $icon = 'f/' . mimeinfo('icon' . $size, $equella->filename);
        }
    }
    if (empty($icon)) {
        $mimetype = $equella->mimetype;
        $icon = file_mimetype_icon($mimetype, $size);
    }
    return $icon;
    //if (substr_count($fullurl, '/') < 3 or substr($fullurl, -1) === '/') {
    //// Most probably default directory - index.php, index.html, etc. Return null because
    //// we want to use the default module icon instead of the HTML file icon.
    //return null;
    //}
    //$icon = file_extension_icon($fullurl, $size);
    //$htmlicon = file_extension_icon('.htm', $size);
    //$unknownicon = file_extension_icon('', $size);
    //// We do not want to return those icon types, the module icon is more appropriate.
    //if ($icon === $unknownicon || $icon === $htmlicon) {
    //return null;
    //}
    //return $icon;
}
开发者ID:CTANZ,项目名称:moodle-mod_equella,代码行数:36,代码来源:lib.php


示例15: ouwiki_print_attachment_diff

 /**
  * Format the compared file for rendering as part of the diff
  *
  * @param file object
  * @param action string
  * @return output
  */
 public function ouwiki_print_attachment_diff($file, $action = 'none')
 {
     global $OUTPUT, $CFG;
     $filename = $file->get_filename();
     $mimetype = $file->get_mimetype();
     $iconimage = html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url(file_mimetype_icon($mimetype)), 'alt' => $mimetype, 'class' => 'icon'));
     if ($action === 'add') {
         $addedstart = html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('diff_added_begins', 'ouwiki'), 'alt' => get_string('addedbegins', 'ouwiki'), 'class' => 'icon'));
         $addedend = html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('diff_added_ends', 'ouwiki'), 'alt' => get_string('addedends', 'ouwiki'), 'class' => 'icon'));
         $output = html_writer::start_tag('li');
         $output .= $addedstart;
         $output .= html_writer::tag('span', " {$iconimage} {$filename} ", array('class' => 'ouw_added'));
         $output .= $addedend;
         $output .= html_writer::end_tag('li');
     } else {
         if ($action === 'delete') {
             $deletedstart = html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('diff_deleted_begins', 'ouwiki'), 'alt' => get_string('deletedbegins', 'ouwiki'), 'class' => 'icon'));
             $deletedend = html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('diff_deleted_ends', 'ouwiki'), 'alt' => get_string('deletedends', 'ouwiki'), 'class' => 'icon'));
             $output = html_writer::start_tag('li');
             $output .= $deletedstart;
             $output .= html_writer::tag('span', " {$iconimage} {$filename} ", array('class' => 'ouw_deleted'));
             $output .= $deletedend;
             $output .= html_writer::end_tag('li');
         } else {
             // default case; no change in file
             $output = html_writer::tag('li', "{$iconimage} {$filename}");
         }
     }
     return $output;
 }
开发者ID:ndunand,项目名称:moodle-mod_ouwiki,代码行数:37,代码来源:renderer.php


示例16: 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, $PAGE;
     $mode = optional_param('mode', '', PARAM_ALPHA);
     $offset = optional_param('offset', 0, PARAM_INT);
     if (!$userid) {
         if (!isloggedin()) {
             return '';
         }
         $userid = $USER->id;
     }
     $output = $OUTPUT->box_start('files');
     $submission = $this->get_submission($userid);
     $candelete = $this->can_delete_files($submission);
     $strdelete = get_string('delete');
     if (!$this->is_finalized($submission) and !empty($mode)) {
         // only during grading
         $output .= '<strong>' . get_string('draft', 'assignment') . ':</strong><br />';
     }
     if ($this->notes_allowed() and !empty($submission->data1) and !empty($mode)) {
         // only during grading
         $npurl = new moodle_url('/mod/assignment/type/uploadpdf/notes.php', array('id' => $this->cm->id, 'userid' => $userid, 'offset' => $offset, 'mode 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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