array(
'#title' => t('BIMA D-Day Registration Form'),
'#type' => 'fieldset',
'agency_name' => array(
'#title' => t('Agency Name'),
'#type' => 'textfield',
'#required' => TRUE,
),
'first_name' => array(
'#title' => t('First Name'),
'#type' => 'textfield',
'#required' => TRUE,
),
'surname' => array(
'#title' => t('Surname'),
'#type' => 'textfield',
'#required' => TRUE,
),
'address_1' => array(
'#title' => t('Address Line 1'),
'#type' => 'textfield',
'#required' => TRUE,
),
'address_2' => array(
'#title' => t('Address Line 2'),
'#type' => 'textfield',
),
'city' => array(
'#title' => t('City/Town'),
'#type' => 'textfield',
'#required' => TRUE,
),
'postcode' => array(
'#title' => t('Postcode'),
'#type' => 'textfield',
'#required' => TRUE,
'#size' => 10,
),
'telephone' => array(
'#title' => t('Telephone'),
'#type' => 'textfield',
'#required' => TRUE,
),
'email' => array(
'#title' => t('Email'),
'#type' => 'textfield',
'#required' => TRUE,
'#element_validate' => array('valid_email_address'),
),
'logo' => array(
'#title' => t('Logo'),
'#type' => 'managed_file',
'#required' => TRUE,
'#description' => t('Attach your logo for listing page (Max width/height 200px jpg,gif or png)'),
'#upload_location' => 'public://bima/',
'#upload_validators' => array(
array(
'file_validate_extensions' => array('png gif jpg jpeg'),
'file_validate_image_resolution' => array('200x200'),
),
),
),
'comments' => array(
'#title' => t('Comments'),
'#type' => 'textarea',
'#description' => t('Please advise if you have a school or college already that you wish to link with.'),
),
'submit' => array(
'#type' => 'submit',
'#value' => t('Submit'),
),
),
);
return $form;
}
function bima_registration_form_submit($form, &$form_state) {
global $base_url;
$emails = array('adam.mitchell@carnyx.com', 'nick.creed@carnyx.com', 'sdc@bima.co.uk');
$values = $form_state['values'];
$message_subject = t('BIMA D-Day Registration Form');
$message_body = '';
$module = "mimemail";
$key = "notice";
$message_body .= '
';
foreach ($values as $vk => $v) {
$message_body .= '' . $vk . ' | ' . $v . ' |
';
}
$message_body .= '
';
$success = TRUE;
$from = $values['email'];
$file = file_load($values['logo']);
$path = substr(file_create_url($file->uri), strlen($base_url . '/'));
$filecontent = file_get_contents($path);
foreach ($emails as $mail) {
$message = array(
'module' => $module,
'key' => $key,
'id' => $module . '_' . $key,
'to' => $mail,
'from' => $from,
'subject' => $message_subject,
'body' => $message_body,
'headers' => array(
'From' => $from,
'Sender' => $from,
'Return-Path' => $from,
'Content-Type' => 'text/html; charset=UTF-8',
'MIME-Version'=>'1.0',
),
);
$message['params']['attachments'][] = array(
'filecontent' => $filecontent,
'filepath' => $path,
'filename' => $file->filename,
'filemime' => $file->filemime,
);
$message = mimemail_prepare_message($message);
$system = drupal_mail_system($module, $key);
//$message = $system->format($message);
//
if (!$system->mail($message)) {
$success = FALSE;
}
}
$success ? drupal_set_message('Thank you for registering for BIMA D-Day, someone will be in touch shortly') : drupal_set_message('Error processing form, please try again or contact us directly', 'error');
}
$css = "
#bima-registration-form input[type='text']{width:300px}
#bima-registration-form textarea{width:310px}
#bima-registration-form input[name='postcode']{width:100px}
#bima-registration-form .form-item-comments .description{margin-left:110px}
#bima-registration-form input[name='logo_upload_button']{display:none}
";
drupal_add_css($css, array('type' => 'inline'));
?>
BIMA D-Day - Register
If you are an agency or freelancer who practices digital and you’d like to be involved in BIMA D-Day on October 10th 2013 please complete the form below. Information and registration for schools and colleges can be found on the BIMA D-Day website