Ejemplo n.º 1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $view = viewx($this->template . '.home', array("template" => $this->template));
     $this->view = $view;
     // to cache
     return $view;
 }
Ejemplo n.º 2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  */
 public function show($id)
 {
     // if exist external content then send it to browser, increment views
     $external_content = $this->showPage->checkAndGetContentFromHtmlFile(app('veer')->siteId, $id);
     if (!empty($external_content)) {
         \Veer\Models\Page::where('id', '=', $id)->increment('views');
         return \Response::make($external_content, 200)->header('Content-type', 'text/html');
     }
     $page = $this->showPage->getPage($id, app('veer')->siteId);
     if (!is_object($page)) {
         return Redirect::route('page.index');
     }
     $page->increment('views');
     $page->load(array('images' => function ($q) {
         return $q->orderBy('pivot_id', 'asc');
     }, 'tags', 'attributes', 'downloads', 'userlists', 'user'));
     $page->imagesIds = collect($page->images->getDictionary());
     if ($page->show_comments == 1) {
         $this->showPage->loadComments($page, 'page');
     }
     $paginator_and_sorting = get_paginator_and_sorting();
     $data = array("page" => $page, "subpages" => $this->showPage->withChildPages(app('veer')->siteId, $page->id, $paginator_and_sorting), "parentpages" => $this->showPage->withParentPages(app('veer')->siteId, $page->id, $paginator_and_sorting), "products" => $this->showPage->withProducts(app('veer')->siteId, $page->id, $paginator_and_sorting), "categories" => $this->showPage->withCategories(app('veer')->siteId, $page->id), "template" => $this->template);
     $blade_path = $this->template . '.pages.' . $id;
     $viewLink = $this->template . '.page';
     // page with special design
     if ($page->original == 1 && \View::exists($blade_path)) {
         $viewLink = $blade_path;
     }
     $view = viewx($viewLink, $data);
     $this->view = $view;
     return $view;
 }
Ejemplo n.º 3
0
 /**
  * Display the specified resource.
  */
 public function show($id)
 {
     // @todo if id=0 then it will try to show everything
     $filtered = $this->showFilter->getFilter(app('veer')->siteId, $id, get_paginator_and_sorting());
     $view = viewx($this->template . '.filter', array("products" => $filtered['products'], "pages" => $filtered['pages'], "categories" => $this->showFilter->withCategories($filtered['products'], $filtered['pages']), "tags" => $this->showFilter->withTags($filtered['products'], $filtered['pages']), "attributes" => $this->showFilter->withAttributes($filtered['products'], $filtered['pages']), "template" => $this->template));
     $this->view = $view;
     return $view;
 }
Ejemplo n.º 4
0
 public function loadComments($object, $type = 'page')
 {
     if (db_parameter('COMMENTS_SYSTEM') == "disqus") {
         app('veer')->loadedComponents['comments_disqus'] = viewx('components.disqus', array("identifier" => $type . $object->id));
     } else {
         $object->load('comments');
         app('veer')->loadedComponents['comments_own'] = $object->comments->toArray();
     }
 }
Ejemplo n.º 5
0
 /**
  * common index view generator
  */
 protected function viewIndex($type, $object, $check = true)
 {
     if (!is_object($object) && $check) {
         return \Redirect::route('index');
     }
     $view = viewx($this->template . '.' . $type, array($type => $object, "template" => $this->template));
     $this->view = $view;
     return $view;
 }
Ejemplo n.º 6
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $tag = $this->showTag->getTag($id);
     if (!is_object($tag)) {
         return Redirect::route('index');
     }
     $paginator_and_sorting = get_paginator_and_sorting();
     $view = viewx($this->template . '.tag', array("tag" => $tag, "products" => $this->showTag->withProducts(app('veer')->siteId, $id, $paginator_and_sorting), "pages" => $this->showTag->withPages(app('veer')->siteId, $id, $paginator_and_sorting), "attributes" => $this->showTag->withAttributes($id, app('veer')->siteId), "categories" => $this->showTag->withCategories($id, app('veer')->siteId), "template" => $this->template));
     $this->view = $view;
     return $view;
 }
Ejemplo n.º 7
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($template, $filename)
 {
     if ($template != "id") {
         return $this->thumbnails($template, $filename);
     }
     $image = $this->showImage->getImageWithSite(app('veer')->siteId, $filename);
     if (!is_object($image)) {
         return Redirect::route('index');
     }
     $paginator_and_sorting = get_paginator_and_sorting();
     $view = viewx($this->template . '.image', array("image" => $image, "products" => $this->showImage->withProducts(app('veer')->siteId, $filename, $paginator_and_sorting), "pages" => $this->showImage->withPages(app('veer')->siteId, $filename, $paginator_and_sorting), "categories" => $this->showImage->withCategories(app('veer')->siteId, $filename), "template" => $this->template));
     $this->view = $view;
     return $view;
 }
Ejemplo n.º 8
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $category = $this->showCategory->getCategory($id, app('veer')->siteId);
     if (!is_object($category)) {
         return Redirect::route('index');
     }
     $category->increment('views');
     $category->load(array('images' => function ($q) {
         return $q->orderBy('pivot_id', 'asc');
     }));
     $paginator_and_sorting = get_paginator_and_sorting();
     $view = viewx($this->template . '.category', array("category" => $category, "products" => $this->showCategory->withProducts($id, $paginator_and_sorting), "pages" => $this->showCategory->withPages($id, $paginator_and_sorting), "tags" => $this->showCategory->withTags($id), "attributes" => $this->showCategory->withAttributes($id), "template" => $this->template));
     $this->view = $view;
     return $view;
 }
Ejemplo n.º 9
0
 public function __construct()
 {
     $checkLocale = new \Veer\Components\commonChangeLocale();
     app('view')->addExtension('md', 'php');
     $this->page = app('router')->current()->id;
     $this->sourcePath = app('veer')->template . '/' . $this->sourcePath . '/' . config('app.locale') . '/' . $this->page . '';
     if (view()->exists($this->sourcePath)) {
         $this->dataPath = app('view')->getFinder()->find($this->sourcePath);
     }
     if (!empty($this->dataPath)) {
         $this->data = \File::get($this->dataPath);
     }
     $this->updateViews();
     if (app('request')->ajax()) {
         return $this->earlyResponse($this->data);
     }
     return $this->earlyResponse(viewx(app('veer')->template . '.page', array("page" => $this->pageDb, "template" => app('veer')->template)));
 }
Ejemplo n.º 10
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  */
 public function show($id, $childId = null)
 {
     $attribute = $this->showAttribute->getAttribute($id, $childId);
     if (!is_object($attribute)) {
         return \Redirect::route('index');
     }
     $data = array("attribute" => $attribute, "template" => $this->template);
     if (!empty($childId)) {
         $page_sort = get_paginator_and_sorting();
         array_set($data, 'products', $this->showAttribute->withProducts(app('veer')->siteId, $childId, $page_sort));
         array_set($data, 'pages', $this->showAttribute->withPages(app('veer')->siteId, $childId, $page_sort));
         array_set($data, 'tags', $this->showAttribute->withTags($attribute->name, $attribute->val, app('veer')->siteId));
         array_set($data, 'categories', $this->showAttribute->withCategories($attribute->name, $attribute->val, app('veer')->siteId));
     }
     $view = viewx($this->template . '.attribute', $data);
     $this->view = $view;
     return $view;
 }
Ejemplo n.º 11
0
 /**
  * Display the specified resource.
  *
  * @param  int|string  $id
  * @return Response
  */
 public function show($id)
 {
     if (in_array($id, array('new', 'ordered', 'viewed'))) {
         return $this->showProductLists($id);
     }
     // @todo queryParams -> filter?
     $product = $this->showProduct->getProduct($id, app('veer')->siteId);
     if (!is_object($product)) {
         return $this->showProductLists('new');
     }
     $product->increment('viewed');
     $product->load(array('images' => function ($q) {
         return $q->orderBy('pivot_id', 'asc');
     }, 'tags', 'attributes', 'downloads', 'userlists'));
     $this->showProduct->loadComments($product, 'product');
     $paginator_and_sorting = get_paginator_and_sorting();
     $data = array("product" => $product, "subproducts" => $this->showProduct->withChildProducts(app('veer')->siteId, $product->id, $paginator_and_sorting), "parentproducts" => $this->showProduct->withParentProducts(app('veer')->siteId, $product->id, $paginator_and_sorting), "pages" => $this->showProduct->withPages(app('veer')->siteId, $product->id, $paginator_and_sorting), "categories" => $this->showProduct->withCategories(app('veer')->siteId, $product->id), "template" => $this->template);
     $view = viewx($this->template . '.product', $data);
     $this->view = $view;
     return $view;
 }
Ejemplo n.º 12
0
 /**
  * Show results for search.show & search.store
  */
 protected function results($searched)
 {
     $view = viewx($this->template . '.search', array("products" => $searched['products'], "pages" => $searched['pages'], "categories" => $this->showSearch->withCategories($searched['products'], $searched['pages']), "tags" => $this->showSearch->withTags($searched['products'], $searched['pages']), "attributes" => $this->showSearch->withAttributes($searched['products'], $searched['pages']), "template" => $this->template));
     $this->view = $view;
     return $view;
 }
Ejemplo n.º 13
0
 /** 
  * Search
  */
 public function searchAdmin($t, $paginateItems = 25)
 {
     $this->targetModel = $t;
     $q = \Input::get('SearchField');
     list($model, $id) = $this->parseQ($q);
     $field = $model == 'category' ? 'category' : 'id';
     $model = $this->getModelName($model, $this->targetModel);
     if (!empty($id)) {
         return \Redirect::route('admin.show', array($this->targetModel, $field => $id));
     }
     $view = $this->targetModel;
     $searchFields = $this->getSearchFields($this->targetModel);
     if (!empty($searchFields)) {
         $items = $model::whereNested(function ($query) use($q, $searchFields) {
             foreach ($searchFields as $s) {
                 $query->orWhere($s, 'like', '%' . $q . '%');
             }
         })->paginate($paginateItems);
     }
     if (isset($items) && is_object($items)) {
         return viewx(app('veer')->template . '.' . $view, array("items" => $items, "template" => app('veer')->template));
     }
     return false;
 }
Ejemplo n.º 14
0
 protected function categoryEarlyResponse($category)
 {
     app('veer')->forceEarlyResponse = true;
     app('veer')->earlyResponseContainer = viewx(app('veer')->template . '.category', array("category" => $category, "template" => app('veer')->template));
 }
Ejemplo n.º 15
0
 /**
  * show cart
  */
 public function showCart()
 {
     // prepare content
     $cart = $this->showUser->getUserCart(app('veer')->siteId, \Auth::id(), app('session')->getId());
     $grouped = app('veershop')->regroupShoppingCart($cart);
     // show user books
     if (\Auth::id() > 0) {
         $userbooks = \Auth::user()->books;
     }
     list($order, $checkDiscount, $calculations) = app('veershop')->prepareOrder($grouped);
     $view = viewx($this->template . '.cart', array("cart" => $grouped, "books" => isset($userbooks) ? $userbooks : null, "methods" => $calculations, "order" => $order, "template" => $this->template));
     return $view;
 }
Ejemplo n.º 16
0
 /**
  * Order was successful made
  */
 public function success()
 {
     if (\Session::has("successfulOrder")) {
         $orders = $this->showOrder->getOrderWithSite(app('veer')->siteId, \Session::get("successfulOrder"), \Auth::id(), administrator());
         if (is_object($orders)) {
             $orders->load('user', 'userbook', 'userdiscount', 'status', 'delivery', 'payment', 'status_history', 'products', 'bills', 'secrets', 'orderContent');
             // @todo do we need to load all information?
             // @todo downloads for digital products
             /* do not cache */
             return viewx($this->template . '.success-order', array("order" => $orders, "template" => $this->template));
         }
     }
     return Redirect::route('index');
 }
Ejemplo n.º 17
0
 protected function earlyResponse()
 {
     app('veer')->forceEarlyResponse = true;
     $data2view['data']['function']['indexCornersPages']['data'] = $this->data;
     $data2view['template'] = app('veer')->template;
     $data2view['loadScripts'] = true;
     app('veer')->earlyResponseContainer = viewx(app('veer')->template . ".layout.pages-list", $data2view);
 }