Lançado Adianti Framework 7.6!
Clique aqui para saber mais
menu

Adianti Solutions

API

Adianti, Framework, PHP, MVC, Active record, Front controller, IDE, RAD, Web, multiplataforma, geração de código, desenvolvimento rápido, relatórios, formulários, listagens, datagrids, gráficos, banco de dados, padrões de projeto, design patterns API do Adianti Framework.
API Docs
code
Selecione a classe

Source for file TXMLBreadCrumb.php

Documentation is available at TXMLBreadCrumb.php

  1. <?php
  2. namespace Adianti\Widget\Util;
  3.  
  4. use Adianti\Widget\Util\TBreadCrumb;
  5. use Adianti\Core\AdiantiCoreTranslator;
  6. use Adianti\Widget\Menu\TMenuParser;
  7. use SimpleXMLElement;
  8. use Exception;
  9.  
  10. /**
  11.  * XMLBreadCrumb
  12.  *
  13.  * @version    7.4
  14.  * @package    widget
  15.  * @subpackage util
  16.  * @author     Pablo Dall'Oglio
  17.  * @copyright  Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
  18.  * @license    http://www.adianti.com.br/framework-license
  19.  */
  20. class TXMLBreadCrumb extends TBreadCrumb
  21. {
  22.     private $parser;
  23.     
  24.     /**
  25.      * Handle paths from a XML file
  26.      * @param $xml_file path for the file
  27.      */
  28.     public function __construct($xml_file$controller)
  29.     {
  30.         parent::__construct();
  31.         
  32.         $this->parser new TMenuParser($xml_file);
  33.         $paths $this->parser->getPath($controller);
  34.         if (!empty($paths))
  35.         {
  36.             parent::addHome();
  37.             
  38.             $count 1;
  39.             foreach ($paths as $path)
  40.             {
  41.                 if (!empty($path))
  42.                 {
  43.                     parent::addItem($path$count == count($paths));
  44.                     $count++;
  45.                 }
  46.             }
  47.         }
  48.         else
  49.         {
  50.             throw new Exception(AdiantiCoreTranslator::translate('Class ^1 not found in ^2'$controller$xml_file));
  51.         }
  52.     }
  53.     
  54.     /**
  55.      * Return the controller path
  56.      */
  57.     public function getPath($controller)
  58.     {
  59.         return $this->parser->getPath($controller);
  60.     }
  61. }