All pastes #2077955 Raw Edit

Anonymous

public php v1 · immutable
#2077955 ·published 2011-08-24 00:44 UTC
rendered paste body
<?phpclass EventsController extends AppController{	var $uses = array('Event', 'Review', 'Venue', 'Genre', 'Profession', 'User', 'Promoter', 'Region','Photo','Geocode');	var $components = array('Thumbnail', 'Email', 'Session','RequestHandler');	var $helpers = array('Html', 'Form', 'Pic');	var $paginate = array(		'conditions' => array('Event.status' => 1),		'limit' => 14, 'page' => 1, 'order' => 'Event.weekly ASC, Event.start ASC',		'fields' => array('Event.id', 'Event.name', 'Genre.name', 'Venue.name', 'Region.name', 'Event.weekly', 'Event.start', 'Event.disabled'));		function add()	{		if(!$this->isLoggedin())		{		$this->Session->setFlash('Please log in first to add Event. Thanks!');		$this->redirect('../../users/login');		}				$month = date("m"); 		$year = date("Y");				if ($this->User->isPromoter($this->getLoggedUserId())) {            $this->set('promoterLogged', true);        } else {            $this->set('promoterLogged', false);        }   						if (! empty($this->data))		{			/* if the user isnt a promoter, make them a promoter */			if (!$this->User->isPromoter($this->getLoggedUserId())) {				 if(! empty($this->params['form']['promoter_name'])) {				 	$promoter_name = $this->params['form']['promoter_name'];				 }				                 $this->Profession->addToUser($this->getLoggedUserId(), 1, $promoter_name);			}						$this->data['Event']['user_id'] = $this->getLoggedUserId();						if ($this->params['data']['Event']['weekly'] == '0') {			list($d, $m, $y) = explode('/', $this->params['data']['Event']['start_date']);			$start = "{$y}-{$m}-{$d} {$this->params['data']['Event']['start_hour']}:{$this->params['data']['Event']['start_minute']}:00";			} else {				$start = '0000-00-00 18:'.$this->params['data']['Event']['start_minute'].':00';			}						$duplicate = $this->Event->find('first',array('conditions'=>array('Event.start'=>$start,			'Event.weeks'=>$this->params['data']['Event']['weeks'],'Event.venue_id'=>$this->params['data']['Event']['venue_id'])));						if(isset($duplicate['Event']['id'])){			$this->Session->setFlash('Another event already exists at the same time at the same venue. Contact oshi@guestlist.net.');				$this->redirect('/events/add');			}						$tempFileName = $this->params['form']['pic']['tmp_name'];			if (is_uploaded_file($tempFileName)) {						}else{				$this->Session->setFlash('Please upload the main picture to go with the event. Thanks.');				$this->redirect('/events/add');				}		if ($this->Event->save($this->data))			{				if (! empty($this->params['form']['ps'])) {					$promoters = $this->params['form']['ps'];					foreach ($promoters as $p) {						$this->Promoter->addToEvent($this->Event->id, $p);					}				}				$tempFileName = $this->params['form']['pic']['tmp_name'];				if (is_uploaded_file($tempFileName)) {					$ocFileName = WWW_ROOT.'files'.DS.'events'.DS.$this->Event->id.'_1.jpg';					$uploaded = move_uploaded_file($tempFileName, $ocFileName);					if ($uploaded) {						$this->Thumbnail->generateThumbnail($ocFileName, 'thumb', 100, 100);						$this->Thumbnail->generateThumbnail($ocFileName, 'small', 600, 375);					}				}else{				$this->Session->setFlash('Please upload the main picture to go with the event. Thanks.');				$this->redirect('/events/add');				}				$tempFileName = $this->params['form']['pic2']['tmp_name'];				if (is_uploaded_file($tempFileName)) {					$is = getimagesize($tempFileName);					$mime = explode('/', $is['mime']);					$ocFileName = WWW_ROOT.'files'.DS.'events'.DS.$this->Event->id.'_2.jpg';					$uploaded = move_uploaded_file($tempFileName, $ocFileName);					if ($uploaded) {						$this->Thumbnail->generateThumbnail($ocFileName, 'thumb', 100, 100);						$this->Thumbnail->generateThumbnail($ocFileName, 'small', 600, 375);					}				}							$promoter =	$this->User->find('all',array('fields'=>array('User.id','User.firstname','User.surname','User.nickname'),							'conditions'=>array('User.id'=>$this->getLoggedUserId())));					//Send an email alert			$this->Email->from    = 'Event <addevent@guestlist.net>';			$this->Email->to      = 'Oshi <oshi@guestlist.net>';			$this->Email->subject = ''.$this->data['Event']['name'].' event added by '.$promoter[0]['User']['firstname'].' '.$promoter[0]['User']['surname'].'!';			$mail = "Comments: \n\n".$this->data['Event']['comment']."\n\n";			$mail .= 'To see the details follow the link: <a href="www.guestlist.net/events/view/'.$this->findLatestId().'">The Guestlist Network</a>';			$mail .= "\n\nThanks!";			$this->Email->send($mail);							$this->Session->setFlash('Event added!');				$this->redirect('/');			}		}						$this->set('venues', $this->Venue->find('all', array('order' => 'Venue.name')));		$this->set('genres', $this->Genre->find('all'));		$this->set('regions', $this->Region->find('all'));		$this->set('promoters', $this->Promoter->getAllPromoters());		$users = $this->User->find('all',array('fields'=>array('User.id','User.firstname','User.surname','User.nickname')));		$this->set('users', $users);	}	function findLatestId()	{		$lastEvent = $this->Event->find('first',array('order' => 'Event.id DESC'));		return $lastEvent['Event']['id'];	}	function edit($id = null)	{		//check promoter		$originalpromoters = $this->Promoter->getEventPromoters($id);		if ($this->isLoggedin()) {			foreach ($originalpromoters as $p) {				if ($p['idUser'] == $this->getLoggedUserId()) {					$promoter = true;					break;				}			}		}		if (! isset($promoter) && ! $this->isLoggedAdmin()) {			$this->redirect('/');		}						if (! empty($this->data)) {			if (! isset($this->data['Event']['id']) && ! is_null($id)) {				$this->data['Event']['id'] = $id;			}			if ($this->Event->save($this->data)) {				if (! empty($this->params['form']['ps'])) {					$promoters = $this->params['form']['ps'];					foreach ($promoters as $p) {						foreach ($originalpromoters as $op) {							if ($op['idUser'] == $p)								continue;							$this->Promoter->addToEvent($this->Event->id, $p);						}					}				}				$tempFileName = $this->params['form']['pic']['tmp_name'];				if (is_uploaded_file($tempFileName)) {										$ocFileName = WWW_ROOT.'files'.DS.'events'.DS.$this->Event->id.'_1.jpg';					$uploaded = move_uploaded_file($tempFileName, $ocFileName);					if ($uploaded) {						$this->Thumbnail->generateThumbnail($ocFileName, 'thumb', 100, 100);					}				}				$tempFileName = $this->params['form']['pic2']['tmp_name'];				if (is_uploaded_file($tempFileName)) {					$is = getimagesize($tempFileName);					$mime = explode('/', $is['mime']);					$ocFileName = WWW_ROOT.'files'.DS.'events'.DS.$this->Event->id.'_2.jpg';					$uploaded = move_uploaded_file($tempFileName, $ocFileName);					if ($uploaded) {						$this->Thumbnail->generateThumbnail($ocFileName, 'thumb', 100, 100);					}				}				$this->Session->setFlash('Event modified!');				$this->redirect('/events/view/'.$this->data['Event']['id']);			}		} else {			$this->data = $this->Event->read(null, $id);		}		$this->set('venues', $this->Venue->find('all', array('order' => 'Venue.name')));		$this->set('genres', $this->Genre->find('all'));		$this->set('regions', $this->Region->find('all', array('conditions' => array('Region.id = 1 OR Region.id = 3'))));		$this->set('promoters', $this->Promoter->getAllPromoters());	}		function indexrss()	{		$conditions=array('Event.disabled'=>0);		$this->set('events',$this->Event->find('all', array('conditions' => $conditions, 'recursive'=>1, 'limit'=>20, 'order' => 'start DESC')));	}	function index($month=null,$year=null)	{		$city=$this->Session->read('city');			if(!($city==1||$city==2)) { $city=1; }		$conditions=array('Event.disabled'=>0,'Event.region_id'=>$city);		$events=$this->Event->find('all', array('fields' => array('Event.id','Event.name','Event.region_id','Region.id','Region.name'), 'conditions' => $conditions, 'recursive'=>1));						if ($this->isLoggedin() && $this->User->isPromoter($this->getLoggedUserId())) {			$this->set('promoterLogged', true);		}				//vendors('calendar');		require_once('app/vendors/calendar.php');		$calendar = new Calendar();		$this->set('calendar', $calendar->output_calendar($year,$month));				$this->set('venues', $this->Venue->find('all', array('order' => 'Venue.name')));		$this->set('genres', $this->Genre->find('all'));		$this->set('regions', $this->Region->find('all'));		$this->set('promoters', $this->Promoter->getAllPromoters());		$this->set('specialEvents', $this->loadAllSpecialEvents());		$this->set('events', $events);				}	function ajaxlist($search = null)	{	$city=$this->Session->read('city');		if(!($city==1||$city==2)) { $city=1; }		$conditions=array('Event.disabled'=>0,'Event.region_id'=>$city);		$events=$this->Event->find('all', array('fields' => array('Event.id','Event.name','Event.region_id','Region.id','Region.name'), 'conditions' => $conditions, 'recursive'=>1));				if (! is_null($search))		{			$searches = explode('|', $search);			foreach ($searches as $s)			{				list($q, $a) = explode('=', $s);				switch ($q) {					case 'gids':						$conditions[] = "Event.genre_id IN ({$a})";						break;					case 'date':						switch ($a) {							case 'today':								$conditions[] = array('or' => array('DATE(Event.start) = CURDATE()', 'Event.weekly = '.date('N')));								break;							case 'thisweek':								$conditions[] = array('or' => array('Event.weekly >= '.date('N'),										'YEAR(Event.start) = YEAR(NOW()) AND WEEKOFYEAR(Event.start) = WEEKOFYEAR(NOW())'));								break;							case 'nextweek':								//TODO: have to fix it before end of december!								$conditions[] = array('or' => array('Event.weekly > 0',										'YEAR(Event.start) = YEAR(NOW()) AND WEEKOFYEAR(Event.start) = (WEEKOFYEAR(NOW())+1)'));								break;							default:								if(!empty($a) && is_numeric($a)) {									$a = $a-1;									$conditions[] = array('or' =>														array(																'DATE(Event.start) = DATE(FROM_UNIXTIME('.($a).'))', 																'Event.weekly = '.date('N',$a),															)													);								}								break;														}						break;				}			}		}else{ $conditions[] = array('or' => array('DATE(Event.start) = CURDATE()', 'Event.weekly = '.date('N'))); }		$this->set('events', $this->paginate('Event', $conditions));		$this->render('ajaxlist', 'ajax');	}	function ajaxsoon($day, $idGenre)	{		$daytmp = $day - (int)date('N');		if ($daytmp < 0) {			$daytmp += 7;		}		$eventTime = mktime(0, 0, 0, date('m'), date('d') + $daytmp, date('Y'));		/*$nextDayTime = mktime(0, 0, 0, date('m'), date('d') + $daytmp + 1, date('Y'));		$conditions = array(			'Event.status' => 1,			'Event.genre_id' => $idGenre,			'or' => array(				'and' => array(					'DATE(Event.start) >= \''.date('Y-m-d', $eventTime).'\'',					'Date(Event.end) < \''.date('Y-m-d', $nextDayTime).'\''),				'Event.weekly' => $day)		);*/		$city=$this->Session->read('city');					$conditions = array(			'Event.status' => 1, 'Event.disabled' => 0, 'Event.region_id'=>$city,			'Event.genre_id' => $idGenre,			'or' => array(				'DATE(Event.start) = \''.date('Y-m-d', $eventTime).'\'',				'Event.weekly' => $day)		);				$events = $this->Event->find('all', array(			'fields' => array('Event.id', 'Event.name'),			'conditions' => $conditions,			'recursive' => -1,			'limit' => 10));									$this->set('events', $events);		$this->render('ajaxsoon', 'ajax');	}	function view($id = null)	{		if ($this->isLoggedin())		{			$this->set('logged',1);		}		else		{			$this->set('logged',0);		}				if($this->isLoggedAdmin())		$this->set('admin',true);		else		$this->set('admin',false);		$conditions[]=array('Event.disabled'=>0);		$events=$this->Event->find('all', array('fields' => array('Event.id','Event.name'), 'conditions' => $conditions));					$this->set('events', $events);		$this->set('user_id', $this->getLoggedUserId());				$albums = $this->requestAction('/photos/getAlbums/1/'.$id.'');		$this->set('albums',$albums);					$this->set('userItem', $this->User->find('first',array('conditions'=>array('User.id'=>$this->getLoggedUserId()), 'fields'=>array('User.id',		'User.firstname','User.surname','User.email','User.mobile'))));				$conds[]=array('Review.item_id'=>$id,'Review.review_type'=>1);		$reviews=$this->Review->find('all', array('conditions' => $conds));			$this->set('reviews', $reviews);				if (! is_null($id)) {					$event = $this->Event->read(null, $id);			//here is the views counter updated			$this->Event->save(array('views' => $event['Event']['views'] + 1));						$this->set('metatags', '<meta property="og:title" content="'.$event['Event']['name'].'"/><meta property="og:type" content="website"/>			<meta property="og:url" content="http://www.guestlist.net/events/view/'.$event['Event']['id'].'"/>			<meta property="og:site_name" content="guestlist.net"/>			<meta property="og:image" content="http://www.guestlist.net/files/events/'.$event['Event']['id'].'_1_small.jpg"/>');						$this->set('htmlTitle', $event['Event']['name']);				$event['Promoters'] = $this->Promoter->getEventPromoters($id);			$this->set('event', $event);			if ($this->isLoggedin()) {				foreach ($event['Promoters'] as $p) {					if ($p['idUser'] == $this->getLoggedUserId()) {						$this->set('promoterLogged', true);						break;					}				}			}		} else {			$this->Session->setFlash('Invalid event!', 'default', array(), 'error');			$this->redirect('/');		}	}	function del($idEvent,$redir=".")	{		if ($this->isLoggedAdmin())		{			$this->Event->delete($idEvent, false);			//TODO: delete pictures and check cascade!			$this->Session->setFlash('Event deleted!');			$this->redirect($redir);		}	}		function download()	{				$toDownload = $this->data;				$this->set('nextMonth',0);				$conditions = array();		$conditions_weekly = array();				if($toDownload['Event']['nextMonth']==0)		{					if($toDownload['Event']['region_id']!=0)			{				$conditions[]=array('Event.region_id'=>$toDownload['Event']['region_id']);						}			if($toDownload['Event']['genre_id']!=0)			{				$conditions[]=array('Event.genre_id'=>$toDownload['Event']['genre_id']);					}				if($toDownload['Event']['venue_id']!=0)			{				$conditions[]=array('Event.venue_id'=>$toDownload['Event']['venue_id']);						}			if($toDownload['Event']['disabled']==0){			$conditions[]=array('Event.disabled'=>0);			}			$conditions_weekly = $conditions;									$year=substr($toDownload['Event']['start_date'],6,4);			$month=substr($toDownload['Event']['start_date'],3,2);			$day=substr($toDownload['Event']['start_date'],0,2);						$startDate = $year.'-'.$month.'-'.$day.' '.$toDownload['Event']['start_hour'].':'.$toDownload['Event']['start_minute'].':00';						$year=substr($toDownload['Event']['end_date'],6,4);			$month=substr($toDownload['Event']['end_date'],3,2);			$day=substr($toDownload['Event']['end_date'],0,2);						$endDate = $year.'-'.$month.'-'.$day.' '.$toDownload['Event']['end_hour'].':'.$toDownload['Event']['end_minute'].':00';			$conditions[]=array('Event.start >='=>$startDate,'Event.end <='=>$endDate);			$conditions_weekly[]=array('Event.weekly >='=>1);						$results=$this->Event->find('all', array('conditions' =>$conditions ));			$results_weekly=$this->Event->find('all', array('conditions' =>$conditions_weekly ));					$this->set('events', $results);			$this->set('events_weekly', $results_weekly);						$download=array_merge($results,$results_weekly);						$this->processDownload($download);			$this->processDownloadCsv(0);		}	else					{ 			$year = date("Y");			$month = date("m");  			$startDay = '01';			$endDay = '31';						$startDate = $year.'-'.$month.'-'.$startDay.' '.'00:00:00';			$endDate = $year.'-'.$month.'-'.$endDay.' '.'23:59:59';						$conditions[]=array('Event.start >='=>$startDate,'Event.end <='=>$endDate);			if($toDownload['Event']['disabled']==0){			$conditions[]=array('Event.disabled'=>0,'Event.start >='=>$startDate,'Event.end <='=>$endDate);			$conditions_weekly[]=array('Event.weekly >='=>1,'Event.disabled'=>0);			}			else			{			$conditions[]=array('Event.start >='=>$startDate,'Event.end <='=>$endDate);			$conditions_weekly[]=array('Event.weekly >='=>1);			}						$this->set('nextMonth',1);									$results=$this->Event->find('all', array('conditions' =>$conditions ));			$results_weekly=$this->Event->find('all', array('conditions' =>$conditions_weekly ));						$this->set('events', $results);			$this->set('events_weekly', $results_weekly);						$download=array_merge($results,$results_weekly);			$this->processDownload($download);			$this->processDownloadCsv(1);							}		   				}			function disableOld()	{		$month = date("m");  		$year = date("Y");		$day = date("d");						$startDate = '0000-00-00 00:00:00';		$endDate = $year.'-'.$month.'-'.$day.' '.'05:00:00';				//$conditions[]=array('Event.start >='=>$startDate,'Event.end <='=>$endDate,'Event.weekly'=>0);			$conditions[]=array('or' => array(array('Event.start >='=>$startDate,'Event.end <='=>$endDate,'Event.weekly'=>0),	array('Event.weekly >='=>1,'Event.id <='=>1000)));				$this->Event->updateAll(array('Event.disabled'=>1), $conditions);	    			$this->Session->setFlash('Old events disabled!');		$this->redirect('.'); 	}	    		function processDownload($download)	{			$path = "../webroot/files/events/";		 	$zip = new ZipArchive();			$opened = $zip->open( 'files/events.zip', ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE );	if( $opened != true ){	die("cannot open events.zip for writing.");	}			foreach ($download as $id)	{		$erase = array("?","//","|","\"");			if(file_exists($path.$id['Event']['id']."_1.jpg"))		{		copy($path.$id['Event']['id']."_1.jpg", str_replace($erase,"",$path."extended/".str_replace("/","",substr($id['Event']['created'],0,10).$id['Event']['name'].$id['Venue']['name'].substr($id['Event']['start'],0,10)))."_1.jpg");		$zip->addFile(str_replace($erase,"",$path."extended/".str_replace("/","",substr($id['Event']['created'],0,10).$id['Event']['name'].$id['Venue']['name'].substr($id['Event']['start'],0,10)))."_1.jpg");		}		if(file_exists($path.$id['Event']['id']."_2.jpg"))		{		copy($path.$id['Event']['id']."_2.jpg", str_replace($erase,"",$path."extended/".str_replace("/","",substr($id['Event']['created'],0,10).$id['Event']['name'].$id['Venue']['name'].substr($id['Event']['start'],0,10)))."_2.jpg");		$zip->addFile(str_replace($erase,"",$path."extended/".substr($id['Event']['created'],0,10).str_replace("/","",$id['Event']['name'].$id['Venue']['name'].substr($id['Event']['start'],0,10)))."_2.jpg");		}	}			// close and save archive	$zip->close();					}		function downzip () {	     $this->view = 'Media';		                   $params = array(              'id' => 'events.zip',              'name' => 'events',              'download' => true,              'extension' => 'zip',              'path' => APP . 'webroot' . DS . 'files' . DS       );       $this->set($params);    }    	function processDownloadCsv($custom)	{				$path = "../webroot/files/";        $zip = new ZipArchive();			$opened = $zip->open( 'files/csv.zip', ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE );	if( $opened != true ){	die("cannot open csv.zip for writing.");	}		if($custom==1)	{		if(file_exists($path."Bashment.csv"))	$zip->addFile($path."Bashment.csv");		if(file_exists($path."Bashment_weekly.csv"))	$zip->addFile($path."Bashment_weekly.csv");			if(file_exists($path."Drum.csv"))	$zip->addFile($path."Drum.csv");			if(file_exists($path."Drum_weekly.csv"))	$zip->addFile($path."Drum_weekly.csv");		if(file_exists($path."Dubstep.csv"))	$zip->addFile($path."Dubstep.csv");		if(file_exists($path."Dumstep_weekly.csv"))	$zip->addFile($path."Dumstep_weekly.csv");		if(file_exists($path."House.csv"))	$zip->addFile($path."House.csv");		if(file_exists($path."House_weekly.csv"))	$zip->addFile($path."House_weekly.csv");		if(file_exists($path."RB.csv"))	$zip->addFile($path."RB.csv");		if(file_exists($path."RB_weekly.csv"))	$zip->addFile($path."RB_weekly.csv");		if(file_exists($path."Other.csv"))	$zip->addFile($path."Other.csv");		if(file_exists($path."Other_weekly.csv"))	$zip->addFile($path."Other_weekly.csv");		}	else	{		if(file_exists($path."customEvents.csv"))		$zip->addFile($path."customEvents.csv");				if(file_exists($path."customEvents_weekly.csv"))		$zip->addFile($path."customEvents_weekly.csv");	}	 	// close and save archive	// close and save archive	$zip->close();			}		function downCsv () {	    $this->view = 'Media';		                   $params = array(              'id' => 'Events.csv',              'name' => 'Events',              'download' => true,              'extension' => 'csv',              'path' => APP . 'webroot' . DS . 'files' . DS       );       $this->set($params);    }	   function disable($id,$redir=".")	{	  		$this->Event->updateAll(	    array('Event.disabled' => 1),	    array('Event.id' => $id)	);	    $this->Session->setFlash('Event disabled!');			$this->redirect($redir);		}		function enable($id,$redir=".")	{	  		$this->Event->updateAll(	    array('Event.disabled' => 0),	    array('Event.id' => $id)	);	    $this->Session->setFlash('Event enabled!');			$this->redirect($redir);			}		function special()	{ 	      	$this->Event->updateAll(	    array('Event.special' =>$this->data['Event']['special']),	    array('Event.id' => $this->data['Event']['id'])			);	    $this->Session->setFlash('Status changed!');			$this->redirect('.');			}		function loadSpecialEvents()	{		$month = date("m");  		$year = date("Y");		$startDay = date("d");		$endDay =  date("d" + 7);				$endDay = mktime(0,0,0,date("m"),date("d")+7,date("Y"));		$endDay=str_replace('/','-',date("Y/m/d", $endDay));		$endDate=$endDay.' '.'23:59:59';						$startDate = $year.'-'.$month.'-'.$startDay.' '.'00:00:00';					$specialsDisplayed = $this->getSpecialEvents();			$conditions = array('Event.special'=>$specialsDisplayed, 'Event.disabled'=>0);			/*	$conditions = array(			'Event.status' => 1, 'Event.disabled' => 0,			'Event.start >='=>$startDate,			'Event.end <='=>$endDate,			'or' => array(				'Event.weekly <='=>7, 'Event.weekly >='=>0,'Event.disabled' => 0)			);									*/				$events = $this->Event->find('all', array(			'fields' => array('Event.id', 'Event.name'),			'conditions' => $conditions,			'recursive' => -1));;				return $events;			}		function loadAllSpecialEvents()	{			$conditions = array('Event.special >='=>1);				$events = $this->Event->find('all', array(			'conditions' => $conditions,			'recursive' => 1));;				return $events;			}		function setSpecialEvents ()	{					$myFile = "specialEvents.txt";		$fh = fopen($myFile, 'w') or die("can't open file");				fwrite($fh, $this->data['Event']['special']);			fclose($fh);		$this->redirect('.');		}	function getSpecialEvents ()	{					$myFile = "specialEvents.txt";		$fh = fopen($myFile, 'r') or die("can't open file");				$theData = fread($fh, 1);		fclose($fh);		return $theData;		}		function goFree($id)	{		$this->Event->updateAll(array('Event.gofree'=>1),array('Event.id'=>$id));		$this->redirect('../../events/view/'.$id.'');	}		function setCity()	{		$this->Session->write('city', $this->params['form']['city']);		$this->redirect($this->params['form']['where']);	}		function location()	{				$this->set('events', $this->Event->find('all', array(				'conditions' => array(									'disabled'=>0,					'(start > NOW() OR weekly > 0)'),				'fields' => array(				'Event.id','Event.venue_id','Event.name','Event.start','Event.weekly','Event.weeks','Event.price','Venue.name','Venue.latitude','Venue.longitude','Venue.id'),				'order' => 'start ASC, weekly DESC', 'recursive' => 1)));						if(!empty($this->data) && !empty($this->data['Geocode']['s']))          {              $location = $this->Geocode->find($this->data['Geocode']['s']);              $this->set(compact('location'));          }	}	}?>