Пример #1
0
 public function index($parameters)
 {
     if ($parameters) {
         $this->loadView('404');
     }
     $page = new Page($this->db, $this->business['id']);
     $data = $page->getPageData('homepage');
     if (!$data) {
         $this->loadView('404');
     }
     if (!$data['hero']) {
         $data['hero'] = 'http://placehold.it/1400x600';
     } else {
         $data['hero'] = '/media/' . $this->business['id'] . '/' . $data['hero'];
     }
     if (!$data['tout_1']) {
         $data['tout_1'] = 'http://placehold.it/800x400';
     } else {
         $data['tout_1'] = '/media/' . $this->business['id'] . '/' . $data['tout_1'];
     }
     if (!$data['tout_2']) {
         $data['tout_2'] = 'http://placehold.it/800x400';
     } else {
         $data['tout_2'] = '/media/' . $this->business['id'] . '/' . $data['tout_2'];
     }
     $this->data = $data;
     $this->loadView('home');
 }
Пример #2
0
 /**
  * /contact/
  */
 public function index($parameters)
 {
     if ($parameters) {
         $this->loadView('404');
     }
     $page = new Page($this->db, $this->business['id']);
     $data = $page->getPageData('contact');
     if (!$data) {
         $this->loadView('404');
     }
     if (!$data['title']) {
         $data['title'] = 'Contact Us';
     }
     $location = $page->getLocationAndHours();
     $address = str_replace('<br>', ' ', $location['location']);
     $address = str_replace(' ', '+', $address);
     $url = 'http://maps.google.com/maps/api/geocode/json?address=' . $address . '&sensor=false';
     try {
         $json = file_get_contents($url);
         $json = json_decode($json);
         if (isset($json->{'results'}[0]->{'geometry'}->{'location'})) {
             $coordinates = $json->results[0]->geometry->location;
             $data['coordinates'] = array('latitude' => $coordinates->lat, 'longitude' => $coordinates->lng);
         }
     } catch (Exception $e) {
     }
     $this->data = $data;
     $this->loadView('contact');
 }
 /**
  * Get the data that is loaded on every page.
  *
  * @return array
  */
 private function _fetchPageData()
 {
     $page = new Page($this->db, $this->business['id']);
     $data = array();
     $data['business'] = $this->business;
     $data['navigation_links'] = $page->getNavigationLinks();
     $data['newsletter'] = $page->getNewsletterStatus();
     $data['social_links'] = $page->getSocialLinks();
     $location_and_hours = $page->getLocationAndHours();
     $data['location'] = $location_and_hours['location'];
     $data['hours'] = $location_and_hours['hours'];
     return $data;
 }
Пример #4
0
 /**
  * /about/
  */
 public function index($parameters)
 {
     if ($parameters) {
         $this->loadView('404');
     }
     $page = new Page($this->db, $this->business['id']);
     $data = $page->getPageData('about');
     if (!$data) {
         $this->loadView('404');
     }
     if (!$data['title']) {
         $data['title'] = 'About Us';
     }
     if (!$data['image']) {
         $data['image'] = 'http://placehold.it/800x800';
     } else {
         $data['image'] = '/media/' . $this->business['id'] . '/' . $data['image'];
     }
     if (!$data['copy']) {
         $data['copy'] = 'Lorem ipsum dolor sit amet, consectetur.';
     }
     $this->data = $data;
     $this->loadView('about');
 }