/** * Returns a list of events to be used in left / right rails of different pages. * * @param int $market_id * @param bool $refreshed - prevents infinite loop if the function had to be called again . * @return Array - list of object with url, and title * * @todo : add a check that it's not a barcrawl */ function getLeftRailEvents($query, $refresh = false) { global $cache_refresh; $cache_key = 'cache::leftrail:market'; foreach ($query as $key => $value) { $cache_key .= '::' . $key . ':' . $value; } $cache_name = $cache_key; if (!$cache_refresh && !$refresh) { $left_events = \mem($cache_name); } if (!$left_events) { $left_events = []; $left_eventIds = \Crave\Model\ct_event::getList($query); foreach ($left_eventIds as $id) { $obj = new stdClass(); $e = new \Crave\Api\Event(['id' => $id, 'no_tickets' => true]); $obj->url = parseEventUrl($e); $obj->title = $e->is->bc ? $e->event_name : $e->where->name; $left_events[] = $obj; } \mem($cache_name, $left_events, $event_cache_duration); } else { if (!$refresh && !is_array($left_events)) { // there has been a problem with the cached data . // calling the function again while refreshing the cache return getLeftRailEvents($query, true); } } return $left_events; }
'crop' => 'center', 'limit' => 1 ); $key = 'cache:newyears.com:event-uri:'.$this->uri; unset ($event); //$event = \mem($key); if(!$event){ // the usage of ide is to prevent the need to handle querystring. $a = unParseEventUrl($p->urlpath.'/'.$p->ide); $eventIds = \Crave\Model\ct_event::getList($a); if(count($eventIds) == 0 ){ // event not found , need to send the user to an error page . echo("<h1>EVENT NOT FOUND</h1>"); die(); } $event = new \Crave\Api\Event($eventIds[0]); $desc_arr = []; $desc = $event->getDescription([ 'website_ide' => $this->website_ide