add emails view pages

This commit is contained in:
Jackson Dou 2023-07-26 15:55:13 +08:00
parent 97d9fc7ab8
commit 9b13219a10
6 changed files with 154 additions and 3 deletions

View file

@ -0,0 +1,16 @@
<?php
if (!defined('IN_CRONLITE')) {
exit('Access Denied');
}
$count = $DB->count('emails');
if ($count > 0) {
$rows = $DB->findAll('emails', '*', array(), "`email_id` DESC");
}
$status_types = array(
"关闭",
"打开",
);
$PageInfo['title'] = $lang->I18N('Emails List');

View file

@ -0,0 +1,24 @@
<?php
if (!defined('IN_CRONLITE')) {
exit('Access Denied');
}
$id = get('id');
if (empty($id)) {
redirect('admin/emails');
exit();
}
$status_types = array(
'关闭',
'打开',
);
$data = null;
if ($id > 0) {
$data = $DB->find('emails', '*', array('email_id' => $id), null, 1);
}
$PageInfo['title'] = $lang->I18N('Email Details');

16
src/admin/emails.php Executable file
View file

@ -0,0 +1,16 @@
<?php
require_once __DIR__ . '/application.php';
$action = get('action', 'list');
if (!in_array($action, array('list', 'view'))) {
$action = 'list';
}
require __DIR__ . '/controllers/emails/' . $action . '.php';
require __DIR__ . '/views/header.php';
require __DIR__ . '/views/navbar.php';
require __DIR__ . '/views/sidebar.php';
require __DIR__ . '/views/emails/' . $action . '.php';
require __DIR__ . '/views/footer.php';

55
src/admin/views/emails/list.php Executable file
View file

@ -0,0 +1,55 @@
<?php
if (!defined('IN_CRONLITE')) {
exit;
}
?>
<div class="content-wrapper">
<ol class="breadcrumb page-breadcrumb">
<li><a href="index.php"><?php echo $lang->I18N('Dashboard'); ?></a></li>
<li class="active"><?php echo $lang->I18N('Emails List'); ?></li>
</ol>
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right">
<a href="emails.php?action=add" class="btn btn-primary btn-xs">
<i class="fa fa-plus"></i> <?php echo $lang->I18N('add'); ?>
</a>
</div>
<span class="panel-title"><?php echo $PageInfo['title']; ?></span>
</div>
<div class="table-responsive">
<table class="table table-stripped table-bordered table-hover">
<thead>
<th width="100">ID</th>
<th><?php echo $lang->I18N('Client'); ?></th>
<th><?php echo $lang->I18N('Title'); ?></th>
<th><?php echo $lang->I18N('Status'); ?></th>
<th style="width: 160px;"><?php echo $lang->I18N('Date'); ?></th>
<th style="width: 100px;"><?php echo $lang->I18N('Action'); ?></th>
</thead>
<tbody>
<?php if ($count > 0): ?>
<?php foreach ($rows as $value): ?>
<tr>
<td><?php echo $value['email_id']; ?></td>
<td><?php echo $value['email_client_id']; ?></td>
<td><?php echo $value["email_subject"]; ?></td>
<td><?php echo $status_types[$value['email_status']]; ?></td>
<td><?php echo $value["email_date"]; ?></td>
<td>
<a href="emails.php?action=view&id=<?php echo $value['email_id']; ?>" class="btn btn-primary btn-xs"><i class="fa fa-info-circle"></i> <?php echo $lang->I18N('details'); ?></a>
</td>
</tr>
<?php endforeach;?>
<?php else: ?>
<tr>
<td colspan="5" class="text-center">Nothing found</td>
</tr>
<?php endif;?>
</tbody>
</table>
</div>
<div class="panel-footer"><?php echo $count; ?> Records Found, Page 1 of 1</div>
</div>
</div>

39
src/admin/views/emails/view.php Executable file
View file

@ -0,0 +1,39 @@
<?php
if (!defined('IN_CRONLITE')) {
exit;
}
?>
<div class="content-wrapper">
<ol class="breadcrumb page-breadcrumb">
<li><a href="index.php"><?php echo $lang->I18N('Dashboard'); ?></a></li>
<li><a href="emails.php"><?php echo $lang->I18N('Emails List'); ?></a></li>
<li class="active"><?php echo $lang->I18N('details'); ?></li>
</ol>
<div class="panel panel-default">
<div class="panel-heading">
<div class="pull-right">
<a href="<?php echo setURL('admin/emails', '', array('action' => 'view', 'client_id' => $data['email_client_id'])); ?>" class="btn btn-success btn-xs">
<i class="fa fa-edit"></i> <?php echo $lang->I18N('Client More'); ?>
</a>
<a href="emails.php?action=list" class="btn btn-primary btn-xs">
<i class="fa fa-list"></i> <?php echo $lang->I18N('list'); ?>
</a>
</div>
<span class="panel-title"><?php echo $PageInfo['title']; ?> ID:<?php echo $id; ?></span>
</div>
<div class="panel-body">
<div class="alert alert-info">
<p>Subject: <?php echo $data['email_subject']; ?></p>
<p>Date: <?php echo $data['email_date']; ?></p>
<p>To: <?php echo $data['email_to']; ?></p>
<p>Client ID: <?php echo $data['email_client_id']; ?></p>
</div>
<div class="news-content">
<?php echo htmlspecialchars_decode($data['email_body']); ?>
</div>
</div>
</div>
</div>

View file

@ -11,11 +11,12 @@
<div class="panel panel-default">
<!-- <div class="panel-heading"><span class="panel-title">菜单</span></div> -->
<div class="list-group">
<a class="list-group-item <?php echo checkIfActive('index,') ?>" href="index.php"><i class="fa fa-tachometer-alt" aria-hidden="true"></i> <?php echo $lang->I18N('Dashboard'); ?></a>
<a class="list-group-item <?php echo checkIfActive('index,') ?>" href="index.php"><i class="fa fa-tachometer-alt fa-fw" aria-hidden="true"></i> <?php echo $lang->I18N('Dashboard'); ?></a>
<a class="list-group-item <?php echo checkIfActive('clients') ?>" href="clients.php"><i class="fa fa-users fa-fw"></i> <?php echo $lang->I18N('Clients List'); ?></a>
<a class="list-group-item <?php echo checkIfActive('accounts') ?>" href="accounts.php"><i class="fa fa-server fa-fw" aria-hidden="true"></i> <?php echo $lang->I18N('Hosting Accounts'); ?></a>
<a class="list-group-item <?php echo checkIfActive('tickets') ?>" href="tickets.php"><i class="fa fa-ticket-alt" aria-hidden="true"></i> <?php echo $lang->I18N('Tickets List'); ?></a>
<a class="list-group-item <?php echo checkIfActive('ssl') ?>" href="ssl.php"><i class="fa fa-shield-alt" aria-hidden="true"></i> <?php echo $lang->I18N('SSL Certificates'); ?></a>
<a class="list-group-item <?php echo checkIfActive('tickets') ?>" href="tickets.php"><i class="fa fa-ticket-alt fa-fw" aria-hidden="true"></i> <?php echo $lang->I18N('Tickets List'); ?></a>
<a class="list-group-item <?php echo checkIfActive('ssl') ?>" href="ssl.php"><i class="fa fa-shield-alt fa-fw" aria-hidden="true"></i> <?php echo $lang->I18N('SSL Certificates'); ?></a>
<a class="list-group-item <?php echo checkIfActive('emails') ?>" href="emails.php"><i class="fa fa-envelope fa-fw" aria-hidden="true"></i> <?php echo $lang->I18N('Emails List'); ?></a>
<a class="list-group-item <?php echo checkIfActive('knowledgebase') ?>" href="knowledgebase.php"><i class="fa fa-book fa-fw" aria-hidden="true"></i> <?php echo $lang->I18N('Knowledgebase'); ?></a>
<a class="list-group-item <?php echo checkIfActive('news') ?>" href="news.php"><i class="fa fa-newspaper fa-fw" aria-hidden="true"></i> <?php echo $lang->I18N('News List'); ?></a>
<a class="list-group-item <?php echo checkIfActive('hosting-provider') ?>" href="hosting-provider.php"><i class="fa fa-server fa-fw" aria-hidden="true"></i> <?php echo $lang->I18N('Hosting Provider'); ?></a>