Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Data Fields | Protected Attributes
Zend_Pdf_Action Class Reference
Inheritance diagram for Zend_Pdf_Action:
Zend_Pdf_Target Zend_Pdf_Action_GoTo Zend_Pdf_Action_GoTo3DView Zend_Pdf_Action_GoToE Zend_Pdf_Action_GoToR Zend_Pdf_Action_Hide Zend_Pdf_Action_ImportData Zend_Pdf_Action_JavaScript Zend_Pdf_Action_Launch Zend_Pdf_Action_Movie Zend_Pdf_Action_Named Zend_Pdf_Action_Rendition Zend_Pdf_Action_ResetForm Zend_Pdf_Action_SetOCGState Zend_Pdf_Action_Sound Zend_Pdf_Action_SubmitForm Zend_Pdf_Action_Thread Zend_Pdf_Action_Trans Zend_Pdf_Action_Unknown Zend_Pdf_Action_URI

Public Member Functions

 __construct (Zend_Pdf_Element $dictionary, SplObjectStorage $processedActions)
 
 getResource ()
 
 dumpAction (Zend_Pdf_ElementFactory_Interface $factory, SplObjectStorage $processedActions=null)
 
 current ()
 
 key ()
 
 next ()
 
 rewind ()
 
 valid ()
 
 getChildren ()
 
 hasChildren ()
 
 count ()
 
- Public Member Functions inherited from Zend_Pdf_Target
 getResource ()
 

Static Public Member Functions

static load (Zend_Pdf_Element $dictionary, SplObjectStorage $processedActions=null)
 
- Static Public Member Functions inherited from Zend_Pdf_Target
static load (Zend_Pdf_Element $resource)
 

Data Fields

 $next = array()
 

Protected Attributes

 $_actionDictionary
 
 $_originalNextList
 

Detailed Description

Definition at line 41 of file Action.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Zend_Pdf_Element  $dictionary,
SplObjectStorage  $processedActions 
)

Object constructor

Parameters
Zend_Pdf_Element_Dictionary$dictionary
SplObjectStorage$processedActionslist of already processed action dictionaries, used to avoid cyclic references
Exceptions
Zend_Pdf_Exception

Definition at line 72 of file Action.php.

73  {
74  #require_once 'Zend/Pdf/Element.php';
75  if ($dictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
76  #require_once 'Zend/Pdf/Exception.php';
77  throw new Zend_Pdf_Exception('$dictionary mast be a direct or an indirect dictionary object.');
78  }
79 
80  $this->_actionDictionary = $dictionary;
81 
82  if ($dictionary->Next !== null) {
83  if ($dictionary->Next instanceof Zend_Pdf_Element_Dictionary) {
84  // Check if dictionary object is not already processed
85  if (!$processedActions->contains($dictionary->Next)) {
86  $processedActions->attach($dictionary->Next);
87  $this->next[] = Zend_Pdf_Action::load($dictionary->Next, $processedActions);
88  }
89  } else if ($dictionary->Next instanceof Zend_Pdf_Element_Array) {
90  foreach ($dictionary->Next->items as $chainedActionDictionary) {
91  // Check if dictionary object is not already processed
92  if (!$processedActions->contains($chainedActionDictionary)) {
93  $processedActions->attach($chainedActionDictionary);
94  $this->next[] = Zend_Pdf_Action::load($chainedActionDictionary, $processedActions);
95  }
96  }
97  } else {
98  #require_once 'Zend/Pdf/Exception.php';
99  throw new Zend_Pdf_Exception('PDF Action dictionary Next entry must be a dictionary or an array.');
100  }
101  }
102 
103  $this->_originalNextList = $this->next;
104  }
const TYPE_DICTIONARY
Definition: Element.php:37
static load(Zend_Pdf_Element $dictionary, SplObjectStorage $processedActions=null)
Definition: Action.php:115

Member Function Documentation

◆ count()

count ( )

count()

Returns
int

Definition at line 400 of file Action.php.

401  {
402  return count($this->childOutlines);
403  }

◆ current()

current ( )

Returns current child action.

Returns
Zend_Pdf_Action

Definition at line 329 of file Action.php.

330  {
331  return current($this->next);
332  }

◆ dumpAction()

dumpAction ( Zend_Pdf_ElementFactory_Interface  $factory,
SplObjectStorage  $processedActions = null 
)

Dump Action and its child actions into PDF structures

Returns dictionary indirect object or reference

Definition at line 255 of file Action.php.

256  {
257  if ($processedActions === null) {
258  $processedActions = new SplObjectStorage();
259  }
260  if ($processedActions->contains($this)) {
261  #require_once 'Zend/Pdf/Exception.php';
262  throw new Zend_Pdf_Exception('Action chain cyclyc reference is detected.');
263  }
264  $processedActions->attach($this);
265 
266  $childListUpdated = false;
267  if (count($this->_originalNextList) != count($this->next)) {
268  // If original and current children arrays have different size then children list was updated
269  $childListUpdated = true;
270  } else if ( !(array_keys($this->_originalNextList) === array_keys($this->next)) ) {
271  // If original and current children arrays have different keys (with a glance to an order) then children list was updated
272  $childListUpdated = true;
273  } else {
274  foreach ($this->next as $key => $childAction) {
275  if ($this->_originalNextList[$key] !== $childAction) {
276  $childListUpdated = true;
277  break;
278  }
279  }
280  }
281 
282  if ($childListUpdated) {
283  $this->_actionDictionary->touch();
284  switch (count($this->next)) {
285  case 0:
286  $this->_actionDictionary->Next = null;
287  break;
288 
289  case 1:
290  $child = reset($this->next);
291  $this->_actionDictionary->Next = $child->dumpAction($factory, $processedActions);
292  break;
293 
294  default:
295  #require_once 'Zend/Pdf/Element/Array.php';
296  $pdfChildArray = new Zend_Pdf_Element_Array();
297  foreach ($this->next as $child) {
298 
299  $pdfChildArray->items[] = $child->dumpAction($factory, $processedActions);
300  }
301  $this->_actionDictionary->Next = $pdfChildArray;
302  break;
303  }
304  } else {
305  foreach ($this->next as $child) {
306  $child->dumpAction($factory, $processedActions);
307  }
308  }
309 
310  if ($this->_actionDictionary instanceof Zend_Pdf_Element_Dictionary) {
311  // It's a newly created action. Register it within object factory and return indirect object
312  return $factory->newObject($this->_actionDictionary);
313  } else {
314  // It's a loaded object
316  }
317  }

◆ getChildren()

getChildren ( )

Returns the child action.

Returns
Zend_Pdf_Action|null

Definition at line 375 of file Action.php.

376  {
377  return current($this->next);
378  }

◆ getResource()

getResource ( )

Get resource

Definition at line 240 of file Action.php.

241  {
243  }

◆ hasChildren()

hasChildren ( )

Implements RecursiveIterator interface.

Returns
bool whether container has any pages

Definition at line 385 of file Action.php.

386  {
387  return count($this->next) > 0;
388  }

◆ key()

key ( )

Returns current iterator key

Returns
integer

Definition at line 339 of file Action.php.

340  {
341  return key($this->next);
342  }

◆ load()

static load ( Zend_Pdf_Element  $dictionary,
SplObjectStorage  $processedActions = null 
)
static

Load PDF action object using specified dictionary

Definition at line 115 of file Action.php.

116  {
117  if ($processedActions === null) {
118  $processedActions = new SplObjectStorage();
119  }
120 
121  #require_once 'Zend/Pdf/Element.php';
122  if ($dictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
123  #require_once 'Zend/Pdf/Exception.php';
124  throw new Zend_Pdf_Exception('$dictionary mast be a direct or an indirect dictionary object.');
125  }
126  if (isset($dictionary->Type) && $dictionary->Type->value != 'Action') {
127  #require_once 'Zend/Pdf/Exception.php';
128  throw new Zend_Pdf_Exception('Action dictionary Type entry must be set to \'Action\'.');
129  }
130 
131  if ($dictionary->S === null) {
132  #require_once 'Zend/Pdf/Exception.php';
133  throw new Zend_Pdf_Exception('Action dictionary must contain S entry');
134  }
135 
136  switch ($dictionary->S->value) {
137  case 'GoTo':
138  #require_once 'Zend/Pdf/Action/GoTo.php';
139  return new Zend_Pdf_Action_GoTo($dictionary, $processedActions);
140  break;
141 
142  case 'GoToR':
143  #require_once 'Zend/Pdf/Action/GoToR.php';
144  return new Zend_Pdf_Action_GoToR($dictionary, $processedActions);
145  break;
146 
147  case 'GoToE':
148  #require_once 'Zend/Pdf/Action/GoToE.php';
149  return new Zend_Pdf_Action_GoToE($dictionary, $processedActions);
150  break;
151 
152  case 'Launch':
153  #require_once 'Zend/Pdf/Action/Launch.php';
154  return new Zend_Pdf_Action_Launch($dictionary, $processedActions);
155  break;
156 
157  case 'Thread':
158  #require_once 'Zend/Pdf/Action/Thread.php';
159  return new Zend_Pdf_Action_Thread($dictionary, $processedActions);
160  break;
161 
162  case 'URI':
163  #require_once 'Zend/Pdf/Action/URI.php';
164  return new Zend_Pdf_Action_URI($dictionary, $processedActions);
165  break;
166 
167  case 'Sound':
168  #require_once 'Zend/Pdf/Action/Sound.php';
169  return new Zend_Pdf_Action_Sound($dictionary, $processedActions);
170  break;
171 
172  case 'Movie':
173  #require_once 'Zend/Pdf/Action/Movie.php';
174  return new Zend_Pdf_Action_Movie($dictionary, $processedActions);
175  break;
176 
177  case 'Hide':
178  #require_once 'Zend/Pdf/Action/Hide.php';
179  return new Zend_Pdf_Action_Hide($dictionary, $processedActions);
180  break;
181 
182  case 'Named':
183  #require_once 'Zend/Pdf/Action/Named.php';
184  return new Zend_Pdf_Action_Named($dictionary, $processedActions);
185  break;
186 
187  case 'SubmitForm':
188  #require_once 'Zend/Pdf/Action/SubmitForm.php';
189  return new Zend_Pdf_Action_SubmitForm($dictionary, $processedActions);
190  break;
191 
192  case 'ResetForm':
193  #require_once 'Zend/Pdf/Action/ResetForm.php';
194  return new Zend_Pdf_Action_ResetForm($dictionary, $processedActions);
195  break;
196 
197  case 'ImportData':
198  #require_once 'Zend/Pdf/Action/ImportData.php';
199  return new Zend_Pdf_Action_ImportData($dictionary, $processedActions);
200  break;
201 
202  case 'JavaScript':
203  #require_once 'Zend/Pdf/Action/JavaScript.php';
204  return new Zend_Pdf_Action_JavaScript($dictionary, $processedActions);
205  break;
206 
207  case 'SetOCGState':
208  #require_once 'Zend/Pdf/Action/SetOCGState.php';
209  return new Zend_Pdf_Action_SetOCGState($dictionary, $processedActions);
210  break;
211 
212  case 'Rendition':
213  #require_once 'Zend/Pdf/Action/Rendition.php';
214  return new Zend_Pdf_Action_Rendition($dictionary, $processedActions);
215  break;
216 
217  case 'Trans':
218  #require_once 'Zend/Pdf/Action/Trans.php';
219  return new Zend_Pdf_Action_Trans($dictionary, $processedActions);
220  break;
221 
222  case 'GoTo3DView':
223  #require_once 'Zend/Pdf/Action/GoTo3DView.php';
224  return new Zend_Pdf_Action_GoTo3DView($dictionary, $processedActions);
225  break;
226 
227  default:
228  #require_once 'Zend/Pdf/Action/Unknown.php';
229  return new Zend_Pdf_Action_Unknown($dictionary, $processedActions);
230  break;
231  }
232  }
const TYPE_DICTIONARY
Definition: Element.php:37

◆ next()

next ( )

Go to next child

Definition at line 347 of file Action.php.

348  {
349  return next($this->next);
350  }

◆ rewind()

rewind ( )

Rewind children

Definition at line 355 of file Action.php.

356  {
357  return reset($this->next);
358  }

◆ valid()

valid ( )

Check if current position is valid

Returns
boolean

Definition at line 365 of file Action.php.

366  {
367  return current($this->next) !== false;
368  }

Field Documentation

◆ $_actionDictionary

$_actionDictionary
protected

Definition at line 48 of file Action.php.

◆ $_originalNextList

$_originalNextList
protected

Definition at line 56 of file Action.php.

◆ $next

$next = array()

Definition at line 63 of file Action.php.


The documentation for this class was generated from the following file: