Пример #1
0
 public function appProject($lang, $slug)
 {
     $project = Dic::valueBySlugs('projects', $slug, ['fields', 'textfields']);
     #Helper::tad($project);
     if (!$project) {
         App::abort(404);
     }
     $project = DicLib::loadImages($project, ['image']);
     $project_page = Page::by_id($project->page_id);
     #Helper::tad($project_page);
     if (!$project_page) {
         App::abort(404);
     }
     $prev_project = null;
     $next_project = null;
     $prev_project = Dic::valuesBySlug('projects', function ($query) use($project) {
         $query->where('lft', '<', $project->lft);
         $query->orderBy('lft', 'ASC');
         $query->take(1);
     }, ['fields', 'textfields'], true, true, true);
     #Helper::ta($prev_project);
     $next_project = Dic::valuesBySlug('projects', function ($query) use($project) {
         $query->where('lft', '>', $project->lft);
         $query->orderBy('lft', 'ASC');
         $query->take(1);
     }, ['fields', 'textfields'], true, true, true);
     #Helper::tad($next_project);
     return View::make(Helper::layout('project'), compact('project', 'project_page', 'prev_project', 'next_project'));
 }
Пример #2
0
?>
@extends(Helper::layout())
<?php 
$route = Route::current();
#dd($route);
$id = $route->getParameter('id');
$record = Dic::valueBySlugAndId('blog', $id, ['fields', 'textfields']);
if (!$record) {
    echo json_encode(['responseType' => 'error', 'responseCode' => 404]);
    return;
}
$record = DicLib::loadImages($record, ['image', 'header_img']);
#Helper::tad($record);
$others_news = Dic::valuesBySlug('blog', function ($query) use($record) {
    $query->where('id', '!=', $record->id);
    $query->orderBy('created_at', 'desc');
    $query->take(5);
}, ['fields', 'textfields']);
$others_news = DicLib::loadImages($others_news, ['image']);
#Helper::tad($others_news);
?>


@section('style')
@stop


@section('content')

    <section class="b-title " style="background-image: url({{ isset($record->header_img) && is_object($record->header_img) ? $record->header_img->full() : '' }});">
Пример #3
0
<?
/**
 * TITLE: Главная страница
 * AVAILABLE_ONLY_IN_ADVANCED_MODE
 */
?>
<?php 
$sliders = Dic::valuesBySlug('slider_in_main', function ($query) {
    $query->orderBy("dictionary_values.lft");
}, 'all', TRUE);
$images = array();
if (count($sliders)) {
    $images_ids = array();
    foreach ($sliders as $index => $slider) {
        if (!empty($slider->slide)) {
            $images_ids[] = $slider->slide;
        }
    }
    if (!empty($images_ids)) {
        foreach (Photo::whereIn('id', $images_ids)->get() as $image) {
            $images[$image->id] = $image->name;
        }
    }
}
?>
@extends(Helper::layout())
@section('style')
@stop
@section('content')
    @if(count($sliders))
        <div id="carousel" class="cf" style="margin-bottom: 0;">
Пример #4
0
?>
@extends(Helper::layout())
<?php 
$route = Route::current();
#dd($route);
$id = $route->getParameter('id');
$event = Dic::valueBySlugAndId('events', $id, ['fields', 'textfields']);
if (!$event) {
    echo json_encode(['responseType' => 'error', 'responseCode' => 404]);
    return;
}
$event = DicLib::loadImages($event, ['image', 'header_img']);
#Helper::tad($event);
$others_events = Dic::valuesBySlug('events', function ($query) use($event) {
    #$query->where('id', '!=', $event->id);
    $query->filter_by_field('date_start', '>=', date('Y-m-d'));
    $query->order_by_field('date_start', 'asc');
    $query->take(5);
}, ['fields', 'textfields']);
$others_events = DicLib::loadImages($others_events, ['image']);
#Helper::tad($others_news);
?>


@section('style')
@stop


@section('content')

    <section class="b-title " style="background-image: url({{ isset($event->header_img) && is_object($event->header_img) ? $event->header_img->full() : '' }});">
Пример #5
0
 public function ajaxGetCourses()
 {
     $city_id = Input::get('city');
     $direction_id = Input::get('direction');
     $response = ['status' => false, 'errorText' => ''];
     $courses = Dic::valuesBySlug('course', function ($query) use($city_id, $direction_id) {
         $query->filter_by_field('city_id', '=', $city_id);
         if ($direction_id > 0) {
             $query->filter_by_field('direction_id', '=', $direction_id);
         }
     }, ['fields', 'textfields'], true, true, true);
     $response['status'] = true;
     $response['list'] = $courses;
     return Response::json($response);
 }
Пример #6
0
<?
/**
 * TITLE: Меню
 * AVAILABLE_ONLY_IN_ADVANCED_MODE
 */
?>
<?php 
$categories = Dic::valuesBySlug('product_category', function ($query) {
    $query->orderBy("dictionary_values.lft");
}, 'all', TRUE);
$current_category = array();
if ($page->sysname == 'menu') {
    echo json_encode(['responseType' => 'redirect', 'redirectUrl' => URL::route('page.category_menu', array('category' => $categories->first()->slug)), 'redirectCode' => 301]);
    return;
} elseif ($page->sysname == 'category_menu') {
    $current_category_slug = Request::segment(2);
    foreach ($categories as $category) {
        if ($category->slug == $current_category_slug) {
            $current_category = $category;
            break;
        }
    }
}
if (!is_object($current_category)) {
    echo json_encode(['responseType' => 'redirect', 'redirectUrl' => URL::route('page.category_menu', array('category' => $categories->first()->slug)), 'redirectCode' => 301]);
    return;
}
?>
@section('title'){{{ $current_category->seo->title }}}@stop
@section('description'){{{ $current_category->seo->description }}}@stop
@section('keywords'){{{ $current_category->seo->keywords }}}@stop
Пример #7
0
 public function postClear($dic_id)
 {
     #Helper::tad($dic_id);
     #Helper::tad(URL::route('dicval.index', ['dic_id' => $dic_id]));
     $dic = Dic::by_id($dic_id);
     $dicvals = Dic::valuesBySlug($dic->slug, NULL, []);
     #Helper::tad($dicvals);
     $adc = new AdminDicvalsController();
     if (count($dicvals)) {
         foreach ($dicvals as $dicval) {
             $id = $dicval->id;
             $adc->full_destroy($dic_id, $id);
         }
     }
     return Redirect::route('dicval.index', ['dic_id' => $dic_id]);
 }
Пример #8
0
    if ($real_city) {
        ## Редирект на нужный адрес
        echo json_encode(['responseType' => 'redirect', 'redirectUrl' => URL::route('page.course', [$real_city->slug, $course_id])]);
        return;
    } else {
        ## 404
        echo json_encode(['responseType' => 'error', 'responseCode' => 404]);
        return;
    }
}
#$course->load('related_dicvals'); ## пусто
#Helper::tad($course);
$teacher = isset($dic_teachers[$course->teacher_id]) ? $dic_teachers[$course->teacher_id] : null;
#Helper::tad($teacher);
$lessons = Dic::valuesBySlug('lessons', function ($query) use($course) {
    $query->filter_by_field('course_id', '=', $course->id);
}, 'all', true, true, true);
#Helper::tad($lessons);
$students_works = new Collection();
if (isset($dic_students_work) && is_object($dic_students_work) && $dic_students_work->count()) {
    foreach ($dic_students_work as $work) {
        if ($work->type_id == $course->type_id) {
            $students_works[] = $work;
        }
    }
}
#Helper::tad($students_works);
$reviews = new Collection();
if (isset($dic_reviews) && is_object($dic_reviews) && $dic_reviews->count()) {
    foreach ($dic_reviews as $review) {
        if ($review->course_id == $course->id) {
Пример #9
0
<?php

return array('fields' => function () {
    /**
     * Предзагружаем нужные словари с данными, по системному имени словаря, для дальнейшего использования.
     * Делается это одним SQL-запросом, для снижения нагрузки на сервер БД.
     */
    $dics_slugs = array('city', 'course');
    $dics = Dic::whereIn('slug', $dics_slugs)->with('values')->get();
    $dics = Dic::modifyKeys($dics, 'slug');
    #Helper::tad($dics);
    $lists = Dic::makeLists($dics, 'values', 'name', 'id');
    #Helper::dd($lists);
    $lists_ids = Dic::makeLists($dics, null, 'id', 'slug');
    #Helper::dd($lists_ids);
    return array('email' => array('title' => 'E-mail', 'type' => 'text'), 'phone' => array('title' => 'Телефон', 'type' => 'text'), 'course_id' => array('title' => 'Курс', 'type' => 'select', 'values' => $lists['course'], 'default' => Input::get('filter.fields.course_id') ?: null), 'city_id' => array('title' => 'Город', 'type' => 'select', 'values' => $lists['city'], 'default' => Input::get('filter.fields.city_id') ?: null));
}, 'hooks' => array('before_index_view' => function ($dic, $dicvals) {
    $temp = Dic::valuesBySlug('city', null, [], true, true, true);
    #Helper::tad($temp);
    Config::set('temp.city', $temp);
    $temp = Dic::valuesBySlug('course', null, [], true, true, true);
    #Helper::tad($temp);
    Config::set('temp.course', $temp);
}, 'after_store_update_destroy_order' => function ($dic = NULL, $dicval = NULL) {
    Cache::forget('dic_' . $dic->slug);
}), 'second_line_modifier' => function ($line, $dic, $dicval) {
    #Helper::ta($dicval);
    $cities = Config::get('temp.city');
    $courses = Config::get('temp.course');
    return (isset($cities[$dicval->city_id]) && is_object($cities[$dicval->city_id]) ? $cities[$dicval->city_id]->name : '') . ' - ' . (isset($courses[$dicval->course_id]) && is_object($courses[$dicval->course_id]) ? $courses[$dicval->course_id]->name : '');
});
Пример #10
0
## Paginator Set Current Page - It is WORK!!
## http://stackoverflow.com/questions/17386641/specify-a-page-for-pagination-laravel-4
##
$current_page = Input::get('tab') == 'blog' ? Input::get('page') : 1;
Paginator::setCurrentPage($current_page);
$blogs = Dic::valuesBySlug('blog', function ($query) {
    $query->orderBy('created_at', 'desc');
}, ['fields', 'textfields'], true, true, true, 6);
$blogs = DicLib::loadImages($blogs, ['image']);
#Helper::tad($blogs);
#dd($blogs);
$current_page = Input::get('tab') == 'events' ? Input::get('page') : 1;
Paginator::setCurrentPage($current_page);
$events = Dic::valuesBySlug('events', function ($query) use($current_city) {
    $query->filter_by_field('city_id', '=', $current_city->id);
    $query->filter_by_field('date_start', '>=', date('Y-m-d'));
    $query->order_by_field('date_start', 'asc');
}, ['fields', 'textfields'], true, true, true, 1);
$events = DicLib::loadImages($events, ['image']);
#Helper::tad($events);
#dd($events);
Paginator::setCurrentPage(1);
$current_tab = 'blog';
if (Input::get('tab') == 'events') {
    $current_tab = Input::get('tab');
} elseif (Input::get('tab') == 'social') {
    $current_tab = Input::get('tab');
}
?>

Пример #11
0
<?php

return array('fields' => function () {
    /**
     * Предзагружаем нужные словари с данными, по системному имени словаря, для дальнейшего использования.
     * Делается это одним SQL-запросом, для снижения нагрузки на сервер БД.
     */
    $dics_slugs = array('city');
    $dics = Dic::whereIn('slug', $dics_slugs)->with('values')->get();
    $dics = Dic::modifyKeys($dics, 'slug');
    #Helper::tad($dics);
    $lists = Dic::makeLists($dics, 'values', 'name', 'id');
    #Helper::dd($lists);
    $lists_ids = Dic::makeLists($dics, null, 'id', 'slug');
    #Helper::dd($lists_ids);
    return array('city_id' => array('title' => 'Город', 'type' => 'select', 'values' => $lists['city'], 'default' => Input::get('filter.fields.city_id') ?: null));
}, 'hooks' => array('before_index_view' => function ($dic, $dicvals) {
    $temp = Dic::valuesBySlug('city', null, [], true, true, true);
    #Helper::tad($temp);
    Config::set('temp.city', $temp);
}, 'after_store_update_destroy_order' => function ($dic = NULL, $dicval = NULL) {
    Cache::forget('dic_' . $dic->slug);
}), 'second_line_modifier' => function ($line, $dic, $dicval) {
    #Helper::ta($dicval);
    $cities = Config::get('temp.city');
    return isset($cities[$dicval->city_id]) && is_object($cities[$dicval->city_id]) ? $cities[$dicval->city_id]->name : '';
});