[ 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_monitoractivities.inc.php (source)

   1  <?php
   2  
   3      require_once(dirname(__FILE__) . SEP . 'class.monitor.inc.php');
   4  
   5      class ui_monitoractivities extends monitor
   6      {
   7  
   8          var $public_functions = array(
   9              'form'    => true,
  10          );
  11          var $filter_is_interactive;
  12          var $filter_is_autorouted;
  13          var $filter_type;
  14  
  15  		function ui_monitoractivities()
  16          {
  17              parent::monitor('monitor_activities');
  18          }
  19  
  20  		function form()
  21          {
  22              //override monitor sort values
  23                          $this->order            = get_var('order', 'any', 'wf_flow_num');
  24                          $this->sort_mode        = $this->order . '__'. $this->sort;
  25  
  26                          //add new filters
  27              $this->filter_is_interactive    = get_var('filter_is_interactive', 'any', '');
  28              $this->filter_is_autorouted    = get_var('filter_is_autorouted', 'any', '');
  29              $this->filter_type        = get_var('filter_type', 'any', '');
  30              $this->show_monitor_tabs($this->class_name);
  31              
  32              $this->link_data['search_str'] = $this->search_str;
  33              if ($this->filter_is_interactive) 
  34              {
  35                  $this->wheres[] = "wf_is_interactive='" . $this->filter_is_interactive . "'"; 
  36                  $this->link_data['filter_is_interactive'] = $this->filter_is_interactive;
  37              }
  38              if ($this->filter_is_autorouted) 
  39              {
  40                  $this->wheres[] = "wf_is_autorouted='" . $this->filter_is_autorouted . "'"; 
  41                  $this->link_data['filter_is_autorouted'] = $this->filter_is_autorouted;
  42              }
  43              if ($this->filter_process) 
  44              {
  45                  $this->wheres[] = "ga.wf_p_id='" .$this->filter_process. "'"; 
  46                  $this->link_data['filter_process'] = $this->filter_process;
  47              }        
  48              if ($this->filter_activity) 
  49              {
  50                  $this->wheres[] = "wf_activity_id='" .$this->filter_activity. "'"; 
  51                  $this->link_data['filter_activity'] = $this->filter_activity;
  52              }
  53              if ($this->filter_type) 
  54              {
  55                  $this->wheres[] = "wf_type= '" . $this->filter_type . "'"; 
  56                  $this->link_data['filter_type'] = $this->filter_type;
  57              }
  58  
  59              if( count($this->wheres) > 0 ) 
  60              {
  61                              $this->where = implode(' and ', $this->wheres);
  62              }
  63              else 
  64              {
  65                  $this->where = '';
  66              }
  67              $activities    =& $this->process_monitor->monitor_list_activities($this->start, $this->offset, $this->sort_mode, $this->search_str,$this->where);
  68              //_debug_array($activities);
  69              $all_types    =& $this->process_monitor->monitor_list_activity_types();
  70  
  71              $this->show_filter_process();
  72                          $this->show_filter_unique_activities($this->where);
  73                          $this->show_filter_types($all_types, $this->filter_type);
  74                          $this->show_filter_is_interactive($this->filter_is_interactive);
  75                          $this->show_filter_is_autorouted($this->filter_is_autorouted);
  76                          $this->show_activities_table($activities['data'], $activities['cant']);
  77  
  78                          $this->fill_general_variables();
  79                          $this->finish();
  80          }
  81  
  82  		function show_activities_table(&$activities_data, $total_number)
  83          {
  84              //_debug_array($activities_data);
  85              
  86              //warning header names are header_[name or alias of the column in the query without a dot]
  87              //this is necessary for sorting
  88              $header_array = array(
  89                  'wf_procname'        => lang('Process'),
  90                  'wf_name'        => lang('Name'),
  91                  'wf_type'        => lang('Type'),
  92                  'wf_is_interactive'    => lang('Int.'),
  93                  'wf_is_autorouted'    => lang('Routing'),
  94              );
  95              
  96              $this->fill_nextmatchs($header_array,$total_number);
  97  
  98              $this->t->set_block('monitor_activities', 'block_act_table', 'act_table');
  99              if (!$activities_data) {
 100                  $this->t->set_var('act_table', '<tr><td colspan="6" align="center">'. lang('There are no activities available') .'</td></tr>');
 101              }
 102              else {
 103                  foreach ($activities_data as $activity)
 104                  {
 105                      if ($activity['wf_type'] == 'standalone')
 106                      {
 107                          $this->t->set_var('act_run', '<a href="'. $GLOBALS['egw']->link('/index.php', 'menuaction=workflow.run_activity.go&activity_id='. $activity['wf_activity_id']) .'"><img src="'. $GLOBALS['egw']->common->image('workflow', 'next') .'" alt="'. lang('run activity') .'" title="'. lang('run activity') .'" /></a>');
 108                      }
 109                      elseif ($activity['wf_type'] == 'start')
 110                      {
 111                          $this->t->set_var('act_run', '<a href="'. $GLOBALS['egw']->link('/index.php', 'menuaction=workflow.run_activity.go&activity_id='. $activity['wf_activity_id'] .'&createInstance=1') .'"><img src="'. $GLOBALS['egw']->common->image('workflow', 'next') .'" alt="'. lang('run activity') .'" title="'. lang('run activity') .'" /></a>');
 112                      }
 113                      else
 114                      {
 115                          $this->t->set_var('act_run', '');
 116                      }
 117      
 118                      $this->t->set_var(array(
 119                          'act_process'            => $activity['wf_procname'],
 120                          'act_process_version'        => $activity['wf_version'],
 121                          'act_icon'            => $this->act_icon($activity['wf_type'],$activity['wf_is_interactive']),
 122                          'act_href'            => $GLOBALS['egw']->link('/index.php', 'menuaction=workflow.ui_adminactivities.form&p_id='. $activity['wf_p_id'] .'&activity_id='. $activity['wf_activity_id']),
 123                          'act_name'            => $activity['wf_name'],
 124                          'act_type'            => $activity['wf_type'],
 125                          'act_is_interactive'        => $activity['wf_is_interactive'],
 126                          'act_is_autorouted'        => $activity['wf_is_autorouted'],
 127                          'act_active_href'        => $GLOBALS['egw']->link('/index.php', 'menuaction=workflow.ui_monitorinstances.form&filter_process='. $activity['wf_p_id'] .'&filter_status=active&filter_activity='. $activity['wf_activity_id']),
 128                          'act_completed_href'        => $GLOBALS['egw']->link('/index.php', 'menuaction=workflow.ui_monitorinstances.form&filter_process='. $activity['wf_p_id'] .'&filter_status=completed&filter_activity='. $activity['wf_activity_id']),
 129                          'act_aborted_href'        => $GLOBALS['egw']->link('/index.php', 'menuaction=workflow.ui_monitorinstances.form&filter_process='. $activity['wf_p_id'] .'&filter_status=aborted&filter_activity='. $activity['wf_activity_id']),
 130                          'act_exception_href'        => $GLOBALS['egw']->link('/index.php', 'menuaction=workflow.ui_monitorinstances.form&filter_process='. $activity['wf_p_id'] .'&filter_status=exception&filter_activity='. $activity['wf_activity_id']),
 131                          'active_instances'        => $activity['active_instances'],
 132                          'completed_instances'        => $activity['completed_instances'],
 133                          'aborted_instances'        => $activity['aborted_instances'],
 134                          'exception_instances'        => $activity['exception_instances'],
 135                          'class_alternate_row'        => $this->nextmatchs->alternate_row_color($tr_color, true),
 136                      ));
 137                      $this->t->parse('act_table', 'block_act_table', true);
 138                  }
 139              }
 140          }
 141  
 142  		function show_filter_types(&$all_types, $filter_type)
 143          {
 144              $this->t->set_var('filter_type_selected_all', (!$filter_type)? 'selected="selected"' : '');
 145              $this->t->set_block('monitor_activities', 'block_filter_type', 'FilterType');
 146              foreach ($all_types as $type)
 147              {
 148  
 149                  $this->t->set_var(array(
 150                      'filter_type_selected'    => ($type == $filter_type)? 'selected="selected"' : '',
 151                      'filter_type'            => $type,
 152                      'filter_types'                  => $type,
 153  
 154                  ));
 155                  $this->t->parse('FilterType', 'block_filter_type', true);
 156              }
 157          }
 158  
 159  		function show_filter_is_interactive($filter_is_interactive)
 160          {
 161              $this->t->set_var(array(
 162                  'filter_interac_selected_all'    => ($filter_is_interactive)? '' : 'selected="selected"',
 163                  'filter_interac_selected_y'        => ($filter_is_interactive == 'y')? 'selected="selected"' : '',
 164                  'filter_interac_selected_n'        => ($filter_is_interactive == 'n')? 'selected="selected"' : '',
 165              ));
 166          }
 167  
 168  		function show_filter_is_autorouted($filter_is_autorouted)
 169          {
 170              $this->t->set_var(array(
 171                  'filter_route_selected_all'    => ($filter_is_autorouted)? '' : 'selected="selected"',
 172                  'filter_route_selected_y'        => ($filter_is_autorouted == 'y')? 'selected="selected"' : '',
 173                  'filter_route_selected_n'        => ($filter_is_autorouted == 'n')? 'selected="selected"' : '',
 174              ));
 175          }
 176      }
 177  ?>


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