diff options
author | Sashi20 | 2021-09-08 14:32:35 +0530 |
---|---|---|
committer | GitHub | 2021-09-08 14:32:35 +0530 |
commit | 95da177b957d3139ee307add81fc20a03540fcbb (patch) | |
tree | 12aa62414945b2c447af0f86c404cef98d247321 | |
parent | b3acdc4539f088b203d59883df8b91957509fc40 (diff) | |
parent | d5aead56f5a92e77e918fffccc034137b43f664e (diff) | |
download | dwsim_flowsheet-95da177b957d3139ee307add81fc20a03540fcbb.tar.gz dwsim_flowsheet-95da177b957d3139ee307add81fc20a03540fcbb.tar.bz2 dwsim_flowsheet-95da177b957d3139ee307add81fc20a03540fcbb.zip |
Merge pull request #48 from Saketh1499/development
Additional tabs required in manage flowsheet proposal
-rwxr-xr-x | dwsim_flowsheet.module | 39 | ||||
-rw-r--r-- | proposals_review_tab.inc | 189 |
2 files changed, 227 insertions, 1 deletions
diff --git a/dwsim_flowsheet.module b/dwsim_flowsheet.module index 2918b8b..302f003 100755 --- a/dwsim_flowsheet.module +++ b/dwsim_flowsheet.module @@ -53,9 +53,46 @@ function dwsim_flowsheet_menu() 'dwsim flowsheet manage proposal' ), 'type' => MENU_LOCAL_TASK, - 'weight' => 4, + 'weight' => 2, 'file' => 'manage_proposal.inc' ); + $items['flowsheeting-project/manage-proposal/approved_proposals'] = array( + 'title' => 'Approved Proposals', + 'description' => 'Approved Proposals', + 'page callback' => 'dwsim_flowsheet_approved_tab', + 'access callback' => 'user_access', + 'access arguments' => array( + 'dwsim flowsheet manage proposal' + ), + 'type' => MENU_LOCAL_TASK, + 'weight' => 3, + 'file' => 'proposals_review_tab.inc' + ); + $items['flowsheeting-project/manage-proposal/uploaded_proposals'] = array( + 'title' => 'Uploaded Proposals', + 'description' => 'Uploaded Proposals', + 'page callback' => 'dwsim_flowsheet_uploaded_tab', + 'access callback' => 'user_access', + 'access arguments' => array( + 'dwsim flowsheet manage proposal' + ), + 'type' => MENU_LOCAL_TASK, + 'weight' => 4, + 'file' => 'proposals_review_tab.inc' + ); + $items['flowsheeting-project/manage-proposal/completed_proposals'] = array( + 'title' => 'Completed Proposals', + 'description' => 'Completed Proposals', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('dwsim_flowsheet_completed_tab_form'), + 'access callback' => 'user_access', + 'access arguments' => array( + 'dwsim flowsheet manage proposal' + ), + 'type' => MENU_LOCAL_TASK, + 'weight' => 5, + 'file' => 'proposals_review_tab.inc' + ); $items['flowsheeting-project/manage-proposal/approve'] = array( 'title' => 'Approve Proposal', 'description' => 'Approve Proposal', diff --git a/proposals_review_tab.inc b/proposals_review_tab.inc new file mode 100644 index 0000000..fe74640 --- /dev/null +++ b/proposals_review_tab.inc @@ -0,0 +1,189 @@ +<?php + +//Proposal tab for reviewing approved proposals +function dwsim_flowsheet_approved_tab() +{ + $page_content = ""; + $result = db_query("SELECT * from dwsim_flowsheet_proposal where id not in (select proposal_id from dwsim_flowsheet_submitted_abstracts) AND approval_status = 1 order by approval_date desc"); + if ($result->rowCount() == 0) + { + $page_content .= "Approved Proposals under Flowsheeting Project<hr>"; + } //$result->rowCount() == 0 + else + { + $page_content .= "Approved Proposals under Flowsheeting Project: " . $result->rowCount() . "<hr>"; + $preference_rows = array(); + $i = 1; + while ($row = $result->fetchObject()) + { + $approval_date = date("d-M-Y", $row->approval_date); + $preference_rows[] = array( + $i, + $row->project_title, + $row->contributor_name, + $row->university, + $approval_date + ); + $i++; + } + $preference_header = array( + 'No', + 'Flowsheet Project', + 'Contributor Name', + 'University / Institute', + 'Date of Approval' + ); + $page_content .= theme('table', array( + 'header' => $preference_header, + 'rows' => $preference_rows + )); + } + return $page_content; +} + + +/////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////// + +//Proposal tab for reviewing Code submission of the uploaded proposals + +function dwsim_flowsheet_uploaded_tab() +{ + $page_content = ""; + $result = db_query("SELECT dfp.project_title, dfp.contributor_name, dfp.id, dfp.university, dfa.abstract_upload_date, dfa.abstract_approval_status from dwsim_flowsheet_proposal as dfp JOIN dwsim_flowsheet_submitted_abstracts as dfa on dfa.proposal_id = dfp.id where dfp.id in (select proposal_id from dwsim_flowsheet_submitted_abstracts) AND approval_status = 1"); + + if ($result->rowCount() == 0) + { + $page_content .= "Uploaded Proposals under Flowsheeting Project<hr>"; + } + else + { + $page_content .= "Uploaded Proposals under Flowsheeting Project: " . $result->rowCount() . "<hr>"; + $preference_rows = array(); + $i = 1; + while ($row = $result->fetchObject()) + { + $abstract_upload_date = date("d-M-Y", $row->abstract_upload_date); + $preference_rows[] = array( + $i, + $row->project_title, + $row->contributor_name, + $row->university, + $abstract_upload_date + ); + $i++; + } + $preference_header = array( + 'No', + 'Flowsheet Project', + 'Contributor Name', + 'University / Institute', + 'Date of file submission' + ); + $page_content .= theme('table', array( + 'header' => $preference_header, + 'rows' => $preference_rows + )); + } + return $page_content; +} + + +/////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////// + +//Proposal tab for reviewing Completed proposals + +function dwsim_flowsheet_completed_tab_form($form, $form_state) +{ + + $form['howmany_select'] = array( + '#title' => t('Sorting projects according to year:'), + '#type' => 'select', + '#options' => array( + 'Please select...' => 'Please select...', + '2017' => '2017', + '2018' => '2018', + '2019' => '2019', + '2020' => '2020', + '2021' => '2021'), + //'#default_value' => 'Please select...', + '#ajax' => array( + 'callback' => 'ajax_example_autocheckboxes_callback', + ), + '#suffix' => '<div id="ajax-selected-flowsheet"></div>' + + ); + return $form; +} + + +function ajax_example_autocheckboxes_callback($form, $form_state) +{ + $commands = array(); + $flowsheet_project_default_value = $form_state['values']['howmany_select']; + if ($flowsheet_project_default_value != 0) + { + $form['howmany_select']['#options'] = array('Please select...' => 'Please select...'); + $commands[] = ajax_command_html('#ajax-selected-flowsheet', _flowsheet_details($flowsheet_project_default_value)); + $commands[] = ajax_command_replace('#ajax_selected_flowsheet_action', drupal_render($form['howmany_select'])); + + } + else + { + $form['howmany_select']['#options'] = array('Please select...' => 'Please select...'); + $commands[] = ajax_command_data('#ajax_selected_flowsheet', 'form_state_value_select', $form_state['values']['howmany_select']); + } + return array( + '#type' => 'ajax', + '#commands' => $commands + ); +} + + +function _flowsheet_details($flowsheet_proposal_id) +{ + $output = ""; + $result = db_query("SELECT * from {dwsim_flowsheet_proposal} WHERE approval_status = 3 and from_unixtime(actual_completion_date, '%Y') = :year", + array( + ':year' => $flowsheet_proposal_id) + ); + + if ($result->rowCount() == 0) + { + $output .= "Work has been completed for the following flow sheets."; + + } + else + { + $output .= "Work has been completed for the following flow sheets: " . $result->rowCount() . "<hr>"; + $preference_rows = array(); + $i = 1; + while ($row = $result->fetchObject()) + { + $completion_date = date("d-M-Y", $row->actual_completion_date); + $preference_rows[] = array( + $i, + l($row->project_title, "flowsheeting-project/dwsim-flowsheet-run/" . $row->id, array('attributes' => array('title' => 'This is a zip file containing a pdf (abstract) and a dwxml/dwxmz file which is the DWSIM flow sheet which is to be viewed by right clicking on the file and opening with DWSIM.'))), + $row->contributor_name, + $row->university, + $completion_date + ); + $i++; + } + $preference_header = array( + 'No', + 'Flowsheet Project', + 'Contributor Name', + 'University / Institute', + 'Date of Completion' + ); + $output .= theme('table', array( + 'header' => $preference_header, + 'rows' => $preference_rows + )); + } + return $output; +}
\ No newline at end of file |