[ Index ]

PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12)

title

Body

[close]

/include/inc_tmpl/ -> newsletter.list.tmpl.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2012 Oliver Georgi <oliver@phpwcms.de> // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  // ----------------------------------------------------------------
  24  // obligate check for phpwcms constants
  25  if (!defined('PHPWCMS_ROOT')) {
  26     die("You Cannot Access This Script Directly, Have a Nice Day.");
  27  }
  28  // ----------------------------------------------------------------
  29  
  30  
  31  if(isset($_GET["s"])) {
  32  
  33      include_once (PHPWCMS_ROOT.'/include/inc_lib/newsletter.form.inc.php');
  34      
  35      if(isset($_GET['edit'])) {
  36          include_once (PHPWCMS_ROOT.'/include/inc_tmpl/newsletter.form.tmpl.php');
  37      }
  38  
  39      if(isset($_GET['send']) && $show_nl_send) {
  40  
  41          include_once (PHPWCMS_ROOT.'/include/inc_tmpl/newsletter.send.tmpl.php');
  42  
  43      }
  44  
  45  } else {
  46  
  47      if(isset($_GET['duplicate_nl'])) {
  48          @_dbDuplicateRow(    'phpwcms_newsletter', 'newsletter_id', intval($_GET['duplicate_nl']), 
  49                              array('newsletter_active' => 0, 'newsletter_changed' => 'SQL:NOW()', 
  50                              'newsletter_lastsending' => '0000-00-00 00:00:00', 'newsletter_created' => 'SQL:NOW()', 
  51                              'newsletter_subject' => '--SELF-- (copy)'));
  52      }
  53  
  54  // check if subscription should be edited
  55  
  56  
  57  // create paginating for newsletter
  58  if(isset($_GET['c'])) {
  59      $_SESSION['list_newsletter_count'] = $_GET['c'] == 'all' ? '99999' : intval($_GET['c']);
  60  }
  61  // set default values for paginating
  62  if(empty($_SESSION['list_newsletter_count'])) {
  63      $_SESSION['list_newsletter_count'] = 10;
  64  }
  65  // set page
  66  if(isset($_GET['page'])) {
  67      $_SESSION['newsletter_page'] = intval($_GET['page']);
  68  }
  69  // start at page 1
  70  if(empty($_SESSION['newsletter_page']) || $_SESSION['newsletter_page'] < 1) {
  71      $_SESSION['newsletter_page'] = 1;
  72  }
  73  
  74  $_newsletter['count_total'] = _dbQuery("SELECT COUNT(*) FROM ".DB_PREPEND."phpwcms_newsletter WHERE newsletter_trashed=0", 'COUNT');
  75  $_newsletter['pages_total'] = ceil($_newsletter['count_total'] / $_SESSION['list_newsletter_count']);
  76  if($_SESSION['newsletter_page'] > $_newsletter['pages_total']) {
  77      $_SESSION['newsletter_page'] = $_newsletter['pages_total'];
  78  }
  79  
  80  ?>
  81  
  82  <div class="title" style="margin-bottom:10px"><?php echo $BL['be_subnav_msg_newslettersend'] ?></div>
  83  
  84  <div class="navBarLeft imgButton chatlist">
  85      &nbsp;&nbsp;
  86      <a href="phpwcms.php?do=messages&amp;p=3&amp;s=0&amp;edit=1"><img src="img/famfamfam/email_add.gif" alt="Add" border="0" /><span><?php echo $BL['be_newsletter_new'] ?></span></a>
  87  </div>
  88  
  89  
  90  
  91  <table width="100%" border="0" cellpadding="0" cellspacing="0" summary="">
  92          <tr>
  93              <td><?php 
  94  if($_newsletter['pages_total'] > 1) {
  95  
  96      echo '<table border="0" cellpadding="0" cellspacing="0" summary=""><tr><td>';
  97      if($_SESSION['newsletter_page'] > 1) {
  98          echo '<a href="phpwcms.php?do=messages&amp;p=3&amp;page='.($_SESSION['newsletter_page']-1).'">';
  99          echo '<img src="img/famfamfam/action_back.gif" alt="" border="0" /></a>';
 100      } else {
 101          echo '<img src="img/famfamfam/action_back.gif" alt="" border="0" class="inactive" />';
 102      }
 103      echo '</td>';
 104      echo '<td><input type="text" name="page" id="page" maxlength="4" size="4" value="'.$_SESSION['newsletter_page'];
 105      echo '"  class="textinput" style="margin:0 3px 0 5px;width:30px;font-weight:bold;" /></td>';
 106      echo '<td class="chatlist">/'.$_newsletter['pages_total'].'&nbsp;</td>';
 107      echo '<td>';
 108      if($_SESSION['newsletter_page'] < $_newsletter['pages_total']) {
 109          echo '<a href="phpwcms.php?do=messages&amp;p=3&amp;page='.($_SESSION['newsletter_page']+1).'">';
 110          echo '<img src="img/famfamfam/action_forward.gif" alt="" border="0" /></a>';
 111      } else {
 112          echo '<img src="img/famfamfam/action_forward.gif" alt="" border="0" class="inactive" />';
 113      }
 114      echo '</td></tr></table>';
 115  } else {
 116      echo '&nbsp;';
 117  }
 118  ?>
 119      
 120      </td>
 121      
 122      <td class="chatlist" align="right">
 123          <a href="phpwcms.php?do=messages&amp;p=3&amp;c=5">5</a>
 124          <a href="phpwcms.php?do=messages&amp;p=3&amp;c=10">10</a>
 125          <a href="phpwcms.php?do=messages&amp;p=3&amp;c=25">25</a>
 126          <a href="phpwcms.php?do=messages&amp;p=3&amp;c=50">50</a>
 127          <a href="phpwcms.php?do=messages&amp;p=3&amp;c=100">100</a>
 128          <a href="phpwcms.php?do=messages&amp;p=3&amp;c=all"><?php echo $BL['be_ftptakeover_all'] ?></a>
 129      </td>
 130  
 131      </tr>
 132  </table>
 133  <table width="100%" border="0" cellpadding="0" cellspacing="0" summary="">
 134      
 135      <tr class="tableHeadRow">
 136          <th>&nbsp;</th>
 137          <th style="text-align:left"><?php echo $BL['be_msg_subject'] ?></th>
 138          <th><?php echo $BL['be_newsletter_changed'] ?></th>
 139          <th><?php echo str_replace(' ', '<br />', $BL['be_last_sending']) ?></th>
 140          <th><?php echo $BL['be_total'].'/<br />'.$BL['be_cnt_queued'].'/<br />'.$BL['be_msg_senttop'] ?></th>
 141          <th>&nbsp;</th>
 142      </tr>
 143      
 144      <tr><td colspan="6" bgcolor="#92A1AF"><img src="img/leer.gif" alt="" width="1" height="1" /></td></tr>
 145      
 146  <?php
 147  
 148      // loop listing available newsletters
 149                                   
 150      $sql  = "SELECT *, UNIX_TIMESTAMP(newsletter_changed) AS cdate, UNIX_TIMESTAMP(newsletter_lastsending) AS lastsend FROM ".DB_PREPEND."phpwcms_newsletter WHERE newsletter_trashed=0 ORDER BY newsletter_changed DESC";
 151      $sql .= " LIMIT ".(($_SESSION['newsletter_page']-1) * $_SESSION['list_newsletter_count']).','.$_SESSION['list_newsletter_count'];
 152      
 153      if($result = mysql_query($sql, $db) or die("error while reading newsletter list")) {
 154          
 155          $row_count = 0;
 156          while($row = mysql_fetch_array($result)) {
 157          
 158          //foreach($result as $row) {
 159          
 160              $row['newsletter_vars'] = unserialize($row['newsletter_vars']);
 161          
 162              echo '<tr'.( ($row_count % 2) ? ' bgcolor="#F3F5F8"' : '' ).' class="listrow">'.LF;
 163              echo '<td width="2%" style="padding:2px 5px 2px 4px;">';
 164              
 165              // sent/queue status
 166              $count_sent          = _dbQuery('SELECT COUNT(*) FROM '.DB_PREPEND.'phpwcms_newsletterqueue WHERE queue_status=1 AND queue_pid='.$row["newsletter_id"], 'COUNT');
 167              $count_queue         = _dbQuery('SELECT COUNT(*) FROM '.DB_PREPEND.'phpwcms_newsletterqueue WHERE queue_status=0 AND queue_pid='.$row["newsletter_id"], 'COUNT');
 168              $count_recipient    = countNewsletterRecipients($row['newsletter_vars']['subscription']);
 169              
 170              if(empty($row["newsletter_active"]) || !$count_queue) {
 171                  echo '<img src="img/famfamfam/email.gif" alt="NL" title="ID:'.$row["newsletter_id"].'" />';
 172              } else {
 173                  echo '<a href="phpwcms.php?do=messages&amp;p=3&amp;s='.$row["newsletter_id"];
 174                  echo '&amp;send=1"><img src="img/famfamfam/email_go.gif" alt="Send" border="0" title="ID:'.$row["newsletter_id"].'"></a>';
 175              }
 176              
 177              echo '</td>'.LF;
 178                          
 179              echo '<td class="dir"><strong>'.html_specialchars($row["newsletter_subject"])."</strong></td>\n";
 180              
 181              // create date
 182              echo '<td nowrap="nowrap" class="v10" align="center">&nbsp;';
 183              if($row['cdate']) {
 184                  echo @date($BL['be_shortdatetime'], $row['cdate']);
 185              }
 186              echo '&nbsp;</td>';
 187              // last sending
 188              echo '<td nowrap="nowrap" class="v10" align="center">&nbsp;';
 189              if($row['lastsend']) {
 190                  @date($BL['be_shortdatetime'], $row['lastsend']);
 191              }
 192              echo '&nbsp;</td>';
 193              
 194              echo '<td nowrap="nowrap" class="v10" align="center">'.$count_recipient.'/'.$count_queue.'/'.$count_sent;
 195              if($count_sent && !$count_queue && $row["newsletter_active"]) {
 196                  echo '<img src="img/symbole/valid.gif" border="0" alt="valid" style="margin: 0 0 0 3px" />';
 197              }
 198              echo '&nbsp;</td>';
 199              
 200              // buttons
 201              echo '<td align="right" nowrap="nowrap" class="button_td">';
 202              
 203              // duplicate
 204              echo '<a href="phpwcms.php?do=messages&amp;p=3&amp;duplicate_nl='.$row["newsletter_id"];
 205              echo '"><img src="img/button/copy_11x11_0.gif" alt="Duplicate" border="0" style="margin:1px 3px 1px 0" /></a>';
 206              
 207              // edit
 208              echo '<a href="phpwcms.php?do=messages&amp;p=3&amp;s='.$row["newsletter_id"];
 209              echo '&amp;edit=1"><img src="img/button/edit_22x13.gif" alt="Edit" border="0" /></a>';
 210              
 211              // delete
 212              echo '<a href="phpwcms.php?do=messages&amp;p=3&amp;s='.$row["newsletter_id"].'&amp;del='.$row["newsletter_id"];
 213              echo '" title="delete: '.html_specialchars($row["newsletter_subject"]);            
 214              echo '" onclick="return confirm(\'Delete newsletter: '.js_singlequote(html_specialchars($row["newsletter_subject"])).'\');">';
 215              echo '<img src="img/button/trash_13x13_1.gif" border="0" alt="Delete" /></a>';
 216              
 217              echo "</td>\n</tr>\n";
 218  
 219              $row_count++;
 220              
 221          }
 222          
 223      } else {
 224      
 225          echo '<tr><td colspan="4">&nbsp;no newsletter available</td></tr>';
 226      
 227      }
 228          
 229  ?>
 230      <tr><td colspan="6" bgcolor="#92A1AF"><img src="img/leer.gif" alt="" width="1" height="1" /></td></tr>
 231      <tr><td colspan="6"><img src="img/leer.gif" alt="" width="1" height="8" /></td></tr>
 232  </table>
 233  <?php
 234  
 235  }
 236  
 237  
 238  ?>


Generated: Sun Jan 29 16:31:14 2012 Cross-referenced by PHPXref 0.7.1