<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: 			*/
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004-2010 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts VistaCart                     |
// +----------------------------------------------------------------------+
// | Authors: Jipson<jipson.thomas@armiasystems.com>             		  |
// +----------------------------------------------------------------------+
?>
<?php echo $javascript->link('jquery.js'); ?>
<?php echo $javascript->link('hint.js'); ?>
<script language="JavaScript" type="text/JavaScript">
    function clickSearch()
    {
        document.frmUsers.submit();
    }
</script>
<?php if($session->check('Message.flash')) { ?><div id="okbox"><font color="#446423"><?php $session->flash(); ?></font></div><?php } ?>			
<div align="center" class="subheading">
    <div align="left">EMAIL TEMPLATES</div>
</div>
<br />
<div>
    <!--serach  area start -->
    <form action="<?php echo $sitebase.$sitefolder.'/'.$this->params["controller"];?>/indexmail" method="get" name="frmUsers">
        <div>
            <div  style="float:left">
                <select name="cmbSearchType" class="box2_admin">
                    <option value="title"  <?php if($cmbSearchType == "title" || $cmbSearchType == "") {
    echo("selected");
} ?>>Title</option>
                    <option value="content"  <?php if($cmbSearchType == "content") {
    echo("selected");
} ?>>Content</option>
                </select> &nbsp;
                <input type="text" name="txtSearch" maxlength="50" value="<?php echo(htmlentities($txtSearch)); ?>" class="box2_admin" >
            </div>
            <div>
                <a style="cursor:pointer" onClick="javascript:clickSearch();"><?php echo $html->image('/img/search_bttn.gif');?></a>
            </div>
        </div>
        <br />
    </form>
    <br />
    <!--serach area start -->
</div>
<div align="left" id="item_details_admin">
    <!--items display area start -->
    <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="items_display_area_admin_table" class="tablebr_bottom">
        <tr>
            <td align="left" valign="top">
                <table width="100%"  border="0" cellspacing="1" cellpadding="6" class="tablebr_bottom"  style="background-color:#cfcfcf;">
                    <tr align="left" valign="middle" id="list_admin_top">
                        <td width="5%">#</td>
                        <td width="25%"><?php echo $paginator->sort('Title', 'title'); ?></td>
                        <td width="50%"><?php echo $paginator->sort('Content', 'content'); ?></td>
                        <td width="5%">Options</td>
                    </tr>
                    <?php
                    if(!empty($passedarg) && !isset($passedarg["page"]))
                        $cnt=1;
                    else if(!empty($passedarg) && $passedarg["page"]==1)
                        $cnt=1;
else
    $cnt=((($passedarg["page"]-1)*($passedarg["limit"]))+1);
if(!empty($pages)) {
    foreach ($pages as $pages) { ?>
                    <tr align="left" valign="middle" id="list_admin">
                        <td><?php echo $cnt++;?></td>
                        <td><?php echo Sanitize::html($pages['Cmspage']['title']); ?></td>
                        <td>
                            <?php echo htmlspecialchars_decode($pages["Cmspage"]["content"]); ?>
                        </td>
                        <td><?php echo $html->link('Edit', "/cmspages/edit/".$pages['Cmspage']['id']."/email"); ?></td>
                    </tr>
        <?php   }  ?>
                </table>
                <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="admin_bottom">
                    <tr>
                        <td align="center">
                                <?php
    if($cmbSearchType <> '' &&  $txtSearch <> '') {
        $paginator->options(array('url'=>array_merge(array('cmbSearchType'=>$cmbSearchType,
                                'txtSearch'=>$txtSearch),$this->passedArgs)));
    }  ?>
    <?php echo $this->renderElement('pagination'); // Render the pagination element ?></td>
                    </tr>
                </table>
    <?php }  else { ?>
                <table width="100%"  border="0" cellspacing="0" cellpadding="0" id="admin_bottom">
                    <tr id="list_admin">
                        <td align="center">No Records Found</td>
                    </tr>
                </table>
    <?php } ?>
            </td>
        </tr>
    </table>

    <div align="left" class="float_clear1"></div>
</div>
<div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>