示例#1
0
 public function __call($name, $parameters)
 {
     $index = array_shift($parameters);
     $paths = array_shift($parameters);
     $page = null;
     if (isset($paths[$index + 1]) === true) {
         $page = $paths[$index + 1];
     }
     $structure_index = implode('/', array_splice($paths, 0, $index + 1));
     $structure = isset($this->structure[$structure_index]) === true ? $this->structure[$structure_index] : false;
     if ($structure === false) {
         return;
     }
     $html = '';
     foreach ($structure['links'] as $url => $allowed) {
         if ($allowed === true) {
             $link = html::navAnchor('#!' . $url, lucid::$app->i18n()->translate('navigation:' . $url));
             #lucid::$app->log($url.'=='.$page);
             if ($url == $page) {
                 #lucid::$app->log($url.' is the active link');
                 $link->setactive(true);
             }
             $html .= html::navItem()->add($link)->render();
         }
     }
     lucid::$app->response()->replace($structure['selector'], $html);
 }