b2evolution PHP Cross Reference Blogging Systems

Source: /inc/links/views/_link_list.view.php - 152 lines - 3664 bytes - Summary - Text - Print

Description: This file displays the links attached to an Object, which can be an Item, Comment, ... (called within the attachment_frame) This file is part of the evoCore framework - {@link http://evocore.net/} See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**

   3   * This file displays the links attached to an Object, which can be an Item, Comment, ... (called within the attachment_frame)

   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   *

  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   * @version $Id: $

  22   */
  23  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  24  
  25  /**

  26   * @var Blog

  27   */
  28  global $Blog;
  29  
  30  /**

  31   * Needed by functions

  32   * @var LinkOwner

  33   */
  34  global $LinkOwner;
  35  
  36  global $AdminUI, $current_User;
  37  
  38  // Override $debug in order to keep the display of the iframe neat

  39  global $debug;
  40  $debug = 0;
  41  
  42  if( empty( $Blog ) )
  43  {
  44      $Blog = & $LinkOwner->get_Blog();
  45  }
  46  
  47  // Name of the iframe we want some actions to come back to:

  48  param( 'iframe_name', 'string', '', true );
  49  
  50  $SQL = $LinkOwner->get_SQL();
  51  
  52  $Results = new Results( $SQL->get(), 'link_' );
  53  
  54  $Results->title = T_('Attachments');
  55  
  56  /*

  57   * Sub Type column

  58   */
  59  function display_subtype( & $row )
  60  {
  61      if( empty($row->file_ID) )
  62      {
  63          return '';
  64      }
  65  
  66      global $current_File;
  67      // Instantiate a File object for this line:

  68      $current_File = new File( $row->file_root_type, $row->file_root_ID, $row->file_path ); // COPY!

  69      // Flow meta data into File object:

  70      $current_File->load_meta( false, $row );
  71  
  72      return $current_File->get_preview_thumb( 'fulltype', true );
  73  }
  74  $Results->cols[] = array(
  75                          'th' => T_('Icon/Type'),
  76                          'td_class' => 'shrinkwrap',
  77                          'td' => '%display_subtype( {row} )%',
  78                      );
  79  
  80  
  81  /*

  82   * LINK column

  83   */
  84  function display_link( & $row )
  85  {
  86      if( !empty($row->file_ID) )
  87      {
  88          /**

  89           * @var File

  90           */
  91          global $current_File;
  92  
  93          $r = '';
  94  
  95          // File relative path & name:

  96          if( $current_File->is_dir() )
  97          { // Directory
  98              $r .= $current_File->dget( '_name' );
  99          }
 100          else
 101          { // File
 102              if( $view_link = $current_File->get_view_link() )
 103              {
 104                  $r .= $view_link;
 105              }
 106              else
 107              { // File extension unrecognized
 108                  $r .= $current_File->dget( '_name' );
 109              }
 110          }
 111  
 112          $title = $current_File->dget('title');
 113          if( $title !== '' )
 114          {
 115              $r .= '<span class="filemeta"> - '.$title.'</span>';
 116          }
 117  
 118          return $r;
 119      }
 120  
 121      return '?';
 122  }
 123  $Results->cols[] = array(
 124                          'th' => T_('Destination'),
 125                          'td' => '%display_link( {row} )%',
 126                      );
 127  
 128  $Results->cols[] = array(
 129                          'th' => T_('Link ID'),
 130                          'td' => '$link_ID$',
 131                          'th_class' => 'shrinkwrap',
 132                          'td_class' => 'shrinkwrap',
 133                      );
 134  
 135  if( $current_User->check_perm( 'files', 'view', false, $Blog->ID ) )
 136  {
 137      $Results->cols[] = array(
 138                              'th' => T_('Actions'),
 139                              'td_class' => 'shrinkwrap',
 140                              'td' => '%link_actions( #link_ID#, {CUR_IDX}, {TOTAL_ROWS} )%',
 141                          );
 142  }
 143  
 144  $Results->cols[] = array(
 145                          'th' => T_('Position'),
 146                          'td_class' => 'shrinkwrap',
 147                          'td' => '%display_link_position( {row} )%',
 148                      );
 149  
 150  $Results->display( $AdminUI->get_template( 'compact_results' ) );
 151  
 152  ?>

title

Description

title

Description

title

Description

title

title

Body