public function show($personId)
 {
     $person = Person::find($personId);
     $tree = $person->buildRelationsTree();
     JavaScript::put(['gentree' => $tree, 'currentElementId' => $personId]);
     return view('person.gentree.show');
 }
示例#2
0
 /**
  * Pass data directly to Javascript.
  *
  * @link https://github.com/laracasts/PHP-Vars-To-Js-Transformer
  *
  * @param mixed $key
  * @param mixed $value
  *
  * @return $this
  */
 protected function setJavascriptData($key, $value = null)
 {
     if (is_array($key)) {
         JavaScriptFacade::put($key);
     } else {
         JavaScriptFacade::put([$key => $value]);
     }
 }
 public function getProperty(Request $request, $propertyId)
 {
     $property = $this->properties->with(['commission', 'wishList', 'media', 'facilities', "services", "bookings"])->findOrFail($propertyId);
     JavaScriptFacade::put(['property' => $property, 'unavailableDates' => $property->unavailableDatesForBooking()]);
     if ($request->user()) {
         JavaScriptFacade::put(['userId' => $request->user()->id]);
     }
     return view('front.pages.house_detail', compact("property"));
 }
示例#4
0
 public function compose(View $view)
 {
     $view->with('uri', $this->request->path());
     $view->with('currentUser', $this->user);
     $view->with('roles_list', Role::lists('name', 'id'));
     $view->with('user_attributes_list', UserAttributes::lists('name', 'alias'));
     $view->with('restaurant_attributes_list', VendorAttributes::lists('name', 'alias'));
     $view->with('restaurant_locations_list', VendorLocation::wherehas('vendor.vendorType', function ($q) {
         $q->where('type', 'Restaurants');
     })->lists('slug', 'id'));
     $view->with('cities_list', Location::where('Type', 'City')->lists('name', 'id'));
     $view->with('locations_area_list', Location::where('Type', 'Area')->lists('name', 'id'));
     $view->with('cuisines', VendorAttributesSelectOptions::wherehas('attribute', function ($q) {
         $q->where('alias', 'cuisines');
     })->lists('option', 'id'));
     $view->with('_token', $this->encrypter->encrypt(csrf_token()));
     $view->with('media_url', Config::get('media.base_s3_url'));
     $view->with('curator_list', Curator::lists('name', 'id'));
     $view->with('tags_list', Collection::lists('name', 'id'));
     $view->with('flags_list', Flag::lists('name', 'id'));
     $view->with('restaurants_list', DB::table('vendors')->lists('name', 'id'));
     $experienceTypeArray = array('simple', 'complex');
     $view->with('experiences_list', DB::table('products')->whereIn('type', $experienceTypeArray)->lists('name', 'id'));
     $view->with('locations_list', Location::where('Type', 'Locality')->lists('name', 'id'));
     $view->with('price_type_list', PriceType::lists('type_name', 'id'));
     $variant_lists = DB::table('product_variant_options')->lists('variation_name', 'id');
     $view->with('variant_list', $variant_lists);
     $complex_experience_list = DB::table('products')->where('type', "complex")->lists('name', 'id');
     $view->with('complex_experience_list', $complex_experience_list);
     $curators_list = Curator::all()->lists('name', 'id');
     $curatorsList = [];
     foreach ($curators_list as $key => $value) {
         $curatorsList[] = ['id' => $key, 'text' => $value];
     }
     $flags_list = Flag::all()->lists('name', 'id');
     $flagsList = [];
     foreach ($flags_list as $key => $value) {
         $flagsList[] = ['id' => $key, 'text' => $value];
     }
     $restaurants_list = DB::table('vendors')->lists('name', 'id');
     $restaurantsList = [];
     foreach ($restaurants_list as $key => $value) {
         $restaurantsList[] = ['id' => $key, 'text' => $value];
     }
     $localities_list = Location::where('Type', 'Locality')->lists('name', 'id');
     $localitiesList = [];
     foreach ($localities_list as $key => $value) {
         $localitiesList[] = ['id' => $key, 'text' => $value];
     }
     //echo "test".die;
     JavaScript::put(['curatorsList' => $curatorsList, 'flagsList' => $flagsList, 'restaurantsList' => $restaurantsList, 'localitiesList' => $localitiesList]);
 }
示例#5
0
 /**
  * Display a listing of the resource.
  *
  * @param Encrypter $encrypter
  * @param $hash
  * @return Response
  * @throws Exception
  */
 public function index(Encrypter $encrypter, $hash)
 {
     try {
         $params = $encrypter->decrypt($hash);
         $project = $this->projectRepository->find($params['project']);
         $user = $project->users->find($params['user']);
         if (is_null($user)) {
             throw new Exception('the user was not found');
         }
         $sourceClass = app()->make('Knoters\\Services\\Sources\\' . ucfirst($project->type->name) . 'Service');
         $video = $sourceClass->getVideo($project->video_id);
         $this->fractal->setSerializer(new ArraySerializer());
         JavaScriptFacade::put(['user' => $this->fractal->createData(new Item($user, new UserTransformer()))->toArray(), 'project' => $this->fractal->createData(new Item($project, new ProjectTransformer()))->toArray()]);
         return view('editor', ['video' => $video, 'project' => $project]);
     } catch (Exception $e) {
         throw $e;
         $this->errorResponse($e);
     }
 }
 public function getPropertyList()
 {
     JavaScriptFacade::put(['property_ajax_url' => route('property_list_ajax')]);
     return view('user.property');
 }
 public function process()
 {
     // set processing time for browser before timeout
     ini_set('max_execution_time', 3600);
     // override default PHP memory limit
     ini_set('memory_limit', '-1');
     // fetch all inputs from the submitted form //
     $input = Request::all();
     // create new objects to store params passed in from form
     $dataParams = new SearchData();
     $searchParams = new SearchData();
     // search type for journals (publication name)
     $queryType1 = "SO";
     // keyword(s)
     // check if journal1 field has been populated, if not entered then set to blank
     if ($input["journal1"]) {
         $queryJournal1 = $input["journal1"];
         $queryJournal1 = $queryType1 . "=" . $queryJournal1;
         // for search params
         $searchJournal1 = $input["journal1"];
     } else {
         $queryJournal1 = "";
         $searchJournal1 = "";
     }
     // check if journal2 field has been populated, if not entered then set to blank
     if (isset($input["journal2"])) {
         $queryJournal2 = $input["journal2"];
         $queryJournal2 = " OR " . $queryType1 . "=" . $queryJournal2;
         // for search params
         $searchJournal2 = $input["journal2"];
     } else {
         $queryJournal2 = "";
         $searchJournal2 = "";
     }
     // check if journal3 field has been populated
     if (isset($input["journal3"])) {
         $queryJournal3 = $input["journal3"];
         $queryJournal3 = " OR " . $queryType1 . "=" . $queryJournal3;
         // for search params
         $searchJournal3 = $input["journal3"];
     } else {
         $queryJournal3 = "";
         $searchJournal3 = "";
     }
     // search type for titles
     $queryType2 = "TI";
     // keyword(s)
     // check if title1 field has been populated
     if ($input["title1"] && $input["journal1"]) {
         $queryTitle1 = $input["title1"];
         $queryTitle1 = " AND " . $queryType2 . "=" . $queryTitle1;
         // for search params
         $searchTitle1 = $input["title1"];
     } elseif ($input["title1"] && !$input["journal1"]) {
         $queryTitle1 = $input["title1"];
         $queryTitle1 = $queryType2 . "=" . $queryTitle1;
         // for search params
         $searchTitle1 = $input["title1"];
     } else {
         $queryTitle1 = "";
         $searchTitle1 = "";
     }
     // check if title2 field has been populated
     if (isset($input["title2"])) {
         $queryTitle2 = $input["title2"];
         $queryTitle2 = " OR " . $queryType2 . "=" . $queryTitle2;
         // for search params
         $searchTitle2 = $input["title2"];
     } else {
         $queryTitle2 = "";
         $searchTitle2 = "";
     }
     // check if title3 field has been populated
     if (isset($input["title3"])) {
         $queryTitle3 = $input["title3"];
         $queryTitle3 = " OR " . $queryType2 . "=" . $queryTitle3;
         // for search params
         $searchTitle3 = $input["title3"];
     } else {
         $queryTitle3 = "";
         $searchTitle3 = "";
     }
     // replace any whitespace with %20 (url encoding)
     $queryTitle1 = str_replace(" ", "%20", $queryTitle1);
     $queryTitle2 = str_replace(" ", "%20", $queryTitle2);
     $queryTitle3 = str_replace(" ", "%20", $queryTitle3);
     // sort type
     $sortType = "TC";
     // check if timespan fields have been populated
     if ($input["timeStart"] != "Select" && $input["timeEnd"] != "Select") {
         $timeStart = $input["timeStart"];
         $timeEnd = $input["timeEnd"];
     } elseif ($input["timeStart"] != "Select" && $input["timeEnd"] == "Select") {
         $timeStart = $input["timeStart"];
         $timeEnd = date("Y");
     } elseif ($input["timeStart"] == "Select" && $input["timeEnd"] != "Select") {
         $timeStart = "1970";
         $timeEnd = $input["timeEnd"];
     } else {
         $timeStart = "1970";
         $timeEnd = date("Y");
     }
     // store the relevant data in the dataParams object
     $dataParams = ['journal1' => $queryJournal1, 'journal2' => $queryJournal2, 'journal3' => $queryJournal3, 'title1' => $queryTitle1, 'title2' => $queryTitle2, 'title3' => $queryTitle3, 'from' => $timeStart, 'to' => $timeEnd];
     // create an array to store all the search parameters to display alongside graphs
     $searchParams = ['journal1' => $searchJournal1, 'journal2' => $searchJournal2, 'journal3' => $searchJournal3, 'title1' => $searchTitle1, 'title2' => $searchTitle2, 'title3' => $searchTitle3, 'from' => $timeStart, 'to' => $timeEnd];
     // ================================================================ //
     // ========== PASS IN PARAMETERS FOR REST REQUEST: GtR ============ //
     // ================================================================ //
     // keyword(s)
     // check if title1 field has been populated
     if ($_POST["title1"] != "") {
         $keyword1 = $_POST["title1"];
     } else {
         $keyword1 = "";
     }
     // check if title2 field has been populated
     if (isset($_POST["title2"])) {
         $keyword2 = $_POST["title2"];
         $keyword2 = " OR " . $keyword2;
     } else {
         $keyword2 = "";
     }
     // check if title3 field has been populated
     if (isset($_POST["title3"])) {
         $keyword3 = $_POST["title3"];
         $keyword3 = " OR " . $keyword3;
     } else {
         $keyword3 = "";
     }
     // replace any whitespace with %20 (url encoding)
     // $keyword1 = str_replace(" ", "%20", $keyword1);
     // $keyword2 = str_replace(" ", "%20", $keyword2);
     // $keyword3 = str_replace(" ", "%20", $keyword3);
     $keyword1 = urlencode($keyword1);
     $keyword2 = urlencode($keyword2);
     $keyword3 = urlencode($keyword3);
     // create new SoapWrapper object to get SOAP data from WoS
     $soap = new SoapWrapper();
     // create new RestWrapper object to get REST data from GtR
     $rest = new RestWrapper();
     // create new ScopusWrapper object to get REST data from Scopus
     // $scopus = new ScopusWrapper;
     // authenticate WoS search to get SID; get initial data (SoapWrapper function)
     $soap->soapExchange($dataParams);
     // perform REST exchange with GtR API
     $rest->restExchange($keyword1, $keyword2, $keyword3);
     // perform REST exchange with Scopus API
     // $scopus->scopusWebExchange($keyword1, $keyword2, $keyword3);
     // perform iterativeWosSearch (SoapWrapper class) to get all records from WoS
     $soap->iterateWosSearch($soap);
     // perform iterateGtrSearch (RestWrapper class) to get all records from GtR
     $rest->iterateGtrSearch($keyword1, $keyword2, $keyword3);
     // sum the funds for duplicate people in data
     $rest->sumFunds();
     // separate the data into the different arrays for time periods
     $rest->timedFunds($timeStart, $timeEnd);
     // sort the data by funds
     $rest->orderData($rest, 'projects', 'funds');
     $rest->orderData($rest, 'timeArrayFunds', 'funds');
     $rest->orderData($rest, 'tenArrayFunds', 'funds');
     $rest->orderData($rest, 'fiveArrayFunds', 'funds');
     $rest->orderData($rest, 'twoArrayFunds', 'funds');
     // make the funds more readable as they are generally in the millions
     $rest->readableFunds();
     // create a new DataSort object to store all the data for the WoS graphs
     $wosData = new DataSort($soap->records);
     // create a new DataSort object to store all the data for the Scopus graphs
     // $scopusData = new DataSort($scopus->scopusData);
     // assign a determined value to each author (WoS)
     $wosData->assignValues();
     // assign a determined value to each author (Scopus)
     // $scopusData->assignValues();
     // run function to create tables for db for WoS data
     $wosData->createTables();
     // run function to create tables for db for Scopus data
     // $scopusData->createTables();
     // populate tables with data from $wosData->records
     $wosData->populateTables($wosData->records, $timeStart, $timeEnd);
     // populate tables with data from $scopusData->records
     // $scopusData->populateTables($scopusData->records, $timeStart, $timeEnd);
     // sum the citations values in all the tables for duplicate authors (WoS)
     $wosData->sumCitesAll();
     $wosData->sumCitesUser();
     $wosData->sumCitesTen();
     $wosData->sumCitesFive();
     $wosData->sumCitesTwo();
     // sum the weighted values in all the tables for duplicate authors
     $wosData->sumValuesAll();
     // sum the citations values in all the tables for duplicate authors (Scopus)
     //$scopusData->sumCitesAll();
     //$scopusData->sumCitesUser();
     //$scopusData->sumCitesTen();
     //$scopusData->sumCitesFive();
     //$scopusData->sumCitesTwo();
     // sum the weighted values in all the tables for duplicate authors
     //$scopusData->sumValuesAll();
     // return processed data back from MySQL to PHP arrays & convert to associative arrays (WoS)
     $wosData->allArray = json_decode(json_encode($wosData->pullData('searchresponse')), true);
     $wosData->timeArray = json_decode(json_encode($wosData->pullData('userdefined')), true);
     $wosData->tenArray = json_decode(json_encode($wosData->pullData('tenyear')), true);
     $wosData->fiveArray = json_decode(json_encode($wosData->pullData('fiveyear')), true);
     $wosData->twoArray = json_decode(json_encode($wosData->pullData('twoyear')), true);
     $wosData->valueArray = json_decode(json_encode($wosData->pullData('searchresponse')), true);
     // return processed data back from MySQL to PHP arrays & convert to associative arrays (Scopus)
     //$scopusData->allArray = json_decode(json_encode($scopusData->pullData('searchresponse')), true);
     //$scopusData->timeArray = json_decode(json_encode($scopusData->pullData('userdefined')), true);
     //$scopusData->tenArray = json_decode(json_encode($scopusData->pullData('tenyear')), true);
     //$scopusData->fiveArray = json_decode(json_encode($scopusData->pullData('fiveyear')), true);
     //$scopusData->twoArray = json_decode(json_encode($scopusData->pullData('twoyear')), true);
     //$scopusData->valueArray = json_decode(json_encode($scopusData->pullData('searchresponse')), true);
     // sort data by highest cited first (WoS)
     $wosData->sortData($wosData, 'allArray', 'citations');
     $wosData->sortData($wosData, 'timeArray', 'citations');
     $wosData->sortData($wosData, 'tenArray', 'citations');
     $wosData->sortData($wosData, 'fiveArray', 'citations');
     $wosData->sortData($wosData, 'twoArray', 'citations');
     $wosData->sortData($wosData, 'valueArray', 'weight');
     // sort data by highest cited first (Scopus)
     //$scopusData->sortData($scopusData, 'allArray', 'citations');
     //$scopusData->sortData($scopusData, 'timeArray', 'citations');
     //$scopusData->sortData($scopusData, 'tenArray', 'citations');
     //$scopusData->sortData($scopusData, 'fiveArray', 'citations');
     //$scopusData->sortData($scopusData, 'twoArray', 'citations');
     //$scopusData->sortData($scopusData, 'valueArray', 'weight');
     // sort value data so that it only has 2 values for bubble chart (author & value)
     $wosData->removeAttributes($wosData->valueArray);
     //$scopusData->removeAttributes($scopusData->valueArray);
     // for data to work in d3 as bubble chart, needs to have parent and children
     $wosData->valuesJSON = [];
     $wosData->valuesJSON["name"] = "rankedData";
     $wosData->valuesJSON["children"] = $wosData->valueArray;
     // SCOPUS
     //$scopusData->valuesJSON = [];
     //$scopusData->valuesJSON["name"] = "rankedData";
     //$scopusData->valuesJSON["children"] = $scopusData->valueArray;
     // JSON encode cited data for use in jQuery (WoS)
     $allCited = json_encode($wosData->allArray);
     $userCited = json_encode($wosData->timeArray);
     $tenCited = json_encode($wosData->tenArray);
     $fiveCited = json_encode($wosData->fiveArray);
     $twoCited = json_encode($wosData->twoArray);
     // JSON encode values data for use in jQuery
     $valueData = json_encode($wosData->valuesJSON);
     // JSON encode cited data for use in jQuery (Scopus)
     //$allCited = json_encode($scopusData->allArray);
     //$userCited = json_encode($scopusData->timeArray);
     //$tenCited = json_encode($scopusData->tenArray);
     //$fiveCited = json_encode($scopusData->fiveArray);
     //$twoCited = json_encode($scopusData->twoArray);
     // JSON encode values data for use in jQuery
     //$valueData = json_encode($scopusData->valuesJSON);
     // JSON encode funds data for use in jQuery
     $allFunds = json_encode($rest->projects);
     $userFunds = json_encode($rest->timeArrayFunds);
     $tenFunds = json_encode($rest->tenArrayFunds);
     $fiveFunds = json_encode($rest->fiveArrayFunds);
     $twoFunds = json_encode($rest->twoArrayFunds);
     //echo "</br>BUBBLE CHART VALUES:</br>";
     //print "<pre>\n";
     //print_r($valueData);
     //print "</pre>";
     // pass data to JavaScript (uses https://github.com/laracasts/PHP-Vars-To-Js-Transformer)
     JavaScript::put(['allCited' => $allCited, 'userCited' => $userCited, 'tenCited' => $tenCited, 'fiveCited' => $fiveCited, 'twoCited' => $twoCited, 'valueData' => $valueData, 'allFunded' => $allFunds, 'userFunded' => $userFunds, 'tenFunded' => $tenFunds, 'fiveFunded' => $fiveFunds, 'twoFunded' => $twoFunds, 'searchData' => $searchParams]);
     return View::make('pages.data');
 }
 /**
  * Pass data to Javascript
  *
  * @param string $data Data
  *
  * @return void
  */
 protected function js($data)
 {
     JavaScriptFacade::put($data);
 }
 public function paymentSuccess(Request $request)
 {
     $ref = $request->get("Ref");
     $theInvoice = $this->invoices->where('orderRef', $ref)->first();
     $theInvoice->status = 'paid';
     $theInvoice->save();
     $message = "You successfully paid.";
     JavaScriptFacade::put(['successMessage' => $message]);
     $this->dispatchFrom(SendInvoicePaidEmail::class, $request);
     return redirect("/property/" . $request->get('property'));
 }
示例#10
0
 public function index()
 {
     JavaScript::put(['loggedIn' => Auth::check()]);
     $locations = Location::lists('name', 'id');
     return View::make('home', compact('locations'));
 }
示例#11
0
 /**
  * Display the calendar with reservations.
  *
  * @return Response
  */
 public function index()
 {
     $reservations = DB::table('reservations')->select(DB::raw('count(*) as count, date'))->groupBy('date')->get();
     JavaScript::put(['reservations' => $reservations]);
     return view('reservation.calendar');
 }