From 7931e4a349a80d20990c0b1a9951766241e37eec Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Mon, 8 Oct 2018 17:15:00 +0530 Subject: added form for workshop proposal --- osdag_workshop_booking.info | 5 ++ osdag_workshop_booking.install | 0 osdag_workshop_booking.module | 23 ++++++ workshop_registration.inc | 164 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 192 insertions(+) create mode 100644 osdag_workshop_booking.info create mode 100644 osdag_workshop_booking.install create mode 100644 osdag_workshop_booking.module create mode 100644 workshop_registration.inc diff --git a/osdag_workshop_booking.info b/osdag_workshop_booking.info new file mode 100644 index 0000000..75329d2 --- /dev/null +++ b/osdag_workshop_booking.info @@ -0,0 +1,5 @@ +name = "Odsag Workshop Booking" +description = "Osdag project, FOSSEE, IIT Bombay" +package = FOSSEE IITB +version = "7.1" +core = "7.x" diff --git a/osdag_workshop_booking.install b/osdag_workshop_booking.install new file mode 100644 index 0000000..e69de29 diff --git a/osdag_workshop_booking.module b/osdag_workshop_booking.module new file mode 100644 index 0000000..9964270 --- /dev/null +++ b/osdag_workshop_booking.module @@ -0,0 +1,23 @@ + 'Osdag Workshop Registration form', + 'description' => 'Osdag Workshop Registration form', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'osdag_workshop_booking_form' + ), + 'access arguments' => array( + 'workshop booking registration' + ), + 'type' => MENU_NORMAL_ITEM, + 'file' => 'workshop_registration.inc' + ); + return $items; +} diff --git a/workshop_registration.inc b/workshop_registration.inc new file mode 100644 index 0000000..3122452 --- /dev/null +++ b/workshop_registration.inc @@ -0,0 +1,164 @@ +fields('osdag_workshop_booking'); + $query->condition('uid', $user->uid); + $query->orderBy('id', 'DESC'); + $query->range(0, 1); + $proposal_q = $query->execute(); + $proposal_data = $proposal_q->fetchObject(); + if ($proposal_data) + { + if ($proposal_data->approval_status == 0 || $proposal_data->approval_status == 1) + { + drupal_set_message(t('We have already received your proposal.'), 'status'); + drupal_goto(''); + return; + } //$proposal_data->approval_status == 0 || $proposal_data->approval_status == 1 + } //$proposal_data + $form['#attributes'] = array( + 'enctype' => "multipart/form-data" + ); + $form['name_title'] = array( + '#type' => 'select', + '#title' => t('Title'), + '#options' => array( + 'Dr' => 'Dr.', + 'Prof' => 'Prof.', + 'Shri' => 'Shri', + 'Smt' => 'Smt', + 'Ku.' => 'Ku.', + 'Mr.' => 'Mr.', + 'Mrs.' => 'Mrs.', + 'Ms.' => 'Ms.', + ), + '#required' => TRUE + ); + $form['fname'] = array( + '#type' => 'textfield', + '#title' => t('First Name'), + '#size' => 30, + '#maxlength' => 50, + '#required' => TRUE + ); + $form['lname'] = array( + '#type' => 'textfield', + '#title' => t('last Name'), + '#size' => 30, + '#maxlength' => 50, + '#required' => TRUE + ); + $form['designation'] = array( + '#type' => 'textfield', + '#title' => t('Designation'), + '#size' => 30, + '#maxlength' => 50, + '#required' => TRUE + ); + $form['institute_company'] = array( + '#type' => 'textfield', + '#title' => t('Name of the Institute/Company'), + '#size' => 30, + '#maxlength' => 50, + '#required' => TRUE + ); + $form['email_id'] = array( + '#type' => 'textfield', + '#title' => t('Email'), + '#size' => 30, + '#value' => $user->mail, + '#disabled' => TRUE + ); + $form['alt_email_id'] = array( + '#type' => 'textfield', + '#title' => t('Organization Email'), + '#size' => 30, + '#value' => $user->mail, + '#disabled' => False + ); + $form['contact_ph'] = array( + '#type' => 'textfield', + '#title' => t('Contact No.'), + '#size' => 30, + '#maxlength' => 15, + '#required' => TRUE + ); + $form['department'] = array( + '#type' => 'select', + '#title' => t('Department/Branch'), + //'#options' => _lm_list_of_departments(), + '#options' => array(""=>""), + '#required' => TRUE + ); + $form['university'] = array( + '#type' => 'textfield', + '#title' => t('University/ Institute'), + '#size' => 80, + '#maxlength' => 200, + '#required' => TRUE, + '#attributes' => array( + 'placeholder' => 'Insert full name of your institute/ university.... ' + ), + '#description' => 'Please insert full name of your institute/ university.' + ); + $form['city'] = array( + '#type' => 'select', + '#title' => t('City/ Village'), + //'#options' => _lm_list_of_cities(), + '#options' => array(""=>""), + '#maxlength' => 150, + '#required' => TRUE, + '#description' => 'Please select location of your institute/ university.' + ); + $form['pincode'] = array( + '#type' => 'textfield', + '#title' => t('Pincode'), + '#size' => 30, + '#maxlength' => 6, + '#required' => TRUE, + '#attributes' => array( + 'placeholder' => 'Insert pincode of your city/ village....' + ), + '#description' => 'Please insert pincode of your institute/ university.' + ); + $form['all_state'] = array( + '#type' => 'select', + '#title' => t('State'), + //'#options' => _lm_list_of_states(), + '#options' => array(""=>""), + '#required' => TRUE, + '#tree' => TRUE, + '#validated' => TRUE, + '#description' => 'Please select state of your institute/ university.' + ); + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('Submit') + ); + return $form; +} -- cgit