| Current Path : /home/megadansyp/www/components/com_eventgallery/library/factory/ |
| Current File : /home/megadansyp/www/components/com_eventgallery/library/factory/googlephotosaccount.php |
<?php
/**
* @package Sven.Bluege
* @subpackage com_eventgallery
*
* @copyright Copyright (C) 2005 - 2019 Sven Bluege All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();
class EventgalleryLibraryFactoryGooglephotosaccount extends EventgalleryLibraryFactoryFactory
{
protected $_accounts;
public function getAccountById($id) {
$sets = $this->getAccounts();
if (isset($sets[$id]))
{
return $sets[$id];
}
return null;
}
/**
*
*
* @return EventgalleryLibraryGooglephotosaccount[]
*/
public function getUsableAccounts() {
return array_filter($this->getAccounts(), function(/** @var EventgalleryLibraryGooglephotosaccount $account */ $account) {
return $account->isUsable();
});
}
/**
* @return EventgalleryLibraryGooglephotosaccount[]
*/
public function getAccounts() {
if ($this->_accounts == null) {
$db = $this->db;
$query = $db->getQuery(true);
$query->select('*');
$query->from('#__eventgallery_googlephotos_account');
$query->order('ordering');
$db->setQuery($query);
$items = $db->loadObjectList();
$this->_accounts = array();
foreach ($items as $item) {
/**
* @var EventgalleryLibraryGooglephotosaccount $itemObject
*/
$itemObject = new EventgalleryLibraryGooglephotosaccount($item);
$this->_accounts[$itemObject->getId()] = $itemObject;
}
}
return $this->_accounts;
}
}