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