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

Source for file DataValidation.php

Documentation is available at DataValidation.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2011 PHPExcel
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  * 
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  *
  21.  * @category   PHPExcel
  22.  * @package    PHPExcel_Cell
  23.  * @copyright  Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.7.6, 2011-02-27
  26.  */
  27.  
  28.  
  29. /**
  30.  * PHPExcel_Cell_DataValidation
  31.  *
  32.  * @category   PHPExcel
  33.  * @package    PHPExcel_Cell
  34.  * @copyright  Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
  35.  */
  36. {
  37.     /* Data validation types */
  38.     const TYPE_NONE            'none';
  39.     const TYPE_CUSTOM        'custom';
  40.     const TYPE_DATE            'date';
  41.     const TYPE_DECIMAL        'decimal';
  42.     const TYPE_LIST            'list';
  43.     const TYPE_TEXTLENGTH    'textLength';
  44.     const TYPE_TIME            'time';
  45.     const TYPE_WHOLE        'whole';
  46.     
  47.     /* Data validation error styles */
  48.     const STYLE_STOP        'stop';
  49.     const STYLE_WARNING        'warning';
  50.     const STYLE_INFORMATION    'information';
  51.     
  52.     /* Data validation operators */
  53.     const OPERATOR_BETWEEN                'between';
  54.     const OPERATOR_EQUAL                'equal';
  55.     const OPERATOR_GREATERTHAN            'greaterThan';
  56.     const OPERATOR_GREATERTHANOREQUAL    'greaterThanOrEqual';
  57.     const OPERATOR_LESSTHAN                'lessThan';
  58.     const OPERATOR_LESSTHANOREQUAL        'lessThanOrEqual';
  59.     const OPERATOR_NOTBETWEEN            'notBetween';
  60.     const OPERATOR_NOTEQUAL                'notEqual';
  61.     
  62.     /**
  63.      * Formula 1
  64.      *
  65.      * @var string 
  66.      */
  67.     private $_formula1;
  68.     
  69.     /**
  70.      * Formula 2
  71.      *
  72.      * @var string 
  73.      */
  74.     private $_formula2;
  75.     
  76.     /**
  77.      * Type
  78.      *
  79.      * @var string 
  80.      */
  81.     private $_type PHPExcel_Cell_DataValidation::TYPE_NONE;
  82.     
  83.     /**
  84.      * Error style
  85.      *
  86.      * @var string 
  87.      */
  88.     private $_errorStyle PHPExcel_Cell_DataValidation::STYLE_STOP;
  89.     
  90.     /**
  91.      * Operator
  92.      *
  93.      * @var string 
  94.      */
  95.     private $_operator;
  96.     
  97.     /**
  98.      * Allow Blank
  99.      *
  100.      * @var boolean 
  101.      */
  102.     private $_allowBlank;
  103.     
  104.     /**
  105.      * Show DropDown
  106.      *
  107.      * @var boolean 
  108.      */
  109.     private $_showDropDown;
  110.     
  111.     /**
  112.      * Show InputMessage
  113.      *
  114.      * @var boolean 
  115.      */
  116.     private $_showInputMessage;
  117.     
  118.     /**
  119.      * Show ErrorMessage
  120.      *
  121.      * @var boolean 
  122.      */
  123.     private $_showErrorMessage;
  124.     
  125.     /**
  126.      * Error title
  127.      *
  128.      * @var string 
  129.      */
  130.     private $_errorTitle;
  131.     
  132.     /**
  133.      * Error
  134.      *
  135.      * @var string 
  136.      */
  137.     private $_error;
  138.     
  139.     /**
  140.      * Prompt title
  141.      *
  142.      * @var string 
  143.      */
  144.     private $_promptTitle;
  145.     
  146.     /**
  147.      * Prompt
  148.      *
  149.      * @var string 
  150.      */
  151.     private $_prompt;
  152.     
  153.     /**
  154.      * Create a new PHPExcel_Cell_DataValidation
  155.      *
  156.      * @throws    Exception
  157.      */
  158.     public function __construct()
  159.     {
  160.         // Initialise member variables
  161.         $this->_formula1             '';
  162.         $this->_formula2             '';
  163.         $this->_type                 PHPExcel_Cell_DataValidation::TYPE_NONE;
  164.         $this->_errorStyle             PHPExcel_Cell_DataValidation::STYLE_STOP;
  165.         $this->_operator             '';
  166.         $this->_allowBlank             false;
  167.         $this->_showDropDown         false;
  168.         $this->_showInputMessage     false;
  169.         $this->_showErrorMessage     false;
  170.         $this->_errorTitle             '';
  171.         $this->_error                 '';
  172.         $this->_promptTitle         '';
  173.         $this->_prompt                 '';
  174.     }
  175.     
  176.     /**
  177.      * Get Formula 1
  178.      *
  179.      * @return string 
  180.      */
  181.     public function getFormula1({
  182.         return $this->_formula1;
  183.     }
  184.  
  185.     /**
  186.      * Set Formula 1
  187.      *
  188.      * @param    string    $value 
  189.      * @return PHPExcel_Cell_DataValidation 
  190.      */
  191.     public function setFormula1($value ''{
  192.         $this->_formula1 $value;
  193.         return $this;
  194.     }
  195.  
  196.     /**
  197.      * Get Formula 2
  198.      *
  199.      * @return string 
  200.      */
  201.     public function getFormula2({
  202.         return $this->_formula2;
  203.     }
  204.  
  205.     /**
  206.      * Set Formula 2
  207.      *
  208.      * @param    string    $value 
  209.      * @return PHPExcel_Cell_DataValidation 
  210.      */
  211.     public function setFormula2($value ''{
  212.         $this->_formula2 $value;
  213.         return $this;
  214.     }
  215.     
  216.     /**
  217.      * Get Type
  218.      *
  219.      * @return string 
  220.      */
  221.     public function getType({
  222.         return $this->_type;
  223.     }
  224.  
  225.     /**
  226.      * Set Type
  227.      *
  228.      * @param    string    $value 
  229.      * @return PHPExcel_Cell_DataValidation 
  230.      */
  231.     public function setType($value PHPExcel_Cell_DataValidation::TYPE_NONE{
  232.         $this->_type $value;
  233.         return $this;
  234.     }
  235.  
  236.     /**
  237.      * Get Error style
  238.      *
  239.      * @return string 
  240.      */
  241.     public function getErrorStyle({
  242.         return $this->_errorStyle;
  243.     }
  244.  
  245.     /**
  246.      * Set Error style
  247.      *
  248.      * @param    string    $value 
  249.      * @return PHPExcel_Cell_DataValidation 
  250.      */
  251.     public function setErrorStyle($value PHPExcel_Cell_DataValidation::STYLE_STOP{
  252.         $this->_errorStyle $value;
  253.         return $this;
  254.     }
  255.  
  256.     /**
  257.      * Get Operator
  258.      *
  259.      * @return string 
  260.      */
  261.     public function getOperator({
  262.         return $this->_operator;
  263.     }
  264.  
  265.     /**
  266.      * Set Operator
  267.      *
  268.      * @param    string    $value 
  269.      * @return PHPExcel_Cell_DataValidation 
  270.      */
  271.     public function setOperator($value ''{
  272.         $this->_operator $value;
  273.         return $this;
  274.     }
  275.  
  276.     /**
  277.      * Get Allow Blank
  278.      *
  279.      * @return boolean 
  280.      */
  281.     public function getAllowBlank({
  282.         return $this->_allowBlank;
  283.     }
  284.  
  285.     /**
  286.      * Set Allow Blank
  287.      *
  288.      * @param    boolean    $value 
  289.      * @return PHPExcel_Cell_DataValidation 
  290.      */
  291.     public function setAllowBlank($value false{
  292.         $this->_allowBlank $value;
  293.         return $this;
  294.     }
  295.  
  296.     /**
  297.      * Get Show DropDown
  298.      *
  299.      * @return boolean 
  300.      */
  301.     public function getShowDropDown({
  302.         return $this->_showDropDown;
  303.     }
  304.  
  305.     /**
  306.      * Set Show DropDown
  307.      *
  308.      * @param    boolean    $value 
  309.      * @return PHPExcel_Cell_DataValidation 
  310.      */
  311.     public function setShowDropDown($value false{
  312.         $this->_showDropDown $value;
  313.         return $this;
  314.     }
  315.  
  316.     /**
  317.      * Get Show InputMessage
  318.      *
  319.      * @return boolean 
  320.      */
  321.     public function getShowInputMessage({
  322.         return $this->_showInputMessage;
  323.     }
  324.  
  325.     /**
  326.      * Set Show InputMessage
  327.      *
  328.      * @param    boolean    $value 
  329.      * @return PHPExcel_Cell_DataValidation 
  330.      */
  331.     public function setShowInputMessage($value false{
  332.         $this->_showInputMessage $value;
  333.         return $this;
  334.     }
  335.  
  336.     /**
  337.      * Get Show ErrorMessage
  338.      *
  339.      * @return boolean 
  340.      */
  341.     public function getShowErrorMessage({
  342.         return $this->_showErrorMessage;
  343.     }
  344.  
  345.     /**
  346.      * Set Show ErrorMessage
  347.      *
  348.      * @param    boolean    $value 
  349.      * @return PHPExcel_Cell_DataValidation 
  350.      */
  351.     public function setShowErrorMessage($value false{
  352.         $this->_showErrorMessage $value;
  353.         return $this;
  354.     }
  355.  
  356.     /**
  357.      * Get Error title
  358.      *
  359.      * @return string 
  360.      */
  361.     public function getErrorTitle({
  362.         return $this->_errorTitle;
  363.     }
  364.  
  365.     /**
  366.      * Set Error title
  367.      *
  368.      * @param    string    $value 
  369.      * @return PHPExcel_Cell_DataValidation 
  370.      */
  371.     public function setErrorTitle($value ''{
  372.         $this->_errorTitle $value;
  373.         return $this;
  374.     }
  375.  
  376.     /**
  377.      * Get Error
  378.      *
  379.      * @return string 
  380.      */
  381.     public function getError({
  382.         return $this->_error;
  383.     }
  384.  
  385.     /**
  386.      * Set Error
  387.      *
  388.      * @param    string    $value 
  389.      * @return PHPExcel_Cell_DataValidation 
  390.      */
  391.     public function setError($value ''{
  392.         $this->_error $value;
  393.         return $this;
  394.     }
  395.  
  396.     /**
  397.      * Get Prompt title
  398.      *
  399.      * @return string 
  400.      */
  401.     public function getPromptTitle({
  402.         return $this->_promptTitle;
  403.     }
  404.  
  405.     /**
  406.      * Set Prompt title
  407.      *
  408.      * @param    string    $value 
  409.      * @return PHPExcel_Cell_DataValidation 
  410.      */
  411.     public function setPromptTitle($value ''{
  412.         $this->_promptTitle $value;
  413.         return $this;
  414.     }
  415.  
  416.     /**
  417.      * Get Prompt
  418.      *
  419.      * @return string 
  420.      */
  421.     public function getPrompt({
  422.         return $this->_prompt;
  423.     }
  424.  
  425.     /**
  426.      * Set Prompt
  427.      *
  428.      * @param    string    $value 
  429.      * @return PHPExcel_Cell_DataValidation 
  430.      */
  431.     public function setPrompt($value ''{
  432.         $this->_prompt $value;
  433.         return $this;
  434.     }
  435.     
  436.     /**
  437.      * Get hash code
  438.      *
  439.      * @return string    Hash code
  440.      */    
  441.     public function getHashCode({
  442.         return md5(
  443.               $this->_formula1
  444.             . $this->_formula2
  445.             . $this->_type PHPExcel_Cell_DataValidation::TYPE_NONE
  446.             . $this->_errorStyle PHPExcel_Cell_DataValidation::STYLE_STOP
  447.             . $this->_operator
  448.             . ($this->_allowBlank 't' 'f')
  449.             . ($this->_showDropDown 't' 'f')
  450.             . ($this->_showInputMessage 't' 'f')
  451.             . ($this->_showErrorMessage 't' 'f')
  452.             . $this->_errorTitle
  453.             . $this->_error
  454.             . $this->_promptTitle
  455.             . $this->_prompt
  456.             . __CLASS__
  457.         );
  458.     }
  459.     
  460.     /**
  461.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  462.      */
  463.     public function __clone({
  464.         $vars get_object_vars($this);
  465.         foreach ($vars as $key => $value{
  466.             if (is_object($value)) {
  467.                 $this->$key clone $value;
  468.             else {
  469.                 $this->$key $value;
  470.             }
  471.         }
  472.     }
  473. }

Documentation generated on Sun, 27 Feb 2011 16:29:21 -0800 by phpDocumentor 1.4.3