private static function generate_data_for_day(SS_Datetime $date)
 {
     $data = array('timestamp' => time(), 'searchDate' => $date->Format("Y-m-d"), 'collections' => array('events' => array(), 'galleries' => array(), 'locations' => array()));
     $galleryIDs = array();
     $locationIDs = array();
     // Get events
     $where = sprintf("DATE(`StartDate`) = '%s'", $date->Format('Y-m-d'));
     $events = Event::get()->where($where)->exclude(array("GalleryID" => 0, "Gallery.LocationID" => 0));
     foreach ($events as $event) {
         $galleryIDs[] = $event->GalleryID;
         $data['collections']['events'][] = $event->forAPI();
     }
     // Get galleries
     $galleries = Gallery::get()->byIDs(array_unique($galleryIDs));
     foreach ($galleries as $gallery) {
         $locationIDs[] = $gallery->LocationID;
         $data['collections']['galleries'][] = $gallery->forAPI();
     }
     // Get locations
     $locations = Location::get()->byIDs(array_unique($locationIDs));
     foreach ($locations as $location) {
         $data['collections']['locations'][] = $location->forAPI();
     }
     return $data;
 }
 public function allPagesToCache()
 {
     // Get each page type to define its sub-urls
     $urls = array();
     // memory intensive depending on number of pages
     $pages = SiteTree::get()->where("ClassName != 'BlogEntry'");
     //remove Blog pages from cache due to Form SecurityID issue
     foreach ($pages as $page) {
         array_push($urls, $page->Link());
         if ($page->ClassName == 'ProjectPage') {
             //add ajax pages for each projectpage
             array_push($urls, $page->Link() . 'ajax');
         }
     }
     //add tag pages
     $tags = Tag::get()->filter(array('HasTagPage' => 1));
     foreach ($tags as $tag) {
         array_push($urls, '/tag/' . $tag->Slug);
     }
     //add location pages
     $locations = Location::get();
     foreach ($locations as $location) {
         array_push($urls, '/location/' . $location->Slug);
     }
     return $urls;
 }
 public function isTFTP()
 {
     $Location = new Location($this->get('locationID'));
     if ($Location && $Location->isValid()) {
         return $Location->get('tftp');
     }
 }
Beispiel #4
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($shortUrl, Request $request)
 {
     $url = ShortUrl::where('short_url', 'LIKE', '%' . $shortUrl)->first();
     $location = \Location::get();
     if ($url !== null) {
         ShortUrlClickInfo::create(['shorturl_id' => $url->id, 'country' => $location->countryName, 'ua' => $request->server->get("HTTP_USER_AGENT")]);
     }
     return redirect()->to($url->long_url);
 }
 function testLocationDeletion()
 {
     $this->logInWithPermission('ADMIN');
     $location = $this->objFromFixture('Location', 'silverstripe');
     $locationID = $location->ID;
     $this->logOut();
     $this->logInWithPermission('Location_DELETE');
     $this->assertTrue($location->canDelete());
     $location->delete();
     $locations = Location::get()->column('ID');
     $this->assertFalse(in_array($locationID, $locations));
 }
 public function index($arguments)
 {
     $slug = $arguments->param('Slug');
     $location = Location::get()->filter(array('Slug' => $slug))->First();
     if ($location) {
         $this->Lat = $location->Latitude;
         $this->Lng = $location->Longitude;
         $this->Location = $location->Title;
         $this->Subtitle = $location->Subtitle;
         $this->Key = $this->config()->key;
         return $this->renderWith(array('LocationPage', 'Page'));
     }
 }
 public function locationData()
 {
     // Get the locations from the database, exclude any that don't have LatLng's defined
     $infoWindowList = Location::get()->exclude(array('lat' => null, 'lng' => null));
     if ($infoWindowList) {
         $InfoWindows = array();
         foreach ($infoWindowList as $obj) {
             $InfoWindows[] = array('lat' => $obj->lat, 'lng' => $obj->lng, 'info' => $obj->Name . "<br />" . $obj->InfoWindow);
         }
         $InfoWindows = Convert::array2json($InfoWindows);
         // Return a JSON object for GoogleMapConfig.js to use
         return $InfoWindows;
     }
 }
 public function run($request)
 {
     Config::inst()->update('DataObject', 'validation_enabled', false);
     $ct = 0;
     $updateEmail = function ($location) use(&$ct) {
         if (!$location->Email && $location->EmailAddress) {
             $location->Email = $location->EmailAddress;
             $location->write();
             ++$ct;
         }
     };
     Location::get()->each($updateEmail);
     Config::inst()->update('DataObject', 'validation_enabled', true);
     echo '<p>' . $ct . ' Locations updated</p>';
 }
Beispiel #9
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // galleries field
     $locations = function () {
         return Location::get()->map('ID', 'Title');
     };
     $locationField = DropdownField::create('LocationID', 'Location', $locations());
     $locationField->useAddNew('Location', $locations);
     if ($this->LocationID) {
         $locationField->setDescription($this->Location()->getDataAdminEditAnchorTag());
     }
     // add fields to tab
     $fields->addFieldsToTab('Root.Main', array($locationField));
     return $fields;
 }
 public static function getLocations($filter = array(), $exclude = array())
 {
     $filter['ShowInLocator'] = true;
     return Location::get()->exclude($exclude)->exclude('Lat', 0)->filter($filter);
 }
Beispiel #11
0
?>
">Add a location</a></h3>
<?php 
if (isset($_SESSION['formmessage'])) {
    $formmessage = $_SESSION['formmessage'];
    $formmessageclass = $_SESSION['formmessageclass'];
    echo '  <p class="message ' . $formmessageclass . '">' . $formmessage . '</p>';
    include "common/clearsessionmessage.php";
}
$locationcount = count($locations);
if ($locationcount > 0) {
    echo '      <ol class="contentlist">';
    foreach ($locations as $locationrow) {
        $locationid = $locationrow['id'];
        $locationname = $locationrow['name'];
        $location = Location::get($locationid, $userid);
        $entity = $location;
        include "hbardata.php";
        ?>
        <li><?php 
        echo $locationname;
        ?>
          <ul class="list-inline contentlistactionlinks">
            <li><a href="editlocation?id=<?php 
        echo $locationid;
        ?>
">Edit</a></li>
<?php 
        if ($menucount == 0 && $categorycount == 0 && $subcategorycount == 0 && $itemcount == 0 && $dealcount == 0 && $imagecount == 0) {
            ?>
            <li>
 public function getLocationDetails()
 {
     $locations = Location::get();
     $result = View::make('reports.locationslist', ['locations' => $locations]);
     return $result;
 }
Beispiel #13
0
<?php

session_start();
include "header.php";
include "common/sessionuser.inc";
require_once "class/Restaurant.inc";
require_once "class/Location.inc";
require_once "class/Deal.inc";
if (REQMETHOD == 'GET') {
    $locationid = $_GET['l'];
    $location = Location::get($locationid);
    $locationname = $location->getProperty('name');
    $restaurantrow = $location->getRestaurant();
    $restaurantid = $restaurantrow[0]['id'];
    $restaurantname = $restaurantrow[0]['name'];
    $deals = $location->getDeals();
}
?>
    <body>
<?php 
include "topnavbar.php";
include "dealhierarchy.php";
?>
    <div class="container content">
<?php 
include "breadcrumb.php";
?>
      <h1>Deals</h1>
      <h3><a href="adddeal?l=<?php 
echo $locationid;
?>
 public function getLocationDetails()
 {
     $locations = Location::get();
     $result = View::make('reports.locationslist', ['locations' => $locations]);
     return PDF::load($result, 'A4', 'portrait')->download();
 }
 public function add_post()
 {
     try {
         $name = trim($_REQUEST['name']);
         if ($this->getClass('LocationManager')->exists(trim($_REQUEST['name']))) {
             throw new Exception('Location already Exists, please try again.');
         }
         if (!$name) {
             throw new Exception('Please enter a name for this location.');
         }
         if (empty($_REQUEST['storagegroup'])) {
             throw new Exception('Please select the storage group this location relates to.');
         }
         $Location = new Location(array('name' => trim($_REQUEST['name']), 'storageGroupID' => $_REQUEST['storagegroup'], 'storageNodeID' => $_REQUEST['storagenode'], 'tftp' => $_REQUEST['tftp']));
         if ($_REQUEST['storagenode'] && $Location->get('storageGroupID') != $this->getClass('StorageNode', $_REQUEST['storagenode'])->get('storageGroupID')) {
             $Location->set('storageGroupID', $this->getClass('StorageNode', $_REQUEST['storagenode'])->get('storageGroupID'));
         }
         if ($Location->save()) {
             $this->FOGCore->setMessage('Location Added, editing!');
             $this->FOGCore->redirect('?node=location&sub=edit&id=' . $Location->get('id'));
         }
     } catch (Exception $e) {
         $this->FOGCore->setMessage($e->getMessage());
         $this->FOGCore->redirect($this->formAction);
     }
 }
 /**
  * Display a listing of the resource.
  * GET /location
  *
  * @return Response
  */
 public function index()
 {
     $locations = Location::get();
     $CalendarEvent = CalendarEvent::paginate(6);
     return View::make('/home')->with(array('locations' => $locations, 'events' => $CalendarEvent));
 }