b2evolution PHP Cross Reference Blogging Systems

Source: /inc/cron/views/_cronjob.view.php - 140 lines - 4789 bytes - Text - Print

Description: This file implements the UI view for the cron log form.

   1  <?php
   2  /**
   3   * This file implements the UI view for the cron log form.
   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   * @version $Id: _cronjob.view.php 6136 2014-03-08 07:59:48Z manuel $
  25   */
  26  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  27  
  28  global $cjob_row, $current_User, $admin_url;
  29  
  30  $Form = new Form( NULL, 'cronlog' );
  31  
  32  if( empty( $cjob_row->clog_status ) && $current_User->check_perm( 'options', 'edit', false, NULL ) )
  33  { // User can edit this job:
  34      $Form->global_icon( T_('Edit this job'), 'edit', $admin_url.'?ctrl=crontab&amp;action=edit&amp;ctsk_ID='.$cjob_row->ctsk_ID, T_('Edit this job...'), 3, 3 );
  35  }
  36  
  37  $Form->global_icon( T_('Close sheet'), 'close', regenerate_url( 'action,cjob_ID' ) );
  38  
  39  $manual_link = cron_job_manual_link( $cjob_row->ctsk_controller );
  40  
  41  $Form->begin_form( 'fform', T_('Scheduled job') );
  42  
  43      $Form->begin_fieldset( T_('Job details').$manual_link );
  44  
  45          $Form->info( T_('Job #'), $cjob_row->ctsk_ID );
  46          $Form->info( T_('Job name'), $cjob_row->ctsk_name.$manual_link );
  47          $Form->info( T_('Scheduled at'), mysql2localedatetime($cjob_row->ctsk_start_datetime) );
  48          $cjob_repeat_after = '';
  49          if( $cjob_repeat_after_days = floor( $cjob_row->ctsk_repeat_after / 86400 ) )
  50          {
  51              $cjob_repeat_after .= $cjob_repeat_after_days.' '.T_('days').' ';
  52          }
  53          if( $cjob_repeat_after_hours = floor( ($cjob_row->ctsk_repeat_after % 86400 ) / 3600 ) )
  54          {
  55              $cjob_repeat_after .= $cjob_repeat_after_hours.' '.T_('hours').' ';
  56          }
  57          if( $cjob_repeat_after_minutes = floor( ($cjob_row->ctsk_repeat_after % 3600 ) / 60 ) )
  58          {
  59              $cjob_repeat_after .= $cjob_repeat_after_minutes.' '.T_('minutes');
  60          }
  61  
  62          $Form->info( T_('Repeat every'), $cjob_repeat_after );
  63  
  64      $Form->end_fieldset();
  65  
  66      $Form->begin_fieldset( T_('Execution details').get_manual_link('scheduler_execution_info') );
  67  
  68          if( empty( $cjob_row->clog_status ) )
  69          {
  70              $Form->info( T_('Status'), 'pending' );
  71          }
  72          else
  73          {
  74              $Form->info( T_('Status'), '<span class="cron_'.$cjob_row->clog_status.'">'.$cjob_row->clog_status.'</span>' );
  75              $Form->info( T_('Real start time'), mysql2localedatetime($cjob_row->clog_realstart_datetime) );
  76              $Form->info( T_('Real stop time'), mysql2localedatetime($cjob_row->clog_realstop_datetime) );
  77              $Form->info( T_('Duration'), seconds_to_period( strtotime( $cjob_row->clog_realstop_datetime ) - strtotime( $cjob_row->clog_realstart_datetime ) ) );
  78              $cron_messages_data = @unserialize( $cjob_row->clog_messages );
  79              if( !is_array( $cron_messages_data ) )
  80              {    // Simple messages
  81                  $Form->info( T_('Messages'), str_replace( "\n", "<br />\n", $cjob_row->clog_messages ) );
  82              }
  83              else
  84              {    // Serialized data
  85                  if( isset( $cron_messages_data['message'] ) )
  86                  {    // Display message
  87                      $Form->info( T_('Messages'), str_replace( "\n", "<br />\n", $cron_messages_data['message'] ) );
  88                  }
  89  
  90                  if( isset( $cron_messages_data['table_cols'], $cron_messages_data['table_data'] ) && ( !empty( $cron_messages_data['table_data'] ) ) )
  91                  {    // Display table with report
  92                      $Table = new Table( NULL, 'cron_' );
  93  
  94                      $Table->cols = array();
  95                      if( !empty( $cron_messages_data['table_cols'] ) )
  96                      {
  97                          foreach( $cron_messages_data['table_cols'] as $col_name )
  98                          {
  99                              $Table->cols[] = array( 'th' => $col_name );
 100                          }
 101                      }
 102  
 103                      $Table->display_init();
 104  
 105                      $Table->display_list_start();
 106  
 107                      // COLUMN HEADERS:
 108                      $Table->display_col_headers();
 109  
 110                      // BODY START:
 111                      $Table->display_body_start();
 112  
 113                      // Display table rows
 114                      foreach( $cron_messages_data['table_data'] as $data_row )
 115                      {
 116                          $Table->display_line_start( false, false );
 117  
 118                          foreach( $data_row as $row_value )
 119                          {
 120                              $Table->display_col_start();
 121                              echo $row_value;
 122                              $Table->display_col_end();
 123                          }
 124  
 125                          $Table->display_line_end();
 126                      }
 127  
 128                      // BODY END:
 129                      $Table->display_body_end();
 130  
 131                      $Table->display_list_end();
 132                  }
 133              }
 134          }
 135  
 136      $Form->end_fieldset();
 137  
 138  $Form->end_form();
 139  
 140  ?>

title

Description

title

Description

title

Description

title

title

Body