Ejemplo n.º 1
0
 public function weekly($attributes)
 {
     $locations_repo = $this->entity_manager->getRepository('Hoo\\Model\\Location');
     if (isset($attributes['location'])) {
         $location = Location::get_location_by_id_or_shortname($attributes['location'], $this->entity_manager);
         if ($location) {
             $locations = array($location);
         } else {
             return 'Invalid Location';
         }
     } else {
         $locations = $locations_repo->findBy(array('is_visible' => true));
     }
     $view = new View('shortcode/weekly');
     $locations_hours = array();
     foreach ($locations as $location) {
         $locations_hours[] = array('location' => $location, 'hours' => $location->get_weekly_hours());
     }
     return $view->fetch(array('header' => $attributes['header'], 'locations' => $locations_hours));
 }