From 7c71967377db9bf9fd9de11b0e2bd9606542f96f Mon Sep 17 00:00:00 2001
From: Saketh1499
Date: Tue, 20 Jul 2021 09:46:56 +0530
Subject: Additional Tabs Requirement in Manage Flowsheet Proposal
---
dwsim_flowsheet.module | 39 +++++++++-
tabs.inc | 203 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 241 insertions(+), 1 deletion(-)
create mode 100644 tabs.inc
diff --git a/dwsim_flowsheet.module b/dwsim_flowsheet.module
index 2918b8b..c69eb00 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'] = array(
+ 'title' => 'Approved Proposals',
+ 'description' => 'Approved Proposals',
+ 'page callback' => 'dwsim_flowsheet_progress_tab',
+ 'access callback' => 'user_access',
+ 'access arguments' => array(
+ 'dwsim flowsheet manage proposal'
+ ),
+ 'type' => MENU_LOCAL_TASK,
+ 'weight' => 3,
+ 'file' => 'tabs.inc'
+ );
+ $items['flowsheeting-project/manage-proposal/uploaded'] = 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' => 'tabs.inc'
+ );
+ $items['flowsheeting-project/manage-proposal/completed'] = 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' => 'tabs.inc'
+ );
$items['flowsheeting-project/manage-proposal/approve'] = array(
'title' => 'Approve Proposal',
'description' => 'Approve Proposal',
diff --git a/tabs.inc b/tabs.inc
new file mode 100644
index 0000000..0ff9cb9
--- /dev/null
+++ b/tabs.inc
@@ -0,0 +1,203 @@
+execute();
+ if ($result->rowCount() == 0)
+ {
+ $page_content .= "Uploaded Proposals under Flowsheeting Project
";
+ } //$result->rowCount() == 0
+ else
+ {
+ $page_content .= "Uploaded Proposals under Flowsheeting Project
";;
+ $preference_rows = array();
+ $i = 1;
+ while ($row = $result->fetchObject())
+ {
+ $approval_date = date("Y", $row->approval_date);
+ $preference_rows[] = array(
+ $i,
+ $row->project_title,
+ $row->contributor_name,
+ $row->university,
+ $approval_date
+ );
+ $i++;
+ } //$row = $result->fetchObject()
+ $preference_header = array(
+ 'No',
+ 'Flowsheet Project',
+ 'Contributor Name',
+ 'University / Institute',
+ 'Year'
+ );
+ $page_content .= theme('table', array(
+ 'header' => $preference_header,
+ 'rows' => $preference_rows
+ ));
+ }
+ return $page_content;
+}
+
+
+
+
+
+
+
+function dwsim_flowsheet_progress_tab()
+{
+ $page_content = "";
+ $query = db_select('dwsim_flowsheet_proposal');
+ $query->fields('dwsim_flowsheet_proposal');
+ $query->condition('approval_status', 1);
+ $query->condition('is_completed', 0);
+ $query->orderBy('approval_date', 'DESC');
+ $result = $query->execute();
+ if ($result->rowCount() == 0)
+ {
+ $page_content .= "Approved Proposals under Flowsheeting Project
";
+ } //$result->rowCount() == 0
+ else
+ {
+ $page_content .= "Approved Proposals under Flowsheeting Project
";;
+ $preference_rows = array();
+ $i = 1;
+ while ($row = $result->fetchObject())
+ {
+ $approval_date = date("Y", $row->approval_date);
+ $preference_rows[] = array(
+ $i,
+ $row->project_title,
+ $row->contributor_name,
+ $row->university,
+ $approval_date
+ );
+ $i++;
+ } //$row = $result->fetchObject()
+ $preference_header = array(
+ 'No',
+ 'Flowsheet Project',
+ 'Contributor Name',
+ 'University / Institute',
+ 'Year'
+ );
+ $page_content .= theme('table', array(
+ 'header' => $preference_header,
+ 'rows' => $preference_rows
+ ));
+ }
+ return $page_content;
+}
+
+function dwsim_flowsheet_completed_tab_form($form, $form_state){
+ /*$options_first = _list_of_flowsheet_project();
+ $selected = isset($form_state['values']['howmany_select']) ? $form_state['values']['howmany_select'] : key($options_first);*/
+ $form['howmany_select'] = array(
+ '#title' => t('Sorting projects according to year:'),
+ '#type' => 'select',
+ '#options' => array(2017 => 2017, 2018 => 2018, 2019 => 2019, 2020 => 2020, 2021 => 2021),
+ //'#default_value' => $selected,
+ '#ajax' => array(
+ 'callback' => 'ajax_example_autocheckboxes_callback',
+ //'wrapper' => 'checkboxes-div',
+ /*'method' => 'replace',
+ 'effect' => 'fade',*/
+ ),
+ '#suffix' => ''
+
+ );
+ return $form;
+}
+
+function ajax_example_autocheckboxes_callback($form, $form_state)
+{
+ $commands = array();
+ $flowsheet_project_default_value = $form_state['values']['howmany_select'];
+ //var_dump($flowsheet_project_default_value);die;
+ if ($flowsheet_project_default_value != 0)
+ {
+ $commands[] = ajax_command_replace('#ajax_selected_flowsheet', _flowsheet_details($flowsheet_project_default_value));
+ } //$flowsheet_project_default_value != 0
+ else
+ {
+ $commands[] = ajax_command_replace('#ajax_selected_flowsheet', '');
+ $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){
+ //var_dump($flowsheet_proposal_id);die;
+ $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));
+ //$sql = $result->execute();
+ //var_dump($result);die;
+ if ($result->rowCount() == 0)
+ {
+ $output .= "Work has been completed for the following flow sheets.";
+
+ } //$result->rowCount() == 0
+ else
+ {
+ $output .= "Work has been completed for the following flow sheets";
+ $preference_rows = array();
+ $i = 1;
+ while ($row = $result->fetchObject())
+ {
+ $completion_date = date("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++;
+ } //$row = $result->fetchObject()
+ $preference_header = array(
+ 'No',
+ 'Flowsheet Project',
+ 'Contributor Name',
+ 'University / Institute',
+ 'Year of Completion'
+ );
+ $output .= theme('table', array(
+ 'header' => $preference_header,
+ 'rows' => $preference_rows
+ ));
+ }
+ return $output;
+}
+
+function _list_of_flowsheet_project()
+{
+ $options_first = array(
+ '0' => 'Please select...'
+ );
+ if(isset($form_state['values']['howmany_select'])) {
+ $rows = db_select('dwsim_flowsheet_proposal', 'actual_completion_date')
+ ->fields('actual_completion_date')
+ ->condition('approval_status', $form_state['values']['howmany_select'])
+ ->execute()
+ ->fetchAll();
+
+ $header = array();
+ $form['results']['#markup'] = theme('table', array('header' => $header, 'rows' => $rows));
+ }
+ else {
+ $form['results']['#markup'] = 'The results will appear here when you change the dropdown option.
';
+ }
+}
\ No newline at end of file
--
cgit
From e50b48acd0b4b8cce7c16f0a4db02aa9551f5880 Mon Sep 17 00:00:00 2001
From: Saketh1499
Date: Tue, 20 Jul 2021 10:05:18 +0530
Subject: Additional tabs requirement in manage flowsheet proposal
---
dwsim_flowsheet.module | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dwsim_flowsheet.module b/dwsim_flowsheet.module
index c69eb00..59df716 100755
--- a/dwsim_flowsheet.module
+++ b/dwsim_flowsheet.module
@@ -80,7 +80,7 @@ function dwsim_flowsheet_menu()
'weight' => 4,
'file' => 'tabs.inc'
);
- $items['flowsheeting-project/manage-proposal/completed'] = array(
+ /*$items['flowsheeting-project/manage-proposal/completed'] = array(
'title' => 'Completed Proposals',
'description' => 'Completed Proposals',
'page callback' => 'drupal_get_form',
@@ -92,7 +92,7 @@ function dwsim_flowsheet_menu()
'type' => MENU_LOCAL_TASK,
'weight' => 5,
'file' => 'tabs.inc'
- );
+ );*/
$items['flowsheeting-project/manage-proposal/approve'] = array(
'title' => 'Approve Proposal',
'description' => 'Approve Proposal',
--
cgit
From f74b033b44fe6be4ec6097ea343792091c7831c2 Mon Sep 17 00:00:00 2001
From: Saketh1499
Date: Tue, 20 Jul 2021 10:20:26 +0530
Subject: Additional tabs requirement in manage flowsheet proposal
---
additional_tabs.inc | 209 +++++++++++++++++++++++++++++++++++++++++++++++++
dwsim_flowsheet.module | 12 +--
2 files changed, 215 insertions(+), 6 deletions(-)
create mode 100644 additional_tabs.inc
diff --git a/additional_tabs.inc b/additional_tabs.inc
new file mode 100644
index 0000000..b3153c3
--- /dev/null
+++ b/additional_tabs.inc
@@ -0,0 +1,209 @@
+fields('dwsim_flowsheet_proposal');
+ $query->condition('approval_status', 1);
+ $query->condition('is_completed', 0);
+ $query->orderBy('approval_date', 'DESC');
+ $result = $query->execute();
+ if ($result->rowCount() == 0)
+ {
+ $page_content .= "Approved Proposals under Flowsheeting Project
";
+ } //$result->rowCount() == 0
+ else
+ {
+ $page_content .= "Approved Proposals under Flowsheeting Project
";;
+ $preference_rows = array();
+ $i = 1;
+ while ($row = $result->fetchObject())
+ {
+ $approval_date = date("Y", $row->approval_date);
+ $preference_rows[] = array(
+ $i,
+ $row->project_title,
+ $row->contributor_name,
+ $row->university,
+ $approval_date
+ );
+ $i++;
+ } //$row = $result->fetchObject()
+ $preference_header = array(
+ 'No',
+ 'Flowsheet Project',
+ 'Contributor Name',
+ 'University / Institute',
+ 'Year'
+ );
+ $page_content .= theme('table', array(
+ 'header' => $preference_header,
+ 'rows' => $preference_rows
+ ));
+ }
+ return $page_content;
+}
+
+
+///////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+
+
+function dwsim_flowsheet_uploaded_tab()
+{
+ $page_content = "";
+ $result = db_query("SELECT dfp.project_title, dfp.contributor_name, dfp.university, dfp.approval_date
+ FROM dwsim_flowsheet_proposal dfp LEFT JOIN dwsim_flowsheet_submitted_abstracts dfsa
+ ON dfp.id= dfsa.proposal_id WHERE approval_status = 1
+ AND user_defined_compound_filepath = 'NULL' ORDER BY dfsa.abstract_upload_date DESC");
+ //var_dump($result);die;
+
+ //$result = $query->execute();
+ if ($result->rowCount() == 0)
+ {
+ $page_content .= "Uploaded Proposals under Flowsheeting Project
";
+ } //$result->rowCount() == 0
+ else
+ {
+ $page_content .= "Uploaded Proposals under Flowsheeting Project
";;
+ $preference_rows = array();
+ $i = 1;
+ while ($row = $result->fetchObject())
+ {
+ $approval_date = date("Y", $row->approval_date);
+ $preference_rows[] = array(
+ $i,
+ $row->project_title,
+ $row->contributor_name,
+ $row->university,
+ $approval_date
+ );
+ $i++;
+ } //$row = $result->fetchObject()
+ $preference_header = array(
+ 'No',
+ 'Flowsheet Project',
+ 'Contributor Name',
+ 'University / Institute',
+ 'Year'
+ );
+ $page_content .= theme('table', array(
+ 'header' => $preference_header,
+ 'rows' => $preference_rows
+ ));
+ }
+ return $page_content;
+}
+
+
+///////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+
+
+function dwsim_flowsheet_completed_tab_form($form, $form_state){
+ /*$options_first = _list_of_flowsheet_project();
+ $selected = isset($form_state['values']['howmany_select']) ? $form_state['values']['howmany_select'] : key($options_first);*/
+ $form['howmany_select'] = array(
+ '#title' => t('Sorting projects according to year:'),
+ '#type' => 'select',
+ '#options' => array(2017 => 2017, 2018 => 2018, 2019 => 2019, 2020 => 2020, 2021 => 2021),
+ //'#default_value' => $selected,
+ '#ajax' => array(
+ 'callback' => 'ajax_example_autocheckboxes_callback',
+ //'wrapper' => 'checkboxes-div',
+ /*'method' => 'replace',
+ 'effect' => 'fade',*/
+ ),
+ '#suffix' => ''
+
+ );
+ return $form;
+}
+
+function ajax_example_autocheckboxes_callback($form, $form_state)
+{
+ $commands = array();
+ $flowsheet_project_default_value = $form_state['values']['howmany_select'];
+ //var_dump($flowsheet_project_default_value);die;
+ if ($flowsheet_project_default_value != 0)
+ {
+ $commands[] = ajax_command_replace('#ajax_selected_flowsheet', _flowsheet_details($flowsheet_project_default_value));
+ } //$flowsheet_project_default_value != 0
+ else
+ {
+ $commands[] = ajax_command_replace('#ajax_selected_flowsheet', '');
+ $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){
+ //var_dump($flowsheet_proposal_id);die;
+ $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));
+ //$sql = $result->execute();
+ //var_dump($result);die;
+ if ($result->rowCount() == 0)
+ {
+ $output .= "Work has been completed for the following flow sheets.";
+
+ } //$result->rowCount() == 0
+ else
+ {
+ $output .= "Work has been completed for the following flow sheets";
+ $preference_rows = array();
+ $i = 1;
+ while ($row = $result->fetchObject())
+ {
+ $completion_date = date("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++;
+ } //$row = $result->fetchObject()
+ $preference_header = array(
+ 'No',
+ 'Flowsheet Project',
+ 'Contributor Name',
+ 'University / Institute',
+ 'Year of Completion'
+ );
+ $output .= theme('table', array(
+ 'header' => $preference_header,
+ 'rows' => $preference_rows
+ ));
+ }
+ return $output;
+}
+
+function _list_of_flowsheet_project()
+{
+ $options_first = array(
+ '0' => 'Please select...'
+ );
+ if(isset($form_state['values']['howmany_select'])) {
+ $rows = db_select('dwsim_flowsheet_proposal', 'actual_completion_date')
+ ->fields('actual_completion_date')
+ ->condition('approval_status', $form_state['values']['howmany_select'])
+ ->execute()
+ ->fetchAll();
+
+ $header = array();
+ $form['results']['#markup'] = theme('table', array('header' => $header, 'rows' => $rows));
+ }
+ else {
+ $form['results']['#markup'] = 'The results will appear here when you change the dropdown option.
';
+ }
+}
\ No newline at end of file
diff --git a/dwsim_flowsheet.module b/dwsim_flowsheet.module
index 59df716..c3ff559 100755
--- a/dwsim_flowsheet.module
+++ b/dwsim_flowsheet.module
@@ -56,7 +56,7 @@ function dwsim_flowsheet_menu()
'weight' => 2,
'file' => 'manage_proposal.inc'
);
- $items['flowsheeting-project/manage-proposal/approved'] = array(
+ $items['flowsheeting-project/manage-proposal/approved_proposals'] = array(
'title' => 'Approved Proposals',
'description' => 'Approved Proposals',
'page callback' => 'dwsim_flowsheet_progress_tab',
@@ -66,9 +66,9 @@ function dwsim_flowsheet_menu()
),
'type' => MENU_LOCAL_TASK,
'weight' => 3,
- 'file' => 'tabs.inc'
+ 'file' => 'additional_tabs.inc'
);
- $items['flowsheeting-project/manage-proposal/uploaded'] = array(
+ $items['flowsheeting-project/manage-proposal/uploaded_proposals'] = array(
'title' => 'Uploaded Proposals',
'description' => 'Uploaded Proposals',
'page callback' => 'dwsim_flowsheet_uploaded_tab',
@@ -78,9 +78,9 @@ function dwsim_flowsheet_menu()
),
'type' => MENU_LOCAL_TASK,
'weight' => 4,
- 'file' => 'tabs.inc'
+ 'file' => 'additional_tabs.inc'
);
- /*$items['flowsheeting-project/manage-proposal/completed'] = array(
+ /*$items['flowsheeting-project/manage-proposal/completed_proposals'] = array(
'title' => 'Completed Proposals',
'description' => 'Completed Proposals',
'page callback' => 'drupal_get_form',
@@ -91,7 +91,7 @@ function dwsim_flowsheet_menu()
),
'type' => MENU_LOCAL_TASK,
'weight' => 5,
- 'file' => 'tabs.inc'
+ 'file' => 'additional_tabs.inc'
);*/
$items['flowsheeting-project/manage-proposal/approve'] = array(
'title' => 'Approve Proposal',
--
cgit
From 64100ccc14a8f17321893728a57745838e15048f Mon Sep 17 00:00:00 2001
From: Saketh1499
Date: Wed, 4 Aug 2021 17:43:01 +0530
Subject: Adding completed tabs interface
---
additional_tabs.inc | 73 ++++++++----------
dwsim_flowsheet.module | 4 +-
tabs.inc | 203 -------------------------------------------------
3 files changed, 32 insertions(+), 248 deletions(-)
delete mode 100644 tabs.inc
diff --git a/additional_tabs.inc b/additional_tabs.inc
index b3153c3..ff29956 100644
--- a/additional_tabs.inc
+++ b/additional_tabs.inc
@@ -20,7 +20,7 @@ function dwsim_flowsheet_progress_tab()
$i = 1;
while ($row = $result->fetchObject())
{
- $approval_date = date("Y", $row->approval_date);
+ $approval_date = date("d-M-Y", $row->approval_date);
$preference_rows[] = array(
$i,
$row->project_title,
@@ -72,7 +72,7 @@ function dwsim_flowsheet_uploaded_tab()
$i = 1;
while ($row = $result->fetchObject())
{
- $approval_date = date("Y", $row->approval_date);
+ $approval_date = date("d-M-Y", $row->approval_date);
$preference_rows[] = array(
$i,
$row->project_title,
@@ -103,38 +103,44 @@ function dwsim_flowsheet_uploaded_tab()
/////////////////////////////////////////////////////////////////////
-function dwsim_flowsheet_completed_tab_form($form, $form_state){
- /*$options_first = _list_of_flowsheet_project();
- $selected = isset($form_state['values']['howmany_select']) ? $form_state['values']['howmany_select'] : key($options_first);*/
+function dwsim_flowsheet_completed_tab_form($form, $form_state)
+{
+
$form['howmany_select'] = array(
'#title' => t('Sorting projects according to year:'),
'#type' => 'select',
- '#options' => array(2017 => 2017, 2018 => 2018, 2019 => 2019, 2020 => 2020, 2021 => 2021),
- //'#default_value' => $selected,
+ '#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',
- //'wrapper' => 'checkboxes-div',
- /*'method' => 'replace',
- 'effect' => 'fade',*/
),
- '#suffix' => ''
+ '#suffix' => ''
);
return $form;
}
+
function ajax_example_autocheckboxes_callback($form, $form_state)
{
$commands = array();
$flowsheet_project_default_value = $form_state['values']['howmany_select'];
- //var_dump($flowsheet_project_default_value);die;
if ($flowsheet_project_default_value != 0)
{
- $commands[] = ajax_command_replace('#ajax_selected_flowsheet', _flowsheet_details($flowsheet_project_default_value));
- } //$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
{
- $commands[] = ajax_command_replace('#ajax_selected_flowsheet', '');
+ $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(
@@ -144,18 +150,19 @@ function ajax_example_autocheckboxes_callback($form, $form_state)
}
-function _flowsheet_details($flowsheet_proposal_id){
- //var_dump($flowsheet_proposal_id);die;
+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));
- //$sql = $result->execute();
- //var_dump($result);die;
+ $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.";
- } //$result->rowCount() == 0
+ }
else
{
$output .= "Work has been completed for the following flow sheets";
@@ -172,7 +179,7 @@ function _flowsheet_details($flowsheet_proposal_id){
$completion_date
);
$i++;
- } //$row = $result->fetchObject()
+ }
$preference_header = array(
'No',
'Flowsheet Project',
@@ -186,24 +193,4 @@ function _flowsheet_details($flowsheet_proposal_id){
));
}
return $output;
-}
-
-function _list_of_flowsheet_project()
-{
- $options_first = array(
- '0' => 'Please select...'
- );
- if(isset($form_state['values']['howmany_select'])) {
- $rows = db_select('dwsim_flowsheet_proposal', 'actual_completion_date')
- ->fields('actual_completion_date')
- ->condition('approval_status', $form_state['values']['howmany_select'])
- ->execute()
- ->fetchAll();
-
- $header = array();
- $form['results']['#markup'] = theme('table', array('header' => $header, 'rows' => $rows));
- }
- else {
- $form['results']['#markup'] = 'The results will appear here when you change the dropdown option.
';
- }
}
\ No newline at end of file
diff --git a/dwsim_flowsheet.module b/dwsim_flowsheet.module
index c3ff559..d0765dc 100755
--- a/dwsim_flowsheet.module
+++ b/dwsim_flowsheet.module
@@ -80,7 +80,7 @@ function dwsim_flowsheet_menu()
'weight' => 4,
'file' => 'additional_tabs.inc'
);
- /*$items['flowsheeting-project/manage-proposal/completed_proposals'] = array(
+ $items['flowsheeting-project/manage-proposal/completed_proposals'] = array(
'title' => 'Completed Proposals',
'description' => 'Completed Proposals',
'page callback' => 'drupal_get_form',
@@ -92,7 +92,7 @@ function dwsim_flowsheet_menu()
'type' => MENU_LOCAL_TASK,
'weight' => 5,
'file' => 'additional_tabs.inc'
- );*/
+ );
$items['flowsheeting-project/manage-proposal/approve'] = array(
'title' => 'Approve Proposal',
'description' => 'Approve Proposal',
diff --git a/tabs.inc b/tabs.inc
deleted file mode 100644
index 0ff9cb9..0000000
--- a/tabs.inc
+++ /dev/null
@@ -1,203 +0,0 @@
-execute();
- if ($result->rowCount() == 0)
- {
- $page_content .= "Uploaded Proposals under Flowsheeting Project
";
- } //$result->rowCount() == 0
- else
- {
- $page_content .= "Uploaded Proposals under Flowsheeting Project
";;
- $preference_rows = array();
- $i = 1;
- while ($row = $result->fetchObject())
- {
- $approval_date = date("Y", $row->approval_date);
- $preference_rows[] = array(
- $i,
- $row->project_title,
- $row->contributor_name,
- $row->university,
- $approval_date
- );
- $i++;
- } //$row = $result->fetchObject()
- $preference_header = array(
- 'No',
- 'Flowsheet Project',
- 'Contributor Name',
- 'University / Institute',
- 'Year'
- );
- $page_content .= theme('table', array(
- 'header' => $preference_header,
- 'rows' => $preference_rows
- ));
- }
- return $page_content;
-}
-
-
-
-
-
-
-
-function dwsim_flowsheet_progress_tab()
-{
- $page_content = "";
- $query = db_select('dwsim_flowsheet_proposal');
- $query->fields('dwsim_flowsheet_proposal');
- $query->condition('approval_status', 1);
- $query->condition('is_completed', 0);
- $query->orderBy('approval_date', 'DESC');
- $result = $query->execute();
- if ($result->rowCount() == 0)
- {
- $page_content .= "Approved Proposals under Flowsheeting Project
";
- } //$result->rowCount() == 0
- else
- {
- $page_content .= "Approved Proposals under Flowsheeting Project
";;
- $preference_rows = array();
- $i = 1;
- while ($row = $result->fetchObject())
- {
- $approval_date = date("Y", $row->approval_date);
- $preference_rows[] = array(
- $i,
- $row->project_title,
- $row->contributor_name,
- $row->university,
- $approval_date
- );
- $i++;
- } //$row = $result->fetchObject()
- $preference_header = array(
- 'No',
- 'Flowsheet Project',
- 'Contributor Name',
- 'University / Institute',
- 'Year'
- );
- $page_content .= theme('table', array(
- 'header' => $preference_header,
- 'rows' => $preference_rows
- ));
- }
- return $page_content;
-}
-
-function dwsim_flowsheet_completed_tab_form($form, $form_state){
- /*$options_first = _list_of_flowsheet_project();
- $selected = isset($form_state['values']['howmany_select']) ? $form_state['values']['howmany_select'] : key($options_first);*/
- $form['howmany_select'] = array(
- '#title' => t('Sorting projects according to year:'),
- '#type' => 'select',
- '#options' => array(2017 => 2017, 2018 => 2018, 2019 => 2019, 2020 => 2020, 2021 => 2021),
- //'#default_value' => $selected,
- '#ajax' => array(
- 'callback' => 'ajax_example_autocheckboxes_callback',
- //'wrapper' => 'checkboxes-div',
- /*'method' => 'replace',
- 'effect' => 'fade',*/
- ),
- '#suffix' => ''
-
- );
- return $form;
-}
-
-function ajax_example_autocheckboxes_callback($form, $form_state)
-{
- $commands = array();
- $flowsheet_project_default_value = $form_state['values']['howmany_select'];
- //var_dump($flowsheet_project_default_value);die;
- if ($flowsheet_project_default_value != 0)
- {
- $commands[] = ajax_command_replace('#ajax_selected_flowsheet', _flowsheet_details($flowsheet_project_default_value));
- } //$flowsheet_project_default_value != 0
- else
- {
- $commands[] = ajax_command_replace('#ajax_selected_flowsheet', '');
- $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){
- //var_dump($flowsheet_proposal_id);die;
- $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));
- //$sql = $result->execute();
- //var_dump($result);die;
- if ($result->rowCount() == 0)
- {
- $output .= "Work has been completed for the following flow sheets.";
-
- } //$result->rowCount() == 0
- else
- {
- $output .= "Work has been completed for the following flow sheets";
- $preference_rows = array();
- $i = 1;
- while ($row = $result->fetchObject())
- {
- $completion_date = date("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++;
- } //$row = $result->fetchObject()
- $preference_header = array(
- 'No',
- 'Flowsheet Project',
- 'Contributor Name',
- 'University / Institute',
- 'Year of Completion'
- );
- $output .= theme('table', array(
- 'header' => $preference_header,
- 'rows' => $preference_rows
- ));
- }
- return $output;
-}
-
-function _list_of_flowsheet_project()
-{
- $options_first = array(
- '0' => 'Please select...'
- );
- if(isset($form_state['values']['howmany_select'])) {
- $rows = db_select('dwsim_flowsheet_proposal', 'actual_completion_date')
- ->fields('actual_completion_date')
- ->condition('approval_status', $form_state['values']['howmany_select'])
- ->execute()
- ->fetchAll();
-
- $header = array();
- $form['results']['#markup'] = theme('table', array('header' => $header, 'rows' => $rows));
- }
- else {
- $form['results']['#markup'] = 'The results will appear here when you change the dropdown option.
';
- }
-}
\ No newline at end of file
--
cgit
From 9f39f8be1dca02cb2aa4c525df7159d91167ca18 Mon Sep 17 00:00:00 2001
From: Saketh1499
Date: Wed, 8 Sep 2021 11:31:33 +0530
Subject: Modified approved and uploaded proposal tabs
---
additional_tabs.inc | 37 +++++++++++++++++++------------------
dwsim_flowsheet.module | 2 +-
2 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/additional_tabs.inc b/additional_tabs.inc
index ff29956..9df713d 100644
--- a/additional_tabs.inc
+++ b/additional_tabs.inc
@@ -1,21 +1,21 @@
fields('dwsim_flowsheet_proposal');
$query->condition('approval_status', 1);
- $query->condition('is_completed', 0);
$query->orderBy('approval_date', 'DESC');
- $result = $query->execute();
+ $result = $query->execute();*/
+ $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
";
} //$result->rowCount() == 0
else
{
- $page_content .= "Approved Proposals under Flowsheeting Project
";;
+ $page_content .= "Approved Proposals under Flowsheeting Project: " . $result->rowCount() . "
";
$preference_rows = array();
$i = 1;
while ($row = $result->fetchObject())
@@ -35,7 +35,7 @@ function dwsim_flowsheet_progress_tab()
'Flowsheet Project',
'Contributor Name',
'University / Institute',
- 'Year'
+ 'Date of Approval'
);
$page_content .= theme('table', array(
'header' => $preference_header,
@@ -54,10 +54,11 @@ function dwsim_flowsheet_progress_tab()
function dwsim_flowsheet_uploaded_tab()
{
$page_content = "";
- $result = db_query("SELECT dfp.project_title, dfp.contributor_name, dfp.university, dfp.approval_date
- FROM dwsim_flowsheet_proposal dfp LEFT JOIN dwsim_flowsheet_submitted_abstracts dfsa
- ON dfp.id= dfsa.proposal_id WHERE approval_status = 1
- AND user_defined_compound_filepath = 'NULL' ORDER BY dfsa.abstract_upload_date DESC");
+
+ /*$result = db_query("SELECT dfp.project_title, dfp.contributor_name, dfp.university, dfp.approval_date , dfsa.abstract_upload_date FROM dwsim_flowsheet_proposal dfp LEFT JOIN dwsim_flowsheet_submitted_abstracts dfsa
+ ON dfp.id= dfsa.proposal_id WHERE dfp.approval_status = 1 ORDER BY dfsa.abstract_upload_date DESC");*/
+
+ $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");
//var_dump($result);die;
//$result = $query->execute();
@@ -67,18 +68,18 @@ function dwsim_flowsheet_uploaded_tab()
} //$result->rowCount() == 0
else
{
- $page_content .= "Uploaded Proposals under Flowsheeting Project
";;
+ $page_content .= "Uploaded Proposals under Flowsheeting Project: " . $result->rowCount() . "
";
$preference_rows = array();
$i = 1;
while ($row = $result->fetchObject())
{
- $approval_date = date("d-M-Y", $row->approval_date);
+ $abstract_upload_date = date("d-M-Y", $row->abstract_upload_date);
$preference_rows[] = array(
$i,
$row->project_title,
$row->contributor_name,
$row->university,
- $approval_date
+ $abstract_upload_date
);
$i++;
} //$row = $result->fetchObject()
@@ -87,7 +88,7 @@ function dwsim_flowsheet_uploaded_tab()
'Flowsheet Project',
'Contributor Name',
'University / Institute',
- 'Year'
+ 'Date of submission'
);
$page_content .= theme('table', array(
'header' => $preference_header,
@@ -156,7 +157,7 @@ function _flowsheet_details($flowsheet_proposal_id)
$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)
{
@@ -165,12 +166,12 @@ function _flowsheet_details($flowsheet_proposal_id)
}
else
{
- $output .= "Work has been completed for the following flow sheets";
+ $output .= "Work has been completed for the following flow sheets: " . $result->rowCount() . "
";
$preference_rows = array();
$i = 1;
while ($row = $result->fetchObject())
{
- $completion_date = date("Y", $row->actual_completion_date);
+ $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.'))),
@@ -185,7 +186,7 @@ function _flowsheet_details($flowsheet_proposal_id)
'Flowsheet Project',
'Contributor Name',
'University / Institute',
- 'Year of Completion'
+ 'Date of Completion'
);
$output .= theme('table', array(
'header' => $preference_header,
diff --git a/dwsim_flowsheet.module b/dwsim_flowsheet.module
index d0765dc..e481ec0 100755
--- a/dwsim_flowsheet.module
+++ b/dwsim_flowsheet.module
@@ -59,7 +59,7 @@ function dwsim_flowsheet_menu()
$items['flowsheeting-project/manage-proposal/approved_proposals'] = array(
'title' => 'Approved Proposals',
'description' => 'Approved Proposals',
- 'page callback' => 'dwsim_flowsheet_progress_tab',
+ 'page callback' => 'dwsim_flowsheet_approved_tab',
'access callback' => 'user_access',
'access arguments' => array(
'dwsim flowsheet manage proposal'
--
cgit
From 3e95ebb0cf7902d52b2a2233f71dceb91bdd6f06 Mon Sep 17 00:00:00 2001
From: Saketh1499
Date: Wed, 8 Sep 2021 12:49:30 +0530
Subject: Modified proposals tabs
---
dwsim_flowsheet.module | 6 +-
proposal_tabs.inc | 200 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 203 insertions(+), 3 deletions(-)
create mode 100644 proposal_tabs.inc
diff --git a/dwsim_flowsheet.module b/dwsim_flowsheet.module
index e481ec0..490668f 100755
--- a/dwsim_flowsheet.module
+++ b/dwsim_flowsheet.module
@@ -66,7 +66,7 @@ function dwsim_flowsheet_menu()
),
'type' => MENU_LOCAL_TASK,
'weight' => 3,
- 'file' => 'additional_tabs.inc'
+ 'file' => 'proposal_tabs.inc'
);
$items['flowsheeting-project/manage-proposal/uploaded_proposals'] = array(
'title' => 'Uploaded Proposals',
@@ -78,7 +78,7 @@ function dwsim_flowsheet_menu()
),
'type' => MENU_LOCAL_TASK,
'weight' => 4,
- 'file' => 'additional_tabs.inc'
+ 'file' => 'proposal_tabs.inc'
);
$items['flowsheeting-project/manage-proposal/completed_proposals'] = array(
'title' => 'Completed Proposals',
@@ -91,7 +91,7 @@ function dwsim_flowsheet_menu()
),
'type' => MENU_LOCAL_TASK,
'weight' => 5,
- 'file' => 'additional_tabs.inc'
+ 'file' => 'proposal_tabs.inc'
);
$items['flowsheeting-project/manage-proposal/approve'] = array(
'title' => 'Approve Proposal',
diff --git a/proposal_tabs.inc b/proposal_tabs.inc
new file mode 100644
index 0000000..64549dd
--- /dev/null
+++ b/proposal_tabs.inc
@@ -0,0 +1,200 @@
+fields('dwsim_flowsheet_proposal');
+ $query->condition('approval_status', 1);
+ $query->orderBy('approval_date', 'DESC');
+ $result = $query->execute();*/
+ $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
";
+ } //$result->rowCount() == 0
+ else
+ {
+ $page_content .= "Approved Proposals under Flowsheeting Project: " . $result->rowCount() . "
";
+ $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++;
+ } //$row = $result->fetchObject()
+ $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 Uploaded proposals
+
+function dwsim_flowsheet_uploaded_tab()
+{
+ $page_content = "";
+
+ /*$result = db_query("SELECT dfp.project_title, dfp.contributor_name, dfp.university, dfp.approval_date , dfsa.abstract_upload_date FROM dwsim_flowsheet_proposal dfp LEFT JOIN dwsim_flowsheet_submitted_abstracts dfsa
+ ON dfp.id= dfsa.proposal_id WHERE dfp.approval_status = 1 ORDER BY dfsa.abstract_upload_date DESC");*/
+
+ $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");
+ //var_dump($result);die;
+
+ //$result = $query->execute();
+ if ($result->rowCount() == 0)
+ {
+ $page_content .= "Uploaded Proposals under Flowsheeting Project
";
+ } //$result->rowCount() == 0
+ else
+ {
+ $page_content .= "Uploaded Proposals under Flowsheeting Project: " . $result->rowCount() . "
";
+ $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++;
+ } //$row = $result->fetchObject()
+ $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 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' => ''
+
+ );
+ 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() . "
";
+ $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
--
cgit
From 9a4bb0ebf3dfc7e11c309ecdcd4f09cb047e4e1f Mon Sep 17 00:00:00 2001
From: Saketh1499
Date: Wed, 8 Sep 2021 12:57:05 +0530
Subject: Modified proposals tabs
---
proposal_tabs.inc | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/proposal_tabs.inc b/proposal_tabs.inc
index 64549dd..d9d91c8 100644
--- a/proposal_tabs.inc
+++ b/proposal_tabs.inc
@@ -4,11 +4,6 @@
function dwsim_flowsheet_approved_tab()
{
$page_content = "";
- /*$query = db_select('dwsim_flowsheet_proposal');
- $query->fields('dwsim_flowsheet_proposal');
- $query->condition('approval_status', 1);
- $query->orderBy('approval_date', 'DESC');
- $result = $query->execute();*/
$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)
{
@@ -30,7 +25,7 @@ function dwsim_flowsheet_approved_tab()
$approval_date
);
$i++;
- } //$row = $result->fetchObject()
+ }
$preference_header = array(
'No',
'Flowsheet Project',
@@ -56,18 +51,12 @@ function dwsim_flowsheet_approved_tab()
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");
- /*$result = db_query("SELECT dfp.project_title, dfp.contributor_name, dfp.university, dfp.approval_date , dfsa.abstract_upload_date FROM dwsim_flowsheet_proposal dfp LEFT JOIN dwsim_flowsheet_submitted_abstracts dfsa
- ON dfp.id= dfsa.proposal_id WHERE dfp.approval_status = 1 ORDER BY dfsa.abstract_upload_date DESC");*/
-
- $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");
- //var_dump($result);die;
-
- //$result = $query->execute();
if ($result->rowCount() == 0)
{
$page_content .= "Uploaded Proposals under Flowsheeting Project
";
- } //$result->rowCount() == 0
+ }
else
{
$page_content .= "Uploaded Proposals under Flowsheeting Project: " . $result->rowCount() . "
";
@@ -84,7 +73,7 @@ function dwsim_flowsheet_uploaded_tab()
$abstract_upload_date
);
$i++;
- } //$row = $result->fetchObject()
+ }
$preference_header = array(
'No',
'Flowsheet Project',
--
cgit
From 85f9aca5bafe1150580fdc330fb6638f63f8958d Mon Sep 17 00:00:00 2001
From: Saketh1499
Date: Wed, 8 Sep 2021 14:08:58 +0530
Subject: Modified proposals tabs
---
dwsim_flowsheet.module | 6 +-
proposal_tabs.inc | 189 -----------------------------------------------
proposals_review_tab.inc | 189 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 192 insertions(+), 192 deletions(-)
delete mode 100644 proposal_tabs.inc
create mode 100644 proposals_review_tab.inc
diff --git a/dwsim_flowsheet.module b/dwsim_flowsheet.module
index 490668f..302f003 100755
--- a/dwsim_flowsheet.module
+++ b/dwsim_flowsheet.module
@@ -66,7 +66,7 @@ function dwsim_flowsheet_menu()
),
'type' => MENU_LOCAL_TASK,
'weight' => 3,
- 'file' => 'proposal_tabs.inc'
+ 'file' => 'proposals_review_tab.inc'
);
$items['flowsheeting-project/manage-proposal/uploaded_proposals'] = array(
'title' => 'Uploaded Proposals',
@@ -78,7 +78,7 @@ function dwsim_flowsheet_menu()
),
'type' => MENU_LOCAL_TASK,
'weight' => 4,
- 'file' => 'proposal_tabs.inc'
+ 'file' => 'proposals_review_tab.inc'
);
$items['flowsheeting-project/manage-proposal/completed_proposals'] = array(
'title' => 'Completed Proposals',
@@ -91,7 +91,7 @@ function dwsim_flowsheet_menu()
),
'type' => MENU_LOCAL_TASK,
'weight' => 5,
- 'file' => 'proposal_tabs.inc'
+ 'file' => 'proposals_review_tab.inc'
);
$items['flowsheeting-project/manage-proposal/approve'] = array(
'title' => 'Approve Proposal',
diff --git a/proposal_tabs.inc b/proposal_tabs.inc
deleted file mode 100644
index d9d91c8..0000000
--- a/proposal_tabs.inc
+++ /dev/null
@@ -1,189 +0,0 @@
-rowCount() == 0)
- {
- $page_content .= "Approved Proposals under Flowsheeting Project
";
- } //$result->rowCount() == 0
- else
- {
- $page_content .= "Approved Proposals under Flowsheeting Project: " . $result->rowCount() . "
";
- $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 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
";
- }
- else
- {
- $page_content .= "Uploaded Proposals under Flowsheeting Project: " . $result->rowCount() . "
";
- $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 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' => ''
-
- );
- 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() . "
";
- $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
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 @@
+rowCount() == 0)
+ {
+ $page_content .= "Approved Proposals under Flowsheeting Project
";
+ } //$result->rowCount() == 0
+ else
+ {
+ $page_content .= "Approved Proposals under Flowsheeting Project: " . $result->rowCount() . "
";
+ $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
";
+ }
+ else
+ {
+ $page_content .= "Uploaded Proposals under Flowsheeting Project: " . $result->rowCount() . "
";
+ $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' => ''
+
+ );
+ 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() . "
";
+ $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
--
cgit
From d5aead56f5a92e77e918fffccc034137b43f664e Mon Sep 17 00:00:00 2001
From: Saketh1499
Date: Wed, 8 Sep 2021 14:31:48 +0530
Subject: Delete additional_tabs.inc
---
additional_tabs.inc | 197 ----------------------------------------------------
1 file changed, 197 deletions(-)
delete mode 100644 additional_tabs.inc
diff --git a/additional_tabs.inc b/additional_tabs.inc
deleted file mode 100644
index 9df713d..0000000
--- a/additional_tabs.inc
+++ /dev/null
@@ -1,197 +0,0 @@
-fields('dwsim_flowsheet_proposal');
- $query->condition('approval_status', 1);
- $query->orderBy('approval_date', 'DESC');
- $result = $query->execute();*/
- $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
";
- } //$result->rowCount() == 0
- else
- {
- $page_content .= "Approved Proposals under Flowsheeting Project: " . $result->rowCount() . "
";
- $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++;
- } //$row = $result->fetchObject()
- $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;
-}
-
-
-///////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////
-
-
-function dwsim_flowsheet_uploaded_tab()
-{
- $page_content = "";
-
- /*$result = db_query("SELECT dfp.project_title, dfp.contributor_name, dfp.university, dfp.approval_date , dfsa.abstract_upload_date FROM dwsim_flowsheet_proposal dfp LEFT JOIN dwsim_flowsheet_submitted_abstracts dfsa
- ON dfp.id= dfsa.proposal_id WHERE dfp.approval_status = 1 ORDER BY dfsa.abstract_upload_date DESC");*/
-
- $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");
- //var_dump($result);die;
-
- //$result = $query->execute();
- if ($result->rowCount() == 0)
- {
- $page_content .= "Uploaded Proposals under Flowsheeting Project
";
- } //$result->rowCount() == 0
- else
- {
- $page_content .= "Uploaded Proposals under Flowsheeting Project: " . $result->rowCount() . "
";
- $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++;
- } //$row = $result->fetchObject()
- $preference_header = array(
- 'No',
- 'Flowsheet Project',
- 'Contributor Name',
- 'University / Institute',
- 'Date of submission'
- );
- $page_content .= theme('table', array(
- 'header' => $preference_header,
- 'rows' => $preference_rows
- ));
- }
- return $page_content;
-}
-
-
-///////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////
-
-
-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' => ''
-
- );
- 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() . "
";
- $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
--
cgit