be3eb9b8e7
Cross-posting Joomla content to social media, email marketing, and chat platforms. Plugin-based service architecture with custom mokojoomcross plugin group. 14 sub-extensions: - com_mokojoomcross (admin component: dashboard, posts, services, logs) - plg_system_mokojoomcross (triggers cross-posting on article publish) - plg_content_mokojoomcross (admin article status badges) - plg_webservices_mokojoomcross (REST API) - 9 service plugins: facebook, twitter, linkedin, mastodon, bluesky, mailchimp, telegram, discord, slack Includes Perfect Publisher Pro migration tool, message templates with placeholders, post queue with retry logic, and default/custom bot modes for services supporting universal bots. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
76 lines
2.3 KiB
PHP
76 lines
2.3 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 PostsModel extends ListModel
|
|
{
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @param array $config Configuration array
|
|
*/
|
|
public function __construct($config = [])
|
|
{
|
|
if (empty($config['filter_fields'])) {
|
|
$config['filter_fields'] = [
|
|
'id', 'a.id',
|
|
'article_id', 'a.article_id',
|
|
'service_id', 'a.service_id',
|
|
'status', 'a.status',
|
|
'created', 'a.created',
|
|
'posted_at', 'a.posted_at',
|
|
];
|
|
}
|
|
|
|
parent::__construct($config);
|
|
}
|
|
|
|
/**
|
|
* Build an SQL query to load the list data.
|
|
*
|
|
* @return \Joomla\Database\QueryInterface
|
|
*/
|
|
protected function getListQuery()
|
|
{
|
|
$db = $this->getDatabase();
|
|
$query = $db->getQuery(true);
|
|
|
|
$query->select('a.*')
|
|
->select($db->quoteName('c.title', 'article_title'))
|
|
->select($db->quoteName('s.title', 'service_title'))
|
|
->select($db->quoteName('s.service_type'))
|
|
->from($db->quoteName('#__mokojoomcross_posts', 'a'))
|
|
->join('LEFT', $db->quoteName('#__content', 'c')
|
|
. ' ON ' . $db->quoteName('c.id') . ' = ' . $db->quoteName('a.article_id'))
|
|
->join('LEFT', $db->quoteName('#__mokojoomcross_services', 's')
|
|
. ' ON ' . $db->quoteName('s.id') . ' = ' . $db->quoteName('a.service_id'));
|
|
|
|
// Filter by status
|
|
$status = $this->getState('filter.status');
|
|
|
|
if (!empty($status)) {
|
|
$query->where($db->quoteName('a.status') . ' = ' . $db->quote($status));
|
|
}
|
|
|
|
// Ordering
|
|
$orderCol = $this->state->get('list.ordering', 'a.created');
|
|
$orderDirn = $this->state->get('list.direction', 'DESC');
|
|
$query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn));
|
|
|
|
return $query;
|
|
}
|
|
}
|