public static function processView($params, &$view) { if (!isset($params['get'])) { return ''; } $params['get'] = Route::route($params['get'], $params); if (!Request::isAvailable($params['get'], 'get')) { return; } $vars_backup = $view->_tpl_vars; if (is_array($params)) { foreach ($params as $name => $value) { $view->assign($name, $value); } } list($controller, $action, $data) = Url::route($params['get'], 'get'); $handler = Url::handler($controller, $action); if (empty($handler)) { return ''; } if (!empty($params['display'])) { $handler .= '.' . $params['display']; } $result = $view->fetch('Modules/' . $handler . '.tpl'); $view->_tpl_vars = $vars_backup; if (!empty($params['wrapper']) && !empty($result)) { return '<div class="' . $params['wrapper'] . '">' . $result . '</div>'; } return $result; }
public static function processView($params, &$view) { if (!isset($params['get'])) { return ''; } $params['get'] = Route::resource($params['get'], $params); if (!Request::isAvailable($params['get'], 'get')) { return; } $vars_backup = $view->_tpl_vars; if (is_array($params)) { foreach ($params as $name => $value) { $view->assign($name, $value); } } list($controller, $action, $data) = Url::route($params['get'], 'get'); $params = array_merge($params, $data); $handler = Url::handler($controller, $action); if (empty($handler)) { return ''; } if (!empty($params['display'])) { $handler .= '.' . $params['display']; } $view->assign('params', $params); $result = $view->fetch('file:' . $handler . '.tpl'); $view->_tpl_vars = $vars_backup; if (!empty($params['wrapper']) && !empty($result)) { list($start, $end) = static::wrapper($params['wrapper']); return $start . $result . $end; } return $result; }
/** * Builds a menu for displaying associated items to a model entry (i.e. /club/21/team). * * The menu will include: * - An Add LinkMenuItem; * - A SpacerMenuItem with the name of the associated model; * - A ResourceMenuItem to hold entries of the associated model. * * @param String $modelName The name of the model (i.e. Club). * @param int $modelId The id of the model entry. * @param String $associationName The name of the associated model (i.e. Team). * @param ModelConfig $config (optional) The `ModelConfig` to use. * * @return Menu the Menu, which can be configured further. */ public function create($modelName, $modelId, $associationName, ModelConfig $config = null) { $menu = new Menu(); $addMenuItem = new LinkMenuItem(); $addMenuItem->setText(Lang::trans('Add') . ' ' . Lang::trans($associationName)); $addMenuItem->setIcon(Icons::ion_plus); $addMenuItem->setTarget(Url::route($this->aujaRouter->getCreateAssociationName($modelName, $associationName), $modelId)); $menu->addMenuItem($addMenuItem); $headerMenuItem = new SpacerMenuItem(); $headerMenuItem->setText(Lang::trans(str_plural($associationName))); $menu->addMenuItem($headerMenuItem); $resourceMenuItem = new ResourceMenuItem(); $resourceMenuItem->setTarget(Url::route($this->aujaRouter->getAssociationName($modelName, $associationName), $modelId)); $menu->addMenuItem($resourceMenuItem); return $menu; }
public static function run($resource, $method) { $top = count(self::$stack) - 1; if ($top < 0) { return; } $isExternal = $top == 0; $resource = Route::route($resource, self::$stack[$top]); if (!self::isAvailable($resource, $method)) { if ($isExternal) { $resource = 'errors/access-denied'; } else { return ''; } } list($controller, $action, $data) = Url::route($resource, $method); self::$stack[$top] = array_merge(self::$stack[$top], $data); $handler = Url::handler($controller, $action); if ($isExternal) { Middleware::processBefore($resource, $action, self::$stack[$top], $method); self::runHandler($handler); Middleware::processAfter($resource, $action, self::$stack[$top], $method); } else { if (!self::runInternalHandler($handler)) { return ''; } } if (!empty(self::$stack[$top]['display'])) { $handler .= '.' . self::$stack[$top]['display']; } if ($isExternal && self::$response->code == '404 Not Found') { list($controller, $action, $data) = Url::route('errors/not-found', 'get'); $handler = Url::handler($controller, $action); self::$response->result("error", self::$response->code); } if ($isExternal && self::$response->code == '403 Forbidden') { list($controller, $action, $data) = Url::route('errors/not-found', 'get'); $handler = Url::handler($controller, $action); self::$response->result("error", self::$response->code); } $r = self::$response->fetch($handler, $isExternal); if ($isExternal) { Language::rewrite($r); } return $r; }
function getListingUrl($params = []) { $params = $params + ['from' => \Input::get('from'), 'to' => \Input::get('to')]; return \Url::route('posts.listing', $params); }
private function smartIncludeMenuItems($main, $config) { foreach ($this->aujaConfigurator->getModels() as $model) { if ($this->aujaConfigurator->shouldSmartIncludeInMain($model, $config)) { $item = new Item(); $item->setTitle($model->getName()); $item->setIcon($this->aujaConfigurator->getIcon($model, $config)); $item->setTarget(Url::route($this->aujaRouter->getMenuName($model->getName()))); $main->addItem($item); } } }
/** * Init url payment authorization */ private function doDetectAuth() { if ($this->payment->cvc == '333') { $this->auth = Url::route('ff-bank-em-pay-auth', array('payment' => Crypt::encrypt($this->payment->id), 'back' => urlencode(Url::route('ff-bank-em-endpoint-auth-result')))); $this->payment->status = Status::AUTHORIZATION; } }