本文整理汇总了PHP中file_folder_icon函数的典型用法代码示例。如果您正苦于以下问题:PHP file_folder_icon函数的具体用法?PHP file_folder_icon怎么用?PHP file_folder_icon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了file_folder_icon函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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 '';
}
$browser = get_file_browser();
$result = '<ul>';
foreach ($dir['subdirs'] as $subdir) {
$image = $this->output->pix_icon(file_folder_icon(24), $subdir['dirname'], 'moodle');
$filename = html_writer::tag('span', $image, array('class' => 'fp-icon')). html_writer::tag('span', s($subdir['dirname']), array('class' => 'fp-filename'));
$filename = html_writer::tag('div', $filename, array('class' => 'fp-filename-icon'));
$result .= html_writer::tag('li', $filename. $this->htmllize_tree($tree, $subdir));
}
foreach ($dir['files'] as $file) {
$fileinfo = $browser->get_file_info($tree->context, $file->get_component(),
$file->get_filearea(), $file->get_itemid(), $file->get_filepath(), $file->get_filename());
$url = $fileinfo->get_url(true);
$filename = $file->get_filename();
if ($imageinfo = $fileinfo->get_imageinfo()) {
$fileurl = new moodle_url($fileinfo->get_url());
$image = $fileurl->out(false, array('preview' => 'tinyicon', 'oid' => $fileinfo->get_timemodified()));
$image = html_writer::empty_tag('img', array('src' => $image));
} else {
$image = $this->output->pix_icon(file_file_icon($file, 24), $filename, 'moodle');
}
$filename = html_writer::tag('span', $image, array('class' => 'fp-icon')). html_writer::tag('span', $filename, array('class' => 'fp-filename'));
$filename = html_writer::tag('span', html_writer::link($url, $filename), array('class' => 'fp-filename-icon'));
$result .= html_writer::tag('li', $filename);
}
$result .= '</ul>';
return $result;
}
开发者ID:nigeli,项目名称:moodle,代码行数:37,代码来源:renderer.php
示例2: get_file_list
/**
* Returns a list of files the user has formated for files api
*
* @param string $path the path which we are in
* @return mixed Array of files formated for fileapoi
*/
public function get_file_list($path = '')
{
global $OUTPUT;
if (empty($path)) {
$url = self::API . "/me/skydrive/files/";
} else {
$url = self::API . "/{$path}/files/";
}
$ret = json_decode($this->get($url));
if (isset($ret->error)) {
$this->log_out();
return false;
}
$files = array();
foreach ($ret->data as $file) {
switch ($file->type) {
case 'folder':
$files[] = array('title' => $file->name, 'path' => $file->id, 'size' => 0, 'date' => strtotime($file->updated_time), 'thumbnail' => $OUTPUT->pix_url(file_folder_icon(90))->out(false), 'children' => array());
break;
case 'photo':
$files[] = array('title' => $file->name, 'size' => $file->size, 'date' => strtotime($file->updated_time), 'thumbnail' => $file->picture, 'source' => $file->id, 'url' => $file->link);
break;
case 'video':
$files[] = array('title' => $file->name, 'size' => $file->size, 'date' => strtotime($file->updated_time), 'thumbnail' => $file->picture, 'source' => $file->id, 'url' => $file->link);
break;
case 'audio':
$files[] = array('title' => $file->name, 'size' => $file->size, 'date' => strtotime($file->updated_time), 'thumbnail' => $OUTPUT->pix_url(file_extension_icon($file->name, 90))->out(false), 'source' => $file->id, 'url' => $file->link);
break;
case 'file':
$files[] = array('title' => $file->name, 'size' => $file->size, 'date' => strtotime($file->updated_time), 'thumbnail' => $OUTPUT->pix_url(file_extension_icon($file->name, 90))->out(false), 'source' => $file->id, 'url' => $file->link);
break;
}
}
return $files;
}
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:41,代码来源:microsoftliveapi.php
示例3: 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)) {
die(json_encode(array('e' => get_string('needaccesskey', 'repository_s3'))));
}
$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->pix_url(file_folder_icon(90))->out(false), '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->pix_url(file_extension_icon($file['name'], 90))->out(false));
}
}
$list['list'] = $tree;
return $list;
}
开发者ID:nmicha,项目名称:moodle,代码行数:40,代码来源:lib.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(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) {
$filename = $file->get_filename();
if ($CFG->enableplagiarism) {
require_once($CFG->libdir.'/plagiarismlib.php');
$plagiarsmlinks = plagiarism_get_links(array('userid'=>$file->get_userid(), 'file'=>$file, 'cmid'=>$tree->cm->id, 'course'=>$tree->course));
} else {
$plagiarsmlinks = '';
}
$image = $this->output->pix_icon(file_file_icon($file), $filename, 'moodle', array('class'=>'icon'));
$result .= '<li yuiConfig=\''.json_encode($yuiconfig).'\'><div>'.$image.' '.$file->fileurl.' '.$plagiarsmlinks.$file->portfoliobutton.'</div></li>';
}
$result .= '</ul>';
return $result;
}
开发者ID:JP-Git,项目名称:moodle,代码行数:34,代码来源:renderer.php
示例5: get_other_values
protected function get_other_values(renderer_base $output)
{
$filename = $this->file->get_filename();
$filenameshort = $filename;
if (core_text::strlen($filename) > 25) {
$filenameshort = shorten_text(substr($filename, 0, -4), 21, true, '..');
$filenameshort .= substr($filename, -4);
}
$icon = $this->file->is_directory() ? file_folder_icon() : file_file_icon($this->file);
$iconurl = $output->pix_url($icon, 'core');
$url = moodle_url::make_pluginfile_url($this->file->get_contextid(), $this->file->get_component(), $this->file->get_filearea(), $this->file->get_itemid(), $this->file->get_filepath(), $this->file->get_filename(), true);
return array('filenameshort' => $filenameshort, 'filesizeformatted' => display_size((int) $this->file->get_filesize()), 'icon' => $icon, 'iconurl' => $iconurl->out(false), 'url' => $url->out(false), 'timecreatedformatted' => userdate($this->file->get_timecreated()), 'timemodifiedformatted' => userdate($this->file->get_timemodified()));
}
开发者ID:evltuma,项目名称:moodle,代码行数:13,代码来源:stored_file_exporter.php
示例6: get_listing
/**
* Get file listing
*
* @param string $path
* @param string $path not used by this plugin
* @return mixed
*/
public function get_listing($path = '', $page = '')
{
global $USER, $OUTPUT;
$itemid = optional_param('itemid', 0, PARAM_INT);
$env = optional_param('env', 'filepicker', PARAM_ALPHA);
$ret = array('dynload' => true, 'nosearch' => true, 'nologin' => true, 'list' => array());
if (empty($itemid) || $env !== 'editor') {
return $ret;
}
// In the most cases files embedded in textarea do not have subfolders. Do not show path by default.
$retpath = array(array('name' => get_string('files'), 'path' => ''));
if (!empty($path)) {
$pathchunks = preg_split('|/|', trim($path, '/'));
foreach ($pathchunks as $i => $chunk) {
$retpath[] = array('name' => $chunk, 'path' => '/' . join('/', array_slice($pathchunks, 0, $i + 1)) . '/');
}
$ret['path'] = $retpath;
// Show path if already inside subfolder.
}
$context = context_user::instance($USER->id);
$fs = get_file_storage();
$files = $fs->get_directory_files($context->id, 'user', 'draft', $itemid, empty($path) ? '/' : $path, false, true);
foreach ($files as $file) {
if ($file->is_directory()) {
$node = array('title' => basename($file->get_filepath()), 'path' => $file->get_filepath(), 'children' => array(), 'datemodified' => $file->get_timemodified(), 'datecreated' => $file->get_timecreated(), 'icon' => $OUTPUT->pix_url(file_folder_icon(24))->out(false), 'thumbnail' => $OUTPUT->pix_url(file_folder_icon(90))->out(false));
$ret['list'][] = $node;
$ret['path'] = $retpath;
// Show path if subfolders exist.
continue;
}
$fileurl = moodle_url::make_draftfile_url($itemid, $file->get_filepath(), $file->get_filename());
$node = array('title' => $file->get_filename(), 'size' => $file->get_filesize(), 'source' => $fileurl->out(), 'datemodified' => $file->get_timemodified(), 'datecreated' => $file->get_timecreated(), 'author' => $file->get_author(), 'license' => $file->get_license(), 'isref' => $file->is_external_file(), 'icon' => $OUTPUT->pix_url(file_file_icon($file, 24))->out(false), 'thumbnail' => $OUTPUT->pix_url(file_file_icon($file, 90))->out(false));
if ($file->get_status() == 666) {
$node['originalmissing'] = true;
}
if ($imageinfo = $file->get_imageinfo()) {
$node['realthumbnail'] = $fileurl->out(false, array('preview' => 'thumb', 'oid' => $file->get_timemodified()));
$node['realicon'] = $fileurl->out(false, array('preview' => 'tinyicon', 'oid' => $file->get_timemodified()));
$node['image_width'] = $imageinfo['width'];
$node['image_height'] = $imageinfo['height'];
}
$ret['list'][] = $node;
}
$ret['list'] = array_filter($ret['list'], array($this, 'filter'));
return $ret;
}
开发者ID:evltuma,项目名称:moodle,代码行数:53,代码来源:lib.php
示例7: render_files_tree_viewer
public function render_files_tree_viewer(files_tree_viewer $tree) {
$html = $this->output->heading_with_help(get_string('coursefiles'), 'courselegacyfiles', 'moodle');
$html .= $this->output->container_start('coursefilesbreadcrumb');
foreach($tree->path as $path) {
$html .= $path;
$html .= ' / ';
}
$html .= $this->output->container_end();
$html .= $this->output->box_start();
$table = new html_table();
$table->head = array(get_string('name'), get_string('lastmodified'), get_string('size', 'repository'), get_string('type', 'repository'));
$table->align = array('left', 'left', 'left', 'left');
$table->width = '100%';
$table->data = array();
foreach ($tree->tree as $file) {
$filedate = $filesize = $filetype = '';
if ($file['filedate']) {
$filedate = userdate($file['filedate'], get_string('strftimedatetimeshort', 'langconfig'));
}
if (empty($file['isdir'])) {
if ($file['filesize']) {
$filesize = display_size($file['filesize']);
}
$fileicon = file_file_icon($file, 24);
$filetype = get_mimetype_description($file);
} else {
$fileicon = file_folder_icon(24);
}
$table->data[] = array(
html_writer::link($file['url'], $this->output->pix_icon($fileicon, get_string('icon')) . ' ' . $file['filename']),
$filedate,
$filesize,
$filetype
);
}
$html .= html_writer::table($table);
$html .= $this->output->single_button(new moodle_url('/files/coursefilesedit.php', array('contextid'=>$tree->context->id)), get_string('coursefilesedit'), 'get');
$html .= $this->output->box_end();
return $html;
}
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:44,代码来源:renderer.php
示例8: 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
示例9: 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
示例10: 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
示例11: get_listing
/**
* Get the list of files and directories in that repository.
*
* @param string $path to browse.
* @param string $page page number.
* @return array list of files and folders.
*/
public function get_listing($path = '', $page = '')
{
global $OUTPUT;
$list = array();
$list['list'] = array();
$list['manage'] = false;
$list['dynload'] = true;
$list['nologin'] = true;
$list['nosearch'] = true;
$list['path'] = array(array('name' => get_string('root', 'repository_filesystem'), 'path' => ''));
$path = trim($path, '/');
if (!$this->is_in_repository($path)) {
// In case of doubt on the path, reset to default.
$path = '';
}
$abspath = rtrim($this->get_rootpath() . $path, '/') . '/';
// Construct the breadcrumb.
$trail = '';
if ($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);
}
}
// Retrieve list of files and directories and sort them.
$fileslist = array();
$dirslist = array();
if ($dh = opendir($abspath)) {
while (($file = readdir($dh)) != false) {
if ($file != '.' and $file != '..') {
if (is_file($abspath . $file)) {
$fileslist[] = $file;
} else {
$dirslist[] = $file;
}
}
}
}
core_collator::asort($fileslist, core_collator::SORT_NATURAL);
core_collator::asort($dirslist, core_collator::SORT_NATURAL);
// Fill the $list['list'].
foreach ($dirslist as $file) {
$list['list'][] = array('title' => $file, 'children' => array(), 'datecreated' => filectime($abspath . $file), 'datemodified' => filemtime($abspath . $file), 'thumbnail' => $OUTPUT->pix_url(file_folder_icon(90))->out(false), 'path' => $path . '/' . $file);
}
foreach ($fileslist as $file) {
$node = array('title' => $file, 'source' => $path . '/' . $file, 'size' => filesize($abspath . $file), 'datecreated' => filectime($abspath . $file), 'datemodified' => filemtime($abspath . $file), 'thumbnail' => $OUTPUT->pix_url(file_extension_icon($file, 90))->out(false), 'icon' => $OUTPUT->pix_url(file_extension_icon($file, 24))->out(false));
if (file_extension_in_typegroup($file, 'image') && ($imageinfo = @getimagesize($abspath . $file))) {
// This means it is an image and we can return dimensions and try to generate thumbnail/icon.
$token = $node['datemodified'] . $node['size'];
// To prevent caching by browser.
$node['realthumbnail'] = $this->get_thumbnail_url($path . '/' . $file, 'thumb', $token)->out(false);
$node['realicon'] = $this->get_thumbnail_url($path . '/' . $file, 'icon', $token)->out(false);
$node['image_width'] = $imageinfo[0];
$node['image_height'] = $imageinfo[1];
}
$list['list'][] = $node;
}
$list['list'] = array_filter($list['list'], array($this, 'filter'));
return $list;
}
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:74,代码来源:lib.php
示例12: 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
示例13: 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
示例14: get_element_icon
/**
* Returns icon of element
*
* @param array &$element An array representing an element in the grade_tree
* @param bool $spacerifnone return spacer if no icon found
*
* @return string icon or spacer
*/
public function get_element_icon(&$element, $spacerifnone = false)
{
global $CFG, $OUTPUT;
require_once $CFG->libdir . '/filelib.php';
switch ($element['type']) {
case 'item':
case 'courseitem':
case 'categoryitem':
$is_course = $element['object']->is_course_item();
$is_category = $element['object']->is_category_item();
$is_scale = $element['object']->gradetype == GRADE_TYPE_SCALE;
$is_value = $element['object']->gradetype == GRADE_TYPE_VALUE;
$is_outcome = !empty($element['object']->outcomeid);
if ($element['object']->is_calculated()) {
$strcalc = get_string('calculatedgrade', 'grades');
return '<img src="' . $OUTPUT->pix_url('i/calc') . '" class="icon itemicon" title="' . s($strcalc) . '" alt="' . s($strcalc) . '"/>';
} else {
if (($is_course or $is_category) and ($is_scale or $is_value)) {
if ($category = $element['object']->get_item_category()) {
switch ($category->aggregation) {
case GRADE_AGGREGATE_MEAN:
case GRADE_AGGREGATE_MEDIAN:
case GRADE_AGGREGATE_WEIGHTED_MEAN:
case GRADE_AGGREGATE_WEIGHTED_MEAN2:
case GRADE_AGGREGATE_EXTRACREDIT_MEAN:
$stragg = get_string('aggregation', 'grades');
return '<img src="' . $OUTPUT->pix_url('i/agg_mean') . '" ' . 'class="icon itemicon" title="' . s($stragg) . '" alt="' . s($stragg) . '"/>';
case GRADE_AGGREGATE_SUM:
$stragg = get_string('aggregation', 'grades');
return '<img src="' . $OUTPUT->pix_url('i/agg_sum') . '" ' . 'class="icon itemicon" title="' . s($stragg) . '" alt="' . s($stragg) . '"/>';
}
}
} else {
if ($element['object']->itemtype == 'mod') {
//prevent outcomes being displaying the same icon as the activity they are attached to
if ($is_outcome) {
$stroutcome = s(get_string('outcome', 'grades'));
return '<img src="' . $OUTPUT->pix_url('i/outcomes') . '" ' . 'class="icon itemicon" title="' . $stroutcome . '" alt="' . $stroutcome . '"/>';
} else {
$strmodname = get_string('modulename', $element['object']->itemmodule);
return '<img src="' . $OUTPUT->pix_url('icon', $element['object']->itemmodule) . '" ' . 'class="icon itemicon" title="' . s($strmodname) . '" alt="' . s($strmodname) . '"/>';
}
} else {
if ($element['object']->itemtype == 'manual') {
if ($element['object']->is_outcome_item()) {
$stroutcome = get_string('outcome', 'grades');
return '<img src="' . $OUTPUT->pix_url('i/outcomes') . '" ' . 'class="icon itemicon" title="' . s($stroutcome) . '" alt="' . s($stroutcome) . '"/>';
} else {
$strmanual = get_string('manualitem', 'grades');
return '<img src="' . $OUTPUT->pix_url('t/manual_item') . '" ' . 'class="icon itemicon" title="' . s($strmanual) . '" alt="' . s($strmanual) . '"/>';
}
}
}
}
}
break;
case 'category':
$strcat = get_string('category', 'grades');
return '<img src="' . $OUTPUT->pix_url(file_folder_icon()) . '" class="icon itemicon" ' . 'title="' . s($strcat) . '" alt="' . s($strcat) . '" />';
}
if ($spacerifnone) {
return $OUTPUT->spacer() . ' ';
} else {
return '';
}
}
开发者ID:JP-Git,项目名称:moodle,代码行数:74,代码来源:lib.php
示例15: contents_api_response_to_list
/**
* Transform a onedrive API response for a folder into a list parameter that the respository class can understand.
*
* @param string $response The response from the API.
* @param string $path The list path.
* @param string $clienttype The type of client that the response is from. onedrive/sharepoint.
* @param string $spparentsiteuri If using the Sharepoint clienttype, this is the parent site URI.
* @return array A $list array to be used by the respository class in get_listing.
*/
protected function contents_api_response_to_list($response, $path, $clienttype, $spparentsiteuri = null)
{
global $OUTPUT, $DB;
$list = [];
if ($clienttype === 'onedrive') {
$pathprefix = '/my' . $path;
} else {
if ($clienttype === 'unified') {
$pathprefix = '/my';
} else {
if ($clienttype === 'sharepoint') {
$pathprefix = '/courses' . $path;
}
}
}
if ($clienttype === 'unified' && $path === '/' || $clienttype !== 'unified') {
$list[] = ['title' => get_string('upload', 'repository_office365'), 'path' => $pathprefix . '/upload/', 'thumbnail' => $OUTPUT->pix_url('a/add_file')->out(false), 'children' => []];
}
if (isset($response['value'])) {
foreach ($response['value'] as $content) {
if ($clienttype === 'unified') {
$itempath = $pathprefix . '/' . $content['id'];
} else {
$itempath = $pathprefix . '/' . $content['name'];
}
if ($content['type'] === 'Folder') {
$list[] = ['title' => $content['name'], 'path' => $itempath, 'thumbnail' => $OUTPUT->pix_url(file_folder_icon(90))->out(false), 'date' => strtotime($content['dateTimeCreated']), 'datemodified' => strtotime($content['dateTimeLastModified']), 'datecreated' => strtotime($content['dateTimeCreated']), 'children' => []];
} else {
if ($content['type'] === 'File') {
$url = $content['webUrl'] . '?web=1';
$source = ['id' => $content['id'], 'source' => $clienttype === 'sharepoint' ? 'sharepoint' : 'onedrive'];
if ($clienttype === 'sharepoint') {
$source['parentsiteuri'] = $spparentsiteuri;
}
$author = '';
if (!empty($content['createdBy']['user']['displayName'])) {
$author = $content['createdBy']['user']['displayName'];
$author = explode(',', $author);
$author = $author[0];
}
$list[] = ['title' => $content['name'], 'date' => strtotime($content['dateTimeCreated']), 'datemodified' => strtotime($content['dateTimeLastModified']), 'datecreated' => strtotime($content['dateTimeCreated']), 'size' => $content['size'], 'url' => $url, 'thumbnail' => $OUTPUT->pix_url(file_extension_icon($content['name'], 90))->out(false), 'author' => $author, 'source' => $this->pack_reference($source)];
}
}
}
}
return $list;
}
开发者ID:jamesmcq,项目名称:o365-moodle,代码行数:56,代码来源:lib.php
示例16: get_listing
public function get_listing($path='', $page = '') {
global $CFG, $OUTPUT;
$list = array();
$ret = array();
$ret['dynload'] = true;
$ret['nosearch'] = true;
$ret['nologin'] = true;
$ret['path'] = array(array('name'=>get_string('webdav', 'repository_webdav'), 'path'=>''));
$ret['list'] = array();
if (!$this->dav->open()) {
return $ret;
}
$webdavpath = rtrim('/'.ltrim($this->options['webdav_path'], '/ '), '/ '); // without slash in the end
if (empty($path) || $path =='/') {
$path = '/';
} else {
$chunks = preg_split('|/|', trim($path, '/'));
for ($i = 0; $i < count($chunks); $i++) {
$ret['path'][] = array(
'name' => urldecode($chunks[$i]),
'path' => '/'. join('/', array_slice($chunks, 0, $i+1)). '/'
);
}
}
$dir = $this->dav->ls($webdavpath. urldecode($path));
if (!is_array($dir)) {
return $ret;
}
$folders = array();
$files = array();
foreach ($dir as $v) {
if (!empty($v['lastmodified'])) {
$v['lastmodified'] = strtotime($v['lastmodified']);
} else {
$v['lastmodified'] = null;
}
// Extracting object title from absolute path
$v['href'] = substr(urldecode($v['href']), strlen($webdavpath));
$title = substr($v['href'], strlen($path));
if (!empty($v['resourcetype']) && $v['resourcetype'] == 'collection') {
// a folder
if ($path != $v['href']) {
$folders[strtoupper($title)] = array(
'title'=>rtrim($title, '/'),
'thumbnail'=>$OUTPUT->pix_url(file_folder_icon(90))->out(false),
'children'=>array(),
'datemodified'=>$v['lastmodified'],
'path'=>$v['href']
);
}
}else{
// a file
$size = !empty($v['getcontentlength'])? $v['getcontentlength']:'';
$files[strtoupper($title)] = array(
'title'=>$title,
'thumbnail' => $OUTPUT->pix_url(file_extension_icon($title, 90))->out(false),
'size'=>$size,
'datemodified'=>$v['lastmodified'],
'source'=>$v['href']
);
}
}
ksort($files);
ksort($folders);
$ret['list'] = array_merge($folders, $files);
return $ret;
}
开发者ID:JP-Git,项目名称:moodle,代码行数:69,代码来源:lib.php
示例17: query
/**
* Query Google Drive for files and folders using a search query.
*
* Documentation about the query format can be found here:
* https://developers.google.com/drive/search-parameters
*
* This returns a list of files and folders with their details as they should be
* formatted and returned by functions such as get_listing() or search().
*
* @param string $q search query as expected by the Google API.
* @param string $path parent path of the current files, will not be used for the query.
* @param int $page page.
* @return array of files and folders.
*/
protected function query($q, $path = null, $page = 0)
{
global $OUTPUT;
$files = array();
$folders = array();
$fields = "items(id,title,mimeType,downloadUrl,fileExtension,exportLinks,modifiedDate,fileSize,thumbnailLink)";
$params = array('q' => $q, 'fields' => $fields);
try {
// Retrieving files and folders.
$response = $this->service->files->listFiles($params);
} catch (Google_ServiceException $e) {
if ($e->getCode() == 403 && strpos($e->getMessage(), 'Access Not Configured') !== false) {
// This is raised when the service Drive API has not been enabled on Google APIs control panel.
throw new repository_exception('servicenotenabled', 'repository_googledocs');
} else {
throw $e;
}
}
$items = isset($response['items']) ? $response['items'] : array();
foreach ($items as $item) {
if ($item['mimeType'] == 'application/vnd.google-apps.folder') {
// This is a folder.
$folders[$item['title'] . $item['id']] = array('title' => $item['title'], 'path' => $this->build_node_path($item['id'], $item['title'], $path), 'date' => strtotime($item['modifiedDate']), 'thumbnail' => $OUTPUT->pix_url(file_folder_icon(64))->out(false), 'thumbnail_height' => 64, 'thumbnail_width' => 64, 'children' => array());
} else {
// This is a file.
if (isset($item['f
|
请发表评论