[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/libraries/PHPExcel/PHPExcel/Cell/ -> DataValidation.php (source)

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


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1