Exemple #1
0
 /**
  * Render flyer.
  *
  * @return  string
  */
 public function flyer()
 {
     if ($image = $this->event->flyer_front()) {
         $icon = $image->get_url($image::SIZE_ICON);
     } elseif ($image = $this->event->flyer_back()) {
         $icon = $image->get_url($image::SIZE_ICON);
     } elseif (count($flyers = $this->event->flyers())) {
         $image = $flyers[0]->image();
         $icon = $image->get_url($image::SIZE_ICON);
     } else {
         $icon = null;
     }
     return $icon ? HTML::anchor(Route::model($this->event), HTML::image($icon, array('alt' => __('Flyer'))), array('class' => 'avatar')) : '<div class="avatar empty"><i class="icon-picture"></i></div>';
 }
Exemple #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 ($image = $event->flyer_front()) {
         $flyer = Model_Flyer::factory()->find_by_image($image->id);
         $link = Route::model($flyer);
     } else {
         if ($image = $event->flyer_back()) {
             $flyer = Model_Flyer::factory()->find_by_image($image->id);
             $link = Route::model($flyer);
         } else {
             if (count($flyers = $event->flyers())) {
                 $flyer = $flyers[0];
                 $image = $flyer->image();
                 $link = Route::model($flyer);
             } else {
                 $image = null;
                 $link = null;
             }
         }
     }
     return new View_Generic_SideImage($image, $link);
 }
Exemple #3
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 ($image = $event->flyer_front()) {
         $flyer = Model_Flyer::factory()->find_by_image($image->id);
         $link = Route::model($flyer);
     } else {
         if ($image = $event->flyer_back()) {
             $flyer = Model_Flyer::factory()->find_by_image($image->id);
             $link = Route::model($flyer);
         } else {
             if (count($flyers = $event->flyers())) {
                 $flyer = $flyers[0];
                 $image = $flyer->image();
                 $link = Route::model($flyer);
             } else {
                 $image = null;
                 $link = null;
             }
         }
     }
     if (Permission::has($event, Model_User::PERMISSION_UPDATE, self::$user)) {
         $uri = Route::model($event, 'image');
         $actions = array();
         $actions[] = HTML::anchor($uri, '<i class="icon-plus-sign icon-white"></i> ' . __('Add flyer'), array('class' => 'btn btn-small btn-primary image-add ajaxify'));
         if ($image) {
             $actions[] = HTML::anchor($uri . '?token=' . Security::csrf() . '&front=' . $image->id, __('As front'), array('class' => 'btn btn-small btn-inverse image-change' . ($event->flyer_front_image_id == $image->id ? ' disabled' : ''), 'data-change' => 'front'));
             $actions[] = HTML::anchor($uri . '?token=' . Security::csrf() . '&back=' . $image->id, __('As back'), array('class' => 'btn btn-small btn-inverse image-change' . ($event->flyer_back_image_id == $image->id ? ' disabled' : ''), 'data-change' => 'back'));
             $actions[] = HTML::anchor($uri . '?token=' . Security::csrf() . '&delete=' . $image->id, '<i class="icon-trash"></i> ' . __('Delete'), array('class' => 'btn btn-small btn-inverse image-delete'));
         }
     } else {
         $actions = null;
     }
     $section = new View_Generic_SideImage($image, $link);
     $section->actions = $actions;
     return $section;
 }