diff --git a/src/com_tjnotifications/admin/access.xml b/src/com_tjnotifications/admin/access.xml index 699cf1ac..c2b25c03 100644 --- a/src/com_tjnotifications/admin/access.xml +++ b/src/com_tjnotifications/admin/access.xml @@ -2,23 +2,14 @@
+ - - - - - - -
-
-
-
diff --git a/src/com_tjnotifications/admin/config.xml b/src/com_tjnotifications/admin/config.xml index 69ae77e9..0e598258 100644 --- a/src/com_tjnotifications/admin/config.xml +++ b/src/com_tjnotifications/admin/config.xml @@ -1,7 +1,7 @@
- + diff --git a/src/com_tjnotifications/admin/helpers/tjnotifications.php b/src/com_tjnotifications/admin/helpers/tjnotifications.php index d15d15bd..435506df 100644 --- a/src/com_tjnotifications/admin/helpers/tjnotifications.php +++ b/src/com_tjnotifications/admin/helpers/tjnotifications.php @@ -17,7 +17,7 @@ * @subpackage com_tjnotifications * @since 2.2 */ -class TjnotificationsHelper +class TjnotificationsHelper extends JHelperContent { /** * Configure the Linkbar. @@ -63,5 +63,35 @@ public static function addSubmenu($view = '') } } } + + JHtmlSidebar::addEntry( + JText::_('COM_TJNOTIFICATIONS_TITLE_NOTIFICATIONS'), + 'index.php?option=com_tjnotifications&view=notifications', + $view == 'rounds' + ); + + JHtmlSidebar::addEntry( + JText::_('COM_TJNOTIFICATIONS_TITLE_NOTIFICATIONLOGS'), + 'index.php?option=com_tjnotifications&view=logs', + $view == 'logs' + ); + } + + /** + * Gets a list of the actions that can be performed. + * + * @param string $component The component name. + * @param string $section The access section name. + * @param integer $id The item ID. + * + * @return JObject + * + * @since 3.2 + */ + public static function getActions($component = 'com_tjnotifications', $section = '', $id = 0) + { + $result = parent::getActions($component, $section, $id); + + return $result; } } diff --git a/src/com_tjnotifications/admin/models/forms/filter_logs.xml b/src/com_tjnotifications/admin/models/forms/filter_logs.xml index ae303ca7..ca379fc4 100644 --- a/src/com_tjnotifications/admin/models/forms/filter_logs.xml +++ b/src/com_tjnotifications/admin/models/forms/filter_logs.xml @@ -15,11 +15,54 @@ description="COM_TJNOTIFICATIONS_FIELD_CLIENT_DESC" onchange="this.form.submit();" type="sql" + class="inputbox" query="SELECT DISTINCT(client) FROM `#__tj_notification_templates`" key_field="client" value_field="client" > + + + + + + + + + + + + + + diff --git a/src/com_tjnotifications/admin/models/logs.php b/src/com_tjnotifications/admin/models/logs.php index 7278ba8f..f0c8ccad 100644 --- a/src/com_tjnotifications/admin/models/logs.php +++ b/src/com_tjnotifications/admin/models/logs.php @@ -31,8 +31,11 @@ public function __construct($config = array()) { $config['filter_fields'] = array( 'id', - 'client', + 'to', 'key', + 'from', + 'cc', + 'provider', 'state', 'subject', 'search', @@ -79,9 +82,6 @@ protected function populateState($ordering = 'id', $direction = 'asc') // Load the filter search $search = $app->getUserStateFromRequest($this->context . 'filter.search', 'filter_search'); $this->setState('filter.search', $search); - // Load the filter state - $published = $app->getUserStateFromRequest($this->context . 'filter.state', 'filter_state', '', 'string'); - $this->setState('filter.state', $published); parent::populateState($ordering, $direction); @@ -107,47 +107,54 @@ protected function populateState($ordering = 'id', $direction = 'asc') */ protected function getListQuery() { - $extension = JFactory::getApplication()->input->get('extension', '', 'word'); - $parts = explode('.', $extension); - - // Extract the component name - $this->setState('filter.component', $parts[0]); - - // Extract the optional section name - $this->setState('filter.section', (count($parts) > 1) ? $parts[1] : null); - // Initialize variables. $db = JFactory::getDbo(); $query = $db->getQuery(true); // Create the base select statement. $query->select('*') - ->from($db->quoteName('#__tjnotification_logs')); + ->from($db->quoteName('#__tjnotification_logs', 'cs')); $search = $this->getState('filter.search'); if (!empty($search)) { $like = $db->quote('%' . $search . '%'); - $query->where($db->quoteName('client') . ' LIKE ' . $like . ' OR ' . $db->quoteName('key') . ' LIKE ' . $like); + $query->where($db->quoteName('subject') . ' LIKE ' . $like . ' OR ' . $db->quoteName('from') . ' LIKE ' . $like . ' OR ' . $db->quoteName('to') . ' LIKE ' . $like); } - if ($extension) + // Filter by client + $client = $this->getState('filter.client'); + if ($client) { - $query->where($db->quoteName('client') . ' = ' . $db->quote($extension)); + $client = $db->quote($client); + $query->where('client = ' . $client); } - else + + // Filter by provider + $provider = $this->getState('filter.provider'); + + if ($provider) { - // Filter by client - $client = $this->getState('filter.client'); - $key = $this->getState('filter.key'); + $provider = $db->quote($provider); + $query->where('provider = ' . $provider); + } - if (!empty($client) && empty($key)) - { - $query->where($db->quoteName('client') . ' = ' . $db->quote($client)); - } + // Filter by key + $key = $this->getState('filter.key'); + if ($key) + { + $key = $db->quote($key); + $query->where('cs.key = ' . $key); } + // Filter by client + $state = $this->getState('filter.state'); + + $state = $db->quote($state); + $query->where('cs.state = ' . $state); + + $orderCol = $this->getState('list.ordering'); $orderDirn = $this->getState('list.direction'); @@ -158,40 +165,4 @@ protected function getListQuery() return $query; } - - /** - * Method to get a store id based on model configuration state. - * - * This is necessary because the model is used by the component and - * different modules that might need different sets of data or different - * ordering requirements. - * - * @param string $id A prefix for the store id. - * - * @return string A store id. - * - * @since 1.1.0 - */ - protected function getStoreId($id = '') - { - // Compile the store id. - $id .= ':' . $this->getState('filter.search'); - $id .= ':' . $this->getState('filter.state'); - return parent::getStoreId($id); - } - - - /** - * Method to get a list of articles. - * Overridden to add a check for access levels. - * - * @return mixed An array of data items on success, false on failure. - * - * @since 1.1.0 - */ - public function getItems() - { - $items = parent::getItems(); - return $items; - } } diff --git a/src/com_tjnotifications/admin/sql/install.mysql.utf8.sql b/src/com_tjnotifications/admin/sql/install.mysql.utf8.sql index 0f8608e5..af7a2e16 100644 --- a/src/com_tjnotifications/admin/sql/install.mysql.utf8.sql +++ b/src/com_tjnotifications/admin/sql/install.mysql.utf8.sql @@ -57,6 +57,7 @@ CREATE TABLE IF NOT EXISTS `#__tjnotification_logs` ( `client` varchar(100) NOT NULL, `provider` varchar(100) NOT NULL, `subject` varchar(250) NOT NULL, + `title` varchar(100) NOT NULL, `body` text NOT NULL, `from` varchar(100) NOT NULL, `to` varchar(100) NOT NULL, diff --git a/src/com_tjnotifications/admin/sql/updates/mysql/1.1.0.sql b/src/com_tjnotifications/admin/sql/updates/mysql/1.1.0.sql index c50efda6..8e8f032b 100644 --- a/src/com_tjnotifications/admin/sql/updates/mysql/1.1.0.sql +++ b/src/com_tjnotifications/admin/sql/updates/mysql/1.1.0.sql @@ -7,6 +7,7 @@ CREATE TABLE IF NOT EXISTS `#__tjnotification_logs` ( `client` varchar(100) NOT NULL, `provider` varchar(100) NOT NULL, `subject` varchar(250) NOT NULL, + `title` varchar(100) NOT NULL, `body` text NOT NULL, `from` varchar(100) NOT NULL, `to` varchar(100) NOT NULL, diff --git a/src/com_tjnotifications/admin/tables/log.php b/src/com_tjnotifications/admin/tables/log.php index 3780a7da..f20e4d25 100644 --- a/src/com_tjnotifications/admin/tables/log.php +++ b/src/com_tjnotifications/admin/tables/log.php @@ -8,13 +8,14 @@ // No direct access to this file defined('_JEXEC') or die; +use Joomla\CMS\Table\Table; /** * table class for notification * * @since 1.6 */ -class TjnotificationsTableLog extends JTable +class TjnotificationsTableLog extends Table { /** * Constructor diff --git a/src/com_tjnotifications/admin/views/logs/tmpl/default.php b/src/com_tjnotifications/admin/views/logs/tmpl/default.php index 403fc566..7401bf74 100644 --- a/src/com_tjnotifications/admin/views/logs/tmpl/default.php +++ b/src/com_tjnotifications/admin/views/logs/tmpl/default.php @@ -9,6 +9,7 @@ defined('_JEXEC') or die; use Joomla\CMS\Layout\LayoutHelper; +include 'header.html'; JHtml::_('bootstrap.tooltip'); JHtml::_('behavior.multiselect'); @@ -17,6 +18,12 @@ $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> +
sidebar)):?> @@ -30,10 +37,7 @@ ";print_r($this);die; - -//echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('filterButton' => 1,'filtersHidden' => 0)));?> - +echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('filterButton' => 1,'filtersHidden' => 0)));?>
pagination->getLimitBox(); ?>
- - +
+
+ - - - - @@ -101,14 +106,15 @@ - - + - - - - + +
+ + - + + - + - + - + - + - + + - + - + id); ?> + title, ENT_COMPAT, 'UTF-8'); + ?> + - subject; ?> + subject, ENT_COMPAT, 'UTF-8');?> - key; ?> + + to, ENT_COMPAT, 'UTF-8'); ?> - provider; ?> + cc, ENT_COMPAT, 'UTF-8'); ?> - from; ?> + bcc, ENT_COMPAT, 'UTF-8'); ?> - to; ?> + date, ENT_COMPAT, 'UTF-8');?> - cc; ?> + state, ENT_COMPAT, 'UTF-8'); ?> - bcc; ?> + key, ENT_COMPAT, 'UTF-8'); + ?> - date; ?> + provider, ENT_COMPAT, 'UTF-8'); ?> - state; ?> + from, ENT_COMPAT, 'UTF-8'); ?> @@ -181,25 +188,27 @@ ?> - -
+ pagination->getListFooter(); ?> - diff --git a/src/com_tjnotifications/admin/views/logs/view.html.php b/src/com_tjnotifications/admin/views/logs/view.html.php index e060f233..c7902f15 100644 --- a/src/com_tjnotifications/admin/views/logs/view.html.php +++ b/src/com_tjnotifications/admin/views/logs/view.html.php @@ -58,11 +58,6 @@ protected function addToolBar() { $title = JText::_('COM_TJNOTIFICATIONS_LOGS'); - if ($this->pagination->total) - { - $title .= ""; - } - JToolBarHelper::title($title, 'log'); if ($this->canDo->get('core.export')) @@ -73,9 +68,9 @@ protected function addToolBar() $bar = JToolBar::getInstance('toolbar'); $message = array(); - $message['success'] = JText::_("COM_TJLMS_EXPORT_FILE_SUCCESS"); - $message['error'] = JText::_("COM_TJLMS_EXPORT_FILE_ERROR"); - $message['inprogress'] = JText::_("COM_TJLMS_EXPORT_FILE_NOTICE"); + $message['success'] = JText::_("COM_TJNOTIFICATIONS_EXPORT_FILE_SUCCESS"); + $message['error'] = JText::_("COM_TJNOTIFICATIONS_EXPORT_FILE_ERROR"); + $message['inprogress'] = JText::_("COM_TJNOTIFICATIONS_EXPORT_FILE_NOTICE"); $bar->appendButton('CsvExport', $message); }