Skip to content

Commit

Permalink
Issue techjoomla#48 chore: Log Email details in DB table
Browse files Browse the repository at this point in the history
  • Loading branch information
punambaravkar committed Jul 2, 2019
1 parent 7fc56ed commit dd5c000
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 144 deletions.
5 changes: 2 additions & 3 deletions src/com_tjnotifications/admin/views/logs/tmpl/body.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
$jinput = Factory::getApplication()->input;
$logId = $jinput->get('id', 0, 'INT');

if ($logId)
if($logId)
{
Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjnotifications/tables');
$logTable = Table::getInstance('Log', 'TjnotificationsTable');
Expand All @@ -28,8 +28,7 @@
<div>
<?php if ($logTable->id) : ?>
<h3 class="modal-title">
<?php echo Text::_("COM_TJNOTIFICATIONS_FIELD_NOTIFICATION_BODY_LABEL");
?>
<?php echo Text::_("COM_TJNOTIFICATIONS_FIELD_NOTIFICATION_BODY_LABEL"); ?>
</h3>
<div class="col-xs-12">
<?php echo $logTable->body; ?>
Expand Down
256 changes: 127 additions & 129 deletions src/com_tjnotifications/admin/views/logs/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
// No direct access to this file
defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Layout\LayoutHelper;
Expand All @@ -33,140 +34,137 @@
});
</script>
<form action="index.php?option=com_tjnotifications&view=logs" method="post" id="adminForm" name="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php
// Search tools bar
echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('filterButton' => 1,'filtersHidden' => 0)));
?>
<div class="btn-group pull-right hidden-phone">
<label for="limit" class="element-invisible">
<?php echo Text::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC'); ?>
</label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th width="2%" class="">
<input type="checkbox" name="checkall-toggle" value=""
title="<?php echo Text::_('JGLOBAL_CHECK_ALL'); ?>"
onclick="Joomla.checkAll(this)"/>
</th>
<th class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_SUBJECT"), 'subject', $listDirn, $listOrder);?>
</th>
<th class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_BODY"), 'title', $listDirn, $listOrder);?>
</th>
<th width="10%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_TO"), 'to', $listDirn, $listOrder);?>
</th>
<th width="10%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_CC"), 'cc', $listDirn, $listOrder);?>
</th>
<th width="10%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_BCC"), 'bcc', $listDirn, $listOrder);?>
</th>
<th width="10%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_DATE"), 'date', $listDirn, $listOrder);?>
</th>
<th width="" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_STATE"), 'state', $listDirn, $listOrder);?>
</th>
<th width="" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_KEY"), 'key', $listDirn, $listOrder);?>
</th>
<th width="10%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_PROVIDER"), 'provider', $listDirn, $listOrder);?>
</th>
<th width="10%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_FROM"), 'from', $listDirn, $listOrder);?>
</th>
<th width="10%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_PARAMS"), 'params', $listDirn, $listOrder);?>
</th>
<th width="2%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_ID"), 'id', $listDirn, $listOrder);?>
</th>
</tr>
</thead>
<tbody>
<?php if (!empty($this->items)) : ?>
<?php foreach ($this->items as $i => $row) :
?>
<tr>
<td class="">
<?php echo JHtml::_('grid.id', $i, $row->id); ?>
</td>
<td class="">
<?php echo htmlspecialchars($row->subject, ENT_COMPAT, 'UTF-8'); ?>
</td>
<td class="">
<a class="modal notification" href="<?php echo Route::_('index.php?option=com_tjnotifications&tmpl=component&view=logs&layout=body&id='. $row->id); ?>">
<?php echo Text::_("COM_TJNOTIFICATIONS_TITLE_VIEW_CONTENTS");?></a>
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php
// Search tools bar
echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('filterButton' => 1,'filtersHidden' => 0)));
?>
<div class="btn-group pull-right hidden-phone">
<label for="limit" class="element-invisible">
<?php echo Text::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC'); ?>
</label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th width="2%" class="">
<input type="checkbox" name="checkall-toggle" value=""
title="<?php echo Text::_('JGLOBAL_CHECK_ALL'); ?>"
onclick="Joomla.checkAll(this)"/>
</th>
<th class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_SUBJECT"), 'subject', $listDirn, $listOrder);?>
</th>
<th class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_BODY"), 'title', $listDirn, $listOrder);?>
</th>
<th width="10%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_TO"), 'to', $listDirn, $listOrder);?>
</th>
<th width="10%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_CC"), 'cc', $listDirn, $listOrder);?>
</th>
<th width="10%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_BCC"), 'bcc', $listDirn, $listOrder);?>
</th>
<th width="10%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_DATE"), 'date', $listDirn, $listOrder);?>
</th>
<th width="" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_STATE"), 'state', $listDirn, $listOrder);?>
</th>
<th width="" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_KEY"), 'key', $listDirn, $listOrder);?>
</th>
<th width="10%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_PROVIDER"), 'provider', $listDirn, $listOrder);?>
</th>
<th width="10%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_FROM"), 'from', $listDirn, $listOrder);?>
</th>
<th width="10%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_PARAMS"), 'params', $listDirn, $listOrder);?>
</th>
<th width="2%" class="">
<?php echo JHtml::_('grid.sort', Text::_("COM_TJNOTIFICATIONS_VIEW_NOTIFICATIONS_DEFAULT_FIELD_ID"), 'id', $listDirn, $listOrder);?>
</th>
</tr>
</thead>
<tbody>
<?php if (!empty($this->items)) : ?>
<?php foreach ($this->items as $i => $row) :
?>
<tr>
<td class="">
<?php echo JHtml::_('grid.id', $i, $row->id); ?>
</td>
<td class="">
<?php echo htmlspecialchars($row->subject, ENT_COMPAT, 'UTF-8'); ?>
</td>
<td class="">
<a class="modal notification" href="<?php echo Route::_('index.php?option=com_tjnotifications&tmpl=component&view=logs&layout=body&id='. $row->id); ?>">
<?php echo Text::_("COM_TJNOTIFICATIONS_TITLE_VIEW_CONTENTS"); ?>
</a>
<td class="">
<?php echo str_replace(',', '<br />', $row->to); ?>
</td>
<td class="">
<?php echo str_replace(',', '<br />', $row->cc); ?>
</td>
<td class="">
<?php echo str_replace(',', '<br />', $row->bcc); ?>
</td>
<td class="">
<?php echo htmlspecialchars($row->date, ENT_COMPAT, 'UTF-8');?>
</td>
<td class="">
<?php
echo empty($row->state ==1) ? Text::_('COM_TJNOTIFICATIONS_STATE_SENT') : Text::_('COM_TJNOTIFICATIONS_STATE_FAILED');
?>
</td>
<td class="">
<?php echo htmlspecialchars($row->key, ENT_COMPAT, 'UTF-8');?>
</td>
<td class="">
<?php echo htmlspecialchars($row->provider, ENT_COMPAT, 'UTF-8');?>
</td>
<td class="">
<?php echo htmlspecialchars($row->from, ENT_COMPAT, 'UTF-8'); ?>
</td>
<td class="">
<?php
if(!empty($row->params))
{ ?>
<a class="modal notification" href="<?php echo Route::_('index.php?option=com_tjnotifications&tmpl=component&view=logs&layout=param&id='. $row->id); ?>">
<?php echo Text::_("COM_TJNOTIFICATIONS_VIEW_PARAMS_POPUP");?></a>
<?php
}
else
{
echo Text::_('COM_TJNOTIFICATIONS_EMPTY_PARAMS');
}?>
</td>
<td class="">
<?php echo htmlspecialchars($row->id, ENT_COMPAT, 'UTF-8');?>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
<?php echo $this->pagination->getListFooter(); ?>
<input type="hidden" name="task" value=""/>
<input type="hidden" name="boxchecked" value="0"/>
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>"/>
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>"/>
<?php echo JHtml::_('form.token'); ?>
</td>
<td class="">
<?php echo str_replace(',', '<br />', $row->to); ?>
</td>
<td class="">
<?php echo str_replace(',', '<br />', $row->cc); ?>
</td>
<td class="">
<?php echo str_replace(',', '<br />', $row->bcc); ?>
</td>
<td class="">
<?php echo htmlspecialchars($row->date, ENT_COMPAT, 'UTF-8'); ?>
</td>
<td class="">
<?php
echo ($row->state === 1) ? Text::_('COM_TJNOTIFICATIONS_STATE_SENT') : Text::_('COM_TJNOTIFICATIONS_STATE_FAILED');
?>
</td>
<td class="">
<?php echo htmlspecialchars($row->key, ENT_COMPAT, 'UTF-8'); ?>
</td>
<td class="">
<?php echo htmlspecialchars($row->provider, ENT_COMPAT, 'UTF-8'); ?>
</td>
<td class="">
<?php echo htmlspecialchars($row->from, ENT_COMPAT, 'UTF-8'); ?>
</td>
<td class="">
<?php if(!empty($row->params)): ?>
<a class="modal notification" href="<?php echo Route::_('index.php?option=com_tjnotifications&tmpl=component&view=logs&layout=param&id='. $row->id); ?>">
<?php echo Text::_("COM_TJNOTIFICATIONS_VIEW_PARAMS_POPUP"); ?>
</a>
<?php else : ?>
<?php echo Text::_('COM_TJNOTIFICATIONS_EMPTY_PARAMS'); ?>
<?php endif; ?>
</td>
<td class="">
<?php echo htmlspecialchars($row->id, ENT_COMPAT, 'UTF-8'); ?>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
<?php echo $this->pagination->getListFooter(); ?>
<input type="hidden" name="task" value=""/>
<input type="hidden" name="boxchecked" value="0"/>
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>"/>
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>"/>
<?php echo JHtml::_('form.token'); ?>
</div>
</div>
</form>
21 changes: 9 additions & 12 deletions src/com_tjnotifications/admin/views/logs/tmpl/param.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<?php
/**
* @package TJNotifications
* @subpackage com_tjnotifications
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
* @package TJNotifications
* @subpackage com_tjnotifications
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2019 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
// No direct access
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Table\Table;

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

if ($logId)
if($logId)
{
Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tjnotifications/tables');
$logTable = Table::getInstance('Log', 'TjnotificationsTable');
Expand All @@ -26,8 +24,7 @@
<div>
<?php if ($logTable->id) : ?>
<h3 class="modal-title">
<?php echo Text::_("COM_TJNOTIFICATIONS_VIEW_PARAMS_POPUP");
?>
<?php echo Text::_("COM_TJNOTIFICATIONS_VIEW_PARAMS_POPUP"); ?>
</h3>
<div class="col-xs-12">
<?php echo $logTable->params; ?>
Expand Down

0 comments on commit dd5c000

Please sign in to comment.