/** * Provide the legislators for the given address. * * Echos JSON object of the names, photo URLs, and emails. */ public function run() { $addressValues = array('Postal_Code_Field' => CRM_Utils_Request::retrieve('zip', 'Int'), 'State_Province_Field' => CRM_Utils_Request::retrieve('state', 'Int'), 'City_Field' => CRM_Utils_Request::retrieve('city', 'String'), 'Street_Address_Field' => CRM_Utils_Request::retrieve('address', 'String')); foreach ($addressValues as $val) { if (empty($val)) { return; } } $recipients = CRM_Petitionemail_Interface_Statelegemail::findRecipients($addressValues); CRM_Utils_JSON::output($recipients); }
/** * Populate defaults. * * @return array * The default values. */ public function setDefaultValues() { return array('states' => CRM_Petitionemail_Interface_Statelegemail::getValidStates(), 'key' => CRM_Petitionemail_Interface_Statelegemail::getApiKey()); }