b2evolution PHP Cross Reference Blogging Systems

Source: /inc/generic/views/_generic_ordered_list.inc.php - 141 lines - 4879 bytes - Summary - Text - Print

Description: This file implements the ordered list editor list.

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

title

Description

title

Description

title

Description

title

title

Body