File: /home/httpd/html/nyloncams.com/public_html/admin/email_templates.php
<?php
require "db.php";
$active_menu = 'settings';
$page = $_GET['page'] > 0 ? (int) $_GET['page'] : 1;
$max_results = $_GET['setmax'] > 0 ? (int) $_GET['setmax'] : 100;
$from = (($page * $max_results) - $max_results);
$total_results = count(dbQuery("SELECT `record_num` FROM `email_templates`", false));
$results = dbQuery("SELECT `email_translations`.*, `email_templates`.`name`, `email_templates`.`description` FROM `email_translations` INNER JOIN `email_templates` ON `email_translations`.`template_id` = `email_templates`.`record_num` ORDER BY `record_num` DESC LIMIT $from, $max_results", false);
$total_pages = ceil($total_results / $max_results);
include 'header.php';
?>
<div class="content-page">
<div class="header-area">
<div class="breadcrumbs">
<a href="index.php">Admin Home</a>
<span><a href="email_template.php">Emails Templates</a></span>
</div>
</div>
<div class="content-outer">
<h2>Emails<strong>Templates</strong></h2>
<div class="content-inner">
<form action="#" method="POST" class="form" novalidate autocomplete="off">
<table class="pagetable">
<thead>
<tr>
<th width="150px">System Name</th>
<th>Subject</th>
<th>Body</th>
<th class="options"></th>
</tr>
</thead>
<tbody>
<?php if (is_array($results)) { ?>
<?php foreach ($results as $row) { ?>
<tr id="record<?php echo $row['record_num']; ?>">
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['subject']; ?></td>
<td><?php echo $row['body']; ?></td>
<td class="options">
<a href="edit_email_content.php?id=<?php echo $row['record_num']; ?>" class="btn btn-xs btn-orange" title="Edit email template"><i class="ion ion-edit icon-edit"></i></a>
</td>
</tr>
<?php } ?>
<?php } else { ?>
<tr>
<td colspan="4">
<div class="notification alert">No email templates found.</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<div id="adminPagination"><?php echo showAdminPagination($total_pages); ?></div>
</form>
</div>
</div>
</div>
<?php require "footer.php"; ?>