Esempio n. 1
0
 /**
  * Return a list of images that this user has.
  */
 public function getItems($uri)
 {
     // If account is already associated, we just need to get the photos from their Flickr account.
     $client = EB::oauth()->getClient(EBLOG_OAUTH_FLICKR);
     $client->setAccess($this->oauth->access_token);
     $client->setParams($this->oauth->params);
     // Get list of photos from Flickr
     $result = $client->getPhotos();
     if (!$result) {
         return $result;
     }
     // Let's build the photos URL now.
     $items = EBMM::filegroup();
     foreach ($result as $row) {
         $items['image'][] = $this->decorate($row, '');
     }
     // Folder
     $folder = new stdClass();
     $folder->place = 'flickr';
     $folder->title = JText::_('COM_EASYBLOG_MM_FLICKR');
     $folder->url = 'flickr';
     $folder->uri = 'flickr';
     $folder->key = 'flickr';
     $folder->type = 'folder';
     $folder->icon = EBMM::$icons['place/flickr'];
     $folder->root = true;
     $folder->scantime = 0;
     $folder->contents = $items;
     $folder->total = count($items['image']);
     return $folder;
 }
Esempio n. 2
0
 /**
  * Returns an array of folders / albums in a given folder since jomsocial only stores user images here.
  *
  * @access	public
  * @param	string	$path	The path that contains the items.
  * @param	int 	$depth	The depth level to search for child items.
  */
 public function getItems($uri)
 {
     if (!$this->exists()) {
         return false;
     }
     // load easysocial language files.
     Foundry::language()->load('com_easysocial', JPATH_ROOT);
     // Determines if we are trying to view a single album or all albums
     $parts = explode(':', $uri);
     $viewAll = count($parts) == 1;
     // Let's build the photos URL now.
     $items = EBMM::filegroup();
     // Viewing of all albums
     if ($viewAll) {
         $model = FD::model('Albums');
         $result = $model->getAlbums($this->my->id, SOCIAL_TYPE_USER);
         if ($result) {
             foreach ($result as $row) {
                 $items['folder'][] = $this->decorateFolder($row);
             }
         }
         // Folder
         $folder = new stdClass();
         $folder->place = 'easysocial';
         $folder->title = JText::_('COM_EASYBLOG_MM_PLACE_EASYSOCIAL');
         $folder->url = 'easysocial';
         $folder->uri = 'easysocial';
         $folder->key = 'easysocial';
         $folder->type = 'folder';
         $folder->icon = EasyBlogMediaManager::$icons['place/easysocial'];
         $folder->root = true;
         $folder->scantime = 0;
         $folder->contents = $items;
         $folder->total = count($items['folder']);
     } else {
         // Get the album id it is trying to view
         $albumId = (int) $parts[1];
         $album = FD::table('Album');
         $album->load($albumId);
         // Render the photos model
         $model = FD::model('Photos');
         $options = array('album_id' => $albumId, 'pagination' => false);
         // Get the photos
         $photos = $model->getPhotos($options);
         if ($photos) {
             foreach ($photos as $photo) {
                 $items['image'][] = $this->decorateImage($photo, $album);
             }
         }
         // Folder
         $folder = new stdClass();
         $folder->place = 'easysocial';
         $folder->title = JText::_($album->get('title'));
         $folder->url = 'easysocial';
         $folder->uri = 'easysocial';
         $folder->key = 'easysocial';
         $folder->type = 'folder';
         $folder->icon = EBMM::$icons['place/easysocial'];
         $folder->root = true;
         $folder->scantime = 0;
         $folder->contents = $items;
         $folder->total = count($items);
     }
     return $folder;
 }
Esempio n. 3
0
 /**
  * Retrieves a list of albums or photos in an album
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function getItems($uri)
 {
     $exists = $this->exists();
     // Namespaces are divided by : and /
     $parts = explode(':', $uri);
     $viewAll = count($parts) == 1;
     // Let's build the photos URL now.
     $items = EBMM::filegroup();
     if ($viewAll) {
         // Use own method to retrieve albums to work around JomSocial's silly bugs.
         $albums = $this->getAlbums($this->my->id);
         if ($albums) {
             foreach ($albums as $row) {
                 $items['folder'][] = $this->decorateFolder($row);
             }
         }
         // $folder = EBMM::folder($uri, $items);
         // $folder->icon = EBMM::$icons['place/jomsocial'];
         // $folder->root = true;
         // $folder->scantime = 0;
         // Folder
         $folder = new stdClass();
         $folder->place = 'jomsocial';
         $folder->title = JText::_('COM_EASYBLOG_MM_PLACE_JOMSOCIAL');
         $folder->url = 'jomsocial';
         $folder->uri = 'jomsocial';
         $folder->key = 'jomsocial';
         $folder->type = 'folder';
         $folder->icon = EasyBlogMediaManager::$icons['place/jomsocial'];
         $folder->root = true;
         $folder->scantime = 0;
         $folder->contents = $items;
         $folder->total = count($items['folder']);
     } else {
         // Get the album id it is trying to view
         $albumId = (int) $parts[1];
         $album = JTable::getInstance('Album', 'CTable');
         $album->load($albumId);
         // Render the photos model
         $model = CFactory::getModel('Photos');
         $photos = $model->getAllPhotos($album->id);
         if ($photos) {
             foreach ($photos as $photo) {
                 $items['image'][] = $this->decorateImage($photo, $album);
             }
         }
         // $folder = EBMM::folder($uri, $items);
         // $folder->title = $album->name;
         // $folder->icon = EBMM::$icons['place/jomsocial'];
         // $folder->root = true;
         // $folder->scantime = 0;
         // Folder
         $folder = new stdClass();
         $folder->place = 'jomsocial';
         $folder->title = $album->get('title');
         $folder->url = 'jomsocial';
         $folder->uri = 'jomsocial';
         $folder->key = 'jomsocial';
         $folder->type = 'folder';
         $folder->icon = EBMM::$icons['place/jomsocial'];
         $folder->root = true;
         $folder->scantime = 0;
         $folder->contents = $items;
         $folder->total = count($items);
     }
     return $folder;
 }