Exemplo n.º 1
0
 protected function _setBreadcrumb()
 {
     if (self::REQUEST_HTML != $this->getRequestType()) {
         return;
     }
     $this->iaCore->factory('breadcrumb');
     if (iaBreadcrumb::total() > 0 || $this->isHomepage() && empty($this->iaCore->requestPath)) {
         return;
     }
     iaCore::ACCESS_FRONT == $this->iaCore->getAccessType() ? iaBreadcrumb::root($this->iaCore->get('bc_home'), IA_URL) : iaBreadcrumb::root(iaLanguage::get('dashboard'), IA_ADMIN_URL);
     $pluginName = $this->get('extras');
     switch ($this->iaCore->getAccessType()) {
         case iaCore::ACCESS_FRONT:
             $parents = array();
             $iaPage = $this->iaCore->factory('page', iaCore::FRONT);
             $iaPage->getParents($this->get('parent'), $parents);
             if ($parents) {
                 iaBreadcrumb::addChain($parents);
             } elseif ($pluginName && 'package' == $this->get('type') && $pluginName . '_home' != $this->name()) {
                 if ($this->iaCore->get('default_package') != $pluginName) {
                     iaBreadcrumb::add(iaLanguage::get($pluginName), IA_PACKAGE_URL);
                 }
             }
             if ($url = $iaPage->getUrlByName($this->name())) {
                 iaBreadcrumb::toEnd(iaLanguage::get('page_title_' . $this->name(), $this->name()), $url);
             }
             break;
         case iaCore::ACCESS_ADMIN:
             $iaPage = $this->iaCore->factory('page', iaCore::ADMIN);
             if ($pluginName) {
                 if ('package' == $this->get('type')) {
                     $title = iaLanguage::get($pluginName . '_package');
                     $url = IA_ADMIN_URL . $pluginName . IA_URL_DELIMITER;
                     $pluginName . '_stats' != $this->name() ? iaBreadcrumb::add($title, $url) : iaBreadcrumb::replaceEnd($title, $url);
                 }
             }
             $url = $iaPage->getUrlByName($this->name());
             iaBreadcrumb::add($this->get('title', $this->name()), $url);
             if (in_array($this->get('action'), array(iaCore::ACTION_ADD, iaCore::ACTION_EDIT))) {
                 iaBreadcrumb::toEnd(iaLanguage::get($this->get('action')), IA_SELF);
             }
     }
 }