b2evolution PHP Cross Reference Blogging Systems

Source: /inc/files/views/_file_links.view.php - 146 lines - 4282 bytes - Summary - Text - Print

Description: This file implements the UI for item links in the filemanager. 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 implements the UI for item links in the filemanager.
   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   * {@internal Open Source relicensing agreement:
  20   * }}
  21   *
  22   * @package admin
  23   *
  24   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  25   * @author fplanque: Francois PLANQUE.
  26   *
  27   * @version $Id: _file_links.view.php 6136 2014-03-08 07:59:48Z manuel $
  28   */
  29  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  30  
  31  
  32  /**
  33   * @var LinkOwner
  34   */
  35  global $LinkOwner;
  36  
  37  global $mode;
  38  
  39  if( $mode != 'upload' )
  40  {    // If not opearting in a popup opened from post edit screen:
  41  
  42      $Form = new Form( NULL, 'fm_links', 'post', 'fieldset' );
  43  
  44  
  45      $Form->begin_form( 'fform' );
  46  
  47      $Form->hidden_ctrl();
  48  
  49      $SQL = $LinkOwner->get_SQL();
  50  
  51      $Results = new Results( $SQL->get(), 'link_' );
  52  
  53      $view_link_title = $LinkOwner->translate( 'View this owner...' );
  54      $Results->title = sprintf( T_('Files linked to &laquo;%s&raquo;'),
  55                      '<a href="'.$LinkOwner->get_view_url().'" title="'.$view_link_title.'">'.$LinkOwner->get( 'title' ).'</a>' );
  56  
  57      if( $LinkOwner->check_perm( 'edit', false ) )
  58      {
  59          $Results->global_icon( $LinkOwner->translate( 'Edit this owner...' ), 'edit', $LinkOwner->get_edit_url(), T_('Edit') );
  60      }
  61  
  62      // Close link mode and continue in File Manager (remember the Item_ID though):
  63      $Results->global_icon( T_('Quit link mode!'), 'close', regenerate_url( 'fm_mode' ) );
  64  
  65  
  66      // TYPE COLUMN:
  67  	function file_type( & $row )
  68      {
  69          global $current_File;
  70  
  71          // Instantiate a File object for this line:
  72          $current_File = new File( $row->file_root_type, $row->file_root_ID, $row->file_path ); // COPY (FUNC) needed for following columns
  73          // Flow meta data into File object:
  74          $current_File->load_meta( false, $row );
  75  
  76          return $current_File->get_preview_thumb( 'fulltype' );
  77      }
  78      $Results->cols[] = array(
  79                              'th' => T_('File'),
  80                              'order' => 'link_ID',
  81                              'th_class' => 'shrinkwrap',
  82                              'td_class' => 'shrinkwrap',
  83                              'td' => '%file_type( {row} )%',
  84                          );
  85  
  86  
  87      // PATH COLUMN:
  88  	function file_path()
  89      {
  90          /**
  91           * @global File
  92           */
  93          global $current_File, $current_User;
  94          global $LinkOwner;
  95  
  96          $r = T_( 'You don\'t have permission to access this file root' );
  97          if( $current_User->check_perm( 'files', 'view', false, $current_File->get_FileRoot() ) )
  98          {
  99              // File relative path & name:
 100              $r = $current_File->get_linkedit_link( $LinkOwner->type, $LinkOwner->get_ID() );
 101          }
 102          return $r;
 103      }
 104      $Results->cols[] = array(
 105                              'th' => T_('Path'),
 106                              'order' => 'file_path',
 107                              'td_class' => 'left',
 108                              'td' => '%file_path()%',
 109                          );
 110  
 111  
 112      // TITLE COLUMN:
 113      $Results->cols[] = array(
 114                              'th' => T_('Title'),
 115                              'order' => 'file_title',
 116                              'td_class' => 'left',
 117                              'td' => '$file_title$',
 118                          );
 119  
 120      // ACTIONS COLUMN:
 121      $Results->cols[] = array(
 122                              'th' => T_('Actions'),
 123                              'th_class' => 'shrinkwrap',
 124                              'td_class' => 'shrinkwrap',
 125                              'td' => '%link_actions( #link_ID#, {CUR_IDX}, {TOTAL_ROWS} )%',
 126                          );
 127  
 128      // POSITION COLUMN:
 129      $Results->cols[] = array(
 130                          'th' => T_('Position'),
 131                          'td_class' => 'shrinkwrap',
 132                          'td' => '%display_link_position( {row} )%',
 133                      );
 134  
 135      $Results->display();
 136  
 137      $Form->end_form( );
 138  }
 139  
 140  if( $LinkOwner->check_perm( 'edit' ) )
 141  {    // Check that we have permission to edit item:
 142      echo '<div>', $LinkOwner->translate( 'Click on link %s icons below to link additional files to $ownerTitle$.',
 143                              get_icon( 'link', 'imgtag', array('class'=>'top') ) ), '</div>';
 144  }
 145  
 146  ?>

title

Description

title

Description

title

Description

title

title

Body