[ 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/generic/views/ -> _generic_ordered_list.inc.php (source)

   1  <?php
   2  /**

   3   * This file implements the ordered list editor 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   * Parts of this file are copyright (c)2005-2006 by PROGIDISTRI - {@link http://progidistri.com/}.

  10   *

  11   * {@internal License choice

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

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

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

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

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

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

  18   * }}

  19   *

  20   * {@internal Open Source relicensing agreement:

  21   * PROGIDISTRI S.A.S. grants Francois PLANQUE the right to license

  22   * PROGIDISTRI S.A.S.'s contributions to this file and the b2evolution project

  23   * under any OSI approved OSS license (http://www.opensource.org/licenses/).

  24   * }}

  25   *

  26   * @package admin

  27   *

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

  29   * @author fplanque: Francois PLANQUE.

  30   * @author mbruneau: Marc BRUNEAU / PROGIDISTRI

  31   *

  32   * @version $Id: _generic_ordered_list.inc.php,v 1.2 2007/09/08 20:23:03 fplanque Exp $

  33   */
  34  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  35  
  36  global $perm_name, $perm_level;
  37  
  38  global $result_fadeout;
  39  
  40  global $GenericElementCache;
  41  
  42  global $list_title, $default_col_order;
  43  
  44  
  45  // EXPERIMENTAL

  46  if ( !isset( $default_col_order ) )
  47  { // The default order column is not set, so the default is the name column
  48      $default_col_order = '-A-';
  49  }
  50  
  51  // Create result set:

  52  $sql = "SELECT $GenericElementCache->dbIDname, {$GenericElementCache->dbprefix}name, {$GenericElementCache->dbprefix}order
  53                     FROM $GenericElementCache->dbtablename";
  54  
  55  $Results = & new Results(    $sql, $GenericElementCache->dbprefix, $default_col_order );
  56  
  57  if( isset( $list_title ) )
  58  {
  59      $Results->title = $list_title;
  60  }
  61  
  62  $Results->cols[] = array(
  63          'th' => T_('ID'),
  64          'order' => $GenericElementCache->dbIDname,
  65          'th_class' => 'shrinkwrap',
  66          'td_class' => 'shrinkwrap',
  67          'td' => "\$$GenericElementCache->dbIDname\$",
  68      );
  69  
  70  function link_name( $title , $ID )
  71  {
  72      global $GenericElementCache;
  73      
  74      global $locked_IDs, $perm_name, $perm_level, $current_User;
  75      
  76      if( !in_array( $ID, $locked_IDs ) 
  77              && ( !isset( $perm_name ) || $current_User->check_perm( $perm_name, $perm_level, false ) ) )
  78      {    // The element is not locked and we have permission permission to edit:
  79          return '<strong><a href="'.regenerate_url( 'action,ID', $GenericElementCache->dbIDname.'='.$ID.'&amp;action=edit' ).'">'.$title.'</a></strong>';
  80      }
  81      else
  82      {
  83          return '<strong>'.$title.'</strong>';
  84      }
  85  }
  86  $Results->cols[] = array(
  87          'th' => T_('Name'),
  88          'order' => $GenericElementCache->dbprefix.'name',
  89           'td' => '%link_name( #'.$GenericElementCache->dbprefix.'name#, #'.$GenericElementCache->dbIDname.'# )%',
  90      );
  91  
  92  
  93  if( !isset( $perm_name ) || $current_User->check_perm( $perm_name, $perm_level, false ) )
  94  {    // We have permission permission to edit:
  95  
  96      $Results->cols[] = array(
  97              'th' => T_('Move'),
  98              'th_class' => 'shrinkwrap',
  99              'order' => $GenericElementCache->dbprefix.'order',
 100              'td_class' => 'shrinkwrap',
 101              'td' => '{move}',
 102          );
 103  
 104  	function edit_actions( $ID )
 105      {
 106          global $locked_IDs, $GenericElementCache;
 107  
 108          $r = action_icon( T_('Duplicate...'), 'copy', regenerate_url( 'action,'.$GenericElementCache->dbIDname, $GenericElementCache->dbIDname.'='.$ID.'&amp;action=copy' ) );
 109  
 110          if( empty( $locked_IDs ) || !in_array( $ID, $locked_IDs ) )
 111          { // This element is NOT locked:
 112              $r = action_icon( T_('Edit...'), 'edit', regenerate_url( 'action,'.$GenericElementCache->dbIDname, $GenericElementCache->dbIDname.'='.$ID.'&amp;action=edit' ) )
 113                          .$r
 114                          .action_icon( T_('Delete!'), 'delete', regenerate_url( 'action,'.$GenericElementCache->dbIDname, $GenericElementCache->dbIDname.'='.$ID.'&amp;action=delete' ) );
 115  
 116          }
 117  
 118          return $r;
 119      }
 120  
 121      $Results->cols[] = array(
 122              'th' => T_('Actions'),
 123              'td_class' => 'shrinkwrap',
 124              'td' => '%edit_actions( #'.$GenericElementCache->dbIDname.'# )%',
 125          );
 126  
 127  }
 128  
 129  if( !isset( $perm_name ) || $current_User->check_perm( $perm_name, $perm_level, false ) )
 130  {    // We have permission permission to edit:
 131      $Results->global_icon( T_('Create a new element...'), 'new', regenerate_url( 'action,'.$GenericElementCache->dbIDname, 'action=new' ), T_('New element').' &raquo;', 3, 4 );
 132  }
 133  
 134  // EXPERIMENTAL

 135  // $Results->display();

 136  $Results->display( NULL, $result_fadeout );
 137  
 138  
 139  /*

 140   * $Log: _generic_ordered_list.inc.php,v $

 141   * Revision 1.2  2007/09/08 20:23:03  fplanque

 142   * action icons / wording

 143   *

 144   * Revision 1.1  2007/06/25 11:00:20  fplanque

 145   * MODULES (refactored MVC)

 146   *

 147   * Revision 1.7  2007/04/26 00:11:11  fplanque

 148   * (c) 2007

 149   *

 150   * Revision 1.6  2006/11/26 01:42:09  fplanque

 151   * doc

 152   */
 153  ?>


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