37d325f1ed
Generic: Repo Health / Release configuration (push) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
Generic: Repo Health / Site Health (push) Has been cancelled
Generic: Repo Health / Access control (push) Has been cancelled
Universal: Auto Version Bump / Version Bump (push) Has been cancelled
Full rename of all extension elements, namespaces, language keys, database tables, file names, and directory names: - pkg_mokobackup → pkg_mokojoombackup - com_mokobackup → com_mokojoombackup - plg_*_mokobackup → plg_*_mokojoombackup - MokoBackup namespace → MokoJoomBackup - #__mokobackup_ tables → #__mokojoombackup_ - COM_MOKOBACKUP_ keys → COM_MOKOJOOMBACKUP_ Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
68 lines
1.7 KiB
PHP
68 lines
1.7 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @package MokoJoomBackup
|
|
* @subpackage com_mokojoombackup
|
|
* @author Moko Consulting <hello@mokoconsulting.tech>
|
|
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
|
* @license GNU General Public License version 3 or later; see LICENSE
|
|
*/
|
|
|
|
namespace Joomla\Component\MokoJoomBackup\Administrator\Model;
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
use Joomla\CMS\MVC\Model\ListModel;
|
|
use Joomla\Database\QueryInterface;
|
|
|
|
class ProfilesModel extends ListModel
|
|
{
|
|
public function __construct($config = [])
|
|
{
|
|
if (empty($config['filter_fields'])) {
|
|
$config['filter_fields'] = [
|
|
'id', 'a.id',
|
|
'title', 'a.title',
|
|
'backup_type', 'a.backup_type',
|
|
'published', 'a.published',
|
|
'ordering', 'a.ordering',
|
|
];
|
|
}
|
|
|
|
parent::__construct($config);
|
|
}
|
|
|
|
protected function getListQuery(): QueryInterface
|
|
{
|
|
$db = $this->getDatabase();
|
|
$query = $db->getQuery(true);
|
|
|
|
$query->select('a.*')
|
|
->from($db->quoteName('#__mokojoombackup_profiles', 'a'));
|
|
|
|
$published = $this->getState('filter.published');
|
|
|
|
if (is_numeric($published)) {
|
|
$query->where($db->quoteName('a.published') . ' = ' . (int) $published);
|
|
}
|
|
|
|
$search = $this->getState('filter.search');
|
|
|
|
if (!empty($search)) {
|
|
$search = $db->quote('%' . $db->escape(trim($search), true) . '%');
|
|
$query->where('(' . $db->quoteName('a.title') . ' LIKE ' . $search . ')');
|
|
}
|
|
|
|
$orderCol = $this->state->get('list.ordering', 'a.ordering');
|
|
$orderDir = $this->state->get('list.direction', 'ASC');
|
|
$query->order($db->escape($orderCol) . ' ' . $db->escape($orderDir));
|
|
|
|
return $query;
|
|
}
|
|
|
|
protected function populateState($ordering = 'a.ordering', $direction = 'ASC'): void
|
|
{
|
|
parent::populateState($ordering, $direction);
|
|
}
|
|
}
|