[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/inc/chapters/views/ -> _chapter_list.view.php (source)

   1  <?php
   2  /**

   3   * This file implements the recursive chapter list.

   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-2007 by Francois PLANQUE - {@link http://fplanque.net/}

   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   * @package admin

  20   *

  21   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}

  22   * @author fplanque: Francois PLANQUE.

  23   *

  24   * @version $Id: _chapter_list.view.php,v 1.5 2007/09/08 20:23:03 fplanque Exp $

  25   */
  26  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  27  //____________________ Callbacks functions to display categories list _____________________

  28  
  29  global $Blog;
  30  
  31  global $GenericCategoryCache;
  32  
  33  global $line_class;
  34  
  35  global $permission_to_edit;
  36  
  37  global $subset_ID;
  38  
  39  global $result_fadeout;
  40  
  41  $line_class = 'odd';
  42  
  43  
  44  /**

  45   * Generate category line when it has children

  46   *

  47   * @param Chapter generic category we want to display

  48   * @param int level of the category in the recursive tree

  49   * @return string HTML

  50   */
  51  function cat_line( $Chapter, $level )
  52  {
  53      global $line_class, $result_fadeout, $permission_to_edit, $current_User, $Settings;
  54      global $GenericCategoryCache;
  55  
  56  
  57      $line_class = $line_class == 'even' ? 'odd' : 'even';
  58  
  59      $r = '<tr id="tr-'.$Chapter->ID.'"class="'.$line_class.
  60                      // Fadeout?

  61                      ( isset($result_fadeout[$GenericCategoryCache->dbIDname]) && in_array( $Chapter->ID, $result_fadeout[$GenericCategoryCache->dbIDname] ) ? ' fadeout-ffff00': '' ).'">
  62                      <td class="firstcol shrinkwrap">'.
  63                          $Chapter->ID.'
  64                  </td>';
  65  
  66      if( $permission_to_edit )
  67      {    // We have permission permission to edit:
  68          $edit_url = regenerate_url( 'action,'.$Chapter->dbIDname, $Chapter->dbIDname.'='.$Chapter->ID.'&amp;action=edit' );
  69          $r .= '<td>
  70                          <strong style="padding-left: '.($level).'em;"><a href="'.$edit_url.'" title="'.T_('Edit...').'">'.$Chapter->dget('name').'</a></strong>
  71                       </td>';
  72      }
  73      else
  74      {
  75          $r .= '<td>
  76                           <strong style="padding-left: '.($level).'em;">'.$Chapter->dget('name').'</strong>
  77                       </td>';
  78      }
  79  
  80      $r .= '<td>'.$Chapter->dget('urlname').'</td>';
  81  
  82  
  83      $r .= '<td class="lastcol shrinkwrap">';
  84      if( $permission_to_edit )
  85      {    // We have permission permission to edit, so display action column:
  86          $r .=  action_icon( T_('New...'), 'new', regenerate_url( 'action,cat_ID,cat_parent_ID', 'cat_parent_ID='.$Chapter->ID.'&amp;action=new' ) )
  87                      .action_icon( T_('Edit...'), 'edit', $edit_url );
  88          if( $Settings->get('allow_moving_chapters') )
  89          { // If moving cats between blogs is allowed:
  90              $r .= action_icon( T_('Move to a different blog...'), 'file_move', regenerate_url( 'action,cat_ID', 'cat_ID='.$Chapter->ID.'&amp;action=move' ), T_('Move') );
  91          }
  92          $r .= action_icon( T_('Delete...'), 'delete', regenerate_url( 'action,cat_ID', 'cat_ID='.$Chapter->ID.'&amp;action=delete' ) );
  93      }
  94      $r .= '</td>';
  95      $r .=    '</tr>';
  96  
  97      return $r;
  98  }
  99  
 100  
 101  /**

 102   * Generate category line when it has no children

 103   *

 104   * @param Chapter generic category we want to display

 105   * @param int level of the category in the recursive tree

 106   * @return string HTML

 107   */
 108  function cat_no_children( $Chapter, $level )
 109  {
 110      return '';
 111  }
 112  
 113  
 114  /**

 115   * Generate code when entering a new level

 116   *

 117   * @param int level of the category in the recursive tree

 118   * @return string HTML

 119   */
 120  function cat_before_level( $level )
 121  {
 122      return '';
 123  }
 124  
 125  /**

 126   * Generate code when exiting from a level

 127   *

 128   * @param int level of the category in the recursive tree

 129   * @return string HTML

 130   */
 131  function cat_after_level( $level )
 132  {
 133      return '';
 134  }
 135  
 136  
 137  $callbacks = array(
 138      'line'                   => 'cat_line',
 139      'no_children'  => 'cat_no_children',
 140      'before_level' => 'cat_before_level',
 141      'after_level'     => 'cat_after_level'
 142  );
 143  
 144  //____________________________________ Display generic categories _____________________________________

 145  
 146  $Table = & new Table();
 147  
 148  $Table->title = T_('Categories for blog:').' '.$Blog->dget('name');
 149  
 150  $Table->global_icon( T_('Create a new category...'), 'new', regenerate_url( 'action,'.$GenericCategoryCache->dbIDname, 'action=new' ), T_('New category').' &raquo;', 3, 4  );
 151  
 152  $Table->cols[] = array(
 153                          'th' => T_('ID'),
 154                      );
 155  $Table->cols[] = array(
 156                          'th' => T_('Name'),
 157                      );
 158  $Table->cols[] = array(
 159                          'th' => T_('URL name'),
 160                      );
 161  if( $permission_to_edit )
 162  {    // We have permission permission to edit, so display action column:
 163      $Table->cols[] = array(
 164                              'th' => T_('Actions'),
 165                          );
 166  }
 167  
 168  $Table->display_init( NULL, $result_fadeout );
 169  
 170  $Table->display_list_start();
 171  
 172  $Table->display_head();
 173  
 174  $Table->display_body_start();
 175  
 176  echo $GenericCategoryCache->recurse( $callbacks, $subset_ID );
 177  
 178  $Table->display_body_end();
 179  
 180  $Table->display_list_end();
 181  
 182  
 183  /* fp> TODO: maybe... (a general group move of posts would be more useful actually)

 184  echo '<p class="note">'.T_('<strong>Note:</strong> Deleting a category does not delete posts from that category. It will just assign them to the parent category. When deleting a root category, posts will be assigned to the oldest remaining category in the same collection (smallest category number).').'</p>';

 185  */
 186  
 187  global $Settings;
 188  if( ! $Settings->get('allow_moving_chapters') )
 189  {    // TODO: check perm
 190      echo '<p class="note">'.sprintf( T_('<strong>Note:</strong> Moving categories across blogs is currently disabled in the %sglobal settings%s.'), '<a href="admin.php?ctrl=features#categories">', '</a>' ).'</p> ';
 191  }
 192  
 193  
 194  /*

 195   * $Log: _chapter_list.view.php,v $

 196   * Revision 1.5  2007/09/08 20:23:03  fplanque

 197   * action icons / wording

 198   *

 199   * Revision 1.4  2007/09/08 18:21:13  blueyed

 200   * isset() check for $result_fadeout[$GenericCategoryCache->dbIDname], failed for "cat_ID" in chapters controller

 201   *

 202   * Revision 1.3  2007/09/04 13:47:48  fplanque

 203   * fixed fadeout

 204   *

 205   * Revision 1.2  2007/09/04 13:23:18  fplanque

 206   * Fixed display for category screen.

 207   *

 208   * Revision 1.1  2007/06/25 10:59:27  fplanque

 209   * MODULES (refactored MVC)

 210   *

 211   * Revision 1.10  2007/04/26 00:11:05  fplanque

 212   * (c) 2007

 213   *

 214   * Revision 1.9  2007/01/07 05:28:15  fplanque

 215   * i18n wording

 216   *

 217   * Revision 1.8  2006/12/11 00:32:26  fplanque

 218   * allow_moving_chapters stting moved to UI

 219   * chapters are now called categories in the UI

 220   *

 221   * Revision 1.7  2006/12/10 02:07:09  fplanque

 222   * doc

 223   *

 224   * Revision 1.6  2006/12/10 01:52:27  fplanque

 225   * old cats are now officially dead :>

 226   *

 227   * Revision 1.5  2006/12/09 17:59:34  fplanque

 228   * started "moving chapters accross blogs" feature

 229   *

 230   * Revision 1.4  2006/12/09 02:37:44  fplanque

 231   * Prevent user from creating loops in the chapter tree

 232   * (still needs a check before writing to DB though)

 233   *

 234   * Revision 1.3  2006/11/24 18:27:25  blueyed

 235   * Fixed link to b2evo CVS browsing interface in file docblocks

 236   */
 237  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics