b2evolution PHP Cross Reference Blogging Systems

Source: /inc/sessions/views/_stats_goals.view.php - 120 lines - 3098 bytes - Summary - Text - Print

Description: This file implements the UI view for the Goal Hit list. b2evolution - {@link http://b2evolution.net/} Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}

   1  <?php
   2  /**
   3   * This file implements the UI view for the Goal Hit list.
   4   *
   5   * b2evolution - {@link http://b2evolution.net/}
   6   * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
   7   *
   8   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}
   9   *
  10   * @package admin
  11   *
  12   * @version $Id: _stats_goals.view.php 6136 2014-03-08 07:59:48Z manuel $
  13   */
  14  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  15  
  16  global $blog, $admin_url, $rsc_url;
  17  global $Session;
  18  
  19  /**
  20   * View funcs
  21   */
  22  require_once dirname(__FILE__).'/_stats_view.funcs.php';
  23  
  24  $final = param( 'final', 'integer', 0, true );
  25  $s = param( 's', 'string', '', true );
  26  
  27  // Create query:
  28  $SQL = new SQL();
  29  $SQL->SELECT( '*' );
  30  $SQL->FROM( 'T_track__goal' );
  31  
  32  if( !empty($final) )
  33  {    // We want to filter on final goals only:
  34      $SQL->WHERE_and( 'goal_redir_url IS NULL' );
  35  }
  36  
  37  if( !empty($s) )
  38  {    // We want to filter on search keyword:
  39      // Note: we use CONCAT_WS (Concat With Separator) because CONCAT returns NULL if any arg is NULL
  40      $SQL->WHERE_and( 'CONCAT_WS( " ", goal_name, goal_key, goal_redir_url ) LIKE "%'.$DB->escape($s).'%"' );
  41  }
  42  
  43  // Create result set:
  44  $Results = new Results( $SQL->get(), 'goals_', '-A' );
  45  
  46  $Results->Cache = & get_GoalCache();
  47  
  48  $Results->title = T_('Goals').get_manual_link( 'goal-settings' );
  49  
  50  /**
  51   * Callback to add filters on top of the result set
  52   *
  53   * @param Form
  54   */
  55  function filter_goals( & $Form )
  56  {
  57      $Form->checkbox_basic_input( 'final', get_param('final'), /* TODO: please add context for translators.. */ T_('Final only').' &bull;' );
  58      $Form->text( 's', get_param('s'), 30, T_('Search'), '', 255 );
  59  }
  60  $Results->filter_area = array(
  61      'callback' => 'filter_goals',
  62      'url_ignore' => 'results_goals_page,final',
  63      'presets' => array(
  64          'all' => array( T_('All'), '?ctrl=goals' ),
  65          'final' => array( T_('Final'), '?ctrl=goals&amp;final=1' ),
  66          )
  67      );
  68  
  69  $Results->cols[] = array(
  70          'th' => T_('ID'),
  71          'order' => 'goal_ID',
  72          'td_class' => 'center',
  73          'td' => '$goal_ID$',
  74      );
  75  
  76  $Results->cols[] = array(
  77          'th' => T_('Name'),
  78          'order' => 'goal_name',
  79          'td' => '$goal_name$',
  80      );
  81  
  82  $Results->cols[] = array(
  83          'th' => T_('Key'),
  84          'order' => 'goal_key',
  85          'td' => '@action_link( "edit", #goal_key# )@',
  86       );
  87  
  88  
  89  $Results->cols[] = array(
  90          'th' => T_('Redirect to'),
  91          'order' => 'goal_redir_url',
  92          'td_class' => 'small',
  93          'td' => '<a href="$goal_redir_url$">$goal_redir_url$</a>',
  94       );
  95  
  96  $Results->cols[] = array(
  97          'th' => T_('Def. val.'),
  98          'order' => 'goal_default_value',
  99          'td_class' => 'right',
 100          'td' => '$goal_default_value$',
 101      );
 102  
 103  if( $current_User->check_perm( 'options', 'edit', false ) )
 104  { // We have permission to modify:
 105  
 106      $Results->cols[] = array(
 107                              'th' => T_('Actions'),
 108                              'th_class' => 'shrinkwrap',
 109                              'td_class' => 'shrinkwrap',
 110                              'td' => '@action_icon("edit")@@action_icon("copy")@@action_icon("delete")@',
 111                          );
 112  
 113    $Results->global_icon( T_('Create a new goal...'), 'new', regenerate_url( 'action', 'action=new' ), T_('New goal').' &raquo;', 3, 4  );
 114  }
 115  
 116  
 117  // Display results:
 118  $Results->display();
 119  
 120  ?>

title

Description

title

Description

title

Description

title

title

Body