diff options
author | Saketh1499 | 2022-04-19 20:22:47 +0530 |
---|---|---|
committer | Saketh1499 | 2022-04-19 20:22:47 +0530 |
commit | 6ca495c80d5694d2b62a68a097858030b6db9475 (patch) | |
tree | 2d147ea4dde52df5e9b05f701ba078280d24e55a | |
parent | f3b9b474481114586c9fa8d5ec238b479d5a3b69 (diff) | |
download | r_textbook_companion-6ca495c80d5694d2b62a68a097858030b6db9475.tar.gz r_textbook_companion-6ca495c80d5694d2b62a68a097858030b6db9475.tar.bz2 r_textbook_companion-6ca495c80d5694d2b62a68a097858030b6db9475.zip |
Re-arranging order of the tabs
-rwxr-xr-x | manage_proposal.inc | 10 | ||||
-rwxr-xr-x | textbook_companion.module | 221 |
2 files changed, 20 insertions, 211 deletions
diff --git a/manage_proposal.inc b/manage_proposal.inc index e3e4681..67aa601 100755 --- a/manage_proposal.inc +++ b/manage_proposal.inc @@ -561,16 +561,11 @@ function proposal_status_form($from, $form_state) '#markup' => $proposal_data->pincode, '#title' => t('Pincode') ); - $form['all_state'] = array( + $form['state'] = array( '#type' => 'item', '#markup' => $proposal_data->state, '#title' => t('State') ); - $form['country'] = array( - '#type' => 'item', - '#markup' => $proposal_data->country, - '#title' => t('Country') - ); $form['faculty'] = array( '#type' => 'hidden', '#markup' => $proposal_data->faculty, @@ -1460,7 +1455,6 @@ function proposal_edit_form_submit($form, &$form_state) function category_edit_form_submit($form, &$form_state) { /* get current proposal - $preference_id = (int) arg(4); /*$preference_q = db_query("SELECT * FROM {textbook_companion_preference} WHERE id = %d", $preference_id); $preference_data = db_fetch_object($preference_q); @@ -1852,4 +1846,4 @@ function RenameDir($preference_id, $dir_name) $category_list_data = $category_list->fetchObject(); $category = $category_list_data->maincategory; return "* ". $category; -}*/ +}*/
\ No newline at end of file diff --git a/textbook_companion.module b/textbook_companion.module index a9788b5..e2f62ca 100755 --- a/textbook_companion.module +++ b/textbook_companion.module @@ -905,62 +905,6 @@ function textbook_companion_permission() ), ); } - -function _tbc_list_of_city_pincode($city=Null, $state=NULL, $district=NULL) -{ - $pincode = array(); - if($city){ - $pincode_list = db_query("SELECT pincode FROM all_india_pincode WHERE city = :city AND state = :state AND district = :district", array(':city' => $city,':state'=> $state, ':district' => $district)); - while ($pincode_list_data = $pincode_list->fetchObject()) - { - $pincode[$pincode_list_data->pincode] = $pincode_list_data->pincode; - } - } - else{ - $pincode[000000] = '000000'; - } - return $pincode; -} - -function _tbc_list_of_cities($state=Null, $district=NULL) -{ - $city = array(''=> '- Select -'); - if($state){ - $city_list = db_query("SELECT city FROM all_india_pincode WHERE state = :state AND district = :district ORDER BY city ASC", array(':state'=> $state, ':district' =>$district)); - while ($city_list_data = $city_list->fetchObject()) - { - $city[$city_list_data->city] = $city_list_data->city; - } - } - return $city; -} - -function _tbc_list_of_district($state=Null) -{ - $district = array(''=> '- Select -'); - if($state){ - $district_list = db_query("SELECT district FROM all_india_pincode WHERE state = :state ORDER BY district ASC", array(':state'=> $state)); - while ($district_list_data = $district_list->fetchObject()) - { - $district[$district_list_data->district] = $district_list_data->district; - } - } - return $district; -} - -function _tbc_list_of_states() -{ - $states = array(''=> '- Select -'); - $states_list = db_query("SELECT state FROM all_india_pincode WHERE country = 'India' ORDER BY state ASC"); - while ($states_list_data = $states_list->fetchObject()) - { - $states[$states_list_data->state] = $states_list_data->state; - } - return $states; -} - - - function textbook_companion_aicte_proposal_all() { global $user; @@ -1185,16 +1129,8 @@ function textbook_companion_proposal_all() } function book_proposal_form($form, &$form_state) { - global $user;$form = array(); - $state = _tbc_list_of_states(); - $selected_state = isset($form_state['values']['all_state'])?$form_state['values']['all_state']:key($state); - $district = _tbc_list_of_district(); - $selected_district = isset($form_state['values']['district'])?$form_state['values']['district']:key($district); - $city = _tbc_list_of_cities(); - $selected_city = isset($form_state['values']['city'])?$form_state['values']['city']:key($city); - $pincode = _tbc_list_of_city_pincode(); - $selected_pincode = isset($form_state['values']['picode'])?$form_state['values']['pincode']:key($pincode); - + global $user; + $form = array(); $form['imp_notice'] = array( '#type' => 'item', '#markup' => '<font color="red"><b>Please fill up this form carefully as the details entered here will be exactly written in the Textbook Companion</b></font>' @@ -1324,12 +1260,6 @@ function book_proposal_form($form, &$form_state) 'India' => 'India', 'Others' => 'Others' ), - //'#default_value' => 'India', - '#prefix' => '<div id="ajax-country-list-replace">', - '#suffix' => '</div>', - // '#ajax' => array( - // 'callback' => 'ajax_get_district_list_callback', - // ), '#required' => TRUE, '#tree' => TRUE, '#validated' => TRUE @@ -1381,17 +1311,11 @@ function book_proposal_form($form, &$form_state) ); $form['all_state'] = array( '#type' => 'select', - '#title' => t('State/UT'), - '#options' => _tbc_list_of_states(), - //'#empty_value' => '0', - //'#empty_option' => '- Select -', - '#default_value' => '0', - '#prefix' => '<div id="ajax-state-list-replace">', - '#suffix' => '</div>', - '#required' => TRUE, - '#ajax' => array( - 'callback' => 'ajax_get_district_list_callback', - ), + '#title' => t('State'), + '#selected' => array( + '' => '-select-' + ), + '#options' => _list_of_states(), '#validated' => TRUE, '#states' => array( 'visible' => array( @@ -1401,64 +1325,26 @@ function book_proposal_form($form, &$form_state) ) ) ); - $form['district'] = array( - '#type' => 'select', - '#title' => t('District/Area'), - '#options' => _tbc_list_of_district($selected_state), - //'#empty_value' => '0', - //'#empty_option' => '- Select -', - '#prefix' => '<div id="ajax-district-list-replace">', - '#suffix' => '</div>', - '#validated' => TRUE, - '#required' => TRUE, - '#ajax' => array( - 'callback' => 'ajax_get_city_list_callback', - ), - '#states' => array( - 'visible' => array( - ':input[name="all_state"]' => array( - 'value' => 'India' - ) - ) - ) - ); $form['city'] = array( '#type' => 'select', - '#title' => t('City/Area'), - '#options' => _tbc_list_of_cities($selected_state, $selected_district), - //'#empty_value' => '0', - //'#empty_option' => '- Select -', - '#prefix' => '<div id="ajax-city-list-replace">', - '#suffix' => '</div>', - '#validated' => TRUE, - '#required' => TRUE, - '#ajax' => array( - 'callback' => 'ajax_get_city_pincode_list_callback', - ), + '#title' => t('City'), + '#options' => _list_of_cities(), '#states' => array( 'visible' => array( - ':input[name="district"]' => array( + ':input[name="country"]' => array( 'value' => 'India' ) ) ) ); $form['pincode'] = array( - '#type' => 'select', + '#type' => 'textfield', '#title' => t('Pincode'), - '#options' => _tbc_list_of_city_pincode($selected_city, $selected_state, $selected_district), - '#prefix' => '<div id="ajax-pincode-list-replace">', - '#suffix' => '</div>', - //'#empty_value' => '0', - //'#empty_option' => '- Select -', - '#required' => TRUE, - '#validated' => TRUE, - '#states' => array( - 'visible' => array( - ':input[name="city"]' => array( - 'value' => 'India' - ) - ) + '#size' => 30, + '#maxlength' => 6, + '#required' => True, + '#attributes' => array( + 'placeholder' => 'Enter pincode....' ) ); /***************************************************************************/ @@ -1831,7 +1717,7 @@ function book_proposal_form_submit($form, &$form_state, $directory_name = NULL) $form_state['values']['reason'] = $my_reason; } //isset($_POST['reason']) $query = "INSERT INTO {textbook_companion_proposal} - (uid, approver_uid, name_title, full_name, mobile, how_project, course, branch, university,city,district,pincode,state,country, faculty, reviewer,reference, completion_date, creation_date, approval_date, proposal_status, r_version, operating_system, teacher_email,reason,samplefilepath,proposal_type,proposed_completion_date, book_download_link) VALUES (:uid, :approver_uid, :name_title, :full_name, :mobile, :how_project, :course, :branch, :university, :city,:district,:pincode,:state,:country, :faculty, :reviewer,:reference, :completion_date, + (uid, approver_uid, name_title, full_name, mobile, how_project, course, branch, university,city,pincode,state,country, faculty, reviewer,reference, completion_date, creation_date, approval_date, proposal_status, r_version, operating_system, teacher_email,reason,samplefilepath,proposal_type,proposed_completion_date, book_download_link) VALUES (:uid, :approver_uid, :name_title, :full_name, :mobile, :how_project, :course, :branch, :university, :city,:pincode,:state,:country, :faculty, :reviewer,:reference, :completion_date, :creation_date, :approval_date, :proposal_status, :r_version, :operating_system, :teacher_email,:reason,:samplefilepath,:proposal_type, :proposed_completion_date, :book_download_link)"; $args = array( @@ -1845,7 +1731,6 @@ function book_proposal_form_submit($form, &$form_state, $directory_name = NULL) ":branch" => trim($form_state['values']['branch']), ":university" => trim($form_state['values']['university']), ":city" => trim($form_state['values']['city']), - ":district" => $form_state['values']['district'], ":pincode" => $form_state['values']['pincode'], ":state" => trim($form_state['values']['all_state']), ":country" => $form_state['values']['country'], @@ -1959,76 +1844,6 @@ function book_proposal_form_submit($form, &$form_state, $directory_name = NULL) drupal_set_message(t('We have received you book proposal. We will get back to you soon.'), 'status'); drupal_goto(''); } - - -function ajax_get_city_list_callback($form, $form_state) -{ - $state_default_value = $form_state['values']['all_state']; - $district_default_value = $form_state['values']['district']; - if ($district_default_value != '0') - { - $form['city']['#options'] = _tbc_list_of_cities($state_default_value, $district_default_value); - $commands[] = ajax_command_replace("#ajax-city-list-replace", drupal_render($form['city'])); - $form['pincode']['#options'] = array('0' => '- Select -'); - $commands[] = ajax_command_replace("#ajax-pincode-list-replace", drupal_render($form['pincode'])); - }else{ - $form['city']['#options'] = array('0' => '- Select -'); - $commands[] = ajax_command_replace("#ajax-city-list-replace", drupal_render($form['city'])); - } - return array( - '#type' => 'ajax', - '#commands' => $commands - ); -} -function ajax_get_district_list_callback($form, $form_state) -{ - $state_default_value = $form_state['values']['all_state']; - if ($state_default_value != '0') - { - $form['district']['#options'] = _tbc_list_of_district($state_default_value); - $commands[] = ajax_command_replace("#ajax-district-list-replace", drupal_render($form['district'])); - $form['pincode']['#options'] = array('0' =>'- Select -'); - $commands[] = ajax_command_replace("#ajax-pincode-list-replace", drupal_render($form['pincode'])); - $form['city']['#options'] = array('0' => '- Select -'); - $commands[] = ajax_command_replace("#ajax-city-list-replace", drupal_render($form['city'])); - }else{ - $form['district']['#options'] = array('0' => '- Select -'); - $commands[] = ajax_command_replace("#ajax-district-list-replace", drupal_render($form['district'])); - $form['pincode']['#options'] = array('0' =>'- Select -'); - $commands[] = ajax_command_replace("#ajax-pincode-list-replace", drupal_render($form['pincode'])); - $form['city']['#options'] = array('0' => '- Select -'); - $commands[] = ajax_command_replace("#ajax-city-list-replace", drupal_render($form['city'])); - } - return array( - '#type' => 'ajax', - '#commands' => $commands - ); -} -function ajax_get_city_pincode_list_callback($form, $form_state) -{ - $city_default_value = $form_state['values']['city']; - $state_default_value = $form_state['values']['all_state']; - $district_default_value = $form_state['values']['district']; - if ($city_default_value != '0') - { - $form['pincode']['#options'] = _tbc_list_of_city_pincode($city_default_value,$state_default_value,$district_default_value); - $commands[] = ajax_command_replace("#ajax-pincode-list-replace", drupal_render($form['pincode'])); - }else{ - $form['pincode']['#options'] = array('0' => '- Select -'); - $commands[] = ajax_command_replace("#ajax-pincode-list-replace", drupal_render($form['pincode'])); - } - return array( - '#type' => 'ajax', - '#commands' => $commands - ); -} - - - - - - - /** * Implementation of hook_mail(). */ @@ -4025,4 +3840,4 @@ function _dir_name($book, $author, $pref_id) } //$result > 1 } return $directory_name; -} +}
\ No newline at end of file |