Stable release of v3.2.0-beta1
Move beta to main repo. Fix #1053 so that the right and left tabs display correctly in Joomla 4&5.
This commit is contained in:
@ -12,12 +12,18 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\MVC\Model\ListModel;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Helper\TagsHelper;
|
||||
use VDM\Joomla\Utilities\FormHelper as JCBFormHelper;
|
||||
use VDM\Joomla\Componentbuilder\Utilities\FilterHelper as JCBFilterHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
|
||||
/**
|
||||
@ -25,10 +31,10 @@ use VDM\Joomla\Utilities\JsonHelper;
|
||||
*/
|
||||
class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
{
|
||||
public function __construct($config = array())
|
||||
public function __construct($config = [])
|
||||
{
|
||||
if (empty($config['filter_fields']))
|
||||
{
|
||||
{
|
||||
$config['filter_fields'] = array(
|
||||
'a.id','id',
|
||||
'a.published','published',
|
||||
@ -77,14 +83,14 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
);
|
||||
// no languages found notice
|
||||
$options = array(
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_LANGUAGES_FOUND') . ' -'
|
||||
'' => '- ' . Text::_('COM_COMPONENTBUILDER_NO_LANGUAGES_FOUND') . ' -'
|
||||
);
|
||||
// check if we have languages set
|
||||
if (($languages = JCBFilterHelper::languages()) !== null)
|
||||
{
|
||||
$options = array(
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_TRANSLATED_IN') . ' -',
|
||||
'all' => JText::_('COM_COMPONENTBUILDER_EVERY_LANGUAGE')
|
||||
'' => '- ' . Text::_('COM_COMPONENTBUILDER_TRANSLATED_IN') . ' -',
|
||||
'all' => Text::_('COM_COMPONENTBUILDER_EVERY_LANGUAGE')
|
||||
);
|
||||
|
||||
$options = array_merge($options, $languages);
|
||||
@ -106,14 +112,14 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
);
|
||||
// no languages found notice
|
||||
$options = array(
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_LANGUAGES_FOUND') . ' -'
|
||||
'' => '- ' . Text::_('COM_COMPONENTBUILDER_NO_LANGUAGES_FOUND') . ' -'
|
||||
);
|
||||
// check if we have languages set
|
||||
if ($languages)
|
||||
{
|
||||
$options = array(
|
||||
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NOT_TRANSLATED_IN') . ' -',
|
||||
'none' => JText::_('COM_COMPONENTBUILDER_ANY_LANGUAGE')
|
||||
'' => '- ' . Text::_('COM_COMPONENTBUILDER_NOT_TRANSLATED_IN') . ' -',
|
||||
'none' => Text::_('COM_COMPONENTBUILDER_ANY_LANGUAGE')
|
||||
);
|
||||
|
||||
$options = array_merge($options, $languages);
|
||||
@ -143,7 +149,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
*/
|
||||
protected function populateState($ordering = null, $direction = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$app = Factory::getApplication();
|
||||
|
||||
// Adjust the context to support modal layouts.
|
||||
if ($layout = $app->input->get('layout'))
|
||||
@ -186,7 +192,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
// List state information.
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
@ -201,12 +207,12 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
$items = parent::getItems();
|
||||
|
||||
// Set values to display correctly.
|
||||
if (ComponentbuilderHelper::checkArray($items))
|
||||
if (UtilitiesArrayHelper::check($items))
|
||||
{
|
||||
// Get the user object if not set.
|
||||
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
|
||||
if (!isset($user) || !ObjectHelper::check($user))
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$user = Factory::getUser();
|
||||
}
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
@ -274,22 +280,22 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
unset($item->translation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
* @return string An SQL query
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Get the user object.
|
||||
$user = JFactory::getUser();
|
||||
$user = Factory::getUser();
|
||||
// Create a new query object.
|
||||
$db = JFactory::getDBO();
|
||||
$db = Factory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select some fields
|
||||
@ -369,7 +375,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
{
|
||||
$query->where('a.access = ' . (int) $_access);
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkArray($_access))
|
||||
elseif (UtilitiesArrayHelper::check($_access))
|
||||
{
|
||||
// Secure the array for the query
|
||||
$_access = ArrayHelper::toInteger($_access);
|
||||
@ -399,10 +405,12 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
|
||||
|
||||
// Add the list ordering clause.
|
||||
$orderCol = $this->state->get('list.ordering', 'a.id');
|
||||
$orderDirn = $this->state->get('list.direction', 'desc');
|
||||
$orderCol = $this->getState('list.ordering', 'a.id');
|
||||
$orderDirn = $this->getState('list.direction', 'desc');
|
||||
if ($orderCol != '')
|
||||
{
|
||||
// Check that the order direction is valid encase we have a field called direction as part of filers.
|
||||
$orderDirn = (is_string($orderDirn) && in_array(strtolower($orderDirn), ['asc', 'desc'])) ? $orderDirn : 'desc';
|
||||
$query->order($db->escape($orderCol . ' ' . $orderDirn));
|
||||
}
|
||||
|
||||
@ -420,17 +428,17 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
public function getExportData($pks, $user = null)
|
||||
{
|
||||
// setup the query
|
||||
if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks)
|
||||
if (($pks_size = UtilitiesArrayHelper::check($pks)) !== false || 'bulk' === $pks)
|
||||
{
|
||||
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
|
||||
$_export = true;
|
||||
// Get the user object if not set.
|
||||
if (!isset($user) || !ComponentbuilderHelper::checkObject($user))
|
||||
if (!isset($user) || !ObjectHelper::check($user))
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$user = Factory::getUser();
|
||||
}
|
||||
// Create a new query object.
|
||||
$db = JFactory::getDBO();
|
||||
$db = Factory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select some fields
|
||||
@ -525,7 +533,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
$items = $db->loadObjectList();
|
||||
|
||||
// Set values to display correctly.
|
||||
if (ComponentbuilderHelper::checkArray($items))
|
||||
if (UtilitiesArrayHelper::check($items))
|
||||
{
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
@ -550,7 +558,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
}
|
||||
// Add headers to items array.
|
||||
$headers = $this->getExImPortHeaders();
|
||||
if (ComponentbuilderHelper::checkObject($headers))
|
||||
if (ObjectHelper::check($headers))
|
||||
{
|
||||
array_unshift($items,$headers);
|
||||
}
|
||||
@ -619,7 +627,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
{
|
||||
$languages = ComponentbuilderHelper::getVars('language', 1, 'published', 'langtag');
|
||||
// start setup of headers
|
||||
$headers = new stdClass();
|
||||
$headers = new \stdClass();
|
||||
$headers->id = 'id';
|
||||
$headers->Source = 'Source';
|
||||
// add the languages
|
||||
@ -632,7 +640,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
}
|
||||
return $headers;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
*
|
||||
@ -647,13 +655,13 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
$id .= ':' . $this->getState('filter.published');
|
||||
// Check if the value is an array
|
||||
$_access = $this->getState('filter.access');
|
||||
if (ComponentbuilderHelper::checkArray($_access))
|
||||
if (UtilitiesArrayHelper::check($_access))
|
||||
{
|
||||
$id .= ':' . implode(':', $_access);
|
||||
}
|
||||
// Check if this is only an number or string
|
||||
elseif (is_numeric($_access)
|
||||
|| ComponentbuilderHelper::checkString($_access))
|
||||
|| StringHelper::check($_access))
|
||||
{
|
||||
$id .= ':' . $_access;
|
||||
}
|
||||
@ -668,19 +676,18 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
/**
|
||||
* Build an SQL query to checkin all items left checked out longer then a set time.
|
||||
*
|
||||
* @return a bool
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function checkInNow()
|
||||
protected function checkInNow(): bool
|
||||
{
|
||||
// Get set check in time
|
||||
$time = JComponentHelper::getParams('com_componentbuilder')->get('check_in');
|
||||
$time = ComponentHelper::getParams('com_componentbuilder')->get('check_in');
|
||||
|
||||
if ($time)
|
||||
{
|
||||
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
$db = Factory::getDbo();
|
||||
// Reset query.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('*');
|
||||
@ -692,7 +699,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
// Get Yesterdays date.
|
||||
$date = JFactory::getDate()->modify($time)->toSql();
|
||||
$date = Factory::getDate()->modify($time)->toSql();
|
||||
// Reset query.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
@ -713,7 +720,7 @@ class ComponentbuilderModelLanguage_translations extends ListModel
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
$db->execute();
|
||||
return $db->execute();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user