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

   1  <?php
   2  
   3      require_once(dirname(__FILE__) . SEP . 'class.monitor.inc.php');
   4  
   5      class ui_monitorworkitems extends monitor
   6      {
   7  
   8          var $public_functions = array(
   9              'form'    => true,
  10          );
  11          var $filter_user;
  12          var $filter_instance;
  13  
  14  		function ui_monitorworkitems()
  15          {
  16              parent::monitor('monitor_workitems');
  17          }
  18  
  19  		function form()
  20          {
  21              //overrite monitor default sort values
  22              $this->order            = get_var('order', 'any', 'wf_item_id');
  23              $this->sort            = get_var('sort', 'any', 'DESC');
  24              $this->sort_mode        = $this->order . '__'. $this->sort;
  25              
  26              //get our own filters
  27              $this->filter_user        = (int)get_var('filter_user', 'any', 0);
  28              $this->filter_instance        = (int)get_var('filter_instance', 'any', 0);
  29              
  30              $this->show_monitor_tabs($this->class_name);
  31              
  32              //echo "order: <pre>";print_r($this->order);echo "</pre>";
  33              //echo "sort_mode: <pre>";print_r($this->sort_mode);echo "</pre>";
  34              
  35                  
  36              $this->link_data['search_str'] = $this->search_str;
  37              if ($this->filter_process) 
  38              {
  39                              $this->wheres[] = "gp.wf_p_id=".$this->filter_process;
  40                  $this->link_data['filter_process'] = $this->filter_process;
  41              }
  42              if ($this->filter_activity) 
  43              {  
  44                              $this->wheres[] = "ga.wf_activity_id=" .$this->filter_activity;
  45                  $this->link_data['filter_activity'] = $this->filter_activity;
  46              }
  47              if ($this->filter_user)
  48              {
  49                              $this->wheres[] = "wf_user =" .$this->filter_user;
  50                  $this->link_data['filter_user'] = $this->filter_user;
  51              }
  52              if ($this->filter_instance != 0)
  53              {
  54                              $this->wheres[] = "wf_instance_id =" .$this->filter_instance;
  55                  $this->link_data['filter_instance'] = $this->filter_instance;
  56              }
  57              else 
  58              {
  59                  $this->filter_instance = '';
  60              }
  61              if (count($this->wheres) > 0)
  62              {
  63                              $this->where = implode(' and ', $this->wheres);
  64              }
  65              else 
  66              {
  67                  $this->where = '';
  68              }
  69              
  70              $wi_users    =& $this->process_monitor->monitor_list_wi_users();
  71              $workitems    =& $this->process_monitor->monitor_list_workitems($this->start, $this->offset, $this->sort_mode, $this->search_str, $this->where);
  72  
  73              $this->show_filter_process();
  74              $this->show_filter_unique_activities();
  75  
  76              $this->show_filter_user($wi_users, $this->filter_user);
  77              $this->show_workitems_table($workitems['data'], $workitems['cant']);
  78  
  79              $this->t->set_var('filter_instance', $this->filter_instance);
  80              $this->fill_general_variables();
  81              $this->finish();
  82          }
  83  
  84  		function show_workitems_table(&$workitems_data, $total_number)
  85          {
  86              //_debug_array($workitems_data);
  87              
  88              //warning header names are header_[name or alias of the column in the query without a dot]
  89              //this is necessary for sorting
  90              $header_array = array(
  91                  'wf_item_id'        => lang('Id'),
  92                  'wf_procname'        => lang('Process'),
  93                  'wf_act_name'        => lang('Activity'),
  94                  'wf_instance_id'    => lang('Inst.'),
  95                  'wf_order_id'        => lang('#'),
  96                  'wf_started'        => lang('Started'),
  97                  'wf_duration'        => lang('Duration'),
  98                  'wf_user'        => lang('User'),
  99              );
 100              
 101              $this->fill_nextmatchs($header_array,$total_number);
 102  
 103              $this->t->set_block('monitor_workitems', 'block_workitems_table', 'workitems_table');
 104              $this->t->set_var(array('header_details'=> lang('details')));
 105  
 106              foreach ($workitems_data as $workitem)
 107              {
 108                  $link_view_workitem = $GLOBALS['egw']->link('/index.php', 'menuaction=workflow.ui_viewworkitem.form&itemId='. $workitem['wf_item_id']);
 109                  $this->t->set_var(array(
 110                      'wi_href'        => $link_view_workitem,
 111                      'wi_id'            => $workitem['wf_item_id'],
 112                      'wi_wf_procname'    => $workitem['wf_procname'],
 113                      'wi_version'        => $workitem['wf_version'],
 114                      'act_icon'        => $this->act_icon($workitem['wf_type'],$workitem['wf_is_interactive']),
 115                      'wi_actname'        => $workitem['wf_act_name'],
 116                      'wi_adm_inst_href'    => $GLOBALS['egw']->link('/index.php', 'menuaction=workflow.ui_admininstance.form&iid='. $workitem['wf_instance_id']),
 117                      'wi_inst_id'        => $workitem['wf_instance_id'],
 118                      'wi_order_id'        => $workitem['wf_order_id'],
 119                      'wi_started'        => $GLOBALS['egw']->common->show_date($workitem['wf_started'] - ((60*60) * $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset'])),
 120                      'wi_duration'        => $this->time_diff($workitem['wf_duration']),
 121                      'class_alternate_row'    => $this->nextmatchs->alternate_row_color($tr_color, true),
 122                      'link_view_details'    => '<a href="'.$link_view_workitem.'">'.lang('view details').'</a>',
 123                  ));
 124                  if( $workitem['wf_user'] == '*') {
 125                      $this->t->set_var('wi_user', $workitem['wf_user']);
 126                  }
 127                  else {
 128                      $this->t->set_var('wi_user', $GLOBALS['egw']->common->grab_owner_name($workitem['wf_user']));
 129                  }
 130                  $this->t->parse('workitems_table', 'block_workitems_table', true);
 131              }
 132              if (!count($workitems_data)) $this->t->set_var('workitems_table', '<tr><td colspan="8" align="center">'. lang('There are no workitems available') .'</td></tr>');
 133          }
 134  
 135  		function show_filter_user(&$wi_users, $filter_user)
 136          {
 137              $this->t->set_var('filter_user_select_all', (!$filter_user)? 'selected="selected"' : '');
 138              $this->t->set_block('monitor_workitems', 'block_filter_user', 'filter_user');
 139              foreach ($wi_users as $user)
 140              {
 141                  $this->t->set_var(array(
 142                      'filter_user_selected'    => ($user == $filter_user)? 'selected="selected"' : '',
 143                      'filter_user_value'        => $user,
 144                      //'filter_user_name'        => $GLOBALS['egw']->common->grab_owner_name($user)
 145                      //'filter_user_name'        => $user,
 146                  ));
 147                  if( $user == '*') {
 148                      $this->t->set_var('filter_user_name', $user);
 149                  }
 150                  else {
 151                      $this->t->set_var('filter_user_name', $GLOBALS['egw']->common->grab_owner_name($user));
 152                  }
 153                  $this->t->parse('filter_user', 'block_filter_user', true);
 154              }
 155          }
 156      }
 157  ?>


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