[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file implements the generic recrusive 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_recursive_list.inc.php,v 1.2 2007/09/08 20:23:04 fplanque Exp $ 33 */ 34 if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); 35 //____________________ Callbacks functions to display categories list _____________________ 36 37 global $list_title; 38 39 global $GenericCategoryCache; 40 41 global $line_class; 42 43 global $permission_to_edit; 44 45 global $subset_ID; 46 47 $line_class = 'odd'; 48 49 50 /** 51 * Generate category line when it has children 52 * 53 * @param GenericCategory generic category we want to display 54 * @param int level of the category in the recursive tree 55 * @return string HTML 56 */ 57 function cat_line( $GenericCategory, $level ) 58 { 59 global $line_class, $result_fadeout, $permission_to_edit, $current_User; 60 61 $line_class = $line_class == 'even' ? 'odd' : 'even'; 62 63 $r = '<tr id="tr-'.$GenericCategory->ID.'"class="'.$line_class. 64 // Fadeout? 65 ( in_array( $GenericCategory->ID, $result_fadeout ) ? ' fadeout-ffff00': '' ).'"> 66 <td class="firstcol shrinkwrap">'. 67 $GenericCategory->ID.' 68 </td>'; 69 70 if( $permission_to_edit ) 71 { // We have permission permission to edit, so display action column: 72 $edit_url = regenerate_url( 'action,'.$GenericCategory->dbIDname, $GenericCategory->dbIDname.'='.$GenericCategory->ID.'&action=edit' ); 73 $r .= '<td> 74 <label style="padding-left: '.($level).'em;"><a href="'.$edit_url.'" title="'.T_('Edit...').'">'.$GenericCategory->name.'</a></label> 75 </td> 76 <td class="lastcol shrinkwrap">'. 77 action_icon( T_('New...'), 'new', regenerate_url( 'action,'.$GenericCategory->dbIDname.','.$GenericCategory->dbprefix.'parent_ID', $GenericCategory->dbprefix.'parent_ID='.$GenericCategory->ID.'&action=new' ) ). 78 action_icon( T_('Edit...'), 'edit', $edit_url ). 79 action_icon( T_('Delete...'), 'delete', regenerate_url( 'action,'.$GenericCategory->dbIDname, $GenericCategory->dbIDname.'='.$GenericCategory->ID.'&action=delete' ) ).' 80 </td>'; 81 } 82 else 83 { 84 $r .= '<td class="lastcol"> 85 <label style="padding-left: '.($level).'em;">'.$GenericCategory->name.'</label> 86 </td>'; 87 } 88 89 90 $r .= '</tr>'; 91 92 return $r; 93 } 94 95 96 /** 97 * Generate category line when it has no children 98 * 99 * @param GenericCategory generic category we want to display 100 * @param int level of the category in the recursive tree 101 * @return string HTML 102 */ 103 function cat_no_children( $GenericCategory, $level ) 104 { 105 return ''; 106 } 107 108 109 /** 110 * Generate code when entering a new level 111 * 112 * @param int level of the category in the recursive tree 113 * @return string HTML 114 */ 115 function cat_before_level( $level ) 116 { 117 return ''; 118 } 119 120 /** 121 * Generate code when exiting from a level 122 * 123 * @param int level of the category in the recursive tree 124 * @return string HTML 125 */ 126 function cat_after_level( $level ) 127 { 128 return ''; 129 } 130 131 132 $callbacks = array( 133 'line' => 'cat_line', 134 'no_children' => 'cat_no_children', 135 'before_level' => 'cat_before_level', 136 'after_level' => 'cat_after_level' 137 ); 138 139 //____________________________________ Display generic categories _____________________________________ 140 141 echo '<table class="grouped" cellspacing="0"> 142 <tr> 143 <th colspan="3" class="results_title"> 144 <div class="results_title">'; 145 146 147 if( $permission_to_edit ) 148 { // We have permission permission to edit, so display global icon to add nex genereic element: 149 echo '<span class="right_icons">' 150 .action_icon( T_('Create a new element...'), 'new', regenerate_url( 'action,'.$GenericCategoryCache->dbIDname, 'action=new' ), T_('Add element').' »', 3, 4 ).' 151 </span>'; 152 } 153 154 echo $list_title.' 155 </div> 156 </th> 157 </tr> 158 <tr> 159 <th class="firstcol shrinkwrap right">'.T_('ID').'</th> 160 <th>'.T_('Name').'</th>'; 161 162 if( $permission_to_edit ) 163 { // We have permission permission to edit, so display action column: 164 echo '<th class="lastcol">'.T_('Actions').'</th>'; 165 } 166 167 echo '</tr>'; 168 169 echo $GenericCategoryCache->recurse( $callbacks, $subset_ID ); 170 171 echo '</table>'; 172 173 174 /* 175 * $Log: _generic_recursive_list.inc.php,v $ 176 * Revision 1.2 2007/09/08 20:23:04 fplanque 177 * action icons / wording 178 * 179 * Revision 1.1 2007/06/25 11:00:21 fplanque 180 * MODULES (refactored MVC) 181 * 182 * Revision 1.8 2007/04/26 00:11:11 fplanque 183 * (c) 2007 184 * 185 * Revision 1.7 2006/11/24 18:27:26 blueyed 186 * Fixed link to b2evo CVS browsing interface in file docblocks 187 */ 188 ?>
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 |
![]() |