<?php
add_action( 'emuP_Contact_finished', 'addToGoogleDocs', 1, 2 );
function addToGoogleDocs($args, $log)
{
	global $emuGDocs;
	$form_id = post_val('e-action');

	switch($form_id)
	{
		case 'contact-form':

			$spreadsheet_name = 'DDS Contacts';
			$spreadsheet_sheet = 'Sheet1';
			$new_entry['firstname'] = post_val('firstName');
			$new_entry['lastname'] = post_val('lastName');
			$new_entry['email'] = post_val('email_address');
			$new_entry['phone'] = post_val('phone');
			$new_entry['referral'] = post_val('referral');
			
			$new_entry['comments'] = post_val('comments');
			$new_entry['frompage'] = post_val('frompage');
			$new_entry['date'] = dateReformat(time(), $format = "F j, Y");//"F j, Y, g:i a"
			$new_entry['notes'] = '';

			break;

		default:
			return;
	}
	$docmanager =  $emuGDocs->getmanager('google docs');
	$docmanager->writeToTheDoc($spreadsheet_name, $spreadsheet_sheet, $new_entry);
}


?>