b2evolution PHP Cross Reference Blogging Systems

Source: /inc/items/views/_item_list_sidebar.view.php - 328 lines - 11406 bytes - Text - Print

Description: This file implements the riight sidebar for the post browsing screen. This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}. See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**
   3   * This file implements the riight sidebar for the post browsing screen.
   4   *
   5   * This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}.
   6   * See also {@link http://sourceforge.net/projects/evocms/}.
   7   *
   8   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}.
   9   * Parts of this file are copyright (c)2005 by Daniel HAHLER - {@link http://thequod.de/contact}.
  10   *
  11   * @license http://b2evolution.net/about/license.html GNU General Public License (GPL)
  12   *
  13   * @package admin
  14   *
  15   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  16   * @author fplanque: Francois PLANQUE.
  17   *
  18   * @version $Id: _item_list_sidebar.view.php 6136 2014-03-08 07:59:48Z manuel $
  19   */
  20  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  21  
  22  /**
  23   * @var AdminUI
  24   */
  25  global $AdminUI;
  26  /**
  27   * @var Blog
  28   */
  29  global $Blog;
  30  /**
  31   * @var Plugins
  32   */
  33  global $Plugins;
  34  /**
  35   * @var ItemList
  36   */
  37  global $ItemList;
  38  
  39  $pp = $ItemList->param_prefix;
  40  
  41  global $tab;
  42  global ${$pp.'show_past'}, ${$pp.'show_future'}, ${$pp.'show_statuses'}, ${$pp.'s'}, ${$pp.'sentence'}, ${$pp.'exact'}, ${$pp.'author'}, ${$pp.'author_login'}, ${$pp.'assgn'}, ${$pp.'assgn_login'}, ${$pp.'status'};
  43  
  44  $show_past = ${$pp.'show_past'};
  45  $show_future = ${$pp.'show_future'};
  46  $show_statuses = ${$pp.'show_statuses'};
  47  $s = ${$pp.'s'};
  48  $sentence = ${$pp.'sentence'};
  49  $exact = ${$pp.'exact'};
  50  $author = ${$pp.'author'};
  51  $author_login = ${$pp.'author_login'};
  52  $assgn = ${$pp.'assgn'};
  53  $assgn_login = ${$pp.'assgn_login'};
  54  $status = ${$pp.'status'};
  55  
  56  
  57  load_funcs( 'skins/_skin.funcs.php' );
  58  
  59  $Widget = new Widget();
  60  $template = $AdminUI->get_template( 'side_item' );
  61  
  62  $Widget->title = format_to_output( $Blog->get_maxlen_name( 22 ), 'htmlbody' );
  63  echo $Widget->replace_vars( $template['block_start'] );
  64  
  65      // CALENDAR:
  66      // Call the Calendar plugin:
  67      $Plugins->call_by_code( 'evo_Calr', array( // Params follow:
  68              'block_start'     => '',
  69              'block_end'       => '',
  70              'title'           => '',        // No title.
  71              'link_type'       => 'context', // Preserve page context
  72              'itemlist_prefix' => $pp        // Prefix of the ItemList object
  73          ) );
  74  
  75  echo $template['block_end'];
  76  
  77  $Widget = new Widget();
  78  $Widget->title = T_('Filters');
  79  if( $ItemList->is_filtered() )
  80  {    // List is filtered, offer option to reset filters:
  81      $Widget->global_icon( T_('Reset all filters!'), 'reset_filters', '?ctrl=items&amp;blog='.$Blog->ID.'&amp;filter=reset', T_('Reset filters'), 4, 4 );
  82  }
  83  echo $Widget->replace_vars( $template['block_start'] );
  84  
  85      $Form = new Form( NULL, 'resetform', 'get', 'none' );
  86  
  87      $Form->begin_form( '' );
  88  
  89          $Form->hidden_ctrl();
  90          $Form->submit( array( 'submit', T_('Search'), 'search', '', 'float:right' ) );
  91  
  92          $Form->hidden( 'tab', $tab );
  93          $Form->hidden( 'blog', $Blog->ID );
  94  
  95          echo '<fieldset>';
  96          echo '<legend>'.T_('Posts to show').'</legend>';
  97          ?>
  98          <div>
  99  
 100          <input type="checkbox" name="<?php echo $pp ?>show_past" value="1" id="ts_min" class="checkbox" <?php if( $show_past ) echo 'checked="checked" '?> />
 101          <label for="ts_min"><?php echo T_('Past') ?></label><br />
 102  
 103          <input type="checkbox" name="<?php echo $pp ?>show_future" value="1" id="ts_max" class="checkbox" <?php if( $show_future ) echo 'checked="checked" '?> />
 104          <label for="ts_max"><?php echo T_('Future') ?></label>
 105  
 106          </div>
 107  
 108          <div>
 109  
 110          <?php
 111          // Get those statuses that current User can't view in this blog, and don't display those as filters
 112          $exclude_statuses = array_merge( get_restricted_statuses( $Blog->ID, 'blog_post!' ), array( 'trash' ) );
 113          $statuses = get_visibility_statuses( 'notes-array', $exclude_statuses );
 114          foreach( $statuses as $status_key => $status_name )
 115          { // show statuses
 116              ?>
 117              <input type="checkbox" name="<?php echo $pp ?>show_statuses[]" value="<?php echo $status_key; ?>" id="sh_<?php echo $status_key; ?>" class="checkbox" <?php if( in_array( $status_key, $show_statuses ) ) echo 'checked="checked" '?> />
 118              <label for="sh_<?php echo $status_key; ?>" title="<?php echo substr( $status_name[1], 1, strlen( $status_name[1] ) - 2 ); ?>"><?php echo $status_name[0] ?></label><br />
 119              <?php
 120          }
 121          ?>
 122  
 123          </div>
 124  
 125          <?php
 126          echo '</fieldset>';
 127  
 128  
 129          echo '<fieldset>';
 130          echo '<legend>'.T_('Title / Text contains').'</legend>';
 131  
 132          echo $Form->inputstart;
 133          ?>
 134          <div><input type="text" name="<?php echo $pp ?>s" size="20" value="<?php echo htmlspecialchars($s) ?>" class="SearchField" /></div>
 135          <?php
 136          echo $Form->inputend;
 137          // echo T_('Words').' : ';
 138          ?>
 139          <div class="tile">
 140              <input type="radio" name="<?php echo $pp ?>sentence" value="AND" id="sentAND" class="radio" <?php if( $sentence=='AND' ) echo 'checked="checked" '?> />
 141              <label for="sentAND"><?php echo T_('AND') ?></label>
 142          </div>
 143          <div class="tile">
 144              <input type="radio" name="<?php echo $pp ?>sentence" value="OR" id="sentOR" class="radio" <?php if( $sentence=='OR' ) echo 'checked="checked" '?> />
 145              <label for="sentOR"><?php echo T_('OR') ?></label>
 146          </div>
 147          <div class="tile">
 148              <input type="radio" name="<?php echo $pp ?>sentence" value="sentence" id="sentence" class="radio" <?php if( $sentence=='sentence' ) echo 'checked="checked" '?> />
 149              <label for="sentence"><?php echo T_('Entire phrase') ?></label>
 150          </div>
 151          <div class="tile">
 152              <input type="checkbox" name="<?php echo $pp ?>exact" value="1" id="exact" class="checkbox" <?php if( $exact ) echo 'checked="checked" '?> />
 153              <label for="exact"><?php echo T_('Exact match') ?></label>
 154          </div>
 155  
 156          <?php
 157          echo '</fieldset>';
 158  
 159  
 160          // Load current blog members into cache:
 161          $UserCache = & get_UserCache();
 162          // Load only first 21 users to know when we should display an input box instead of full users list
 163          $UserCache->load_blogmembers( $Blog->ID, 21 );
 164          $user_count = count( $UserCache->cache );
 165  
 166          if( $Blog->get_setting( 'use_workflow' ) )
 167          { // Display only if workflow is enabled
 168  
 169              /*
 170               * Assignees:
 171               * TODO: allow multiple selection
 172               */
 173              echo '<fieldset>';
 174              echo '<legend>'.T_('Assignees').'</legend>';
 175              if( $user_count )
 176              {
 177                  echo '<ul>';
 178  
 179                  echo '<li><input type="radio" name="'.$pp.'assgn" value="0" class="radio"';
 180                  if( empty( $assgn ) ) echo ' checked="checked"';
 181                  echo ' /> <a href="'.regenerate_url( $pp.'assgn', $pp.'assgn=0' ).'">'.T_('Any').'</a></li>';
 182  
 183                  echo '<li><input type="radio" name="'.$pp.'assgn" value="-" class="radio"';
 184                  if( '-' == $assgn ) echo ' checked="checked"';
 185                  echo ' /> <a href="'.regenerate_url( $pp.'assgn', $pp.'assgn=-' ).'">'.T_('Not assigned').'</a></li>';
 186  
 187                  if( $user_count > 20 )
 188                  { // Display an input box to enter user login
 189                      echo '<li>';
 190                      echo T_('User').': <input type="text" class="form_text_input autocomplete_login" value="'.$assgn_login.'" name="'.$pp.'assgn_login" id="'.$pp.'assgn_login" />';
 191                      echo '</li>';
 192                  }
 193                  else
 194                  { // Display a list of users
 195                      foreach( $UserCache->cache as $loop_User )
 196                      {
 197                          echo '<li><input type="radio" name="'.$pp.'assgn" value="'.$loop_User->ID.'" class="radio"';
 198                          if( $loop_User->ID == $assgn ) echo ' checked="checked"';
 199                          echo ' /> <a href="'.regenerate_url( $pp.'assgn', $pp.'assgn='.$loop_User->ID ).'" class="'.$loop_User->get_gender_class().'" rel="bubbletip_user_'.$loop_User->ID.'">';
 200                          $loop_User->login();
 201                          echo '</a></li>';
 202                      }
 203                  }
 204                  echo '</ul>';
 205              }
 206              echo '</fieldset>';
 207              ?>
 208              <script type="text/javascript">
 209              jQuery( '#<?php echo $pp; ?>assgn_login' ).focus( function()
 210              {
 211                  jQuery( 'input[name=<?php echo $pp; ?>assgn]' ).removeAttr( 'checked' );
 212              } );
 213              jQuery( 'input[name=<?php echo $pp; ?>assgn]' ).click( function()
 214              {
 215                  jQuery( '#<?php echo $pp; ?>assgn_login' ).val( '' );
 216              } );
 217              </script>
 218              <?php
 219          }
 220  
 221  
 222          /*
 223           * Authors:
 224           * TODO: allow multiple selection
 225           */
 226          echo '<fieldset>';
 227          echo '<legend>'.T_('Authors').'</legend>';
 228          if( $user_count )
 229          {
 230              echo '<ul>';
 231  
 232              if( $user_count > 20 )
 233              { // Display an input box to enter user login    
 234                  echo '<li>';
 235                  echo T_('User').': <input type="text" class="form_text_input autocomplete_login" value="'.$author_login.'" name="'.$pp.'author_login" id="'.$pp.'author_login" />';
 236                  echo '</li>';
 237              }
 238              else
 239              { // Display a list of users
 240                  echo '<li><input type="radio" name="'.$pp.'author" value="0" class="radio"';
 241                  if( empty( $author ) ) echo ' checked="checked"';
 242                  echo ' /> <a href="'.regenerate_url( $pp.'author', $pp.'author=0' ).'">'.T_('Any').'</a></li>';
 243  
 244                  foreach( $UserCache->cache as $loop_User )
 245                  {
 246                      echo '<li><input type="radio" name="'.$pp.'author" value="'.$loop_User->ID.'" class="radio"';
 247                      if( $loop_User->ID == $author ) echo ' checked="checked"';
 248                      echo ' /> <a href="'.regenerate_url( $pp.'author', $pp.'author='.$loop_User->ID ).'" class="'.$loop_User->get_gender_class().'" rel="bubbletip_user_'.$loop_User->ID.'">';
 249                      $loop_User->login();
 250                      echo '</a></li>';
 251                  }
 252              }
 253              echo '</ul>';
 254          }
 255          echo '</fieldset>';
 256  
 257  
 258          /*
 259           * Statuses
 260           * TODO: allow multiple selection
 261           */
 262          $ItemStatusCache = & get_ItemStatusCache();
 263          $ItemStatusCache->load_all(); // TODO: load for current blog only
 264          if( count($ItemStatusCache->cache) )
 265          {    // We have satuses:
 266              echo '<fieldset>';
 267              echo '<legend>'.T_('Statuses').'</legend>';
 268              echo '<ul>';
 269  
 270              echo '<li><input type="radio" name="'.$pp.'status" value="-" class="radio"';
 271              if( '-' == $status ) echo ' checked="checked"';
 272              echo ' /> <a href="'.regenerate_url( $pp.'status', $pp.'status=-' ).'">'.T_('Without status').'</a></li>';
 273  
 274              foreach( $ItemStatusCache->cache as $loop_Obj )
 275              {
 276                  echo '<li><input type="radio" name="'.$pp.'status" value="'.$loop_Obj->ID.'" class="radio"';
 277                  if( $loop_Obj->ID == $status ) echo ' checked="checked"';
 278                  echo ' /> <a href="'.regenerate_url( $pp.'status', $pp.'status='.$loop_Obj->ID ).'">';
 279                  $loop_Obj->disp('name');
 280                  echo '</a></li>';
 281              }
 282              echo '</ul>';
 283              echo '</fieldset>';
 284          }
 285  
 286          // --------------------------------- START OF CATEGORY LIST --------------------------------
 287          skin_widget( array(
 288                  // CODE for the widget:
 289                  'widget' => 'coll_category_list',
 290                  // Optional display params
 291                  'block_start' => '<fieldset class="widget_core_coll_category_list">',
 292                  'block_end' => '</fieldset>',
 293                  'block_title_start' => '<legend>',
 294                  'block_title_end' => '</legend>',
 295                  'link_type' => 'context',
 296                  'display_checkboxes' => 1,
 297                  'show_locked' => true,
 298              ) );
 299          // ---------------------------------- END OF CATEGORY LIST ---------------------------------
 300  
 301  
 302          // ARCHIVES:
 303          // Call the Archives plugin:
 304          $Plugins->call_by_code( 'evo_Arch', array( // Parameters follow:
 305                  'block_start'     => '<fieldset>',
 306                  'block_end'       => "</fieldset>\n",
 307                  'title'           => '<legend>'.T_('Archives')."</legend>\n",
 308                  'link_type'       => 'context', // Preserve page context
 309                  'form'            => true,      // add form fields (radio buttons)
 310                  'limit'           => '',        // No limit
 311                  'more_link'       => '',        // No more link
 312                  'itemlist_prefix' => $pp,       // Prefix of the ItemList object
 313              ) );
 314  
 315  
 316          $Form->submit( array( 'submit', T_('Search'), 'search' ) );
 317  
 318          if( $ItemList->is_filtered() )
 319          {
 320              // TODO: style this better:
 321              echo '&nbsp; <a href="?ctrl=items&amp;blog='.$Blog->ID.'&amp;filter=reset">'.T_('Reset all filters!').'</a>';
 322          }
 323  
 324      $Form->end_form();
 325  
 326  echo $template['block_end'];
 327  
 328  ?>

title

Description

title

Description

title

Description

title

title

Body