Ejemplo n.º 1
0
 public function setAttributes()
 {
     $hrefWithoutBeginning = str_replace(BEGINNING_OF_URL, '', MenuElement::makeUrlOfCurrentPage(array('ampersand' => '%26')));
     $urlParts = explode('?', $hrefWithoutBeginning);
     if (strstr($urlParts[0], '/')) {
         $aliasWithoutSlash = explode('/', $urlParts[0]);
         $alias = $aliasWithoutSlash[0];
     } else {
         $alias = $urlParts[0];
     }
     $thisAlias = $alias;
     $this->href = strtr($this->translate(array('property' => 'href', 'isSlug' => true)), '&', '&amp');
     $hrefWithoutBeginning = str_replace(BEGINNING_OF_URL, '', $this->href);
     $urlParts = explode('?', $hrefWithoutBeginning);
     if (strstr($urlParts[0], '/')) {
         $aliasWithoutSlash = explode('/', $urlParts[0]);
         $alias = $aliasWithoutSlash[0];
     } else {
         $alias = $urlParts[0];
     }
     if ($alias === $thisAlias) {
         $this->active = TRUE;
     }
     if (strpos($this->href, '[ID-OF-USER]') !== FALSE) {
         if (isset($_SESSION['idUser'])) {
             $this->href = str_replace('[ID-OF-USER]', '&idHuman=' . $_SESSION['idUser'], $this->href);
         } else {
             $this->href = str_replace('[ID-OF-USER]', '&idHuman=', $this->href);
         }
     }
 }