]> git.mxchange.org Git - core.git/blob - framework/main/classes/template/menu/class_MenuTemplateEngine.php
Rewrite continued:
[core.git] / framework / main / classes / template / menu / class_MenuTemplateEngine.php
1 <?php
2 // Own namespace
3 namespace CoreFramework\Template\Engine;
4
5 // Import framework stuff
6 use CoreFramework\Factory\ObjectFactory;
7 use CoreFramework\Filesystem\InvalidDirectoryException;
8 use CoreFramework\Parser\Xml\XmlParser;
9 use CoreFramework\Registry\Registry;
10 use CoreFramework\Template\CompileableTemplate;
11
12 // Import SPL stuff
13 use \UnexpectedValueException;
14
15 /**
16  * A Menu template engine class
17  *
18  * @author              Roland Haeder <webmaster@shipsimu.org>
19  * @version             0.0.0
20  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
21  * @license             GNU GPL 3.0 or any newer version
22  * @link                http://www.shipsimu.org
23  *
24  * This program is free software: you can redistribute it and/or modify
25  * it under the terms of the GNU General Public License as published by
26  * the Free Software Foundation, either version 3 of the License, or
27  * (at your option) any later version.
28  *
29  * This program is distributed in the hope that it will be useful,
30  * but WITHOUT ANY WARRANTY; without even the implied warranty of
31  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32  * GNU General Public License for more details.
33  *
34  * You should have received a copy of the GNU General Public License
35  * along with this program. If not, see <http://www.gnu.org/licenses/>.
36  */
37 class MenuTemplateEngine extends BaseTemplateEngine implements CompileableTemplate {
38         /**
39          * Main nodes in the XML tree ('menu' is ignored)
40          */
41         private $mainNodes = array(
42                 'block-list',
43         );
44
45         /**
46          * Sub nodes in the XML tree
47          */
48         private $subNodes = array(
49                 'entry-list',
50                 'entry',
51                 'entry-id',
52                 'entries-content',
53                 'block-header',
54                 'block-footer',
55                 'footer-id',
56                 'footer-class',
57                 'footer-text',
58                 'block',
59                 'title',
60                 'title-id',
61                 'title-class',
62                 'title-text',
63                 'design',
64                 'text',
65                 'advert',
66                 'anchor',
67                 'anchor-id',
68                 'anchor-text',
69                 'anchor-title',
70                 'anchor-href',
71         );
72
73         /**
74          * Variables for a menu entry
75          */
76         private $menuEntryVariables = array(
77                 // List entry
78                 'entry_id',
79                 // Anchor
80                 'anchor-id',
81                 'anchor-text',
82                 'anchor-title',
83                 'anchor-href',
84         );
85
86         /**
87          * Variables for a menu block
88          */
89         private $menuBlockVariables = array(
90                 // Title
91                 'title_id',
92                 'title_class',
93                 'title_text',
94                 // Content is taken from menuEntries
95                 // Footer
96                 'footer_id',
97                 'footer_class',
98                 'footer_text',
99         );
100
101         /**
102          * Rendered menu entries
103          */
104         private $menuEntries = array();
105
106         /**
107          * Rendered menu blocks
108          */
109         private $menuBlocks = array();
110
111         /**
112          * Menu instance
113          */
114         private $menuInstance = NULL;
115
116         /**
117          * Current main node
118          */
119         private $curr = array();
120
121         /**
122          * Content from dependency
123          */
124         private $dependencyContent = array();
125
126         /**
127          * Protected constructor
128          *
129          * @return      void
130          */
131         protected function __construct () {
132                 // Call parent constructor
133                 parent::__construct(__CLASS__);
134         }
135
136         /**
137          * Creates an instance of the class TemplateEngine and prepares it for usage
138          *
139          * @param       $menuInstance                   A RenderableMenu instance
140          * @return      $templateInstance               An instance of TemplateEngine
141          * @throws      UnexpectedValueException                If the found $templateBasePath is empty or not a string
142          * @throws      InvalidDirectoryException       If $templateBasePath is no directory or not found
143          * @throws      BasePathReadProtectedException  If $templateBasePath is
144          *                                                                                      read-protected
145          */
146         public static final function createMenuTemplateEngine (RenderableMenu $menuInstance) {
147                 // Get a new instance
148                 $templateInstance = new MenuTemplateEngine();
149
150                 // Get the application instance from registry
151                 $applicationInstance = Registry::getRegistry()->getInstance('app');
152
153                 // Determine base path
154                 $templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $applicationInstance->getAppShortName(). '/';
155
156                 // Is the base path valid?
157                 if (empty($templateBasePath)) {
158                         // Base path is empty
159                         throw new UnexpectedValueException(sprintf('[%s:%d] Variable templateBasePath is empty.', $templateInstance->__toString(), __LINE__), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
160                 } elseif (!is_string($templateBasePath)) {
161                         // Is not a string
162                         throw new UnexpectedValueException(sprintf('[%s:%d] %s is not a string with a base path.', $templateInstance->__toString(), __LINE__, $templateBasePath), self::EXCEPTION_INVALID_STRING);
163                 } elseif (!is_dir($templateBasePath)) {
164                         // Is not a path
165                         throw new InvalidDirectoryException(array($templateInstance, $templateBasePath), self::EXCEPTION_INVALID_PATH_NAME);
166                 } elseif (!is_readable($templateBasePath)) {
167                         // Is not readable
168                         throw new BasePathReadProtectedException(array($templateInstance, $templateBasePath), self::EXCEPTION_READ_PROTECED_PATH);
169                 }
170
171                 // Set the base path
172                 $templateInstance->setTemplateBasePath($templateBasePath);
173
174                 // Set template extensions
175                 $templateInstance->setRawTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('raw_template_extension'));
176                 $templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('menu_template_extension'));
177
178                 // Absolute output path for compiled templates
179                 $templateInstance->setCompileOutputPath(sprintf('%s%s/',
180                         $templateBasePath,
181                         $templateInstance->getConfigInstance()->getConfigEntry('compile_output_path')
182                 ));
183
184                 // Set the menu instance
185                 $templateInstance->setMenuInstance($menuInstance);
186
187                 // Init a variable stacker
188                 $stackInstance = ObjectFactory::createObjectByConfiguredName('menu_stacker_class');
189
190                 // Set it
191                 $templateInstance->setStackInstance($stackInstance);
192
193                 // Return the prepared instance
194                 return $templateInstance;
195         }
196
197         /**
198          * Load a specified menu template into the engine
199          *
200          * @param       $template       The menu template we shall load which is
201          *                                              located in 'menu' by default
202          * @return      void
203          */
204         public function loadMenuTemplate ($template) {
205                 // Set template type
206                 $this->setTemplateType($this->getConfigInstance()->getConfigEntry('menu_template_type'));
207
208                 // Load the special template
209                 $this->loadTemplate($template);
210         }
211
212         /**
213          * Getter for current main node
214          *
215          * @return      $currMainNode   Current main node
216          */
217         public final function getCurrMainNode () {
218                 return $this->curr['main_node'];
219         }
220
221         /**
222          * Setter for current main node
223          *
224          * @param       $element                Element name to set as current main node
225          * @return      $currMainNode   Current main node
226          */
227         private final function setCurrMainNode ($element) {
228                 $this->curr['main_node'] = (string) $element;
229         }
230
231         /**
232          * Getter for main node array
233          *
234          * @return      $mainNodes      Array with valid main node names
235          */
236         public final function getMainNodes () {
237                 return $this->mainNodes;
238         }
239
240         /**
241          * Getter for sub node array
242          *
243          * @return      $subNodes       Array with valid sub node names
244          */
245         public final function getSubNodes () {
246                 return $this->subNodes;
247         }
248
249         /**
250          * Handles the start element of an XML resource
251          *
252          * @param       $resource               XML parser resource (currently ignored)
253          * @param       $element                The element we shall handle
254          * @param       $attributes             All attributes
255          * @return      void
256          * @throws      InvalidXmlNodeException         If an unknown/invalid XML node name was found
257          */
258         public function startElement ($resource, $element, array $attributes) {
259                 // Initial method name which will never be called...
260                 $methodName = 'initMenu';
261
262                 // Make the element name lower-case
263                 $element = strtolower($element);
264
265                 // Is the element a main node?
266                 //* DEBUG: */ echo "START: &gt;".$element."&lt;<br />\n";
267                 if (in_array($element, $this->getMainNodes())) {
268                         // Okay, main node found!
269                         $methodName = 'start' . self::convertToClassName($element);
270
271                         // Set it
272                         $this->setCurrMainNode($element);
273                 } elseif (in_array($element, $this->getSubNodes())) {
274                         // Sub node found
275                         $methodName = 'start' . self::convertToClassName($element);
276                 } elseif ($element != 'menu') {
277                         // Invalid node name found
278                         throw new InvalidXmlNodeException(array($this, $element, $attributes), XmlParser::EXCEPTION_XML_NODE_UNKNOWN);
279                 }
280
281                 // Call method
282                 //* DEBUG: */ echo "call: ".$methodName."<br />\n";
283                 call_user_func_array(array($this, $methodName), $attributes);
284         }
285
286         /**
287          * Ends the main or sub node by sending out the gathered data
288          *
289          * @param       $resource       An XML resource pointer (currently ignored)
290          * @param       $nodeName       Name of the node we want to finish
291          * @return      void
292          * @throws      XmlNodeMismatchException        If current main node mismatches the closing one
293          */
294         public function finishElement ($resource, $nodeName) {
295                 // Make all lower-case
296                 $nodeName = strtolower($nodeName);
297
298                 // Does this match with current main node?
299                 //* DEBUG: */ echo "END: &gt;".$nodeName."&lt;<br />\n";
300                 if (($nodeName != $this->getCurrMainNode()) && (in_array($nodeName, $this->getMainNodes()))) {
301                         // Did not match!
302                         throw new XmlNodeMismatchException (array($this, $nodeName, $this->getCurrMainNode()), XmlParser::EXCEPTION_XML_NODE_MISMATCH);
303                 } // END - if
304
305                 // Construct method name
306                 $methodName = 'finish' . self::convertToClassName($nodeName);
307
308                 // Call the corresponding method
309                 //* DEBUG: */ echo "call: ".$methodName."<br />\n";
310                 call_user_func_array(array($this, $methodName), array());
311         }
312
313         /**
314          * Currently not used
315          *
316          * @param       $resource               XML parser resource (currently ignored)
317          * @param       $characters             Characters to handle
318          * @return      void
319          * @todo        Find something useful with this!
320          */
321         public function characterHandler ($resource, $characters) {
322                 // Trim all spaces away
323                 $characters = trim($characters);
324
325                 // Is this string empty?
326                 if (empty($characters)) {
327                         // Then skip it silently
328                         return;
329                 } // END - if
330
331                 // Assign the found characters to variable and use the last entry from
332                 // stack as the name
333                 parent::assignVariable($this->getStackInstance()->getNamed('current_node'), $characters);
334         }
335
336         /**
337          * Handles the template dependency for given node
338          *
339          * @param       $node                                   The node we should load a dependency template
340          * @param       $templateDependency             A template to load to satisfy dependencies
341          * @return      void
342          */
343         private function handleTemplateDependency ($node, $templateDependency) {
344                 // Is the template dependency set?
345                 if ((!empty($templateDependency)) && (!isset($this->dependencyContent[$node]))) {
346                         // Get a temporay menu template instance
347                         $templateInstance = ObjectFactory::createObjectByConfiguredName('menu_template_class', array($this->getMenuInstance()));
348
349                         // Then load it
350                         $templateInstance->loadMenuTemplate($templateDependency);
351
352                         // Parse the XML content
353                         $templateInstance->renderXmlContent();
354
355                         // Save the parsed raw content in our dependency array
356                         $this->dependencyContent[$node] = $templateInstance->getRawTemplateData();
357                 } // END - if
358         }
359
360         /**
361          * Intializes the menu
362          *
363          * @param       $templateDependency             A template to load to satisfy dependencies
364          * @return      void
365          * @todo        Add cache creation here
366          */
367         private function initMenu ($templateDependency = '') {
368                 // Get web template engine
369                 $this->setTemplateInstance(ObjectFactory::createObjectByConfiguredName('html_template_class', array(Registry::getRegistry()->getInstance('app'))));
370
371                 // Handle the dependency template
372                 $this->handleTemplateDependency('menu', $templateDependency);
373
374                 // Push the node name on the stacker
375                 $this->getStackInstance()->pushNamed('current_node', 'menu');
376         }
377
378         /**
379          * Starts the menu entries
380          *
381          * @param       $templateDependency             A template to load to satisfy dependencies
382          * @return      void
383          */
384         private function startEntryList () {
385                 // Push the node name on the stacker
386                 $this->getStackInstance()->pushNamed('current_node', 'entry-list');
387         }
388
389         /**
390          * Starts the menu block header
391          *
392          * @return      void
393          */
394         private function startBlockHeader () {
395                 // Push the node name on the stacker
396                 $this->getStackInstance()->pushNamed('current_node', 'block-header');
397         }
398
399         /**
400          * Starts the menu block footer
401          *
402          * @return      void
403          */
404         private function startBlockFooter () {
405                 // Push the node name on the stacker
406                 $this->getStackInstance()->pushNamed('current_node', 'block-footer');
407         }
408
409         /**
410          * Starts the menu property 'block-list'
411          *
412          * @return      void
413          */
414         private function startBlockList () {
415                 // Push the node name on the stacker
416                 $this->getStackInstance()->pushNamed('current_node', 'block-list');
417         }
418
419         /**
420          * Starts the menu property 'block'
421          *
422          * @return      void
423          */
424         private function startBlock () {
425                 // Push the node name on the stacker
426                 $this->getStackInstance()->pushNamed('current_node', 'block');
427         }
428
429         /**
430          * Starts the menu property 'title'
431          *
432          * @return      void
433          */
434         private function startTitle () {
435                 // Push the node name on the stacker
436                 $this->getStackInstance()->pushNamed('current_node', 'title');
437         }
438
439         /**
440          * Starts the menu property 'title-id'
441          *
442          * @return      void
443          */
444         private function startTitleId () {
445                 // Push the node name on the stacker
446                 $this->getStackInstance()->pushNamed('current_node', 'title-id');
447         }
448
449         /**
450          * Starts the menu property 'title-class'
451          *
452          * @return      void
453          */
454         private function startTitleClass () {
455                 // Push the node name on the stacker
456                 $this->getStackInstance()->pushNamed('current_node', 'title-class');
457         }
458
459         /**
460          * Starts the menu property 'title-text'
461          *
462          * @return      void
463          */
464         private function startTitleText () {
465                 // Push the node name on the stacker
466                 $this->getStackInstance()->pushNamed('current_node', 'title-text');
467         }
468
469         /**
470          * Starts the menu property 'entry'
471          *
472          * @return      void
473          */
474         private function startEntry () {
475                 // Push the node name on the stacker
476                 $this->getStackInstance()->pushNamed('current_node', 'entry');
477         }
478
479         /**
480          * Starts the menu property 'entry-id'
481          *
482          * @return      void
483          */
484         private function startEntryId () {
485                 // Push the node name on the stacker
486                 $this->getStackInstance()->pushNamed('current_node', 'entry-id');
487         }
488
489         /**
490          * Starts the menu property 'anchor'
491          *
492          * @return      void
493          */
494         private function startAnchor () {
495                 // Push the node name on the stacker
496                 $this->getStackInstance()->pushNamed('current_node', 'anchor');
497         }
498
499         /**
500          * Starts the menu property 'anchor-id'
501          *
502          * @return      void
503          */
504         private function startAnchorId () {
505                 // Push the node name on the stacker
506                 $this->getStackInstance()->pushNamed('current_node', 'anchor-id');
507         }
508
509         /**
510          * Starts the menu property 'anchor-text'
511          *
512          * @return      void
513          */
514         private function startAnchorText () {
515                 // Push the node name on the stacker
516                 $this->getStackInstance()->pushNamed('current_node', 'anchor-text');
517         }
518
519         /**
520          * Starts the menu property 'anchor-title'
521          *
522          * @return      void
523          */
524         private function startAnchorTitle () {
525                 // Push the node name on the stacker
526                 $this->getStackInstance()->pushNamed('current_node', 'anchor-title');
527         }
528
529         /**
530          * Starts the menu property 'anchor-href'
531          *
532          * @return      void
533          */
534         private function startAnchorHref () {
535                 // Push the node name on the stacker
536                 $this->getStackInstance()->pushNamed('current_node', 'anchor-href');
537         }
538
539         /**
540          * Starts the menu property 'footer-id'
541          *
542          * @return      void
543          */
544         private function startFooterId () {
545                 // Push the node name on the stacker
546                 $this->getStackInstance()->pushNamed('current_node', 'footer-id');
547         }
548
549         /**
550          * Starts the menu property 'footer-class'
551          *
552          * @return      void
553          */
554         private function startFooterClass () {
555                 // Push the node name on the stacker
556                 $this->getStackInstance()->pushNamed('current_node', 'footer-class');
557         }
558
559         /**
560          * Starts the menu property 'footer-text'
561          *
562          * @return      void
563          */
564         private function startFooterText () {
565                 // Push the node name on the stacker
566                 $this->getStackInstance()->pushNamed('current_node', 'footer-text');
567         }
568
569         /**
570          * Finishes the title node by added another template to the menu
571          *
572          * @return      void
573          */
574         private function finishTitle () {
575                 // Pop the last entry
576                 $this->getStackInstance()->popNamed('current_node');
577         }
578
579         /**
580          * Finishes the title-id node by
581          *
582          * @return      void
583          */
584         private function finishTitleId () {
585                 // Pop the last entry
586                 $this->getStackInstance()->popNamed('current_node');
587         }
588
589         /**
590          * Finishes the title-class node
591          *
592          * @return      void
593          */
594         private function finishTitleClass () {
595                 // Pop the last entry
596                 $this->getStackInstance()->popNamed('current_node');
597         }
598
599         /**
600          * Finishes the title-class node
601          *
602          * @return      void
603          */
604         private function finishTitleText () {
605                 // Pop the last entry
606                 $this->getStackInstance()->popNamed('current_node');
607         }
608
609         /**
610          * Finishes the footer-text node
611          *
612          * @return      void
613          */
614         private function finishFooterText () {
615                 // Pop the last entry
616                 $this->getStackInstance()->popNamed('current_node');
617         }
618
619         /**
620          * Finishes the footer-class node
621          *
622          * @return      void
623          */
624         private function finishFooterClass () {
625                 // Pop the last entry
626                 $this->getStackInstance()->popNamed('current_node');
627         }
628
629         /**
630          * Finishes the footer-id node
631          *
632          * @return      void
633          */
634         private function finishFooterId () {
635                 // Pop the last entry
636                 $this->getStackInstance()->popNamed('current_node');
637         }
638
639         /**
640          * Finishes the anchor-href node
641          *
642          * @return      void
643          */
644         private function finishAnchorHref () {
645                 // Pop the last entry
646                 $this->getStackInstance()->popNamed('current_node');
647         }
648
649         /**
650          * Finishes the anchor-title node
651          *
652          * @return      void
653          */
654         private function finishAnchorTitle () {
655                 // Pop the last entry
656                 $this->getStackInstance()->popNamed('current_node');
657         }
658
659         /**
660          * Finishes the anchor-text node
661          *
662          * @return      void
663          */
664         private function finishAnchorText () {
665                 // Pop the last entry
666                 $this->getStackInstance()->popNamed('current_node');
667         }
668
669         /**
670          * Finishes the anchor-id node
671          *
672          * @return      void
673          */
674         private function finishAnchorId () {
675                 // Pop the last entry
676                 $this->getStackInstance()->popNamed('current_node');
677         }
678
679         /**
680          * Finishes the anchor node
681          *
682          * @return      void
683          */
684         private function finishAnchor () {
685                 // Pop the last entry
686                 $this->getStackInstance()->popNamed('current_node');
687         }
688
689         /**
690          * Finishes the entry-id node
691          *
692          * @return      void
693          */
694         private function finishEntryId () {
695                 // Pop the last entry
696                 $this->getStackInstance()->popNamed('current_node');
697         }
698
699         /**
700          * Finishes the entry node
701          *
702          * @return      void
703          */
704         private function finishEntry () {
705                 // Pop the last entry
706                 $this->getStackInstance()->popNamed('current_node');
707
708                 // Render this menu entry
709                 $this->renderMenuEntry();
710         }
711
712         /**
713          * Finishes the block node
714          *
715          * @return      void
716          */
717         private function finishBlock () {
718                 // Pop the last entry
719                 $this->getStackInstance()->popNamed('current_node');
720
721                 // Render this menu block
722                 $this->renderMenuBlock();
723         }
724
725         /**
726          * Finishes the block-list node
727          *
728          * @return      void
729          */
730         private function finishBlockList () {
731                 // Pop the last entry
732                 $this->getStackInstance()->popNamed('current_node');
733         }
734
735         /**
736          * Finishes the menu entries
737          *
738          * @return      void
739          */
740         private function finishEntryList () {
741                 // Pop the last entry
742                 $this->getStackInstance()->popNamed('current_node');
743         }
744
745         /**
746          * Finishes the menu block header
747          *
748          * @return      void
749          */
750         private function finishBlockHeader () {
751                 // Pop the last entry
752                 $this->getStackInstance()->popNamed('current_node');
753         }
754
755         /**
756          * Finishes the menu block footer
757          *
758          * @return      void
759          */
760         private function finishBlockFooter () {
761                 // Pop the last entry
762                 $this->getStackInstance()->popNamed('current_node');
763         }
764
765         /**
766          * Finishes the menu
767          *
768          * @return      void
769          */
770         private function finishMenu () {
771                 // Pop the last entry
772                 $this->getStackInstance()->popNamed('current_node');
773         }
774
775         /**
776          * Renders this menu entry, as every block all variables got overwritten
777          * with data from next entry.
778          *
779          * @return      void
780          */
781         private function renderMenuEntry () {
782                 // Prepare template engine
783                 $templateInstance = $this->prepareTemplateInstance();
784
785                 // Load menu entry template
786                 $templateInstance->loadCodeTemplate('menu_entry');
787
788                 // Copy all variables over to it
789                 foreach ($this->menuEntryVariables as $variableName) {
790                         // Copy variable
791                         $variableValue = $this->readVariable($variableName);
792
793                         // Is the key 'anchor-href'?
794                         if ($variableName == 'anchor-href') {
795                                 // Expand variable with URL then
796                                 $variableValue = '{?base_url?}/' . $variableValue;
797                         } // END - if
798
799                         // ... into the instance
800                         $templateInstance->assignVariable($variableName, $variableValue);
801                 } // END - foreach
802
803                 // Compile template + variables
804                 $templateInstance->compileTemplate();
805                 $templateInstance->compileVariables();
806
807                 // Remember it here
808                 $this->menuEntries[$this->readVariable('entry_id')] = $templateInstance->getRawTemplateData();
809         }
810
811         /**
812          * Renders this menu block, as next block all data is overwritten with
813          * next block.
814          *
815          * @return      void
816          */
817         private function renderMenuBlock () {
818                 // Init block content
819                 $blockContent = implode('', $this->menuEntries);
820
821                 // Prepare template engine
822                 $templateInstance = $this->prepareTemplateInstance();
823
824                 // Load menu entry template
825                 $templateInstance->loadCodeTemplate('menu_block');
826
827                 // Copy all variables over to it
828                 foreach ($this->menuBlockVariables as $variableName) {
829                         // Copy variable
830                         $variableValue = $this->readVariable($variableName);
831
832                         // ... into the instance
833                         $templateInstance->assignVariable($variableName, $variableValue);
834                 } // END - foreach
835
836                 // Assign block content
837                 $templateInstance->assignVariable('block_content', $blockContent);
838
839                 // Compile template + variables
840                 $templateInstance->compileTemplate();
841                 $templateInstance->compileVariables();
842
843                 // Remember it here
844                 array_push($this->menuBlocks, $templateInstance->getRawTemplateData());
845
846                 // Reset rendered menu entries array
847                 $this->menuEntries = array();
848         }
849
850         /**
851          * "Getter" for menu content
852          *
853          * @return      $menuContent    Returned menu content
854          */
855         public function getMenuContent () {
856                 // Implode menuBlocks
857                 $menuContent = implode('', $this->menuBlocks);
858
859                 // Clean variable
860                 $this->menuBlocks = array();
861
862                 // And return it
863                 return $menuContent;
864         }
865
866         /**
867          * Getter for menu cache file (FQFN)
868          *
869          * @return      $fqfn   Full-qualified file name of the menu cache
870          */
871         public function getMenuCacheFqfn () {
872                 // Get the application instance from registry
873                 $applicationInstance = Registry::getRegistry()->getInstance('app');
874
875                 // Get the FQFN ready
876                 $fqfn = sprintf('%s%smenus/_cache/%s.%s',
877                         $this->getConfigInstance()->getConfigEntry('application_base_path'),
878                         $applicationInstance->getAppShortName(),
879                         md5(
880                                 $this->getMenuInstance()->getMenuName() . ':' .
881                                 $this->__toString() . ':' .
882                                 $this->getMenuInstance()->__toString()
883                         ),
884                         $this->getMenuInstance()->getMenuType()
885                 );
886
887                 // Return it
888                 return $fqfn;
889         }
890
891 }