/**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     $network_id = config('yppmembers.network_id');
     $network = Network::find($network_id);
     $network_sites = $network->sites()->withcontent()->orderBy('name', 'asc')->get();
     $most_used_tags_in_network = Tag::ofNetwork($network->id)->mostUsedInNetwork($network->id)->take(20)->get();
     $most_used_models_in_network = Model::ofNetwork($network->id)->mostUsedInNetwork($network->id)->take(20)->get();
     $view->with('network_sites', $network_sites);
     $view->with('most_used_tags_in_network', $most_used_tags_in_network);
     $view->with('most_used_models_in_network', $most_used_models_in_network);
 }
Esempio n. 2
0
 public function xhrSearch(Request $request)
 {
     $q = Request::input('q', '');
     $q = strip_tags(str_replace("'", " ", $q));
     $response = [];
     if (!empty($q)) {
         $contents = Content::ofNetwork($this->network->id)->published()->search($q)->paginate(10);
         $models = Model::ofNetwork($this->network->id)->where('name', 'LIKE', "%{$q}%")->paginate(10);
         $tags = Tag::ofNetwork($this->network->id)->where('name', 'LIKE', "%{$q}%")->paginate(10);
         $items = $contents->merge($models)->merge($tags);
         foreach ($items as $item) {
             $response[] = ['title' => $item->getAttribute('title') ? $item->title : $item->name, 'url' => $item->link, 'thumb' => $item->thumb, 'type' => class_basename(get_class($item))];
         }
         $this->dispatch(new UpdateSearchKeywords($q));
     }
     return \Response::json($response);
 }
Esempio n. 3
0
 public function index()
 {
     $network = $this->network;
     $theme = $network->theme;
     $theme = check_for_tour_theme($theme);
     Theme::setActive($theme);
     $data = $this->data;
     if (Input::has('l')) {
         $letter = Input::get('l');
         $models = Model::ofNetwork($network->id)->published()->where('name', 'like', $letter . '%')->paginate(config('yppmembers.per_page'));
     } else {
         $models = Model::ofNetwork($network->id)->published()->mostUsedInNetwork($network->id)->paginate(config('yppmembers.per_page'));
     }
     $data['page_title'] = $this->network->name . ' Models';
     $data['models'] = $models;
     $this->breadcrumbs->addCrumb('Popular Models');
     return Theme::view('model.index', $data);
 }
Esempio n. 4
0
 public function __construct()
 {
     $network_id = config('yppmembers.network_id');
     $network = Network::find($network_id);
     if (!$network) {
         echo 'Invalid Network';
         exit;
     }
     $this->network = $network;
     $this->breadcrumbs = new \Creitive\Breadcrumbs\Breadcrumbs();
     $this->breadcrumbs->setListElement('ol');
     $this->breadcrumbs->setDivider(null);
     $this->breadcrumbs->setCssClasses('breadcrumb');
     $this->breadcrumbs->addCrumb($network->name, url());
     $data['breadcrumbs'] = $this->breadcrumbs;
     $data['network'] = $network;
     $data['support_url'] = config('yppmembers.support_url');
     $data['network_sites'] = $network->sites()->withcontent()->orderBy('name', 'asc')->get();
     $data['most_used_tags_in_network'] = Tag::ofNetwork($network->id)->mostUsedInNetwork($network->id)->take(20)->get();
     $data['most_used_models_in_network'] = Model::ofNetwork($network->id)->mostUsedInNetwork($network->id)->take(20)->get();
     $data['show_network_header'] = true;
     $data['piwik_tracker_ids'] = config('yppmembers.use_piwik') && $network->piwik_id != 0 ? [$network->piwik_id] : [];
     $this->data = $data;
 }