/** * Активация ссылок * * @param string $returnUrl * @param string $activeCss * * @return string */ public function activeLink($returnUrl, $activeCss = 'class="active"') { $current = strtolower($this->request->getController() . '/' . $this->request->getAction()); if ($current === $returnUrl) { return $activeCss; } preg_match('#(.+?)/<(.*?)>#', $returnUrl, $out); if (!empty($out)) { $check = explode('|', $out[2]); foreach ($check as $action) { if ($current === $out[1] . '/' . $action) { return $activeCss; } } } return null; }
/** * Конструктор * * @param object $router */ public function __construct($router) { parent::__construct($router); }
/** * Возвращает имя вызванного экшена * * @return string */ public function getAction() { $action = $this->request->getAction(); $action = preg_replace('#[^a-z0-9\\-_]#ui', '', $action); return 'action' . mb_convert_case($action, MB_CASE_TITLE); }