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

PHP file_extension_icon函数代码示例

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

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



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

示例1: get_listing

 public function get_listing($path = '', $page = '')
 {
     global $CFG, $OUTPUT;
     $list = array();
     $list['list'] = array();
     // the management interface url
     $list['manage'] = false;
     // dynamically loading
     $list['dynload'] = true;
     // the current path of this list.
     // set to true, the login link will be removed
     $list['nologin'] = true;
     // set to true, the search button will be removed
     $list['nosearch'] = true;
     $tree = array();
     if (empty($path)) {
         $buckets = $this->s->listBuckets();
         foreach ($buckets as $bucket) {
             $folder = array('title' => $bucket, 'children' => array(), 'thumbnail' => $OUTPUT->old_icon_url('f/folder-32'), 'path' => $bucket);
             $tree[] = $folder;
         }
     } else {
         $contents = $this->s->getBucket($path);
         foreach ($contents as $file) {
             $info = $this->s->getObjectInfo($path, baseName($file['name']));
             $tree[] = array('title' => $file['name'], 'size' => $file['size'], 'date' => userdate($file['time']), 'source' => $path . '/' . $file['name'], 'thumbnail' => $OUTPUT->old_icon_url(file_extension_icon($file['name'], 32)));
         }
     }
     $list['list'] = $tree;
     return $list;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:repository.class.php


示例2: definition

 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     //--------------------------------------------------------------------------------
     $urls = $this->_customdata['urls'];
     $fromareaname = $this->_customdata['fromareaname'];
     $toareaname = $this->_customdata['toareaname'];
     $fileoptions = array(QUESTION_FILEDONOTHING => get_string('donothing', 'question'), QUESTION_FILECOPY => get_string('copy', 'question', $fromareaname), QUESTION_FILEMOVE => get_string('move', 'question', $fromareaname), QUESTION_FILEMOVELINKSONLY => get_string('movelinksonly', 'question', $fromareaname));
     $brokenfileoptions = array(QUESTION_FILEDONOTHING => get_string('donothing', 'question'), QUESTION_FILEMOVELINKSONLY => get_string('movelinksonly', 'question', $fromareaname));
     $brokenurls = $this->_customdata['brokenurls'];
     if (count($urls)) {
         $mform->addElement('header', 'general', get_string('filestomove', 'question', $toareaname));
         $i = 0;
         foreach (array_keys($urls) as $url) {
             $icontype = mimeinfo('type', $url);
             $img = "<img src=\"" . $OUTPUT->old_icon_url(file_extension_icon($url)) . "\"  class=\"icon\" alt=\"{$icontype}\" />";
             if (in_array($url, $brokenurls)) {
                 $mform->addElement('select', "urls[{$i}]", $img . $url, $brokenfileoptions);
             } else {
                 $mform->addElement('select', "urls[{$i}]", $img . $url, $fileoptions);
             }
             $i++;
         }
     }
     if (count($brokenurls)) {
         $mform->addElement('advcheckbox', 'ignorebroken', get_string('ignorebroken', 'question'));
     }
     //--------------------------------------------------------------------------------
     $this->add_action_buttons(true, get_string('moveq', 'question'));
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:contextmoveq_form.php


示例3: get_content

 function get_content()
 {
     global $CFG, $DB, $OUTPUT;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     $course = $this->page->course;
     require_once $CFG->dirroot . '/course/lib.php';
     $modinfo = get_fast_modinfo($course);
     $modfullnames = array();
     $archetypes = array();
     foreach ($modinfo->cms as $cm) {
         // Exclude activities which are not visible or have no link (=label)
         if (!$cm->uservisible or !$cm->has_view()) {
             continue;
         }
         if (array_key_exists($cm->modname, $modfullnames)) {
             continue;
         }
         if (!array_key_exists($cm->modname, $archetypes)) {
             $archetypes[$cm->modname] = plugin_supports('mod', $cm->modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
         }
         if ($archetypes[$cm->modname] == MOD_ARCHETYPE_RESOURCE) {
             if (!array_key_exists('resources', $modfullnames)) {
                 $modfullnames['resources'] = get_string('resources');
             }
         } else {
             $modfullnames[$cm->modname] = $cm->modplural;
         }
     }
     collatorlib::asort($modfullnames);
     foreach ($modfullnames as $modname => $modfullname) {
         if ($modname === 'resources') {
             $icon = $OUTPUT->pix_icon(file_extension_icon('.htm'), '', 'moodle', array('class' => 'icon')) . '&nbsp;';
             $this->content->items[] = '<a href="' . $CFG->wwwroot . '/course/resources.php?id=' . $course->id . '">' . $icon . $modfullname . '</a>';
         } else {
             $icon = '<img src="' . $OUTPUT->pix_url('icon', $modname) . '" class="icon" alt="" />&nbsp;';
             $this->content->items[] = '<a href="' . $CFG->wwwroot . '/mod/' . $modname . '/index.php?id=' . $course->id . '">' . $icon . $modfullname . '</a>';
         }
     }
     return $this->content;
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:46,代码来源:block_activity_modules.php


示例4: get_listing

 public function get_listing($path = '', $page = '')
 {
     global $CFG, $OUTPUT;
     $list = array();
     $list['list'] = array();
     // process breacrumb trail
     $list['path'] = array(array('name' => 'Root', 'path' => ''));
     $trail = '';
     if (!empty($path)) {
         $parts = explode('/', $path);
         if (count($parts) > 1) {
             foreach ($parts as $part) {
                 if (!empty($part)) {
                     $trail .= '/' . $part;
                     $list['path'][] = array('name' => $part, 'path' => $trail);
                 }
             }
         } else {
             $list['path'][] = array('name' => $path, 'path' => $path);
         }
         $this->root_path .= $path . '/';
     }
     $list['manage'] = false;
     $list['dynload'] = true;
     $list['nologin'] = true;
     $list['nosearch'] = true;
     if ($dh = opendir($this->root_path)) {
         while (($file = readdir($dh)) != false) {
             if ($file != '.' and $file != '..') {
                 if (filetype($this->root_path . $file) == 'file') {
                     $list['list'][] = array('title' => $file, 'source' => $path . '/' . $file, 'size' => filesize($this->root_path . $file), 'date' => time(), 'thumbnail' => $OUTPUT->pix_url(file_extension_icon($this->root_path . $file, 32))->out(false));
                 } else {
                     if (!empty($path)) {
                         $current_path = $path . '/' . $file;
                     } else {
                         $current_path = $file;
                     }
                     $list['list'][] = array('title' => $file, 'children' => array(), 'thumbnail' => $OUTPUT->pix_url('f/folder-32')->out(false), 'path' => $current_path);
                 }
             }
         }
     }
     $list['list'] = array_filter($list['list'], array($this, 'filter'));
     return $list;
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:45,代码来源:lib.php


示例5: get_listing

 function get_listing($path = '', $page = '')
 {
     global $OUTPUT;
     if (!empty($path)) {
         $pathArray = json_decode($path);
     } else {
         $pathArray = array(array('name' => '', 'type' => 'top-communities'));
     }
     $list = array();
     $list['nologin'] = true;
     $list['dynload'] = true;
     $list['nosearch'] = true;
     $list['list'] = array();
     $lastPath = (array) end($pathArray);
     $results = $this->getChildrenByType($lastPath);
     foreach ($results as $result) {
         $itemPath = $pathArray;
         $itemPath[] = array('name' => $result->name, 'id' => $result->id, 'type' => $result->type);
         if ($result->countItems === 0) {
             continue;
         }
         $baseElement = array('title' => $result->name);
         switch ($result->type) {
             case 'community':
             case 'collection':
             case 'item':
                 $typeOptions = array('children' => array(), 'dynload' => true, 'thumbnail' => $OUTPUT->pix_url(file_folder_icon(64))->out(false), 'path' => json_encode($itemPath));
                 break;
             case 'bitstream':
                 $typeOptions = array('thumbnail' => $OUTPUT->pix_url(file_extension_icon($result->name, 64))->out(false), 'url' => $this->rest_url . 'bitstreams/' . $result->id . '/retrieve', 'source' => $this->rest_url . 'bitstreams/' . $result->id . '/retrieve');
                 break;
         }
         $list['list'][] = array_merge($baseElement, $typeOptions);
     }
     $list['path'] = array();
     while (count($pathArray) > 0) {
         $lastItem = (array) end($pathArray);
         array_unshift($list['path'], array('path' => json_encode($pathArray), 'name' => strlen($lastItem['name']) <= 20 ? $lastItem['name'] : substr($lastItem['name'], 0, 17) . '...'));
         array_pop($pathArray);
     }
     return $list;
 }
开发者ID:pmarrone,项目名称:Moodle-Dspace-Plugin,代码行数:42,代码来源:lib.php


示例6: get_listing

 /**
  * Get S3 file list
  *
  * @param string $path this parameter can a folder name, or a identification of folder
  * @param string $page the page number of file list
  * @return array the list of files, including some meta infomation
  */
 public function get_listing($path = '', $page = '')
 {
     global $OUTPUT;
     $s = $this->create_s3();
     $bucket = $this->get_option('bucket_name');
     $list = array();
     $list['list'] = array();
     $list['path'] = array(array('name' => $bucket, 'path' => ''));
     $list['manage'] = false;
     $list['dynload'] = true;
     $list['nologin'] = true;
     $list['nosearch'] = true;
     $files = array();
     $folders = array();
     try {
         $contents = $s->getBucket($bucket, $path, null, null, '/', true);
     } catch (S3Exception $e) {
         throw new moodle_exception('errorwhilecommunicatingwith', 'repository', '', $this->get_name(), $e->getMessage());
     }
     foreach ($contents as $object) {
         if (isset($object['prefix'])) {
             $title = rtrim($object['prefix'], '/');
         } else {
             $title = $object['name'];
         }
         if (strlen($path) > 0) {
             $title = substr($title, strlen($path));
             if (empty($title) && !is_numeric($title)) {
                 continue;
             }
         }
         if (isset($object['prefix'])) {
             $folders[] = array('title' => $title, 'children' => array(), 'thumbnail' => $OUTPUT->pix_url(file_folder_icon(90))->out(false), 'path' => $object['prefix']);
         } else {
             $files[] = array('title' => $title, 'size' => $object['size'], 'datemodified' => $object['time'], 'source' => $object['name'], 'thumbnail' => $OUTPUT->pix_url(file_extension_icon($title, 90))->out(false));
         }
     }
     $list['list'] = array_merge($folders, $files);
     return $list;
 }
开发者ID:ewallah,项目名称:repository_s3bucket,代码行数:47,代码来源:lib.php


示例7: get_listing

    /**
     * Get S3 file list
     *
     * @param string $path
     * @return array The file list and options
     */
    public function get_listing($path = '', $page = '') {
        global $CFG, $OUTPUT;
        if (empty($this->access_key)) {
            throw new moodle_exception('needaccesskey', 'repository_s3');
        }

        $list = array();
        $list['list'] = array();
        $list['path'] = array(
            array('name' => get_string('pluginname', 'repository_s3'), 'path' => '')
        );

        // the management interface url
        $list['manage'] = false;
        // dynamically loading
        $list['dynload'] = true;
        // the current path of this list.
        // set to true, the login link will be removed
        $list['nologin'] = true;
        // set to true, the search button will be removed
        $list['nosearch'] = true;

        $tree = array();

        if (empty($path)) {
            try {
                $buckets = $this->s->listBuckets();
            } catch (S3Exception $e) {
                throw new moodle_exception('errorwhilecommunicatingwith', 'repository', '', $this->get_name());
            }
            foreach ($buckets as $bucket) {
                $folder = array(
                    'title' => $bucket,
                    'children' => array(),
                    'thumbnail' => $OUTPUT->pix_url(file_folder_icon(90))->out(false),
                    'path' => $bucket
                    );
                $tree[] = $folder;
            }
        } else {
            $files = array();
            $folders = array();
            list($bucket, $uri) = $this->explode_path($path);

            try {
                $contents = $this->s->getBucket($bucket, $uri, null, null, '/', true);
            } catch (S3Exception $e) {
                throw new moodle_exception('errorwhilecommunicatingwith', 'repository', '', $this->get_name());
            }
            foreach ($contents as $object) {

                // If object has a prefix, it is a 'CommonPrefix', which we consider a folder
                if (isset($object['prefix'])) {
                    $title = rtrim($object['prefix'], '/');
                } else {
                    $title = $object['name'];
                }

                // Removes the prefix (folder path) from the title
                if (strlen($uri) > 0) {
                    $title = substr($title, strlen($uri));
                    // Check if title is empty and not zero
                    if (empty($title) && !is_numeric($title)) {
                        // Amazon returns the prefix itself, we skip it
                        continue;
                    }
                }

                // This is a so-called CommonPrefix, we consider it as a folder
                if (isset($object['prefix'])) {
                    $folders[] = array(
                        'title' => $title,
                        'children' => array(),
                        'thumbnail'=> $OUTPUT->pix_url(file_folder_icon(90))->out(false),
                        'path' => $bucket . '/' . $object['prefix']
                    );
                } else {
                    $files[] = array(
                        'title' => $title,
                        'size' => $object['size'],
                        'datemodified' => $object['time'],
                        'source' => $bucket . '/' . $object['name'],
                        'thumbnail' => $OUTPUT->pix_url(file_extension_icon($title, 90))->out(false)
                    );
                }
            }
            $tree = array_merge($folders, $files);
        }

        $trail = '';
        if (!empty($path)) {
            $parts = explode('/', $path);
            if (count($parts) > 1) {
                foreach ($parts as $part) {
//.........这里部分代码省略.........
开发者ID:educacionbe,项目名称:cursos,代码行数:101,代码来源:lib.php


示例8: print_user_files

    function print_user_files($userid=0, $return=false) {
        global $OUTPUT, $CFG, $USER;

        if (!$userid) {
            if (!isloggedin()) {
                return '';
            }
            $userid = $USER->id;
        }

        if (!$submission = $this->get_submission($userid)) {
            return '';
        }

        $link = new moodle_url("/mod/assignment/type/online/file.php?id={$this->cm->id}&userid={$submission->userid}");
        $action = new popup_action('click', $link, 'file'.$userid, array('height' => 450, 'width' => 580));
        $popup = $OUTPUT->action_link($link, get_string('popupinnewwindow','assignment'), $action, array('title'=>get_string('submission', 'assignment')));

        $output = '<div class="files">'.
                  $OUTPUT->pix_icon(file_extension_icon('.htm'), 'html', 'moodle', array('height' => 16, 'width' => 16)).
                  $popup .
                  '</div>';

        $wordcount = '<p id="wordcount">'. $popup . '&nbsp;';
    /// Decide what to count
        if ($CFG->assignment_itemstocount == ASSIGNMENT_COUNT_WORDS) {
            $wordcount .= '('.get_string('numwords', '', count_words(format_text($submission->data1, $submission->data2))).')';
        } else if ($CFG->assignment_itemstocount == ASSIGNMENT_COUNT_LETTERS) {
            $wordcount .= '('.get_string('numletters', '', count_letters(format_text($submission->data1, $submission->data2))).')';
        }
        $wordcount .= '</p>';

        $text = file_rewrite_pluginfile_urls($submission->data1, 'pluginfile.php', $this->context->id, 'mod_assignment', $this->filearea, $submission->id);
        return $wordcount . format_text($text, $submission->data2, array('overflowdiv'=>true));


        }
开发者ID:JP-Git,项目名称:moodle,代码行数:37,代码来源:assignment.class.php


示例9: get_listing

    /**
     * Get file listing
     *
     * @param string $encodedpath
     * @param string $path not used by this plugin
     * @return mixed
     */
    public function get_listing($encodedpath = '', $page = '') {
        global $OUTPUT;
        $ret = array();
        $ret['dynload'] = true;
        $ret['nosearch'] = true;
        $ret['nologin'] = true;
        $list = array();
        $files = $this->get_recent_files(0, $this->number);

        try {
            foreach ($files as $file) {
                $params = base64_encode(serialize($file));
                // Check that file exists and accessible
                $filesize = $this->get_file_size($params);
                if (!empty($filesize)) {
                    $node = array(
                        'title' => $file['filename'],
                        'size' => $filesize,
                        'date' => '',
                        'source'=> $params,
                        'thumbnail' => $OUTPUT->pix_url(file_extension_icon($file['filename'], 32))->out(false),
                    );
                    $list[] = $node;
                }
            }
        } catch (Exception $e) {
            throw new repository_exception('emptyfilelist', 'repository_recent');
        }
        $ret['list'] = array_filter($list, array($this, 'filter'));
        return $ret;
    }
开发者ID:raymondAntonio,项目名称:moodle,代码行数:38,代码来源:lib.php


示例10: get_listing

    /**
     * Get file listing
     *
     * @param string $encodedpath
     * @return mixed
     */
    public function get_listing($encodedpath = '') {
        global $CFG, $USER, $OUTPUT;
        $ret = array();
        $ret['dynload'] = true;
        $ret['nosearch'] = true;
        $ret['nologin'] = true;
        $list = array();

        if (!empty($encodedpath)) {
            $params = unserialize(base64_decode($encodedpath));
            if (is_array($params)) {
                $component = is_null($params['component']) ? NULL : clean_param($params['component'], PARAM_COMPONENT);
                $filearea  = is_null($params['filearea']) ? NULL : clean_param($params['filearea'], PARAM_AREA);
                $itemid    = is_null($params['itemid']) ? NULL : clean_param($params['itemid'], PARAM_INT);
                $filepath  = is_null($params['filepath']) ? NULL : clean_param($params['filepath'], PARAM_PATH);;
                $filename  = is_null($params['filename']) ? NULL : clean_param($params['filename'], PARAM_FILE);
                $context = get_context_instance_by_id(clean_param($params['contextid'], PARAM_INT));
            }
        } else {
            $itemid   = null;
            $filename = null;
            $filearea = null;
            $filepath = null;
            $component = null;
            if (!empty($this->context)) {
                list($context, $course, $cm) = get_context_info_array($this->context->id);
                $courseid = is_object($course) ? $course->id : SITEID;
                $context = get_context_instance(CONTEXT_COURSE, $courseid);
            } else {
                $context = get_system_context();
            }
        }

        $browser = get_file_browser();

        if ($fileinfo = $browser->get_file_info($context, $component, $filearea, $itemid, $filepath, $filename)) {
            // build path navigation
            $pathnodes = array();
            $encodedpath = base64_encode(serialize($fileinfo->get_params()));
            $pathnodes[] = array('name'=>$fileinfo->get_visible_name(), 'path'=>$encodedpath);
            $level = $fileinfo->get_parent();
            while ($level) {
                $encodedpath = base64_encode(serialize($level->get_params()));
                $pathnodes[] = array('name'=>$level->get_visible_name(), 'path'=>$encodedpath);
                $level = $level->get_parent();
            }
            if (!empty($pathnodes) && is_array($pathnodes)) {
                $pathnodes = array_reverse($pathnodes);
                $ret['path'] = $pathnodes;
            }
            // build file tree
            $children = $fileinfo->get_children();
            foreach ($children as $child) {
                if ($child->is_directory()) {
                    if ($child->is_empty_area()) {
                        continue;
                    }
                    $params = $child->get_params();
                    $encodedpath = base64_encode(serialize($params));
                    // hide user_private area from local plugin, user should
                    // use private file plugin to access private files
                    //if ($params['filearea'] == 'user_private') {
                        //continue;
                    //}
                    $node = array(
                        'title' => $child->get_visible_name(),
                        'size' => 0,
                        'date' => '',
                        'path' => $encodedpath,
                        'children'=>array(),
                        'thumbnail' => $OUTPUT->pix_url('f/folder-32')->out(false)
                    );
                    $list[] = $node;
                } else {
                    $encodedpath = base64_encode(serialize($child->get_params()));
                    $node = array(
                        'title' => $child->get_visible_name(),
                        'size' => 0,
                        'date' => '',
                        'source'=> $encodedpath,
                        'thumbnail' => $OUTPUT->pix_url(file_extension_icon($child->get_visible_name(), 32))->out(false)
                    );
                    $list[] = $node;
                }
            }
        } else {
            // if file doesn't exist, build path nodes root of current context
            $pathnodes = array();
            $fileinfo = $browser->get_file_info($context, null, null, null, null, null);
            $encodedpath = base64_encode(serialize($fileinfo->get_params()));
            $pathnodes[] = array('name'=>$fileinfo->get_visible_name(), 'path'=>$encodedpath);
            $level = $fileinfo->get_parent();
            while ($level) {
                $encodedpath = base64_encode(serialize($level->get_params()));
//.........这里部分代码省略.........
开发者ID:ravivare,项目名称:moodle-1,代码行数:101,代码来源:lib.php


示例11: 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 = '';
        }
    }
    $mimetypes =& get_mimetypes_array();
    if ($filename) {
        $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
        if ($extension && !empty($mimetypes[$extension])) {
            // if file name has known extension, return icon for this extension
            return file_extension_icon($filename, $size);
        }
    }
    return file_mimetype_icon($mimetype, $size);
}
开发者ID:IFPBMoodle,项目名称:moodle,代码行数:56,代码来源:filelib.php


示例12: get_listing

 /**
  * Get a file list from alfresco
  *
  * @param string $uuid a unique id of directory in alfresco
  * @param string $path path to a directory
  * @return array
  */
 public function get_listing($uuid = '', $path = '')
 {
     global $CFG, $SESSION, $OUTPUT;
     $ret = array();
     $ret['dynload'] = true;
     $ret['list'] = array();
     $server_url = $this->options['alfresco_url'];
     $pattern = '#^(.*)api#';
     if ($return = preg_match($pattern, $server_url, $matches)) {
         $ret['manage'] = $matches[1] . 'faces/jsp/dashboards/container.jsp';
     }
     $ret['path'] = array(array('name' => get_string('pluginname', 'repository_alfresco'), 'path' => ''));
     try {
         if (empty($uuid)) {
             $this->current_node = $this->store->companyHome;
         } else {
             $this->current_node = $this->user_session->getNode($this->store, $uuid);
         }
         $folder_filter = "{http://www.alfresco.org/model/content/1.0}folder";
         $file_filter = "{http://www.alfresco.org/model/content/1.0}content";
         // top level sites folder
         $sites_filter = "{http://www.alfresco.org/model/site/1.0}sites";
         // individual site
         $site_filter = "{http://www.alfresco.org/model/site/1.0}site";
         foreach ($this->current_node->children as $child) {
             if ($child->child->type == $folder_filter or $child->child->type == $sites_filter or $child->child->type == $site_filter) {
                 $ret['list'][] = array('title' => $child->child->cm_name, 'path' => $child->child->id, 'thumbnail' => $OUTPUT->pix_url(file_folder_icon(90))->out(false), 'children' => array());
             } elseif ($child->child->type == $file_filter) {
                 $ret['list'][] = array('title' => $child->child->cm_name, 'thumbnail' => $OUTPUT->pix_url(file_extension_icon($child->child->cm_name, 90))->out(false), 'source' => $child->child->id);
             }
         }
     } catch (Exception $e) {
         unset($SESSION->{$this->sessname});
         $ret = $this->print_login();
     }
     return $ret;
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:44,代码来源:lib.php


示例13: url_guess_icon

/**
 * Optimised mimetype detection from general URL
 * @param $fullurl
 * @param int $size of the icon.
 * @return string|null mimetype or null when the filetype is not relevant.
 */
function url_guess_icon($fullurl, $size = null)
{
    global $CFG;
    require_once "{$CFG->libdir}/filelib.php";
    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:lucaboesch,项目名称:moodle,代码行数:24,代码来源:locallib.php


示例14: search_images

 /**
  * Search for images and return photos array.
  *
  * @param string $keyword
  * @param int $page
  * @param array $params additional query params
  * @return array
  */
 public function search_images($keyword, $page = 0, $params = array())
 {
     global $OUTPUT;
     $files_array = array();
     $this->_param['action'] = 'query';
     $this->_param['generator'] = 'search';
     $this->_param['gsrsearch'] = $keyword;
     $this->_param['gsrnamespace'] = WIKIMEDIA_FILE_NS;
     $this->_param['gsrlimit'] = WIKIMEDIA_THUMBS_PER_PAGE;
     $this->_param['gsroffset'] = $page * WIKIMEDIA_THUMBS_PER_PAGE;
     $this->_param['prop'] = 'imageinfo';
     $this->_param['iiprop'] = 'url|dimensions|mime|timestamp|size|user';
     $this->_param += $params;
     $this->_param += array('iiurlwidth' => WIKIMEDIA_IMAGE_SIDE_LENGTH, 'iiurlheight' => WIKIMEDIA_IMAGE_SIDE_LENGTH);
     //didn't work with POST
     $content = $this->_conn->get($this->api, $this->_param);
     $result = unserialize($content);
     if (!empty($result['query']['pages'])) {
         foreach ($result['query']['pages'] as $page) {
             $title = $page['title'];
             $file_type = $page['imageinfo'][0]['mime'];
             $image_types = array('image/jpeg', 'image/png', 'image/gif', 'image/svg+xml');
             if (in_array($file_type, $image_types)) {
                 //is image
                 $extension = pathinfo($title, PATHINFO_EXTENSION);
                 $issvg = strcmp($extension, 'svg') == 0;
                 // Get PNG equivalent to SVG files.
                 if ($issvg) {
                     $title .= '.png';
                 }
                 // The thumbnail (max size requested) is smaller than the original size, we will use the thumbnail.
                 if ($page['imageinfo'][0]['thumbwidth'] < $page['imageinfo'][0]['width']) {
                     $attrs = array('source' => $page['imageinfo'][0]['thumburl'], 'image_width' => $page['imageinfo'][0]['thumbwidth'], 'image_height' => $page['imageinfo'][0]['thumbheight']);
                     if ($attrs['image_width'] <= WIKIMEDIA_THUMB_SIZE && $attrs['image_height'] <= WIKIMEDIA_THUMB_SIZE) {
                         $attrs['realthumbnail'] = $attrs['source'];
                     }
                     if ($attrs['image_width'] <= 24 && $attrs['image_height'] <= 24) {
                         $attrs['realicon'] = $attrs['source'];
                     }
                     // We use the original file.
                 } else {
                     $attrs = array('image_width' => $page['imageinfo'][0]['width'], 'image_height' => $page['imageinfo'][0]['height'], 'size' => $page['imageinfo'][0]['size']);
                     // We cannot use the source when the file is SVG.
                     if ($issvg) {
                         // So we generate a PNG thumbnail of the file at its original size.
                         $attrs['source'] = $this->get_thumb_url($page['imageinfo'][0]['url'], $page['imageinfo'][0]['width'], $page['imageinfo'][0]['height'], $page['imageinfo'][0]['width'], true);
                     } else {
                         $attrs['source'] = $page['imageinfo'][0]['url'];
                     }
                 }
                 $attrs += array('realthumbnail' => $this->get_thumb_url($page['imageinfo'][0]['url'], $page['imageinfo'][0]['width'], $page['imageinfo'][0]['height'], WIKIMEDIA_THUMB_SIZE), 'realicon' => $this->get_thumb_url($page['imageinfo'][0]['url'], $page['imageinfo'][0]['width'], $page['imageinfo'][0]['height'], 24), 'author' => $page['imageinfo'][0]['user'], 'datemodified' => strtotime($page['imageinfo'][0]['timestamp']));
             } else {
                 // other file types
                 $attrs = array('source' => $page['imageinfo'][0]['url']);
             }
             $files_array[] = array('title' => substr($title, 5), 'thumbnail' => $OUTPUT->pix_url(file_extension_icon(substr($title, 5), WIKIMEDIA_THUMB_SIZE))->out(false), 'thumbnail_width' => WIKIMEDIA_THUMB_SIZE, 'thumbnail_height' => WIKIMEDIA_THUMB_SIZE, 'license' => 'cc-sa', 'url' => $page['imageinfo'][0]['descriptionurl']) + $attrs;
         }
     }
     return $files_array;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:68,代码来源:wikimedia.php


示例15: search

 public function search($search_text, $page = 1)
 {
     global $OUTPUT;
     $ret = array();
     $list = array();
     $ret['nologin'] = true;
     if (empty($page)) {
         $page = 1;
     }
     // Pagination not working
     //$searchlist = WebService::standardSearch($this->repositoryClient,'2','2',$search_text,1+($page-1)*repository_hive::$resultsPerPage,repository_hive::$resultsPerPage);
     $searchlist = WebService::standardSearch($this->id, $search_text, -1, -1);
     $searchArray = $searchlist['searchResults']['list'];
     foreach ($searchArray as $value) {
         $list[] = array('shorttitle' => $value['title'], 'title' => $value['filename'], 'thumbnail' => $OUTPUT->pix_url(file_extension_icon($value['filename'], 32))->out(false), 'source' => $value['bureauId'] . '|' . $value['aliasId'] . '|' . urlencode($value['filename']));
     }
     // Pagination
     // NOT WORKING
     //$ret['pages'] = ceil($searchlist['totalNumberOfResults']/repository_hive::$resultsPerPage);
     $ret['list'] = $list;
     return $ret;
 }
开发者ID:harvestroad,项目名称:moodle-repository_hive,代码行数:22,代码来源:lib.php


示例16: search

 /**
  * Search files from box.net
  *
  * @param string $search_text
  * @return mixed
  */
 public function search($search_text, $page = 0) {
     global $OUTPUT;
     $list = array();
     $ret  = array();
     $tree = $this->boxclient->getAccountTree();
     if (!empty($tree)) {
         $filenames = $tree['file_name'];
         $fileids   = $tree['file_id'];
         $filesizes = $tree['file_size'];
         $filedates = $tree['file_date'];
         $fileicon  = $tree['thumbnail'];
         foreach ($filenames as $n=>$v){
             if(strstr(strtolower($v), strtolower($search_text)) !== false) {
                 $list[] = array('title'=>$v,
                         'size'=>$filesizes[$n],
                         'date'=>$filedates[$n],
                         'source'=>'https://www.box.com/api/1.0/download/'
                             .$this->auth_token.'/'.$fileids[$n],
                         'thumbnail' => $OUTPUT->pix_url(file_extension_icon($v, 90))->out(false));
             }
         }
     }
     $ret['list'] = array_filter($list, array($this, 'filter'));
     return $ret;
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:31,代码来源:lib.php


示例17: get_listing

 public function get_listing($path = '', $page = '') {
     global $CFG, $OUTPUT;
     $list = array();
     $list['list'] = array();
     // process breacrumb trail
     $list['path'] = array(
         array('name'=>get_string('root', 'repository_filesystem'), 'path'=>'')
     );
     $trail = '';
     if (!empty($path)) {
         $parts = explode('/', $path);
         if (count($parts) > 1) {
             foreach ($parts as $part) {
                 if (!empty($part)) {
                     $trail .= ('/'.$part);
                     $list['path'][] = array('name'=>$part, 'path'=>$trail);
                 }
             }
         } else {
             $list['path'][] = array('name'=>$path, 'path'=>$path);
         }
         $this->root_path .= ($path.'/');
     }
     $list['manage'] = false;
     $list['dynload'] = true;
     $list['nologin'] = true;
     $list['nosearch'] = true;
     // retrieve list of files and directories and sort them
     $fileslist = array();
     $dirslist = array();
     if ($dh = opendir($this->root_path)) {
         while (($file = readdir($dh)) != false) {
             if ( $file != '.' and $file !='..') {
                 if (is_file($this->root_path.$file)) {
                     $fileslist[] = $file;
                 } else {
                     $dirslist[] = $file;
                 }
             }
         }
     }
     collatorlib::asort($fileslist, collatorlib::SORT_STRING);
     collatorlib::asort($dirslist, collatorlib::SORT_STRING);
     // fill the $list['list']
     foreach ($dirslist as $file) {
         if (!empty($path)) {
             $current_path = $path . '/'. $file;
         } else {
             $current_path = $file;
         }
         $list['list'][] = array(
             'title' => $file,
             'children' => array(),
             'datecreated' => filectime($this->root_path.$file),
             'datemodified' => filemtime($this->root_path.$file),
             'thumbnail' => $OUTPUT->pix_url(file_folder_icon(90))->out(false),
             'path' => $current_path
             );
     }
     foreach ($fileslist as $file) {
         $list['list'][] = array(
             'title' => $file,
             'source' => $path.'/'.$file,
             'size' => filesize($this->root_path.$file),
             'datecreated' => filectime($this->root_path.$file),
             'datemodified' => filemtime($this->root_path.$file),
             'thumbnail' => $OUTPUT->pix_url(file_extension_icon($file, 90))->out(false),
             'icon' => $OUTPUT->pix_url(file_extension_icon($file, 24))->out(false)
         );
     }
     $list['list'] = array_filter($list['list'], array($this, 'filter'));
     return $list;
 }
开发者ID:nigeli,项目名称:moodle,代码行数:73,代码来源:lib.php


示例18: get_listing

 /**
  * Get file listing
  *
  * @param string $path
  * @param string $page
  * @return mixed
  */
 public function get_listing($fullpath = '', $page = '')
 {
     global $OUTPUT;
     $ret = array();
     $ret['list'] = array();
     $ret['manage'] = self::MANAGE_URL;
     $ret['dynload'] = true;
     $crumbs = explode('/', $fullpath);
     $path = array_pop($crumbs);
     if (empty($path)) {
         $type = 'folder';
         $pathid = 0;
         $pathname = get_string('pluginname', 'repository_boxnet');
     } else {
         list($type, $pathid, $pathname) = $this->split_part($path);
     }
     $ret['path'] = $this->build_breadcrumb($fullpath);
     $folders = array();
     $files = array();
     if ($type == 'search') {
         $result = $this->boxnetclient->search($pathname);
     } else {
         $result = $this->boxnetclient->get_folder_items($pathid);
     }
     foreach ($result->entries as $item) {
         if ($item->type == 'folder') {
             $folders[$item->name . ':' . $item->id] = array('title' => $item->name, 'path' => $fullpath . '/' . $this->build_part('folder', $item->id, $item->name), 'date' => strtotime($item->modified_at), 'thumbnail' => $OUTPUT->pix_url(file_folder_icon(64))->out(false), 'thumbnail_height' => 64, 'thumbnail_width' => 64, 'children' => array(), 'size' => $item->size);
         } else {
             $files[$item->name . ':' . $item->id] = array('title' =&g 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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