*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Pdf / Destination.php
blob42ea17df5dc77221142d3d4d80601023d4573b5f
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 Destination
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: Destination.php 17182 2009-07-27 13:54:11Z alexander $
23 /** Zend_Pdf_ElementFactory */
24 require_once 'Zend/Pdf/ElementFactory.php';
26 /** Zend_Pdf_Page */
27 require_once 'Zend/Pdf/Page.php';
29 /** Zend_Pdf_Target */
30 require_once 'Zend/Pdf/Target.php';
33 /**
34 * Abstract PDF destination representation class
36 * @package Zend_Pdf
37 * @subpackage Destination
38 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
39 * @license http://framework.zend.com/license/new-bsd New BSD License
41 abstract class Zend_Pdf_Destination extends Zend_Pdf_Target
43 /**
44 * Load Destination object from a specified resource
46 * @internal
47 * @param $destinationArray
48 * @return Zend_Pdf_Destination
50 public static function load(Zend_Pdf_Element $resource)
52 if ($resource->getType() == Zend_Pdf_Element::TYPE_NAME || $resource->getType() == Zend_Pdf_Element::TYPE_STRING) {
53 require_once 'Zend/Pdf/Destination/Named.php';
54 return new Zend_Pdf_Destination_Named($resource);
57 if ($resource->getType() != Zend_Pdf_Element::TYPE_ARRAY) {
58 require_once 'Zend/Pdf/Exception.php';
59 throw new Zend_Pdf_Exception('An explicit destination must be a direct or an indirect array object.');
61 if (count($resource->items) < 2) {
62 require_once 'Zend/Pdf/Exception.php';
63 throw new Zend_Pdf_Exception('An explicit destination array must contain at least two elements.');
66 switch ($resource->items[1]->value) {
67 case 'XYZ':
68 require_once 'Zend/Pdf/Destination/Zoom.php';
69 return new Zend_Pdf_Destination_Zoom($resource);
70 break;
72 case 'Fit':
73 require_once 'Zend/Pdf/Destination/Fit.php';
74 return new Zend_Pdf_Destination_Fit($resource);
75 break;
77 case 'FitH':
78 require_once 'Zend/Pdf/Destination/FitHorizontally.php';
79 return new Zend_Pdf_Destination_FitHorizontally($resource);
80 break;
82 case 'FitV':
83 require_once 'Zend/Pdf/Destination/FitVertically.php';
84 return new Zend_Pdf_Destination_FitVertically($resource);
85 break;
87 case 'FitR':
88 require_once 'Zend/Pdf/Destination/FitRectangle.php';
89 return new Zend_Pdf_Destination_FitRectangle($resource);
90 break;
92 case 'FitB':
93 require_once 'Zend/Pdf/Destination/FitBoundingBox.php';
94 return new Zend_Pdf_Destination_FitBoundingBox($resource);
95 break;
97 case 'FitBH':
98 require_once 'Zend/Pdf/Destination/FitBoundingBoxHorizontally.php';
99 return new Zend_Pdf_Destination_FitBoundingBoxHorizontally($resource);
100 break;
102 case 'FitBV':
103 require_once 'Zend/Pdf/Destination/FitBoundingBoxVertically.php';
104 return new Zend_Pdf_Destination_FitBoundingBoxVertically($resource);
105 break;
107 default:
108 require_once 'Zend/Pdf/Destination/Unknown.php';
109 return new Zend_Pdf_Destination_Unknown($resource);
110 break;