Beispiel #1
0
 /**
  * Render content.
  *
  * @return  string
  */
 public function content()
 {
     ob_start();
     // Stamp
     echo HTML::time(Date('l ', $this->event->stamp_begin) . Date::format('DDMMYYYY', $this->event->stamp_begin), $this->event->stamp_begin, true);
     // Location
     if ($this->event->venue) {
         echo ' @ ', HTML::anchor(Route::model($this->event->venue), HTML::chars($this->event->venue->name)), ', ', HTML::chars($this->event->venue->city_name);
     } elseif ($this->event->venue_name) {
         echo ' @ ', $this->event->venue_url ? HTML::anchor($this->event->venue_url, $this->event->venue_name) : HTML::chars($this->event->venue_name), $this->event->city_name ? ', ' . HTML::chars($this->event->city_name) : '';
     } elseif ($this->event->city_name) {
         echo ' @ ', HTML::chars($this->event->city_name);
     }
     // Flyer
     if ($flyer = $this->event->flyer()) {
         echo '<figure>', HTML::image($flyer->image_url(Model_Image::SIZE_THUMBNAIL)), '</figure>';
     } elseif ($this->event->flyer_front_url) {
         echo '<figure>', HTML::image($this->event->flyer_front_url, ['class' => 'img-responsive']), '</figure>';
     }
     // Favorites
     if ($this->event->favorite_count) {
         echo '<span class="stats"><i class="fa fa-heart"></i> ' . $this->event->favorite_count . '</span>';
     }
     return ob_get_clean();
 }
Beispiel #2
0
 /**
  * Get side image.
  *
  * @param   Model_Event  $event
  * @return  View_Generic_SideImage
  */
 protected function section_event_image(Model_Event $event)
 {
     // Display front flyer by default
     if (($flyer = $event->flyer()) && $event->flyer()->image()) {
         $image = $flyer->image();
         $link = Route::model($flyer);
     } else {
         $image = null;
         $link = null;
     }
     return new View_Generic_SideImage($image, $link);
 }
Beispiel #3
0
Datei: day.php Projekt: anqh/anqh
 /**
  * Render flyer.
  *
  * @return  string
  */
 public function flyer()
 {
     $icon = ($flyer = $this->event->flyer()) ? $flyer->image_url(Model_Image::SIZE_THUMBNAIL) : $this->event->flyer_front_url;
     return HTML::anchor(Route::model($this->event), $icon ? HTML::image($icon, array('alt' => __('Flyer'))) : '<i class="fa fa-calendar"></i>');
 }
Beispiel #4
0
Datei: api.php Projekt: anqh/anqh
 /**
  * Prepare event for data array
  *
  * @param   Model_Event  $event
  * @param   array        $fields
  * @return  array
  */
 protected function _prepare_event(Model_Event $event, array $fields = null)
 {
     $data = array();
     empty($fields) and $fields = self::$_fields;
     foreach ($fields as $field) {
         switch ($field) {
             // Raw value
             case 'age':
             case 'created':
             case 'favorite_count':
             case 'flyer_id':
             case 'dj':
             case 'id':
             case 'info':
             case 'modified':
             case 'name':
             case 'price':
             case 'price2':
             case 'stamp_begin':
             case 'stamp_end':
             case 'venue_id':
                 $data[$field] = $event->{$field};
                 break;
                 // Custom value
             // Custom value
             case 'venue':
                 $data[$field] = ($venue = $event->venue()) ? $venue->name : $event->venue_name;
                 break;
             case 'city':
                 $data[$field] = ($venue = $event->venue()) ? $venue->city_name : $event->city_name;
                 break;
             case 'flyer':
             case 'flyer_icon':
             case 'flyer_thumb':
                 if ($field === 'flyer_icon') {
                     $size = Model_Image::SIZE_ICON;
                 } else {
                     if ($field === 'flyer__thumb') {
                         $size = Model_Image::SIZE_THUMBNAIL;
                     } else {
                         $size = null;
                     }
                 }
                 $data[$field] = ($flyer = $event->flyer()) ? $flyer->image_url($size) : null;
                 break;
             case 'music':
                 if ($tags = $event->tags()) {
                     $music = implode(', ', $tags);
                 } else {
                     if (!empty($event->music)) {
                         $music = $event->music;
                     } else {
                         $music = null;
                     }
                 }
                 $data[$field] = $music;
                 break;
             case 'url':
                 $data[$field] = URL::site(Route::model($event), true);
                 break;
         }
     }
     return $data;
 }