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

Source for file Hyperlink.php

Documentation is available at Hyperlink.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2009 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 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.6.5, 2009-01-05
  26.  */
  27.  
  28.  
  29. /**
  30.  * PHPExcel_Cell_Hyperlink
  31.  *
  32.  * @category   PHPExcel
  33.  * @package    PHPExcel_Cell
  34.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  35.  */
  36. {
  37.     /**
  38.      * Cell representing the hyperlink
  39.      *
  40.      * @var PHPExcel_Cell 
  41.      */
  42.     private $_cell;
  43.     
  44.     /**
  45.      * URL to link the cell to
  46.      *
  47.      * @var string 
  48.      */
  49.     private $_url;
  50.     
  51.     /**
  52.      * Tooltip to display on the hyperlink
  53.      *
  54.      * @var string 
  55.      */
  56.     private $_tooltip;    
  57.     
  58.     /**
  59.      * Create a new PHPExcel_Cell_Hyperlink
  60.      *
  61.      * @param     PHPExcel_Cell        $pCell        Parent cell
  62.      * @param     string                $pUrl        Url to link the cell to
  63.      * @param    string                $pTooltip    Tooltip to display on the hyperlink
  64.      * @throws    Exception
  65.      */
  66.     public function __construct(PHPExcel_Cell $pCell null$pUrl ''$pTooltip '')
  67.     {
  68.         // Initialise member variables
  69.         $this->_url         = $pUrl;
  70.         $this->_tooltip     = $pTooltip;
  71.      
  72.         // Set cell
  73.         $this->_parent         $pCell;
  74.     }
  75.     
  76.     /**
  77.      * Get URL
  78.      *
  79.      * @return string 
  80.      */
  81.     public function getUrl({
  82.         return $this->_url;
  83.     }
  84.  
  85.     /**
  86.      * Set URL
  87.      *
  88.      * @param    string    $value 
  89.      */
  90.     public function setUrl($value ''{
  91.         $this->_url = $value;
  92.     }
  93.     
  94.     /**
  95.      * Get tooltip
  96.      *
  97.      * @return string 
  98.      */
  99.     public function getTooltip({
  100.         return $this->_tooltip;
  101.     }
  102.  
  103.     /**
  104.      * Set tooltip
  105.      *
  106.      * @param    string    $value 
  107.      */
  108.     public function setTooltip($value ''{
  109.         $this->_tooltip = $value;
  110.     }
  111.     
  112.     /**
  113.      * Is this hyperlink internal? (to another sheet)
  114.      *
  115.      * @return boolean 
  116.      */
  117.     public function isInternal({
  118.         return strpos($this->_url'sheet://'!== false;
  119.     }
  120.     
  121.     /**
  122.      * Get parent
  123.      *
  124.      * @return PHPExcel_Cell 
  125.      */
  126.     public function getParent({
  127.         return $this->_parent;
  128.     }
  129.     
  130.     /**
  131.      * Set Parent
  132.      *
  133.      * @param    PHPExcel_Cell    $value 
  134.      */
  135.     public function setParent($value null{
  136.         $this->_parent $value;
  137.     }
  138.     
  139.     /**
  140.      * Get hash code
  141.      *
  142.      * @return string    Hash code
  143.      */    
  144.     public function getHashCode({
  145.         return md5(
  146.               $this->_url
  147.             . $this->_tooltip
  148.             . $this->_parent->getCoordinate()
  149.             . __CLASS__
  150.         );
  151.     }
  152. }

Documentation generated on Mon, 05 Jan 2009 20:37:58 +0100 by phpDocumentor 1.4.1