b2evolution PHP Cross Reference Blogging Systems

Source: /inc/tools/views/_email_return.view.php - 151 lines - 5120 bytes - Summary - Text - Print

Description: This file implements the UI view for Tools > Email > Sent This file is part of the evoCore framework - {@link http://evocore.net/} See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**

   3   * This file implements the UI view for Tools > Email > Sent

   4   *

   5   * This file is part of the evoCore framework - {@link http://evocore.net/}

   6   * See also {@link http://sourceforge.net/projects/evocms/}.

   7   *

   8   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}

   9   *

  10   * {@internal License choice

  11   * - If you have received this file as part of a package, please find the license.txt file in

  12   *   the same folder or the closest folder above for complete license terms.

  13   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)

  14   *   then you must choose one of the following licenses before using the file:

  15   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php

  16   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php

  17   * }}

  18   *

  19   * {@internal Open Source relicensing agreement:

  20   * }}

  21   *

  22   * @package admin

  23   *

  24   * @version $Id: _email_sent.view.php 349 2011-11-18 11:18:14Z yura $

  25   */
  26  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  27  
  28  global $blog, $admin_url, $UserSettings;
  29  
  30  
  31  global $datestartinput, $datestart, $datestopinput, $datestop, $email;
  32  
  33  if( param_date( 'datestartinput', T_('Invalid date'), false,  NULL ) !== NULL )
  34  {    // We have a user provided localized date:
  35      memorize_param( 'datestart', 'string', NULL, trim(form_date($datestartinput)) );
  36  }
  37  else
  38  {    // We may have an automated param transmission date:
  39      param( 'datestart', 'string', '', true );
  40  }
  41  if( param_date( 'datestopinput', T_('Invalid date'), false, NULL ) !== NULL )
  42  {    // We have a user provided localized date:
  43      memorize_param( 'datestop', 'string', NULL, trim(form_date($datestopinput)) );
  44  }
  45  else
  46  {    // We may have an automated param transmission date:
  47      param( 'datestop', 'string', '', true );
  48  }
  49  param( 'email', 'string', '', true );
  50  
  51  // Create result set:

  52  
  53  $SQL = new SQL();
  54  $SQL->SELECT( 'SQL_NO_CACHE emret_ID, emret_timestamp, emret_address, emret_errormsg, emret_errtype' );
  55  $SQL->FROM( 'T_email__returns' );
  56  
  57  $CountSQL = new SQL();
  58  $CountSQL->SELECT( 'SQL_NO_CACHE COUNT(emret_ID)' );
  59  $CountSQL->FROM( 'T_email__returns' );
  60  
  61  if( !empty( $datestart ) )
  62  {    // Filter by start date
  63      $SQL->WHERE_and( 'emret_timestamp >= '.$DB->quote( $datestart.' 00:00:00' ) );
  64      $CountSQL->WHERE_and( 'emret_timestamp >= '.$DB->quote( $datestart.' 00:00:00' ) );
  65  }
  66  if( !empty( $datestop ) )
  67  {    // Filter by end date
  68      $SQL->WHERE_and( 'emret_timestamp <= '.$DB->quote( $datestop.' 23:59:59' ) );
  69      $CountSQL->WHERE_and( 'emret_timestamp <= '.$DB->quote( $datestop.' 23:59:59' ) );
  70  }
  71  if( !empty( $email ) )
  72  {    // Filter by email
  73      $SQL->WHERE_and( 'emret_address LIKE '.$DB->quote( $email ) );
  74      $CountSQL->WHERE_and( 'emret_address LIKE '.$DB->quote( $email ) );
  75  }
  76  
  77  
  78  $Results = new Results( $SQL->get(), 'emret_', 'D', $UserSettings->get( 'results_per_page' ), $CountSQL->get() );
  79  
  80  $Results->title = T_('Returned emails');
  81  
  82  /**

  83   * Callback to add filters on top of the result set

  84   *

  85   * @param Form

  86   */
  87  function filter_email_return( & $Form )
  88  {
  89      global $datestart, $datestop, $email;
  90  
  91      $Form->date_input( 'datestartinput', $datestart, T_('From date') );
  92      $Form->date_input( 'datestopinput', $datestop, T_('To date') );
  93      $Form->text_input( 'email', $email, 40, T_('Email') );
  94  }
  95  $Results->filter_area = array(
  96      'callback' => 'filter_email_return',
  97      'presets' => array(
  98          'all' => array( T_('All'), $admin_url.'?ctrl=email&amp;tab=return'),
  99          )
 100      );
 101  
 102  $Results->cols[] = array(
 103          'th' => T_('ID'),
 104          'order' => 'emret_ID',
 105          'th_class' => 'shrinkwrap',
 106          'td_class' => 'right',
 107          'td' => '$emret_ID$',
 108      );
 109  
 110  $Results->cols[] = array(
 111          'th' => T_('Date Time'),
 112          'order' => 'emret_timestamp',
 113          'default_dir' => 'D',
 114          'th_class' => 'shrinkwrap',
 115          'td_class' => 'timestamp compact_data',
 116          'td' => '%mysql2localedatetime_spans( #emret_timestamp#, "M-d" )%',
 117      );
 118  
 119  $Results->cols[] = array(
 120          'th' => T_('Address'),
 121          'order' => 'emret_address',
 122          'td' => '<a href="'.regenerate_url( 'email,action,emret_ID', 'email=$emret_address$' ).'">$emret_address$</a>',
 123          'th_class' => 'shrinkwrap',
 124      );
 125  
 126  $Results->cols[] = array(
 127          'th' => T_('Err Type'),
 128          'order' => 'emret_errtype',
 129          'td' => '%dre_decode_error_type( #emret_errtype# )%',
 130          'th_class' => 'shrinkwrap',
 131          'td_class' => 'shrinkwrap',
 132      );
 133  
 134  $Results->cols[] = array(
 135          'th' => T_('Error'),
 136          'order' => 'emret_errormsg',
 137          'td' => '<a href="'.$admin_url.'?ctrl=email&amp;tab=return&amp;emret_ID=$emret_ID$">%htmlspecialchars( #emret_errormsg# )%</a>',
 138      );
 139  
 140  $Results->cols[] = array(
 141          'th' => T_('Actions'),
 142          'th_class' => 'shrinkwrap small',
 143          'td_class' => 'shrinkwrap',
 144          'td' => action_icon( T_('View this email...'), 'magnifier', $admin_url.'?ctrl=email&amp;tab=return&amp;emret_ID=$emret_ID$' )
 145              .action_icon( T_('Go to users list with this email address'), 'play', $admin_url.'?ctrl=users&amp;filter=new&amp;keywords=$emret_address$' )
 146      );
 147  
 148  // Display results:

 149  $Results->display();
 150  
 151  ?>

title

Description

title

Description

title

Description

title

title

Body