[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/workflow/inc/ -> class.ui_monitors.inc.php (source)

   1  <?php
   2  
   3      require_once(dirname(__FILE__) . SEP . 'class.monitor.inc.php');
   4  
   5      class ui_monitors extends monitor
   6      {
   7  
   8          var $public_functions = array(
   9              'form'    => true,
  10          );
  11          var $filter_process_cleanup_aborted;
  12          var $cleanup_aborted_instances;
  13  
  14  		function ui_monitors()
  15          {
  16              //parent monitor with template name
  17              parent::monitor('monitors');
  18          }
  19  
  20  		function form()
  21          {
  22              $this->filter_process_cleanup_aborted = (int)get_var('filter_process_cleanup_aborted', 'POST', '');
  23              $this->filter_process_cleanup = (int)get_var('filter_process_cleanup', 'POST', '');
  24              $this->cleanup_aborted_instances = get_var('cleanup_aborted_instances', 'POST', '');
  25              $this->cleanup_process = get_var('cleanup_process', 'POST', '');
  26              
  27              $this->show_monitor_tabs($this->class_name);
  28              $this->show_filter_process_cleanup_aborted();
  29              $this->show_filter_process_cleanup();
  30              
  31              if (!($this->cleanup_aborted_instances==''))
  32              {
  33                  //process removing of aborted instances
  34                  $this->perform_aborted_cleanup();
  35              }
  36              if (!($this->cleanup_process==''))
  37              {
  38                  //process removing of all instances and workitems of the choosen process
  39                  $this->perform_process_cleanup();
  40              }
  41              
  42              $this->fill_local_variables();
  43              $this->fill_monitor_stats($this->stats);
  44                                                  $this->t->set_var(array('message' => implode('<br>', $this->message)));
  45                                                  $this->fill_general_variables();
  46              $this->finish();
  47          }
  48          
  49  		function perform_aborted_cleanup()
  50          {
  51              if (!($this->filter_process_cleanup_aborted))
  52              {
  53                  $this->message[] = lang('removing instances and workitems for aborted instances on all processes');
  54              }
  55              else
  56              {
  57                  $this->message[] = lang('removing instances and workitems for aborted instances on process #%1',$this->filter_process_cleanup_aborted);
  58              }
  59              if ($this->process_monitor->remove_aborted($this->filter_process_cleanup_aborted))
  60              {
  61                  $this->message[] = lang('complete cleanup of aborted instances done');
  62                  // we need to reload the monitor stats, we just changed them, in fact
  63                  $this->stats =& $this->process_monitor->monitor_stats();
  64              }
  65              else
  66              {
  67                  $this->message[] = lang('error: removing was not done');
  68              }
  69          }
  70  
  71  		function perform_process_cleanup()
  72          {
  73              $this->message[] = lang('removing instances and workitems for all instances on process #%1',$this->filter_process_cleanup);
  74              if ($this->process_monitor->remove_all($this->filter_process_cleanup))
  75              {
  76                  $this->message[] = lang('complete cleanup of all instances done');
  77                  // we need to reload the monitor stats, we just changed them, in fact
  78                  $this->stats =& $this->process_monitor->monitor_stats();
  79              }
  80              else
  81              {
  82                  $this->message[] = lang('error: removing was not done');
  83              }
  84          }
  85          
  86  		function show_filter_process_cleanup_aborted()
  87          {
  88              $this->t->set_var(array(
  89                  'filter_process_cleanup_aborted_selected_all' => (!$this->filter_process_cleanup_aborted)? 'selected="selected"' : ''
  90              ));
  91              $this->t->set_block($this->template_name, 'block_filter_process_cleanup_aborted', 'filter_process_cleanup_aborted');
  92              foreach ($this->all_processes['data'] as $process)
  93              {
  94                  $this->t->set_var(array(
  95                      'filter_process_cleanup_aborted_selected'       => ($process['wf_p_id'] == $this->filter_process_cleanup_aborted)? 'selected':'',
  96                      'filter_process_cleanup_aborted_value'          => $process['wf_p_id'],
  97                      'filter_process_cleanup_aborted_name'           => $process['wf_name'],
  98                      'filter_process_cleanup_aborted_version'        => $process['wf_version'],
  99                  ));
 100                  $this->t->parse('filter_process_cleanup_aborted', 'block_filter_process_cleanup_aborted', true);
 101              } 
 102          }
 103  
 104  		function show_filter_process_cleanup()
 105          {
 106              $this->t->set_block($this->template_name, 'block_filter_process_cleanup', 'filter_process_cleanup');
 107              foreach ($this->all_processes['data'] as $process)
 108              {
 109                  $this->t->set_var(array(
 110                      'filter_process_cleanup_selected'       => ($process['wf_p_id'] == $this->filter_process_cleanup)? 'selected':'',
 111                      'filter_process_cleanup_value'          => $process['wf_p_id'],
 112                      'filter_process_cleanup_name'           => $process['wf_name'],
 113                      'filter_process_cleanup_version'        => $process['wf_version'],
 114                  ));
 115                  $this->t->parse('filter_process_cleanup', 'block_filter_process_cleanup', true);
 116              } 
 117          }
 118          
 119          //! fill help messages
 120  		function fill_local_variables()
 121          {
 122              $this->t->set_var(array(
 123                      'help_monitor_processes'    => lang('list of processes with status and validity and, for each, counters of instances by status'),
 124                      'help_monitor_activities'    => lang('list of all activities with, for each,  counters of instances by status'),
 125                      'help_monitor_instances'    => lang('list of all instances with info about current status and activities and link to administration of theses instances'),
 126                      'help_monitor_workitems'    => lang('list of all history items made by instances while they travel in the workflow with information about duration and date'),
 127                      'help_cleanup_aborted'        => lang('warning: by using this button you will definitively remove all aborted instances AND their history (workitems) for the selected process.'),
 128                      'help_cleanup'            => lang('warning: by using this button you will definitively remove all instances AND their history (workitems) for the selected process, whatever the state they are.'),
 129              ));
 130          }
 131  
 132      }
 133  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7