[ Index ] |
|
Code source de b2evolution 2.1.0-beta |
1 <?php 2 /** 3 * This file implements the UI view for the general settings. 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 * @version $Id: _cronjob_list.view.php,v 1.3 2007/09/12 21:00:31 fplanque Exp $ 25 */ 26 if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); 27 28 29 // Get filters: 30 global $ctst_pending, $ctst_started, $ctst_timeout, $ctst_error, $ctst_finished; 31 if( !$ctst_pending && !$ctst_started && !$ctst_timeout && !$ctst_error && !$ctst_finished ) 32 { // Set default status filters: 33 $ctst_pending = 1; 34 $ctst_started = 1; 35 $ctst_timeout = 1; 36 $ctst_error = 1; 37 } 38 39 /* 40 * Create result set : 41 */ 42 $SQL = & new SQL(); 43 $SQL->SELECT( 'ctsk_ID, ctsk_start_datetime, ctsk_name, ctsk_repeat_after, IFNULL( clog_status, "pending" ) as status' ); 44 $SQL->FROM( 'T_cron__task LEFT JOIN T_cron__log ON ctsk_ID = clog_ctsk_ID' ); 45 if( $ctst_pending ) 46 { 47 $SQL->WHERE_or( 'clog_status IS NULL' ); 48 } 49 if( $ctst_started ) 50 { 51 $SQL->WHERE_or( 'clog_status = "started"' ); 52 } 53 if( $ctst_timeout ) 54 { 55 $SQL->WHERE_or( 'clog_status = "timeout"' ); 56 } 57 if( $ctst_error ) 58 { 59 $SQL->WHERE_or( 'clog_status = "error"' ); 60 } 61 if( $ctst_finished ) 62 { 63 $SQL->WHERE_or( 'clog_status = "finished"' ); 64 } 65 $SQL->ORDER_BY( '*, ctsk_ID' ); 66 67 $Results = & new Results( $SQL->get(), 'crontab_', '-A' ); 68 69 $Results->title = T_('Scheduled jobs').get_manual_link('scheduler'); 70 71 72 $Results->global_icon( T_('Refresh'), 'refresh', regenerate_url(), T_('Refresh'), 3, 4 ); 73 if( $current_User->check_perm( 'options', 'edit', false, NULL ) ) 74 { // Permission to edit settings: 75 $Results->global_icon( T_('Create a new scheduled job...'), 'new', regenerate_url( 'action,cjob_ID', 'action=new' ), T_('New job').' »', 3, 4 ); 76 } 77 78 /** 79 * Callback to add filters on top of the result set 80 * 81 * @param Form 82 */ 83 function filter_crontab( & $Form ) 84 { 85 global $ctst_pending, $ctst_started, $ctst_timeout, $ctst_error, $ctst_finished; 86 87 $Form->checkbox( 'ctst_pending', $ctst_pending, T_('Pending') ); 88 $Form->checkbox( 'ctst_started', $ctst_started, T_('Started') ); 89 $Form->checkbox( 'ctst_timeout', $ctst_timeout, T_('Timed out') ); 90 $Form->checkbox( 'ctst_error', $ctst_error, T_('Error') ); 91 $Form->checkbox( 'ctst_finished', $ctst_finished, T_('Finished') ); 92 } 93 $Results->filter_area = array( 94 'callback' => 'filter_crontab', 95 'url_ignore' => 'results_crontab_page,ctst_pending,ctst_started,ctst_timeout,ctst_error,ctst_finished', // ignor epage param and checkboxes 96 'presets' => array( 97 'schedule' => array( T_('Schedule'), '?ctrl=crontab&ctst_pending=1&ctst_started=1&ctst_timeout=1&ctst_error=1' ), 98 'attention' => array( T_('Attention'), '?ctrl=crontab&ctst_timeout=1&ctst_error=1' ), 99 'all' => array( T_('All'), '?ctrl=crontab&ctst_pending=1&ctst_started=1&ctst_timeout=1&ctst_error=1&ctst_finished=1' ), 100 ) 101 ); 102 103 104 $Results->cols[] = array( 105 'th' => T_('ID'), 106 'order' => 'ctsk_ID', 107 'th_class' => 'shrinkwrap', 108 'td_class' => 'shrinkwrap', 109 'td' => '$ctsk_ID$' 110 ); 111 112 $Results->cols[] = array( 113 'th' => T_('Planned at'), 114 'order' => 'ctsk_start_datetime', 115 'td_class' => 'shrinkwrap', 116 'td' => '$ctsk_start_datetime$', 117 ); 118 119 $Results->cols[] = array( 120 'th' => T_('Name'), 121 'order' => 'ctsk_name', 122 'td' => '<a href="%regenerate_url(\'action,cjob_ID\',\'action=view&cjob_ID=$ctsk_ID$\')%">$ctsk_name$</a>', 123 ); 124 125 $Results->cols[] = array( 126 'th' => T_('Status'), 127 'order' => 'status', 128 'td_class' => 'shrinkwrap cron_$status$', 129 'td' => '$status$', 130 ); 131 132 $Results->cols[] = array( 133 'th' => T_('Repeat'), 134 'order' => 'ctsk_repeat_after', 135 'td_class' => 'shrinkwrap', 136 'td' => '$ctsk_repeat_after$', 137 ); 138 139 function crontab_actions( $ctsk_ID, $status ) 140 { 141 global $current_User; 142 143 $col = ''; 144 145 if( $status != 'started' && $current_User->check_perm( 'options', 'edit', false, NULL ) ) 146 { // User can edit options: 147 $col = action_icon( T_('Delete this job!'), 'delete', 148 regenerate_url( 'action', 'ctsk_ID='.$ctsk_ID.'&action=delete') ); 149 } 150 151 return $col; 152 } 153 $Results->cols[] = array( 154 'th' => T_('Actions'), 155 'td_class' => 'shrinkwrap', 156 'td' => '%crontab_actions( #ctsk_ID#, #status# )%', 157 ); 158 159 160 161 // Display results : 162 $Results->display(); 163 164 165 global $cron_url; 166 echo '<p>[<a href="'.$cron_url.'cron_exec.php" onclick="return pop_up_window( \''.$cron_url.'cron_exec.php\', \'evo_cron\' )" target="evo_cron">'.T_('Execute pending jobs in a popup window now!').'</a>]</p>'; 167 168 169 /* 170 * $Log: _cronjob_list.view.php,v $ 171 * Revision 1.3 2007/09/12 21:00:31 fplanque 172 * UI improvements 173 * 174 * Revision 1.2 2007/09/08 20:23:03 fplanque 175 * action icons / wording 176 * 177 * Revision 1.1 2007/06/25 10:59:49 fplanque 178 * MODULES (refactored MVC) 179 * 180 * Revision 1.10 2007/04/26 00:11:09 fplanque 181 * (c) 2007 182 * 183 * Revision 1.9 2007/01/26 02:12:06 fplanque 184 * cleaner popup windows 185 * 186 * Revision 1.8 2007/01/07 18:42:35 fplanque 187 * cleaned up reload/refresh icons & links 188 * 189 * Revision 1.7 2006/11/24 18:27:25 blueyed 190 * Fixed link to b2evo CVS browsing interface in file docblocks 191 * 192 * Revision 1.6 2006/07/05 22:13:10 blueyed 193 * trans consistency 194 * 195 * Revision 1.5 2006/07/05 18:26:33 fplanque 196 * no message 197 * 198 * Revision 1.4 2006/06/26 23:09:34 fplanque 199 * Really working cronjob environment :) 200 * 201 * Revision 1.3 2006/06/16 21:32:02 fplanque 202 * no message 203 * 204 * Revision 1.2 2006/06/13 21:52:44 blueyed 205 * Added files from 1.8 branch 206 * 207 * Revision 1.1.2.1 2006/06/12 20:00:39 fplanque 208 * one too many massive syncs... 209 * 210 */ 211 ?>
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 |
![]() |