*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Pdf / Action / GoTo.php
blobfa29f0afe8e0ed4f695dae6cb5af2ca2d9abfaa7
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
15 * @category Zend
16 * @package Zend_Pdf
17 * @subpackage Actions
18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: GoTo.php 17245 2009-07-28 13:59:45Z alexander $
23 /** Zend_Pdf_Action */
24 require_once 'Zend/Pdf/Action.php';
26 /** Zend_Pdf_Destination */
27 require_once 'Zend/Pdf/Destination.php';
30 /**
31 * PDF 'Go to' action
33 * @package Zend_Pdf
34 * @subpackage Actions
35 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
36 * @license http://framework.zend.com/license/new-bsd New BSD License
38 class Zend_Pdf_Action_GoTo extends Zend_Pdf_Action
40 /**
41 * GoTo Action destination
43 * @var Zend_Pdf_Destination
45 protected $_destination;
48 /**
49 * Object constructor
51 * @param Zend_Pdf_Element_Dictionary $dictionary
52 * @param SplObjectStorage $processedActions list of already processed action dictionaries, used to avoid cyclic references
53 * @throws Zend_Pdf_Exception
55 public function __construct(Zend_Pdf_Element $dictionary, SplObjectStorage $processedActions)
57 parent::__construct($dictionary, $processedActions);
59 $this->_destination = Zend_Pdf_Destination::load($dictionary->D);
62 /**
63 * Create new Zend_Pdf_Action_GoTo object using specified destination
65 * @param Zend_Pdf_Destination|string $destination
66 * @return Zend_Pdf_Action_GoTo
68 public static function create($destination)
70 if (is_string($destination)) {
71 require_once 'Zend/Pdf/Destination/Named.php';
72 $destination = Zend_Pdf_Destination_Named::create($destination);
75 if (!$destination instanceof Zend_Pdf_Destination) {
76 require_once 'Zend/Pdf/Exception.php';
77 throw new Zend_Pdf_Exception('$destination parameter must be a Zend_Pdf_Destination object or string.');
80 $dictionary = new Zend_Pdf_Element_Dictionary();
81 $dictionary->Type = new Zend_Pdf_Element_Name('Action');
82 $dictionary->S = new Zend_Pdf_Element_Name('GoTo');
83 $dictionary->Next = null;
84 $dictionary->D = $destination->getResource();
86 return new Zend_Pdf_Action_GoTo($dictionary, new SplObjectStorage());
89 /**
90 * Set goto action destination
92 * @return Zend_Pdf_Action_GoTo
94 public function setDestination(Zend_Pdf_Destination $destination)
96 $this->_destination = $destination;
98 $this->_actionDictionary->touch();
99 $this->_actionDictionary->D = $destination->getResource();
101 return $this;
105 * Get goto action destination
107 * @return Zend_Pdf_Destination
109 public function getDestination()
111 return $this->_destination;