[ 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/files/views/ -> _file_links.view.php (source)

   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-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   * {@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,v 1.2 2007/09/26 21:53:23 fplanque Exp $

  28   */
  29  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  30  
  31  
  32  /**

  33   * @var Item

  34   */
  35  global $edited_Item;
  36  
  37  
  38  $Form = & new Form( NULL, 'fm_links', 'post', 'fieldset' );
  39  
  40  
  41  $Form->begin_form( 'fform' );
  42  
  43  $Form->hidden_ctrl();
  44  
  45  
  46  $Results = & new Results(
  47                      'SELECT link_ID, link_ltype_ID, T_files.*
  48                           FROM T_links INNER JOIN T_files ON link_file_ID = file_ID
  49                          WHERE link_itm_ID = '.$edited_Item->ID,
  50                      'link_' );
  51  
  52  $Results->title = sprintf( T_('Files linked to &laquo;%s&raquo;'),
  53                  '<a href="?ctrl=items&amp;blog='.$edited_Item->blog_ID.'&amp;p='.$edited_Item->ID.'" title="'
  54                  .T_('View this post...').'">'.$edited_Item->dget('title').'</a>' );
  55  
  56  if( $current_User->check_perm( 'item_post!'.$edited_Item->status, 'edit', false, $edited_Item ) )
  57  { // User has permission to edit this post
  58      $Results->global_icon( T_('Edit this post...'), 'edit', '?ctrl=items&amp;action=edit&amp;p='.$edited_Item->ID, T_('Edit') );
  59  }
  60  
  61  // Close link mode and continue in File Manager (remember the Item_ID though):

  62  $Results->global_icon( T_('Quit link mode!'), 'close', regenerate_url( 'fm_mode' ) );
  63  
  64  
  65  // TYPE COLUMN:

  66  function file_type( & $row )
  67  {
  68      global $current_File;
  69  
  70      // Instantiate a File object for this line:

  71      $current_File = new File( $row->file_root_type, $row->file_root_ID, $row->file_path ); // COPY (FUNC) needed for following columns

  72      // Flow meta data into File object:

  73      $current_File->load_meta( false, $row );
  74  
  75      return $current_File->get_preview_thumb( 'fulltype' );
  76  }
  77  $Results->cols[] = array(
  78                          'th' => T_('Icon/Type'),
  79                          'th_class' => 'shrinkwrap',
  80                          'td_class' => 'shrinkwrap',
  81                          'td' => '%file_type( {row} )%',
  82                      );
  83  
  84  
  85  // PATH COLUMN:

  86  function file_path()
  87  {
  88      /**

  89       * @global File

  90       */
  91      global $current_File;
  92      global $edited_Item;
  93  
  94      // File relative path & name:

  95      return $current_File->get_linkedit_link( '&amp;fm_mode=link_item&amp;item_ID='.$edited_Item->ID );
  96  }
  97  $Results->cols[] = array(
  98                          'th' => T_('Path'),
  99                          'order' => 'file_path',
 100                          'td_class' => 'left',
 101                          'td' => '%file_path()%',
 102                      );
 103  
 104  
 105  // TITLE COLUMN:

 106  $Results->cols[] = array(
 107                          'th' => T_('Title'),
 108                          'order' => 'file_title',
 109                          'td_class' => 'left',
 110                          'td' => '$file_title$',
 111                      );
 112  
 113  
 114  // ACTIONS COLUMN:

 115  function file_actions( $link_ID )
 116  {
 117      global $current_File, $edited_Item, $current_User;
 118  
 119      $title = T_('Locate this file!');
 120  
 121      $r = $current_File->get_linkedit_link( '&amp;fm_mode=link_item&amp;item_ID='.$edited_Item->ID, get_icon( 'locate', 'imgtag', array( 'title'=>$title ) ), $title );
 122  
 123      if( $current_User->check_perm( 'item', 'edit', false, $edited_Item ) )
 124      {    // Check that we have permission to edit item:
 125          $r .= action_icon( T_('Delete this link!'), 'unlink',
 126                        regenerate_url( 'action', 'link_ID='.$link_ID.'&amp;action=unlink') );
 127      }
 128  
 129      return $r;
 130  }
 131  $Results->cols[] = array(
 132                          'th' => T_('Actions'),
 133                          'th_class' => 'shrinkwrap',
 134                          'td_class' => 'shrinkwrap',
 135                          'td' => '%file_actions( #link_ID# )%',
 136                      );
 137  
 138  $Results->display();
 139  
 140  if( $current_User->check_perm( 'item', 'edit', false, $edited_Item ) )
 141  {    // Check that we have permission to edit item:
 142      printf( '<p>'.T_('Click on link %s icons below to link additional files to this item.').'</p>', get_icon( 'link', 'imgtag', array('class'=>'top') ) );
 143  }
 144  
 145  $Form->end_form( );
 146  
 147  
 148  /*

 149   * $Log: _file_links.view.php,v $

 150   * Revision 1.2  2007/09/26 21:53:23  fplanque

 151   * file manager / file linking enhancements

 152   *

 153   * Revision 1.1  2007/06/25 11:00:01  fplanque

 154   * MODULES (refactored MVC)

 155   *

 156   * Revision 1.13  2007/04/26 00:11:10  fplanque

 157   * (c) 2007

 158   *

 159   * Revision 1.12  2006/12/14 01:46:29  fplanque

 160   * refactoring / factorized image preview display

 161   *

 162   * Revision 1.11  2006/12/14 00:33:53  fplanque

 163   * thumbnails & previews everywhere.

 164   * this is getting good :D

 165   *

 166   * Revision 1.10  2006/12/12 19:39:07  fplanque

 167   * enhanced file links / permissions

 168   *

 169   * Revision 1.9  2006/12/12 18:04:53  fplanque

 170   * fixed item links

 171   *

 172   * Revision 1.8  2006/12/07 20:03:32  fplanque

 173   * Woohoo! File editing... means all skin editing.

 174   *

 175   * Revision 1.7  2006/11/24 18:27:25  blueyed

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

 177   */
 178  ?>


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