当前位置: 首页>>代码示例>>PHP>>正文


PHP Folder::getSubFolder方法代码示例

本文整理汇总了PHP中Folder::getSubFolder方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::getSubFolder方法的具体用法?PHP Folder::getSubFolder怎么用?PHP Folder::getSubFolder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Folder的用法示例。


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

示例1: listContent

 private function listContent()
 {
     $listSubFolder = $this->listSubFolder;
     $listFiles = $this->listFiles;
     $folderId = $this->request->arg[1];
     $page = empty($this->request->arg[2]) ? 1 : $this->request->arg[2];
     $limitNum = Config::get('default_file_pager');
     $startId = ($page - 1) * $limitNum;
     $this->data['limitNum'] = $limitNum;
     $this->data['page'] = $page;
     import('dao.Folder');
     $folder = new Folder();
     $myFolder = $folder->getFolder($folderId);
     if (empty($myFolder)) {
         goToUrl('/pageNotFound');
     }
     $this->data['currentFolderId'] = $myFolder['fd_id'];
     if ($listSubFolder) {
         $options = array('limit' => $limitNum, 'start' => $startId);
         $subFolders = $folder->getSubFolder($myFolder['fd_id'], $options);
         foreach ($subFolders as $key => $subFolder) {
             $defaultCoverThumb = Config::get('default_cover_thumbnail');
             $defaultCoverThumb = empty($defaultCoverThumb) ? '/images/default_cover_thumbnail.jpg' : $defaultCoverThumb;
             $folderCover = $folder->getFolderCover($subFolder['fd_id']);
             $coverThumb = imageCache::cacheImage($folderCover, 160, 120);
             $subFolder['thumbnail'] = $coverThumb ? $coverThumb : $defaultCoverThumb;
             $subFolder['filesNum'] = count($folder->getFilesInFolder($subFolder['fd_id'], array("where" => "and image_type>0")));
             $subFolder['subFoldersNum'] = count($folder->getSubFolder($subFolder['fd_id']));
             $subFolders[$key] = $subFolder;
         }
         $this->data['folders'] = $subFolders;
         $this->data['subFolderTotal'] = $folder->getSubFolderTotal($folderId);
         if ($listFiles && count($this->data['subFolderTotal']) > $limitNum) {
             $this->data['subFolderPager'] = 'more';
         } else {
             $this->data['subFolderPager'] = 'full';
         }
     }
     if ($listFiles) {
         $options = array("where" => "and image_type>0", "limit" => $limitNum, 'start' => $startId);
         $myFiles = $folder->getFilesInFolder($folderId, $options);
         foreach ($myFiles as $key => $myFile) {
             $defaultThumb = Config::get('default_thumbnail');
             $defaultThumb = empty($defaultThumb) ? '/images/default_thumbnail.jpg' : $defaultThumb;
             $myThumb = imageCache::cacheImage($myFile['path'], 160, 120);
             $myFile['thumbnail'] = $myThumb ? $myThumb : $defaultThumb;
             $myFiles[$key] = $myFile;
         }
         //ZDebug::my_print($myFiles, 'files');
         $this->data['files'] = $myFiles;
         $this->data['filesTotal'] = $folder->getFilesInFolderTotal($folderId);
         if ($listSubFolder && count($this->data['filesTotal']) > $limitNum) {
             $this->data['filesPager'] = 'more';
         } else {
             $this->data['filesPager'] = 'full';
         }
     }
     $this->data['currentFolderName'] = $myFolder['name'];
     $this->data['nav'] = $this->genNav($myFolder, $folder);
 }
开发者ID:elevenfox,项目名称:VTree,代码行数:60,代码来源:folderPageModel.class.php

示例2: blockHeaderData

 public function blockHeaderData()
 {
     $headerData['site_logo'] = Config::get('site_logo');
     $menuLinks = array();
     import('dao.Folder');
     $folder = new Folder();
     $folders = $folder->getSubFolder(0);
     foreach ($folders as $folderItem) {
         $menuLinks[] = array('name' => $folderItem['name'], 'url' => '/list/' . $folderItem['fd_id']);
     }
     $headerData['menuLinks'] = $menuLinks;
     return $headerData;
 }
开发者ID:elevenfox,项目名称:VTree,代码行数:13,代码来源:ModelCore.class.php

示例3: syncFolders

 public static function syncFolders($folderToSync)
 {
     $debug = self::$debug;
     $mode = self::$mode;
     import('dao.Folder');
     $folder = new Folder();
     import('dao.File');
     $file = new File();
     $folderFullName = $folderToSync['path'];
     $folderId = $folderToSync['fd_id'];
     // If folder is locked, ignore. Unless set mode greater than 0.
     if ($folderToSync['locked'] && $mode == 0) {
         if ($debug) {
             ZDebug::my_echo('Ignore locked folder: ' . $folderFullName . '(' . $folderId . ')');
         }
         return TRUE;
     }
     // Step 1: If folder is not physically exist, set to deleted in DB.
     if (!is_dir($folderFullName)) {
         $folder->deleteFolder($folderId);
         if ($debug) {
             ZDebug::my_echo('Delete folder in DB: ' . $folderFullName . '(' . $folderId . ')');
         }
         return TRUE;
     }
     // Step 2: Get the result set of files under this folder
     $filesInFolder = $folder->getFilesInFolder($folderId);
     $fileNameArr = array();
     foreach ($filesInFolder as $theFile) {
         // Step 3: If a file is not physically exist, delete it in table files.
         if (!file_exists($theFile['path'])) {
             $file->deleteFile($theFile['fid']);
             if ($debug) {
                 ZDebug::my_echo('Delete file in DB: ' . $theFile['path'] . '(' . $theFile['fid'] . ')');
             }
         } elseif ($theFile['last_modified'] != my_filemtime($theFile['path'])) {
             $theFile['last_modified'] = my_filemtime($theFile['path']);
             $file->saveFile($theFile);
             if ($debug) {
                 ZDebug::my_echo('Update file in DB: ' . $theFile['path'] . '(' . $theFile['fid'] . ')');
             }
         } elseif ($mode > 1) {
             $file->saveFile($theFile);
             if ($debug) {
                 ZDebug::my_echo('Update file in DB: ' . $theFile['path'] . '(' . $theFile['fid'] . ')');
             }
         } else {
         }
         $fileNameArr[] = $theFile['name'];
     }
     // Step 5: Get result set of sub-folders under this folder
     $subFoldera = $folder->getSubFolder($folderId);
     $folderNameArr = array();
     foreach ($subFoldera as $theFolder) {
         // Step 6: If a folder is not physically exist, set deleted flag in table folders.
         if (!file_exists($theFolder['path'])) {
             $folder->deleteFolder($theFolder['fd_id']);
             if ($debug) {
                 ZDebug::my_echo('Delete folder in DB: ' . $theFolder['path'] . '(' . $theFolder['fd_id'] . ')');
             }
         } elseif ($theFolder['last_modified'] != my_filemtime($theFolder['path'])) {
             $theFolder['last_modified'] = my_filemtime($theFolder['path']);
             $folder->saveFolder($theFolder);
             if ($debug) {
                 ZDebug::my_echo('Update folder in DB: ' . $theFolder['path'] . '(' . $theFolder['fd_id'] . ')');
             }
             self::syncFolders($theFolder);
         } else {
             self::syncFolders($theFolder);
         }
         $folderNameArr[] = $theFolder['name'];
     }
     $hdl = opendir($folderFullName);
     while ($item = readdir($hdl)) {
         $itemFullName = $folderFullName . DIRECTORY_SEPARATOR . $item;
         // Step 8: If physical file is not in DB file result set, then add a file
         if ($item != "." && $item != ".." && is_file($itemFullName) && !in_array($item, $fileNameArr)) {
             $file->saveFile(array('path' => $itemFullName, 'fd_id' => $folderId));
             if ($debug > 1) {
                 ZDebug::my_echo('Adding new file in DB: ' . $itemFullName);
             }
         }
         // Step 9: if physical folder is not in DB folder result set, then add a folder
         if ($item != "." && $item != ".." && is_dir($itemFullName) && !in_array($item, $folderNameArr)) {
             self::addFolder($itemFullName, $folderId);
         }
     }
     closedir($hdl);
 }
开发者ID:elevenfox,项目名称:VTree,代码行数:89,代码来源:SyncFiles.class.php


注:本文中的Folder::getSubFolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。