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

   1  <?php
   2      require_once(dirname(__FILE__) . SEP . 'class.workflow.inc.php');
   3      
   4      class bo_workflow_forms extends workflow
   5      {
   6          //nextmatchs (max number of rows per page) and associated vars
   7          var $nextmatchs;
   8          var $start; //actual starting row number
   9          var $total_records; //total number of rows
  10          var $order; //column used for order
  11          var $sort; //ASC or DESC
  12          var $sort_mode; //combination of order and sort
  13          var $offset; //the number of authorized lines
  14          // searched string
  15          var $search_str;
  16          //associative array of input and values used for get links and/or hidden fields
  17          var $link_data = array();
  18          //name of the template associated with this form, used to set the form_action as well
  19          //for example a template named monitor_processes must be linked with a class.ui_monitor_processes.inc.php
  20          var $template_name;
  21          //form destination
  22          var $form_action;
  23          //related to template_name, name of the child class
  24          var $class_name;
  25          // message shown in red in top of forms
  26          var $message=Array();
  27          
  28  		function bo_workflow_forms($template_name)
  29          {
  30              parent::workflow();
  31              
  32              //retrieve common form POST or GET values
  33              $this->start        = (int)get_var('start', 'any', 0);
  34              $this->order        = get_var('order','any','wf_procname');
  35              $this->sort        = get_var('sort','any','ASC');
  36              $this->sort_mode    = $this->order . '__' . $this->sort;
  37              $this->search_str    = get_var('find', 'any', '');
  38              $this->nextmatchs    =& CreateObject('phpgwapi.nextmatchs');
  39              
  40              // number of rows allowed
  41                                                  if ($GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] > 0) 
  42                                                  {
  43                                                      $this->offset = $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
  44              }
  45              else
  46              {
  47                  $this->offset = 15;
  48              }
  49              
  50              $this->template_name = $template_name;
  51              $this->class_name = explode('_', $this->template_name);
  52              $this->class_name = implode('', $this->class_name);
  53              $this->form_action = $GLOBALS['egw']->link('/index.php', 'menuaction=workflow.ui_'. $this->class_name .'.form');
  54  
  55              $title = explode('_', $this->template_name);
  56              $title[0] = ucfirst($title[0]);
  57              $title[1] = ucfirst($title[1]);
  58              $title = implode(' ', $title);
  59              $GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps']['workflow']['title'] . ' - ' . lang($title);
  60              $GLOBALS['egw']->common->egw_header();
  61              echo parse_navbar();
  62  
  63              $this->t->set_file($this->template_name, $this->template_name . '.tpl');
  64          }
  65          
  66          //! fill the nextmatchs fields, arrows, and counter
  67          /**
  68           * * $header_array is an array with header_names => header_text_shown
  69           * * warning header names are header_[name or alias of the column in the query without a dot]
  70           * * this is necessary for sorting
  71           * * You need some fields on the template:
  72           * *         <table style="border: 0px;width:100%; margin:0 auto">
  73           * *             <tr class="th" style="font-weight:bold">
  74           * *                    {left}
  75           *          *     *          *     <td><div align="center">{lang_showing}</div></td>
  76           *          *     *          *     {right}
  77           * *             </tr>
  78           * *    </table>
  79           */
  80  		function fill_nextmatchs(&$header_array, $total_number)
  81          {
  82              $this->total_records = $total_number;
  83              // left and right nextmatchs arrows
  84              $this->t->set_var('left',$this->nextmatchs->left(
  85                  $this->form_action,$this->start,$this->total_records,$this->link_data));
  86              $this->t->set_var('right',$this->nextmatchs->right(
  87                  $this->form_action,$this->start,$this->total_records,$this->link_data));
  88              //show table headers with sort
  89              foreach($header_array as $col => $translation) 
  90              {
  91                  $this->t->set_var('header_'.$col,$this->nextmatchs->show_sort_order(
  92                      $this->sort,$col,$this->order,'/index.php',$translation,$this->link_data));
  93              }
  94              
  95              // info about number of rows
  96              if (($this->total_records) > $this->offset)    
  97              {
  98                  $this->t->set_var('lang_showing',lang('showing %1 - %2 of %3',
  99                      1+$this->start,
 100                      (($this->start+$this->offset) > ($this->total_records))? $this->total_records : $this->start+$this->offset,
 101                      $this->total_records));
 102              }
 103              else 
 104              {
 105                  $this->t->set_var('lang_showing', lang('showing %1',$this->total_records));
 106              }
 107          }
 108  
 109          //!fill general datas of workflow forms 
 110          /**
 111           * theses datas are:
 112           *     $message    : one or more ui message
 113           *     $search_str    : search string for research
 114           *     $start         * : nextmatch: number of the first row
 115           *     $sort         * : nextmatch: current sort header
 116           *     $order         * : nextmatch: asc or desc
 117           *     $form_action    : link to the monitor subclass
 118           */
 119  		function fill_form_variables()
 120          {
 121              $this->t->set_var(array(
 122                  'message'            => implode('<br />', array_filter($this->message)),
 123                  'start'                => $this->start,
 124                  'search_str'            => $this->search_str,
 125                  'sort'                => $this->sort,
 126                  'order'                => $this->order,
 127                  'form_action'            => $this->form_action,
 128              ));
 129          }
 130  
 131          //! finish the form process by translating the template, outputing it and showing the footer
 132  		function finish()
 133          {
 134              $this->translate_template($this->template_name);
 135              $this->t->pparse('output', $this->template_name);
 136              $GLOBALS['egw']->common->egw_footer();
 137          }
 138  
 139      }
 140  ?>


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