| Current Path : /proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/4052773/cwd/ |
| Current File : //proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/4052773/cwd/akeebasubs.php.tar |
home/digilove/public_html/plugins/system/nnframework/fields/akeebasubs.php 0000644 00000005224 15235560242 0023231 0 ustar 00 <?php
/**
* Element: AkeebaSubs
* Displays a multiselectbox of available Akeeba Subsriptons levels
*
* @package NoNumber Framework
* @version 14.11.6
*
* @author Peter van Westen <peter@nonumber.nl>
* @link http://www.nonumber.nl
* @copyright Copyright © 2014 NoNumber All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php';
class JFormFieldNN_AkeebaSubs extends JFormField
{
public $type = 'AkeebaSubs';
private $params = null;
private $db = null;
protected function getInput()
{
if (!nnFrameworkFunctions::extensionInstalled('akeebasubs'))
{
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_AKEEBASUBS')) . '</fieldset>';
}
$this->params = $this->element->attributes();
$this->db = JFactory::getDBO();
$group = $this->get('group', 'categories');
$tables = $this->db->getTableList();
if (!in_array($this->db->getPrefix() . 'akeebasubs_' . $group, $tables))
{
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_AKEEBASUBS')) . '</fieldset>';
}
if (!is_array($this->value))
{
$this->value = explode(',', $this->value);
}
$options = $this->{'get' . $group}();
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
switch ($group)
{
case 'categories':
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
default:
return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
}
}
function getLevels()
{
$query = $this->db->getQuery(true)
->select('l.akeebasubs_level_id as id, l.title AS name, l.enabled as published')
->from('#__akeebasubs_levels AS l')
->where('l.enabled > -1')
->order('l.title, l.akeebasubs_level_id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
// assemble items to the array
$options = array();
foreach ($list as $item)
{
$item->name = nnText::prepareSelectItem($item->name, $item->published);
$options[] = JHtml::_('select.option', $item->id, $item->name, 'value', 'text', 0);
}
return $options;
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
home/digilove/public_html/110/plugins/system/nnframework/fields/akeebasubs.php 0000644 00000005224 15235662164 0023540 0 ustar 00 <?php
/**
* Element: AkeebaSubs
* Displays a multiselectbox of available Akeeba Subsriptons levels
*
* @package NoNumber Framework
* @version 14.11.6
*
* @author Peter van Westen <peter@nonumber.nl>
* @link http://www.nonumber.nl
* @copyright Copyright © 2014 NoNumber All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php';
class JFormFieldNN_AkeebaSubs extends JFormField
{
public $type = 'AkeebaSubs';
private $params = null;
private $db = null;
protected function getInput()
{
if (!nnFrameworkFunctions::extensionInstalled('akeebasubs'))
{
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_AKEEBASUBS')) . '</fieldset>';
}
$this->params = $this->element->attributes();
$this->db = JFactory::getDBO();
$group = $this->get('group', 'categories');
$tables = $this->db->getTableList();
if (!in_array($this->db->getPrefix() . 'akeebasubs_' . $group, $tables))
{
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_AKEEBASUBS')) . '</fieldset>';
}
if (!is_array($this->value))
{
$this->value = explode(',', $this->value);
}
$options = $this->{'get' . $group}();
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
switch ($group)
{
case 'categories':
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
default:
return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
}
}
function getLevels()
{
$query = $this->db->getQuery(true)
->select('l.akeebasubs_level_id as id, l.title AS name, l.enabled as published')
->from('#__akeebasubs_levels AS l')
->where('l.enabled > -1')
->order('l.title, l.akeebasubs_level_id');
$this->db->setQuery($query);
$list = $this->db->loadObjectList();
// assemble items to the array
$options = array();
foreach ($list as $item)
{
$item->name = nnText::prepareSelectItem($item->name, $item->published);
$options[] = JHtml::_('select.option', $item->id, $item->name, 'value', 'text', 0);
}
return $options;
}
private function get($val, $default = '')
{
return (isset($this->params[$val]) && (string) $this->params[$val] != '') ? (string) $this->params[$val] : $default;
}
}
home/digilove/public_html/plugins/system/nrframework/fields/akeebasubs.php 0000644 00000003171 15241444605 0023235 0 ustar 00 <?php
/**
* @author Tassos Marinos <info@tassos.gr>
* @link https://www.tassos.gr
* @copyright Copyright © 2024 Tassos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
// No direct access to this file
//
defined('_JEXEC') or die;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
class JFormFieldAkeebaSubs extends ListField
{
/**
* Method to get a list of options for a list input.
*
* @return array An array of options.
*/
protected function getOptions()
{
if (!NRFramework\Extension::isInstalled('akeebasubs'))
{
return;
}
$lists = $this->getLevels();
if (!count($lists))
{
return;
}
$options = array();
foreach ($lists as $option)
{
$options[] = HTMLHelper::_('select.option', $option->id, $option->name);
}
return array_merge(parent::getOptions(), $options);
}
/**
* Retrieve all Akeeba Subscription Levels
*
* @return array Subscription Levels
*/
private function getLevels()
{
// Get a db connection.
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('l.akeebasubs_level_id as id, l.title AS name, l.enabled as published')
->from('#__akeebasubs_levels AS l')
->where('l.enabled > -1')
->order('l.title, l.akeebasubs_level_id');
$db->setQuery($query);
return $db->loadObjectList();
}
}