本文整理汇总了PHP中isListingDocument函数的典型用法代码示例。如果您正苦于以下问题:PHP isListingDocument函数的具体用法?PHP isListingDocument怎么用?PHP isListingDocument使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isListingDocument函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFolderListing
/**
* get the list of folder under a specified folder
* which will be used for drop-down menu
* @param string $path the path of the specified folder
* @param array $outputs
* @param string $indexNumber
* @param string $prefixNumber the prefix before the index number
* @param string $prefixName the prefix before the folder name
* @return array
*/
function getFolderListing($path,$indexNumber=null, $prefixNumber =' ', $prefixName =' - ', $outputs=array())
{
$path = removeTrailingSlash(backslashToSlash($path));
if(is_null($indexNumber))
{
$outputs[IMG_LBL_ROOT_FOLDER] = removeTrailingSlash(backslashToSlash($path));
}
$fh = @opendir($path);
if($fh)
{
$count = 1;
while($file = @readdir($fh))
{
$newPath = removeTrailingSlash(backslashToSlash($path . "/" . $file));
if(isListingDocument($newPath) && $file != '.' && $file != '..' && is_dir($newPath))
{
if(!empty($indexNumber))
{//this is not root folder
$outputs[$prefixNumber . $indexNumber . "." . $count . $prefixName . $file] = $newPath;
getFolderListing($newPath, $prefixNumber . $indexNumber . "." . $count , $prefixNumber, $prefixName, $outputs);
}else
{//this is root folder
$outputs[$count . $prefixName . $file] = $newPath;
getFolderListing($newPath, $count, $prefixNumber, $prefixName, $outputs);
}
$count++;
}
}
@closedir($fh);
}
return $outputs;
}
示例2: doSearch
/**
* get the file according to the search keywords
*
*/
function doSearch($baseFolderPath = null)
{
$baseFolderPath = addTrailingSlash(backslashToSlash((is_null($baseFolderPath)?$this->rootFolder:$baseFolderPath)));
$dirHandler = @opendir($baseFolderPath);
if($dirHandler)
{
while(false !== ($file = readdir($dirHandler)))
{
if($file != '.' && $file != '..')
{
$path = $baseFolderPath . $file;
if(is_file($path))
{
$isValid = true;
$fileTime = @filemtime($path);
$fileSize = @filesize($path);
if($this->searchkeywords['name'] !== '' && @eregi($this->searchkeywords['name'], $file) === false)
{
$isValid = false;
}
if($this->searchkeywords['mtime_from'] != '' && $fileTime < @strtotime($this->searchkeywords['mtime_from']))
{
$isValid = false;
}
if($this->searchkeywords['mtime_to'] != '' && $fileTime > @strtotime($this->searchkeywords['mtime_to']))
{
$isValid = false;
}
if($this->searchkeywords['size_from'] != '' && $fileSize < @strtotime($this->searchkeywords['size_from']))
{
$isValid = false;
}
if($this->searchkeywords['size_to'] != '' && $fileSize > @strtotime($this->searchkeywords['size_to']))
{
$isValid = false;
}
if($isValid && isListingDocument($path))
{
$finalPath = $path;
$objFile = new file($finalPath);
$tem = $objFile->getFileInfo();
$obj = new manager($finalPath, false);
$obj->setSessionAction($this->sessionAction);
$selectedDocuments = $this->sessionAction->get();
$fileType = $obj->getFileType($finalPath);
foreach($fileType as $k=>$v)
{
$tem[$k] = $v;
}
$tem['path'] = backslashToSlash($finalPath);
$tem['type'] = (is_dir($finalPath)?'folder':'file');
/* $tem['size'] = transformFileSize($tem['size']);
$tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']);
$tem['mtime'] = date(DATE_TIME_FORMAT, $tem['mtime']);*/
$tem['flag'] = (array_search($tem['path'], $selectedDocuments) !== false?($this->sessionAction->getAction() == "copy"?'copyFlag':'cutFlag'):'noFlag');
$tem['url'] = getFileUrl($tem['path']);
$this->rootFolderInfo['file']++;
$manager = null;
$this->files[] = $tem;
$tem = null;
}
}elseif(is_dir($path) && $this->searchkeywords['recursive'])
{
$this->Search($baseFolderPath);
}
}
}
}
}
示例3: getFileList
/**
* get the list of files and folders under this current fold
* @return array
*/
function getFileList()
{
$outputs = array();
$files = array();
$folders = array();
$tem = array();
$dirHandler = @opendir($this->currentFolderPath);
if ($dirHandler) {
while (false !== ($file = readdir($dirHandler))) {
if ($file != '.' && $file != '..') {
$flag = $this->flags['no'];
if ($this->sessionAction->getFolder() == $this->currentFolderPath) {
//check if any flag associated with this folder or file
$folder = addTrailingSlash(backslashToSlash($this->currentFolderPath));
if (in_array($folder . $file, $this->sessionAction->get())) {
if ($this->sessionAction->getAction() == "copy") {
$flag = $this->flags['copy'];
} else {
$flag = $this->flags['cut'];
}
}
}
$path = $this->currentFolderPath . $file;
if (is_dir($path) && isListingDocument($path)) {
$this->currentFolderInfo['subdir']++;
if (!$this->calculateSubdir) {
} else {
$folder = $this->getFolderInfo($path);
$folder['flag'] = $flag;
$folders[$file] = $folder;
$outputs[$file] = $folders[$file];
}
} elseif (is_file($path) && isListingDocument($path)) {
$obj = new file($path);
$tem = $obj->getFileInfo();
if (sizeof($tem)) {
$fileType = $this->getFileType($file);
foreach ($fileType as $k => $v) {
$tem[$k] = $v;
}
$this->currentFolderInfo['size'] += $tem['size'];
$this->currentFolderInfo['file']++;
$tem['path'] = backslashToSlash($path);
$tem['type'] = "file";
$tem['flag'] = $flag;
$files[$file] = $tem;
$outputs[$file] = $tem;
$tem = array();
$obj->close();
}
}
}
}
if ($this->forceFolderOnTop) {
uksort($folders, "strnatcasecmp");
uksort($files, "strnatcasecmp");
$outputs = array();
foreach ($folders as $v) {
$outputs[] = $v;
}
foreach ($files as $v) {
$outputs[] = $v;
}
} else {
uksort($outputs, "strnatcasecmp");
}
@closedir($dirHandler);
} else {
trigger_error('Unable to locate the folder ' . $this->currentFolderPath, E_NOTICE);
}
return $outputs;
}
示例4: getFileList
/**
* get the list of files and folders under this current fold
* @return array
*/
function getFileList()
{
$outputs = array();
$files = array();
$folders = array();
$tem = array();
$to_group_id = api_get_group_id();
global $is_user_in_group;
$dirHandler = @opendir($this->getCurrentFolderPath());
if ($dirHandler) {
while (false !== ($file = readdir($dirHandler))) {
if ($file != '.' && $file != '..') {
$flag = $this->flags['no'];
if ($this->sessionAction->getFolder() == $this->getCurrentFolderPath()) {
//check if any flag associated with this folder or file
$folder = addTrailingSlash(backslashToSlash($this->getCurrentFolderPath()));
if (in_array($folder . $file, $this->sessionAction->get())) {
if ($this->sessionAction->getAction() == "copy") {
$flag = $this->flags['copy'];
} else {
$flag = $this->flags['cut'];
}
}
}
$path = $this->getCurrentFolderPath() . $file;
if (is_dir($path) && isListingDocument($path)) {
$this->currentFolderInfo['subdir']++;
//fix count left folders for Chamilo
$deleted_by_Chamilo_folder = '_DELETED_';
$css_folder_Chamilo = 'css';
$hotpotatoes_folder_Chamilo = 'HotPotatoes_files';
$chat_files_Chamilo = 'chat_files';
$certificates_Chamilo = 'certificates';
//show group's directory only if I'm member. Or if I'm a teacher.
//@todo: check groups not necessary because the student dont have access to main folder documents (only to document/group or document/shared_folder).
//Teachers can access to all groups ?
$group_folder = '_groupdocs';
$hide_doc_group = false;
if (preg_match("/{$group_folder}/", $path)) {
$hide_doc_group = true;
if ($is_user_in_group || $to_group_id != 0 && api_is_allowed_to_edit()) {
$hide_doc_group = false;
}
}
if (preg_match("/{$deleted_by_Chamilo_folder}/", $path) || preg_match("/{$css_folder_Chamilo}/", $path) || preg_match("/{$hotpotatoes_folder_Chamilo}/", $path) || preg_match("/{$chat_files_Chamilo}/", $path) || preg_match("/{$certificates_Chamilo}/", $path) || $hide_doc_group || $file[0] == '.') {
$this->currentFolderInfo['subdir'] = $this->currentFolderInfo['subdir'] - 1;
}
//end fix for Chamilo
if (!$this->calculateSubdir) {
} else {
$folder = $this->getFolderInfo($path);
$folder['flag'] = $flag;
$folders[$file] = $folder;
$outputs[$file] = $folders[$file];
}
} elseif (is_file($path) && isListingDocument($path)) {
$obj = new file($path);
$tem = $obj->getFileInfo();
if (sizeof($tem)) {
$fileType = $this->getFileType($file);
foreach ($fileType as $k => $v) {
$tem[$k] = $v;
}
$this->currentFolderInfo['size'] += $tem['size'];
$this->currentFolderInfo['file']++;
//fix count left files for Chamilo
$deleted_by_Chamilo_file = ' DELETED ';
// ' DELETED ' not '_DELETED_' because in $file['name'] _ is replaced with blank see class.manager.php
if (preg_match("/{$deleted_by_Chamilo_file}/", $tem['name']) || $tem['name'][0] == '.') {
$this->currentFolderInfo['file'] = $this->currentFolderInfo['file'] - 1;
}
///end fix for Chamilo
//Try a course file
$tem['path'] = backslashToSlash($path);
$pos = strpos($this->getCurrentFolderPath(), 'courses/');
if ($pos === false) {
//try my_files
$pos = strpos($this->getCurrentFolderPath(), 'main/');
$tem['public_path'] = api_get_path(WEB_PATH) . substr($this->getCurrentFolderPath(), $pos, strlen($this->getCurrentFolderPath())) . $file;
} else {
$tem['public_path'] = api_get_path(WEB_PATH) . substr($this->getCurrentFolderPath(), $pos, strlen($this->getCurrentFolderPath())) . $file;
}
$tem['type'] = "file";
$tem['flag'] = $flag;
$files[$file] = $tem;
$outputs[$file] = $tem;
$tem = array();
$obj->close();
}
}
}
}
if ($this->forceFolderOnTop) {
uksort($folders, "strnatcasecmp");
uksort($files, "strnatcasecmp");
$outputs = array();
//.........这里部分代码省略.........