Esempio n. 1
0
 /**
  * Sets the "url" attribute with a URL to this object
  * @param string $pageName
  * @param Cms\Classes\Controller $controller
  */
 public function setUrl($controller, $page)
 {
     $params_view = ['asset_id' => $this->id, 'action' => 'view'];
     $params_update = ['asset_id' => $this->id, 'action' => 'update'];
     $this->url_view = $controller->pageUrl($page, $params_view);
     $this->url_update = $controller->pageUrl($page, $params_update);
 }
Esempio n. 2
0
 /**
  * Sets the "url" attribute with a URL to this object
  * @param string $pageName
  * @param Cms\Classes\Controller $controller
  */
 public function setUrl($pageName, $controller)
 {
     $params = ['id' => $this->id, 'slug' => $this->slug];
     if (array_key_exists('categories', $this->getRelations())) {
         $params['category'] = $this->categories->count() ? $this->categories->first()->slug : null;
     }
     return $this->url = $controller->pageUrl($pageName, $params);
 }
Esempio n. 3
0
 /**
  * Sets the "url" attribute with a URL to this object
  * @param string $pageName
  * @param Cms\Classes\Controller $controller
  */
 public function setUrl($pageName, $controller)
 {
     $params = ['id' => $this->id, 'slug' => $this->slug];
     if (array_key_exists('categories', $this->getRelations())) {
         $params['category'] = $this->categories->count() ? $this->categories->first()->slug : null;
     }
     //expose published year, month and day as URL parameters
     if ($this->published) {
         $params['year'] = $this->published_at->format('Y');
         $params['month'] = $this->published_at->format('m');
         $params['day'] = $this->published_at->format('d');
     }
     return $this->url = $controller->pageUrl($pageName, $params);
 }
Esempio n. 4
0
 /**
  * Sets the "url" attribute with a URL to this object
  * @param string $pageName
  * @param Cms\Classes\Controller $controller
  */
 public function setUrl($pageName, $controller)
 {
     $params = ['id' => $this->id, 'slug' => $this->slug];
     return $this->url = $controller->pageUrl($pageName, $params);
 }
 /**
  * Sets the "url" attribute with a URL to this object
  * @param string $pageName
  * @param Cms\Classes\Controller $controller
  */
 public function setUrl($pageName, $controller)
 {
     $params = ['calendarSlug' => $this->slug];
     $this->url = $controller->pageUrl($pageName, $params);
     return $this->url;
 }
<?php

/**
 * @author Alex Carrega <*****@*****.**>
 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
 */
/*
 * Add route to the logo.
 * Adds custom routes.
 * @param Illuminate\Http\Request $request
 * @return null
 */
App::before(function ($request) {
    Route::get('/logo', function () {
        $response = Response::make(\Backend\Models\BrandSettings::instance()->logo->output(), 200);
        $response->header('Content-Type', 'image/png');
        return $response;
    });
    $ctrl = new \Cms\Classes\Controller();
    foreach (\AxC\DataManagement\Models\Route::published() as $route) {
        $language[] = (object) ['code' => $route->language];
        if ($route->language == '') {
            $language = array_merge($language, \RainLab\Translate\Models\Locale::get(['code'])->all());
        }
        foreach ($language as $l) {
            Route::any("{$l->code}/{$route->path}", function () use($ctrl, $route) {
                return $ctrl->run($route->page);
            });
        }
    }
});
 /**
  * @param $url
  * @return string
  */
 public function getPageContents($url)
 {
     $controller = new \Cms\Classes\Controller();
     $response = $controller->run($url);
     return $response instanceof \Illuminate\Http\Response ? $response->getOriginalContent() : $this->renderRedirectScript($response);
 }