forms
[ class tree: forms ] [ index: forms ] [ all elements ]

Source for file SubmitCancelButton.class.php

Documentation is available at SubmitCancelButton.class.php

  1. <?php
  2. /**
  3.  * For including this file you have to define the constant "CLASSPATH".
  4.  * Because every include in the framework depends on the CLASSPATH definition.
  5.  * The CLASSPATH means the relative path to the folder that contains the
  6.  * framework GilliGan.
  7.  *
  8.  * @package    forms
  9.  * @subpackage items
  10.  */
  11.  
  12. if!defined"CLASSPATH" ) )
  13. {
  14.   echo "<h3>You have to define the constant CLASSPATH!</h3>\n";
  15.   echo "Example: define( 'CLASSPATH', '../path/to/classes/' );\n";
  16.   exit();
  17. }
  18.  
  19. if defined"LANG" ) )
  20.    /**
  21.     * Including language specific messages.
  22.     */
  23.    include CLASSPATH."/forms/items/SubmitCancelButton/".LANG.".inc.php";
  24. else
  25. {
  26.    echo "<h3>You have to define the constant LANG!</h3>\n";
  27.    echo "Example for german: define( 'LANG', 'de' );\n";
  28.    exit();
  29. }
  30.  
  31. /**
  32.  *
  33.  */
  34. require_once CLASSPATH."forms/items/HTMLButton.class.php";
  35. /**
  36.  *
  37.  */
  38. require_once CLASSPATH."forms/items/HTMLSubmitButton.class.php";
  39.  
  40. /**
  41.  * A class to create a reset and a buton to submit forms.
  42.  *
  43.  * @package    forms
  44.  * @subpackage items
  45.  * @version    0.1.21
  46.  * @author     Daniel Plücken <daniel@debakel.net>
  47.  * @license    http://www.gnu.org/copyleft/lesser.html
  48.  *              GNU Lesser General Public License
  49.  * @copyright  Copyright (C) 2006 Daniel Pluecken <daniel@debakel.net>
  50.  *
  51.  *  This library is free software; you can redistribute it and/or
  52.  *  modify it under the terms of the GNU Lesser General Public
  53.  *  License as published by the Free Software Foundation; either
  54.  *  version 2.1 of the License.
  55.  *
  56.  *  This library is distributed in the hope that it will be useful,
  57.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  58.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  59.  *  GNU Lesser General Public License for more details.
  60.  *
  61.  *  You should have received a copy of the GNU Lesser General
  62.  *  Public License along with this library; if not, write to the
  63.  *  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  64.  *  Boston, MA 02111-1307 USA
  65.  */
  66. {
  67.    /**
  68.     * @var object 
  69.     *  access private
  70.     */
  71.    var $cncbt;
  72.    /**
  73.     * @var object 
  74.     *  access private
  75.     */
  76.    var $sbtbt;
  77.  
  78.  
  79.  
  80.    /**
  81.     * Constructor
  82.     *
  83.     * @version 1.1
  84.     * @since   0.1.0
  85.     * @author  Daniel Plücken <daniel@debakel.net>
  86.     * @access  public
  87.     * @param   string  $labelSbtBt  Label for the submit button.
  88.     * @param   string  $labelCncBt  Label for the cancel button.
  89.     */
  90.    function SubmitCancelButton()
  91.    {
  92.       $param func_get_args();
  93.  
  94.       $labelSbtBt empty$param[0)
  95.                     ? STANDARD_LABEL_SUBMIT_BT
  96.                     : $param[0];
  97.       $labelCncBt empty$param[1)
  98.                     ? STANDARD_LABEL_CANCEL_BT
  99.                     : $param[1];
  100.  
  101.       $this->sbtbt =new HTMLSubmitButton"formsent"$labelSbtBt );
  102.       $this->cncbt =new HTMLButton"cancel"$labelCncBt );
  103.    }
  104.  
  105.  
  106.  
  107.   /**
  108.    * Sets the label of the reset button.
  109.    *
  110.    * @version 1.0
  111.    * @since   0.1.0
  112.    * @author  Daniel Plücken <daniel@debakel.net>
  113.    * @access  public
  114.    * @param   string  $string  The text how the reset button should be labled.
  115.    */
  116.    function setLabelOfCancelButton$string )
  117.    {
  118.      ifget_class$this->cncbt == "htmlresetbutton" )
  119.        $this->cncbt->setValue$string );
  120.    }
  121.  
  122.  
  123.  
  124.    /**
  125.    * Sets the label of the submit button.
  126.    *
  127.    * @version 1.0
  128.    * @since   0.1.0
  129.    * @author  Daniel Plücken <daniel@debakel.net>
  130.    * @access  public
  131.    * @param   string  $string  The text how the submit button should be labled.
  132.    */
  133.    function setLabelOfSubmitButton$string )
  134.    {
  135.      ifget_class$this->sbtbt == "htmlsubmitbutton" )
  136.        $this->sbtbt->setValue$string );
  137.    }
  138.  
  139.  
  140.  
  141.    /**
  142.     * Sets the "parentform"-attribute of both buttons.
  143.     *
  144.     * @version 1.0
  145.     * @since   0.1.0
  146.     * @author  Daniel Plücken <daniel@debakel.net>
  147.     * @access  public
  148.     * @param   object $formobj This object's parent object.
  149.     */
  150.    function setParentForm&$formobj )
  151.    {
  152.       $this->cncbt->parentform =$formobj;
  153.       $this->sbtbt->parentform =$formobj;
  154.    }
  155.  
  156.  
  157.  
  158.    /**
  159.     * Sets the mouseUp-function of the cancel button.
  160.     *
  161.     * @version 1.0
  162.     * @since   0.1.0
  163.     * @author  Daniel Plücken <daniel@debakel.net>
  164.     * @access  public
  165.     * @param   string $js_string Javascript of what to do on cancel.
  166.     */
  167.    function setCancelOrder$js_string )
  168.    $this->cncbt->setOnMouseUp$js_string )}
  169.  
  170.  
  171.  
  172.    /**
  173.     * Blind method cause other objects will invoke it.
  174.     *
  175.     * @version 1.0
  176.     * @since   0.1.0
  177.     * @author  Daniel Plücken <daniel@debakel.net>
  178.     * @access  public
  179.     * @return  string 
  180.     */
  181.    function getName()
  182.    return ""}
  183.  
  184.  
  185.  
  186.    /**
  187.     * Returns the name of the cancel button.
  188.     *
  189.     * @version 1.0
  190.     * @since   0.1.0
  191.     * @author  Daniel Plücken <daniel@debakel.net>
  192.     * @access  public
  193.     * @return  string 
  194.     */
  195.    function getNameOfCancelButton()
  196.    return $this->cncbt->getName()}
  197.  
  198.  
  199.  
  200.    /**
  201.     * Returns the label of the cancel button.
  202.     *
  203.     * @version 1.0
  204.     * @since   0.1.0
  205.     * @author  Daniel Plücken <daniel@debakel.net>
  206.     * @access  public
  207.     * @return  string 
  208.     */
  209.    function getLabelOfCancelButton()
  210.    {
  211.      ifget_class$this->cncbt == "htmlbutton" )
  212.        return $this->cncbt ->getValue();
  213.      else
  214.        return false;
  215.    }
  216.  
  217.  
  218.  
  219.    /**
  220.     * Returns the name of the submit button.
  221.     *
  222.     * @version 1.0
  223.     * @since   0.1.0
  224.     * @author  Daniel Plücken <daniel@debakel.net>
  225.     * @access  public
  226.     * @return  string 
  227.     */
  228.    function getNameOfSubmitButton()
  229.    return $this->sbtbt->getName()}
  230.  
  231.  
  232.  
  233.    /**
  234.     * Returns the label of the submit button.
  235.     *
  236.     * @version 1.0
  237.     * @since   0.1.0
  238.     * @author  Daniel Plücken <daniel@debakel.net>
  239.     * @access  public
  240.     * @return  string 
  241.     */
  242.    function getLabelOfSubmitButton()
  243.    {
  244.      ifget_class$this->sbtbt == "htmlsubmitbutton" )
  245.        return $this->sbtbt->getValue();
  246.      else
  247.        return false;
  248.    }
  249.  
  250.  
  251.  
  252.    /**
  253.     * Blind method cause other objects will invoke it.
  254.     *
  255.     * @version 1.0
  256.     * @since   0.1.0
  257.     * @author  Daniel Plücken <daniel@debakel.net>
  258.     * @access  public
  259.     * @return  boolean 
  260.     */
  261.    function getCheckOrder$formName )
  262.    return false}
  263.  
  264.  
  265.  
  266.    /**
  267.     * Blind method cause other objects will invoke it.
  268.     *
  269.     * @version 1.0
  270.     * @since   0.1.0
  271.     * @author  Daniel Plücken <daniel@debakel.net>
  272.     * @access  public
  273.     * @return  boolean 
  274.     */
  275.    function getValidationOrder$formName )
  276.    return false}
  277.  
  278.  
  279.  
  280.    /**
  281.    * Generates the sourcecode to build this object and returns it.
  282.    *
  283.    * @version 1.0
  284.    * @since   0.1.0
  285.    * @author  Daniel Plücken <daniel@debakel.net>
  286.    * @access  public
  287.    * @return  string 
  288.    */
  289.    function getPHPSource()
  290.    {
  291.       $outputstr "\x24input[] = new ResetSubmitButton(\n"
  292.                   ."                                   \""
  293.                   .$this->getLabelOfCancelButton()."\",\n"
  294.                   ."                                   \""
  295.                   .$this->getLabelOfSubmitButton()."\"\n"
  296.                   ."                                );\n";
  297.  
  298.       return $outputstr;
  299.    }
  300.  
  301.  
  302.  
  303.    /**
  304.     * Returns a generated string based on the attributes of this HTML-Object.
  305.     *
  306.     * @version 1.1
  307.     * @since   0.1.0
  308.     * @author  Daniel Plücken <daniel@debakel.net>
  309.     * @access  public
  310.     * @param   boolean $swap_position 
  311.     * @return  string 
  312.     */
  313.    function get$swap_position false )
  314.    {
  315.      if $swap_position )
  316.         return $this->sbtbt->get()
  317.               .$this->cncbt->get();
  318.      else
  319.         return $this->cncbt->get()
  320.               .$this->sbtbt->get();
  321.    }
  322. // End of class SubmitCancelButton
  323. ?>

Documentation generated on Thu, 05 Jun 2008 19:15:12 +0200 by phpDocumentor 1.4.1