b2evolution PHP Cross Reference Blogging Systems

Source: /inc/messaging/views/_thread_list.view.php - 116 lines - 3540 bytes - Summary - Text - Print

Description: This file is part of b2evolution - {@link http://b2evolution.net/} See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**
   3   * This file is part of b2evolution - {@link http://b2evolution.net/}
   4   * See also {@link http://sourceforge.net/projects/evocms/}.
   5   *
   6   * @copyright (c)2009-2014 by Francois PLANQUE - {@link http://fplanque.net/}
   7   * Parts of this file are copyright (c)2009 by The Evo Factory - {@link http://www.evofactory.com/}.
   8   *
   9   * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
  10   *
  11   * {@internal Open Source relicensing agreement:
  12   * The Evo Factory grants Francois PLANQUE the right to license
  13   * The Evo Factory's contributions to this file and the b2evolution project
  14   * under any OSI approved OSS license (http://www.opensource.org/licenses/).
  15   * }}
  16   *
  17   * @package messaging
  18   *
  19   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  20   * @author efy-maxim: Evo Factory / Maxim.
  21   * @author fplanque: Francois Planque.
  22   *
  23   * @version $Id: _thread_list.view.php 6136 2014-03-08 07:59:48Z manuel $
  24   */
  25  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  26  
  27  global $current_User;
  28  global $unread_messages_count;
  29  global $DB, $Blog;
  30  global $perm_abuse_management; // TRUE if we go from Abuse Management
  31  
  32  if( !isset( $display_params ) )
  33  { // init display_params
  34      $display_params = array();
  35  }
  36  // set default values
  37  $display_params = array_merge( array(
  38      'show_only_date' => 0,
  39      ), $display_params );
  40  
  41  // Create result set:
  42  $Results = get_threads_results( array(
  43          'results_param_prefix' => $perm_abuse_management ? 'abuse_' : 'thrd_',
  44          'search_word' => param( 's', 'string', '', true ),
  45          'search_user' => param( 'u', 'string', '', true ),
  46          'show_closed_threads' => param( 'show_closed', 'boolean', NULL, true ),
  47      ) );
  48  
  49  $Results->Cache = & get_ThreadCache();
  50  
  51  $Results->title = T_('Conversations list');
  52  if( is_admin_page() )
  53  {
  54      $Results->title .= get_manual_link( 'messaging' );
  55  }
  56  
  57  if( $unread_messages_count > 0 && !$perm_abuse_management )
  58  {
  59      $Results->title = $Results->title.' <span class="badge">'.$unread_messages_count.'</span></b>';
  60  }
  61  
  62  /**
  63   * Callback to add filters on top of the result set
  64   *
  65   * @param Form
  66   */
  67  function filter_recipients( & $Form )
  68  {
  69      global $perm_abuse_management;
  70      $Form->text( 's', get_param('s'), 20, T_('Search'), '', 255 );
  71      $Form->text( 'u', get_param('u'), 10, T_('User'), '', 255 );
  72      if( !$perm_abuse_management )
  73      {
  74          $Form->checkbox( 'show_closed', get_param('show_closed'), T_( 'Show closed conversations' ) );
  75      }
  76  }
  77  
  78  if( $perm_abuse_management )
  79  { // In case of abuse management
  80      $preset_filters = array( 'all' => array( T_('All'), get_dispctrl_url( 'abuse' ) ) );
  81  }
  82  else
  83  { // In case of simple thread list view
  84      $preset_filters = array(
  85          'avtive' => array( T_('Active conversations'), get_dispctrl_url( 'threads', 'show_closed=0' ) ),
  86          'all' => array( T_('All conversations'), get_dispctrl_url( 'threads', 'show_closed=1' ) )
  87      );
  88  }
  89  
  90  $Results->filter_area = array(
  91      'callback' => 'filter_recipients',
  92      'presets' => $preset_filters,
  93      );
  94  
  95  // Initialize Results object
  96  threads_results( $Results, array_merge( array(
  97          'abuse_management' => (int)$perm_abuse_management,
  98      ), $display_params ) );
  99  
 100  if( ! $perm_abuse_management )
 101  {    // Show link to create a new conversation
 102      if( is_admin_page() )
 103      {
 104          $newmsg_url = regenerate_url( 'action', 'action=new' );
 105      }
 106      else
 107      {
 108          $newmsg_url = regenerate_url( 'disp', 'disp=threads&action=new' );
 109      }
 110  
 111      $Results->global_icon( T_('Create a new conversation...'), 'new', $newmsg_url, T_('Compose new').' &raquo;', 3, 4  );
 112  }
 113  
 114  $Results->display( $display_params );
 115  
 116  ?>

title

Description

title

Description

title

Description

title

title

Body