/** * @name loadUrl This function generate an URL from array * @param string $name Text to show * @param array $vals Array with information: * mod = module, * cont = controller, * act = action, * get = GET extra * target = type of target in href, * href = direct HREF (this is ignored if are "cont" or "act" * @param string $classes Classes to show * @return string URL */ static function loadUrl($name, $vals, $classes = '') { $r = '<a class="' . $classes . '"'; // If have URL if (isset($vals['href'])) { $r .= ' href="'; if (is_array($vals['href'])) { $mod = isset($vals['href']['mod']) ? $vals['href']['mod'] : ''; $cont = isset($vals['href']['cont']) ? $vals['href']['cont'] : ''; $act = isset($vals['href']['act']) ? $vals['href']['act'] : ''; $get = isset($vals['href']['get']) ? $vals['href']['get'] : ''; $r .= rewriter($mod, $cont, $act, $get); } else { $r .= $vals['href']; } $r .= '"'; } if (isset($vals['target'])) { $r .= ' target="' . $vals['target'] . '"'; } return $r .= '>' . $name . '</a>'; }
/** * Redirect to some Module * @param string $module * @param string $controller * @param string $action * @param number $time Seconds waiting to redirect */ static function rewrite($module, $controller, $action, $time = 0) { self::url(rewriter($module, $controller, $action), $time); }