Пример #1
0
 /**
  * Retrieves a list of items from a given uri
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getItems($uri, $includeVariations = false)
 {
     // List down posts from the site
     $model = EB::model('MediaManager');
     $posts = $model->getPosts();
     // Get path and folder
     $folder = $this->getFolderItem($uri);
     // Get the absolute path to the main "articles" folder
     $folderPath = EasyBlogMediaManager::getPath($folder->uri);
     if (!$posts) {
         return $folder;
     }
     // Filegroup is the array where files are stored.
     // Sort arrays are used to speed up file sorting.
     $filegroup = EasyBlogMediaManager::filegroup();
     // The strategy used here is to use a single loop that build:
     // - data that is ready-to-use
     // - sort arrays so sorting becomes cheap.
     // - variations
     $variations = array();
     $total = 0;
     foreach ($posts as $post) {
         // Get the folder path of the article
         $articlePath = $folderPath . '/' . $post->id;
         // Get the uri for the article
         $uri = 'post:' . $post->id;
         $items = parent::getItems($uri);
         $filegroup['folder'][] = $items;
         $total++;
     }
     // Set the folder contents
     $folder->contents = $filegroup;
     $folder->total = $total;
     return $folder;
 }
Пример #2
0
 /**
  * Retrieves a list of items from a given uri
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getItems($uri, $includeVariations = false)
 {
     // Retrieve a list of authors from the site.
     $model = EB::model('Blogger');
     $result = $model->getBloggers();
     // Get path and folder
     $folder = $this->getFolderItem($uri);
     // Get the absolute path to the main "articles" folder
     $folderPath = EasyBlogMediaManager::getPath($folder->uri);
     if (!$result) {
         return $folder;
     }
     // Filegroup is the array where files are stored.
     // Sort arrays are used to speed up file sorting.
     $filegroup = EasyBlogMediaManager::filegroup();
     // The strategy used here is to use a single loop that build:
     // - data that is ready-to-use
     // - sort arrays so sorting becomes cheap.
     // - variations
     $variations = array();
     $total = 0;
     // Map them with the profile table
     $authors = array();
     if ($result) {
         foreach ($result as $row) {
             $author = EB::user($row->id);
             $authorPath = $folderPath . '/' . $row->id;
             $uri = 'user:'******'folder'][] = $items;
             $total++;
         }
     }
     // Set the folder contents
     $folder->contents = $filegroup;
     $folder->total = $total;
     return $folder;
 }