<?php
class ContactsController extends AppController{
var $helpers = array('Form', 'Html', 'Text','Javascript', 'Time', 'Number', 'Session', 'Paginator', 'Ajax', 'Cache');
	
		//Use the functions defined in the following models just in case you need them.
	    var $uses=array('Contact');
		var $name = 'Contacts';
		var $components = array('Session');

	    function index(){	
		$this->paginate['limit'] = 50;
		$this->paginate['order'] = array('id' => 'desc');
		$this->set('listitem', $this->paginate('Contact'));
		  }
	////////////////////////////////////////////////////////////////////////////////////
 	function userViewMore(){
		$id=$this->params['url']['id'];
		$feedback=$this->Contact->getSpecificInfo($id);//print_r($feedback);exit;
		$this->set('page_info',$this->Contact->getSpecificInfo($id));
		}
	
	function userDelete(){
		$id = $this->params['url']['id'];
		$this->Contact->delete($id);		
		$goTo = '/contacts/index';		
		$this->redirect($goTo);
	}
	
	
	function replyMessage(){
	$id = $this->params['url']['id'];	
	$this->set('tothisperson', $this->Contact->find('all', array('conditions' => array('id' => $id))));	
	}
	
 	function sendreply(){
		 	if (!empty($this->data)){
			$from = 'info@alphaafrique.com';
    		$to = $this->data['Contact']['email_address'];
    		$message = $this->data['Contact']['message'];
			$this->Email->from    = $from;
			$this->Email->to      = $to;
			$this->Email->subject = 'Your Reply from Alpha Afrique';
			$this->Email->send($message);
			$goTo = '/feedbacks/index';		
			$this->redirect($goTo);
		 	}
		}
 }
?>