[ Index ]
 

Code source de Horde 3.1.3

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

title

Body

[fermer]

/lib/Horde/Form/Action/ -> sum_fields.php (source)

   1  <?php
   2  /**
   3   * Horde_Form_Action_sum_fields is a Horde_Form_Action that sets the target
   4   * field to the sum of one or more other numeric fields.
   5   *
   6   * The params array should contain the names of the fields which will be
   7   * summed.
   8   *
   9   * $Horde: framework/Form/Form/Action/sum_fields.php,v 1.5.10.4 2006/01/01 21:28:17 jan Exp $
  10   *
  11   * Copyright 2002-2006 Matt Kynaston <matt@kynx.org>
  12   *
  13   * See the enclosed file COPYING for license information (LGPL). If you
  14   * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  15   *
  16   * @author  Matt Kynaston <matt@kynx.org>
  17   * @package Horde_Form
  18   */
  19  class Horde_Form_Action_sum_fields extends Horde_Form_Action {
  20  
  21      var $_trigger = array('onload');
  22  
  23      function getActionScript(&$form, $renderer, $varname)
  24      {
  25          Horde::addScriptFile('form_helpers.js', 'horde', true);
  26  
  27          $form_name = $form->getName();
  28          $fields = "'" . implode("','", $this->_params) . "'";
  29          $js = array();
  30          $js[] = sprintf('document.forms[\'%s\'].elements[\'%s\'].disabled = true;',
  31                          $form_name,
  32                          $varname);
  33          foreach ($this->_params as $field) {
  34              $js[] = sprintf("addEvent(document.forms['%1\$s'].elements['%2\$s'], \"onchange\", \"sumFields(document.forms['%1\$s'], '%3\$s', %4\$s);\");",
  35                              $form_name,
  36                              $field,
  37                              $varname,
  38                              $fields);
  39          }
  40  
  41          return implode("\n", $js);
  42      }
  43  
  44  }


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