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