public function deleteFeaturedEvent($id) { $this->tx_manager->transaction(function () use($id) { FeaturedEvent::delete_by_id('FeaturedEvent', $id); }); }
public function getFeaturedEvents() { $offset = $this->request->getVar('offset'); try { $featured_events = FeaturedEvent::get('FeaturedEvent')->leftJoin('EventPage', 'EventPage.ID = FeaturedEvent.EventID')->sort('EventPage.EventStartDate'); $featured_result = array(); foreach ($featured_events->limit(8, $offset) as $featured) { $featured_result[] = array('title' => $featured->Event()->Title, 'location' => $featured->Event()->Location, 'date' => $featured->Event()->formatDateRange(), 'image' => $featured->Picture()->CroppedImage(200, 100)->getTag()); } return $this->ok($featured_result); } catch (Exception $ex) { SS_Log::log($ex, SS_Log::ERR); return $this->serverError(); } }
public function getFeaturedEvents() { return FeaturedEvent::get('FeaturedEvent'); }
public function getFeaturedEvents() { return FeaturedEvent::get('FeaturedEvent')->leftJoin('EventPage', 'EventPage.ID = FeaturedEvent.EventID')->sort('EventPage.EventStartDate'); }