[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file implements the element 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_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, $form_below_list; 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 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 71 function link_name( $title , $ID ) 72 { 73 global $GenericElementCache; 74 75 global $locked_IDs, $perm_name, $perm_level, $current_User; 76 77 if( ( empty( $locked_IDs ) || !in_array( $ID, $locked_IDs ) ) 78 && ( !isset( $perm_name ) || $current_User->check_perm( $perm_name, $perm_level, false ) ) ) 79 { // The element is not locked and we have permission permission to edit: 80 return '<strong><a href="'.regenerate_url( 'action,ID', $GenericElementCache->dbIDname.'='.$ID.'&action=edit' ).'">'.$title.'</a></strong>'; 81 } 82 else 83 { 84 return '<strong>'.$title.'</strong>'; 85 } 86 } 87 $Results->cols[] = array( 88 'th' => T_('Name'), 89 'order' => $GenericElementCache->dbprefix.'name', 90 'td' => '%link_name( #'.$GenericElementCache->dbprefix.'name#, #'.$GenericElementCache->dbIDname.'# )%', 91 ); 92 93 94 if( !isset( $perm_name ) || $current_User->check_perm( $perm_name, $perm_level, false ) ) 95 { // We have permission permission to edit: 96 97 function edit_actions( $ID ) 98 { 99 global $locked_IDs, $GenericElementCache; 100 101 $r = action_icon( T_('Duplicate...'), 'copy', regenerate_url( 'action,'.$GenericElementCache->dbIDname, $GenericElementCache->dbIDname.'='.$ID.'&action=copy' ) ); 102 103 if( empty( $locked_IDs ) || !in_array( $ID, $locked_IDs ) ) 104 { // This element is NOT locked: 105 $r = action_icon( T_('Edit...'), 'edit', regenerate_url( 'action,'.$GenericElementCache->dbIDname, $GenericElementCache->dbIDname.'='.$ID.'&action=edit' ) ) 106 .$r 107 .action_icon( T_('Delete!'), 'delete', regenerate_url( 'action,'.$GenericElementCache->dbIDname, $GenericElementCache->dbIDname.'='.$ID.'&action=delete' ) ); 108 109 } 110 111 return $r; 112 } 113 114 $Results->cols[] = array( 115 'th' => T_('Actions'), 116 'td_class' => 'shrinkwrap', 117 'td' => '%edit_actions( #'.$GenericElementCache->dbIDname.'# )%', 118 ); 119 120 } 121 122 if( !$form_below_list ) 123 { // Need to dispaly global icon to add new geenric element: 124 if( !isset( $perm_name ) || $current_User->check_perm( $perm_name, $perm_level, false ) ) 125 { // We have permission permission to edit: 126 $Results->global_icon( T_('Create a new element...'), 'new', regenerate_url( 'action,'.$GenericElementCache->dbIDname, 'action=new' ), T_('New element').' »', 3, 4 ); 127 } 128 } 129 130 // EXPERIMENTAL 131 // $Results->display(); 132 $Results->display( NULL, $result_fadeout ); 133 134 135 /* 136 * $Log: _generic_list.inc.php,v $ 137 * Revision 1.2 2007/09/08 20:23:03 fplanque 138 * action icons / wording 139 * 140 * Revision 1.1 2007/06/25 11:00:19 fplanque 141 * MODULES (refactored MVC) 142 * 143 * Revision 1.7 2007/04/26 00:11:11 fplanque 144 * (c) 2007 145 * 146 * Revision 1.6 2006/11/26 01:42:09 fplanque 147 * doc 148 */ 149 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 23:58:50 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |