342f6fa3b8
#12 LinkedIn: plugin config form (OAuth client ID/secret, redirect URI) #13 Mastodon: plugin config (default instance, visibility, hashtags) #14 Bluesky: plugin config (default PDS URL, auto link cards) #15 Mailchimp: plugin config (sender name/email, auto-send toggle) #17 Template management: full CRUD with TemplatesController, TemplateController, TemplatesModel, TemplateModel, TemplateTable. List view with service type badges and body preview. Edit view with placeholder reference panel showing all 8 placeholders. Filter form with search, published, service_type filters. Added Templates submenu item and dashboard quick link. #18 Logs: added filter form with level and search filters. #16 WebServices: implementation already in place from scaffold, routes registered for posts and services CRUD. Admin component now has 5 submenu items: Dashboard, Post Queue, Services, Templates, Activity Logs. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
62 lines
1.7 KiB
PHP
62 lines
1.7 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @package MokoJoomCross
|
|
* @subpackage com_mokojoomcross
|
|
* @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
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
|
|
namespace Joomla\Component\MokoJoomCross\Administrator\Model;
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
use Joomla\CMS\MVC\Model\ListModel;
|
|
|
|
class TemplatesModel extends ListModel
|
|
{
|
|
public function __construct($config = [])
|
|
{
|
|
if (empty($config['filter_fields'])) {
|
|
$config['filter_fields'] = [
|
|
'id', 'a.id',
|
|
'title', 'a.title',
|
|
'service_type', 'a.service_type',
|
|
'published', 'a.published',
|
|
'ordering', 'a.ordering',
|
|
];
|
|
}
|
|
|
|
parent::__construct($config);
|
|
}
|
|
|
|
protected function getListQuery()
|
|
{
|
|
$db = $this->getDatabase();
|
|
$query = $db->getQuery(true);
|
|
|
|
$query->select('a.*')
|
|
->from($db->quoteName('#__mokojoomcross_templates', 'a'));
|
|
|
|
$published = $this->getState('filter.published');
|
|
|
|
if (is_numeric($published)) {
|
|
$query->where($db->quoteName('a.published') . ' = ' . (int) $published);
|
|
}
|
|
|
|
$serviceType = $this->getState('filter.service_type');
|
|
|
|
if (!empty($serviceType)) {
|
|
$query->where($db->quoteName('a.service_type') . ' = ' . $db->quote($serviceType));
|
|
}
|
|
|
|
$orderCol = $this->state->get('list.ordering', 'a.ordering');
|
|
$orderDirn = $this->state->get('list.direction', 'ASC');
|
|
$query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn));
|
|
|
|
return $query;
|
|
}
|
|
}
|