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