Skip to content

Commit

Permalink
Issue techjoomla#48 chore: Log Email details in DB table - Tj Notific…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
punambaravkar committed Jun 28, 2019
1 parent f077d79 commit ef61de7
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 55 deletions.
3 changes: 3 additions & 0 deletions src/com_tjnotifications/admin/sql/install.mysql.utf8.sql
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ CREATE TABLE IF NOT EXISTS `#__tjnotification_logs` (
`date` date NOT NULL,
`state` int(11) NOT NULL,
`params` text NOT NULL,
`priority`int(11) NOT NULL,
`message` text NOT NULL,
`category` text NOT NULL,
PRIMARY KEY (`id`)
)
DEFAULT CHARSET=utf8
Expand Down
4 changes: 4 additions & 0 deletions src/com_tjnotifications/admin/sql/updates/mysql/1.1.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ CREATE TABLE IF NOT EXISTS `#__tjnotification_logs` (
`date` date NOT NULL,
`state` int(11) NOT NULL,
`params` text NOT NULL,
`priority`int(11) NOT NULL,
`message` text NOT NULL,
`category` text NOT NULL,
PRIMARY KEY (`id`)
)
DEFAULT CHARSET=utf8
AUTO_INCREMENT=0 ;

33 changes: 33 additions & 0 deletions src/com_tjnotifications/admin/views/logs/tmpl/body.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* @package Com_Tjnotifications
* @copyright Copyright (c) 2009-2019 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
*/

// No direct access to this file
defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;
use Joomla\CMS\Factory;

$jinput = Factory::getApplication()->input;
$logId = $jinput->get('id', 0, 'INT');

if($logId)
{
Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjnotifications/tables');
$logTable = Table::getInstance('Log', 'TjnotificationsTable');
$logTable->load(array('id' => $logId));
}
?>
<div>
<h4 class="modal-title"><?php echo
JText::_("COM_TJNOTIFICATIONS_FIELD_EMAIL_BODY_LABEL");
?></h4>
</div>
<div class="col-xs-12">
<p><?php echo $logTable->body; ?>
</p>
</div>
</div>
13 changes: 9 additions & 4 deletions src/com_tjnotifications/admin/views/logs/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<div id="j-main-container">
<?php endif;?>


<?php
echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('filterButton' => 1,'filtersHidden' => 0)));?>

Expand Down Expand Up @@ -117,7 +116,7 @@
?>
</td>
<td class="">
<a id="modal_info" class="modal" href="<?php echo JRoute::_('index.php?option=com_tjnotifications&tmpl=component&subject=true&view=logs&layout=popup&id='. $row->id); ?>"><?php echo htmlspecialchars($row->subject, ENT_COMPAT, 'UTF-8'); ?></a>
<a id="modal_info" class="modal" href="<?php echo JRoute::_('index.php?option=com_tjnotifications&tmpl=component&view=logs&layout=body&id='. $row->id); ?>"><?php echo htmlspecialchars($row->subject, ENT_COMPAT, 'UTF-8'); ?></a>

<td class="center">
<?php echo htmlspecialchars($row->to, ENT_COMPAT, 'UTF-8'); ?>
Expand Down Expand Up @@ -149,9 +148,15 @@
<td class="center">
<?php echo htmlspecialchars($row->from, ENT_COMPAT, 'UTF-8'); ?>
</td>
<td class="">
<a id="modal_info" class="modal" href="<?php echo JRoute::_('index.php?option=com_tjnotifications&tmpl=component&view=logs&layout=popup&id='. $row->id); ?>"><?php echo JText::_("COM_TJNOTIFICATIONS_VIEW_PARAMS_POPUP");?></a>
<td class="center">
<?php if(!empty($row->params)){ ?>
<a id="modal_info" class="modal" href="<?php echo JRoute::_('index.php?option=com_tjnotifications&tmpl=component&view=logs&layout=param&id='. $row->id); ?>"><?php echo JText::_("COM_TJNOTIFICATIONS_VIEW_PARAMS_POPUP");?></a>
</a>
<?php }
else
{
echo JText::_('COM_TJNOTIFICATIONS_EMPTY_PARAMS');
}?>
</td>
</tr>
<?php endforeach; ?>
Expand Down
33 changes: 33 additions & 0 deletions src/com_tjnotifications/admin/views/logs/tmpl/param.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* @package Com_Tjnotifications
* @copyright Copyright (c) 2009-2019 TechJoomla. All rights reserved.
* @license GNU General Public License version 2 or later.
*/

// No direct access to this file
defined('_JEXEC') or die;

use Joomla\CMS\Table\Table;
use Joomla\CMS\Factory;

$jinput = Factory::getApplication()->input;
$logId = $jinput->get('id', 0, 'INT');

if($logId)
{
Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjnotifications/tables');
$logTable = Table::getInstance('Log', 'TjnotificationsTable');
$logTable->load(array('id' => $logId));
}
?>
<div>
<h4 class="modal-title"><?php echo
JText::_("COM_TJNOTIFICATIONS_VIEW_PARAMS_POPUP");
?></h4>
</div>
<div class="col-xs-12">
<p><?php echo $logTable->params; ?>
</p>
</div>
</div>
50 changes: 0 additions & 50 deletions src/com_tjnotifications/admin/views/logs/tmpl/popup.php

This file was deleted.

3 changes: 2 additions & 1 deletion src/com_tjnotifications/admin/views/logs/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

defined('_JEXEC') or die;
jimport('joomla.application.component.view');
JLoader::register('TjnotificationsHelper', JPATH_ADMINISTRATOR . '/components/com_tjnotifications/helpers/tjnotifications.php');
use Joomla\CMS\MVC\View\HtmlView;

/**
Expand Down Expand Up @@ -61,7 +62,7 @@ protected function addToolBar()

if ($this->canDo->get('core.export'))
{
// Adding techjoomla library for csv Export
// adding techjoomla library for csv Export
jimport('techjoomla.tjtoolbar.button.csvexport');

$bar = JToolBar::getInstance('toolbar');
Expand Down

0 comments on commit ef61de7

Please sign in to comment.