/**
  * Add a View instance to the Collector
  *
  * @param \Illuminate\View\View $view
  */
 public function addView(View $view)
 {
     $name = $view->getName();
     $path = $view->getPath();
     if ($path) {
         $path = ltrim(str_replace(base_path(), '', realpath($path)), '/');
     }
     if (substr($path, -10) == '.blade.php') {
         $type = 'blade';
     } else {
         $type = pathinfo($path, PATHINFO_EXTENSION);
     }
     if (!$this->collect_data) {
         $params = array_keys($view->getData());
     } else {
         $data = array();
         foreach ($view->getData() as $key => $value) {
             if (in_array($key, ['__env', 'app', 'errors', 'obLevel', 'currentUser'])) {
                 continue;
             }
             $data[$key] = $this->exportValue($value);
         }
         $params = $data;
     }
     $this->templates[] = array('name' => $path ? sprintf('%s (%s)', $name, $path) : $name, 'param_count' => count($params), 'params' => $params, 'type' => $type);
 }
Esempio n. 2
0
 /**
  * @param View $view
  */
 public function compose(View $view)
 {
     $view->with('currentUser', $this->sentinel->getUser());
     $view->with('mode', array_get($view->getData(), 'mode', ''));
     $view->with('breadcrumbs', config('shapeshifter.breadcrumbs') ? $this->breadcrumbService->breadcrumbs() : []);
     $view->with('menu', $this->menuService->generateMenu());
 }
 /**
  * Figures out if the menu item we're displaying should be active
  * @param View $view
  */
 public function menuLink($view)
 {
     $viewData = $view->getData();
     $activeClass = '';
     $item = $viewData['item'];
     $slug = $item->slug !== '' ? $item->slug : $item->url;
     if ($slug == '') {
         $slug = '/foo';
     }
     // it's active if it's an exact match to the slug
     if ('/' . Request::path() == $slug) {
         $activeClass = 'active';
     } else {
         if (strpos('/' . Request::path(), $slug) === 0) {
             // unless the slug is the homepage
             if ($slug !== '/') {
                 $activeClass = 'active';
             }
             if ($slug == '/' && Request::path() == '/') {
                 $activeClass = 'active';
             }
         }
     }
     $clientInfo = Config::get('clientInfo');
     $locale = isset($clientInfo->primary_language->language_code) && App::getLocale() == $clientInfo->primary_language->language_code ? '' : '/' . App::getLocale();
     $link = $item->slug ? URL::to($locale . $item->slug) : $locale . $item->url;
     // translations, if any
     $translations = json_decode($item->translations, true);
     if (isset($translations[App::getLocale()]) && $translations[App::getLocale()] !== '') {
         $item->page_name = $translations[App::getLocale()];
     }
     $view->with('activeClass', $activeClass)->with('link', $link)->with('item', $item);
 }
Esempio n. 4
0
 /**
  * Bind data to the view.
  *
  * @param  \Illuminate\View\View  $view
  */
 public function compose(View $view)
 {
     foreach (config('arcanesoft.foundation.sidebar.items', []) as $sidebarKey) {
         if (config()->has($sidebarKey)) {
             $this->sidebar->add(config($sidebarKey));
         }
     }
     $this->sidebar->setCurrent(Arr::get($view->getData(), 'current_page', ''));
 }
Esempio n. 5
0
 /**
  * Add a View instance to the Collector
  *
  * @param \Illuminate\View\View $view
  */
 public function addView(View $view)
 {
     $name = $view->getName();
     $type = pathinfo($view->getPath(), PATHINFO_EXTENSION);
     if (!$this->collect_data) {
         $params = array_keys($view->getData());
     } else {
         $data = array();
         foreach ($view->getData() as $key => $value) {
             if (is_object($value) && method_exists($value, 'toArray')) {
                 $value = $value->toArray();
             }
             $data[$key] = $this->exporter->exportValue($value);
         }
         $params = $data;
     }
     $this->templates[] = array('name' => $name, 'param_count' => count($params), 'params' => $params, 'type' => $type);
 }
Esempio n. 6
0
 /**
  * @param $view
  */
 public function compose(View $view)
 {
     $viewData = $view->getData();
     $date = array_has($viewData, 'date') && $viewData['date'] ? $viewData['date'] : Carbon::today();
     $calendar = $this->manager->getCalendar(Carbon::today());
     $lastBillboard = $this->billboardsRepository->findNewer();
     $view->with('calendar', $calendar);
     $view->with('date', $date);
     $view->with('lastBillboard', $lastBillboard);
 }
 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     $clients = $this->clients->find($view->getData()['client']['id']);
     /**
      * [User assigned the client]
      * @var contact
      */
     $contact = $clients->userAssignee;
     $view->with('contact', $contact);
 }
 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     $tasks = $this->tasks->find($view->getData()['tasks']['id']);
     /**
      * [User assigned the task]
      * @var contact
      */
     $contact = $tasks->assignee;
     $client = $tasks->clientAssignee;
     $view->with('contact', $contact);
     $view->with('client', $client);
 }
 /**
  * @param View $view
  */
 public function address($view)
 {
     $viewData = $view->getData();
     $address = ['id' => '', 'address1' => '', 'address2' => '', 'address3' => '', 'city' => '', 'state' => '', 'postcode' => '', 'countryId' => ''];
     if (isset($viewData['address']) && $viewData['address']) {
         foreach ($viewData['address'] as $key => $value) {
             $address[$key] = $value;
         }
     }
     $view->with('address', $address);
     if (!isset($viewData['prefix'])) {
         $view->with('prefix', '');
     }
 }
Esempio n. 10
0
 public function compose(View $view)
 {
     $data = $view->getData();
     if (Auth::check()) {
         $this->putUserInfo();
     }
     if (array_key_exists('group', $data) && $data['group'] instanceof Group) {
         JavaScript::put(['group' => $data['group']]);
     }
     if (array_key_exists('content', $data) && $data['content'] instanceof Content) {
         JavaScript::put(['content' => $data['content']->toArray()]);
     }
     JavaScript::put(['config' => ['env' => app()->environment(), 'pusher_key' => config('broadcasting.connections.pusher.key')]]);
 }
Esempio n. 11
0
 /**
  * Composer for updating a course
  * @param View $view
  */
 public function compose(View $view)
 {
     $course = $view->getData()['course'];
     $empty_link = new Link(['link' => "", 'name' => ""]);
     $empty_link->id = 0;
     $links = \Link::getAllLinks($course);
     $length = count($links) > 0 ? $links[count($links) - 1]->id + 1 : 1;
     \JavaScript::put(['links' => $length]);
     $view->with('empty_link', $empty_link);
     $view->with('images', \Image::listImages($course));
     $view->with('videos', \Video::listVideos($course));
     $view->with('ebooks', \Ebook::listEbooks($course));
     $view->with('links', $links);
     $view->with('body', \Resource::getCourseBody($course));
 }
Esempio n. 12
0
 /**
  * Composer for showing a course
  * @param View $view
  */
 public function compose(View $view)
 {
     $course = $view->getData()['course'];
     $view->with('course_categories', \Category::getCourseCategories($course));
     $view->with('images', \Image::listImagesWithCleanPath($course));
     $view->with('videos', \Video::listVideosWithCleanPath($course));
     $view->with('ebooks', \Ebook::listEbooksWithCleanPath($course));
     $view->with('links', \Link::listLinksWithNames($course));
     $view->with('created_at', \MyCarbon::format($course->created_at->diffForHumans()));
     $view->with('course_user', $course->user);
     $view->with('count_likes', \Course::countLikes($course));
     $view->with('count_dislikes', \Course::countDislikes($course));
     if (Auth::check()) {
         \JavaScript::put(['star_index' => \Course::getLikeRating($course, Auth::user())]);
     }
 }
Esempio n. 13
0
 /**
  * Add a View instance to the Collector
  *
  * @param \Illuminate\View\View $view
  */
 public function addView(View $view)
 {
     $name = $view->getName();
     if (!$this->collect_data) {
         $this->views[] = $name;
     } else {
         $data = array();
         foreach ($view->getData() as $key => $value) {
             if (is_object($value) and method_exists($value, 'toArray')) {
                 $data[$key] = $value->toArray();
             } else {
                 $data[$key] = $value;
             }
         }
         $this->views[] = $name . ' => ' . $this->formatVar($data);
     }
 }
 /**
  * @param View $view
  */
 public function slider($view)
 {
     $viewData = $view->getData();
     if (!isset($viewData['options'])) {
         $viewData['options'] = json_decode($viewData['element']->element_options, true);
     }
     $slider_id = $viewData['options']['id'];
     try {
         $slider = VendirunApi::makeRequest('cms/slider', ['id' => $slider_id])->getData();
         $sliderStyles = $this->getSliderStyles($slider);
         $slideStyles = $this->getSlideStyles($slider);
     } catch (FailResponseException $e) {
         $slider = false;
         $sliderStyles = [];
         $slideStyles = [];
     }
     $view->with('slider', $slider)->with('sliderStyles', $sliderStyles)->with('slideStyles', $slideStyles);
 }
Esempio n. 15
0
 /**
  * Add a View instance to the Collector
  *
  * @param \Illuminate\View\View $view
  */
 public function addView(View $view)
 {
     $name = $view->getName();
     if (!$this->collect_data) {
         $this->data[$name] = $name;
     } else {
         $data = array();
         foreach ($view->getData() as $key => $value) {
             if (is_object($value)) {
                 if (method_exists($value, 'toArray')) {
                     $data[$key] = $value->toArray();
                 } else {
                     $data[$key] = "Object (" . get_class($value) . ")";
                 }
             } else {
                 $data[$key] = $value;
             }
         }
         $this->data[$name] = $data;
     }
 }
Esempio n. 16
0
 public function compose(View $view)
 {
     // Check for route based vars for body tag
     $existing_view_data = $view->getData();
     if (!isset($existing_view_data['route_method']) && !isset($existing_view_data['route_controller'])) {
         if (!Route::getCurrentRoute()) {
             // 404
             $route_method = '404';
             $route_controller = '404';
         } else {
             $route_information = Str::parseCallBack(Route::currentRouteAction(), null);
             $controller_array = explode('\\', $route_information[0]);
             $route_method = $route_information[1];
             $route_controller = end($controller_array);
         }
     }
     $view_data = [];
     // Override vars for closure based routes
     if (isset($route_method) && isset($route_controller)) {
         $view_data['route_method'] = $route_method;
         $view_data['route_controller'] = $route_controller;
     }
     $view->with($view_data);
 }
 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     $view->with('contact', $this->users->find($view->getData()['user']['id']));
 }
 /**
  * Create breadcrumbs depending on what kind of page we're on
  * @param View $view
  */
 public function index($view)
 {
     $viewData = $view->getData();
     $view->with('breadcrumbs', $this->generateBreadcrumbs($viewData));
 }
 /**
  * @param View $view
  */
 public function cart(View $view)
 {
     $viewData = $view->getData();
     if (!isset($viewData['cart'])) {
         $cartRepository = App::make('AlistairShaw\\Vendirun\\App\\Entities\\Cart\\CartRepository');
         $view->with('cart', $cartRepository->find());
     }
 }
 /**
  * @param View $view
  */
 public function propertyButtons(View $view)
 {
     $viewData = $view->getData();
     $validPropertyButtons = ['details', 'enquire', 'favourite', 'property-card', 'recommend'];
     if (!isset($viewData['propertyButtons'])) {
         $propertyButtons = $validPropertyButtons;
     } else {
         $propertyButtons = [];
         foreach ($viewData['propertyButtons'] as $button) {
             if (in_array($button, $validPropertyButtons)) {
                 $propertyButtons[] = $button;
             }
         }
     }
     $view->with('propertyButtons', $propertyButtons);
     if (!isset($viewData['abbreviatedButtons'])) {
         $view->with('abbreviatedButtons', false);
     }
     $view->with('propertyCardUrl', Config::get('vendirun.apiEndPoint') . '../../public_area/property_card/' . $viewData['property']->id . '/' . Config::get('vendirun.clientId') . '/single/A4/true/' . App::getLocale());
 }
 /**
  * Composer for showing the filtered courses
  *
  * @param View $view
  */
 public function compose(View $view)
 {
     $categories = $view->getData()['selected_categories'];
     $view->with('courses', \Course::filterCourses($categories));
     $view->with('count', \Course::countFilterCourses($categories));
 }
 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     $invoices = $this->invoices->find($view->getData()['invoice']['id']);
     $client = $invoices->clients->first();
     $view->with('client', $client);
 }