示例#1
0
/**
 * @param $date
 * @param string $format
 * @return string
 */
function showDate($date, $format = 'date')
{
    $dt = new Date($date);
    if (app::getLocale() == 'en') {
        if ($format == 'date') {
            return $dt->format('Y-m-d');
        }
        if ($format == 'text') {
            return $dt->format('l F j, Y');
        }
        if ($format == 'text-court') {
            return $dt->format('l F j');
        }
        return $dt->format($format);
    }
    if ($format == 'date') {
        return $dt->format('d-m-Y');
    }
    if ($format == 'text') {
        return $dt->format('l j F Y');
    }
    if ($format == 'text-court') {
        return $dt->format('l j F');
    }
    return $dt->format($format);
}
示例#2
0
/**
 * @param $texte
 * @return mixed
 */
function gl($texte)
{
    return Traduction::gl($texte, app::getLocale());
}
示例#3
0
 protected function renderNavigation()
 {
     $model = new Menu();
     $menus = $model->get_all(app::getLocale());
     $template_data = array('data' => json_decode($menus->toJson()));
     return View::make('hbs::navigation', $template_data);
 }
示例#4
0
    /*
    	$routes = $view->offsetGet('data');
    	$data = new stdClass;
    	$data->desktop = $routes[0];
    	$data->mobile = $routes[1];
    	$view->with(array(
    		'data' => $data,
    	));
    */
});
// home.hbs
View::composer(array('hbs::home', 'hbs::homeIE'), function ($view) {
    // page data
    $page = $view->offsetGet('data');
    $viewName = $view->offsetGet('viewName');
    $lang = app::getLocale();
    $headline = array('cs' => 'DOCKonalý domov', 'en' => 'Perfect home', 'ru' => 'Идеальный дом');
    View::share('imageSrc', '0.jpg');
    View::share('headline', $headline[$lang]);
});
// navigationPage.hbs
View::composer('hbs::navigationPage', function ($view) {
    // get page data
    $page = $view->offsetGet('data');
    $colSize = 1;
    $children = $page->children;
    if (!empty($children) && is_array($children)) {
        $colNum = count($children) <= 4 ? count($children) : 3;
        $colSize = 12 / $colNum;
    }
    // add data
示例#5
0
| and give it the Closure to execute when that URI is requested.
|
*/
// ===============================================
// API SECTION
// ===============================================
Route::group(array('prefix' => 'api'), function () {
    // API ROUTE ERROR handling
    // -------------------------------------------------
    Route::get('/{else}', function () {
        // return 400 - bad request
        return Response::json(array('error' => array('message' => "Bad Request", 'type' => "BadRequest")), 400);
    })->where('else', '(.*)');
});
// ----------------------------------------------
// ===============================================
// FRONT
// ===============================================
Route::get('/{route?}', 'Vizioart\\Cookbook\\FrontController@resolveRoute')->where('route', '(.*)');
App::missing(function ($exception) {
    $view_data = array('meta_title' => 'Page Not Found');
    // --------------------------------------
    $model = new Vizioart\Cookbook\Models\MenuModel();
    $menus = $model->get_all(app::getLocale());
    $template_data = array('data' => json_decode($menus->toJson()));
    $view_data['navigation'] = View::make('hbs::navigation', $template_data);
    // --------------------------------------
    // page template (handlebars)
    $view_data['content'] = View::make('hbs::404');
    return Response::view('layouts.error', $view_data, 404);
});