From 15dca07df6dd9d49257c86228092eac0382a3897 Mon Sep 17 00:00:00 2001 From: Saketh1499 Date: Thu, 21 Oct 2021 12:18:04 +0530 Subject: Updating columns in the interface --- download.inc | 53 ++++++++++++++++++++++++++++++++++-------------- proposals_review_tab.inc | 2 +- 2 files changed, 39 insertions(+), 16 deletions(-) mode change 100644 => 100755 proposals_review_tab.inc diff --git a/download.inc b/download.inc index c33084d..790d45a 100755 --- a/download.inc +++ b/download.inc @@ -308,7 +308,7 @@ function dwsim_flowsheet_download_proposals() { $root_path = dwsim_flowsheet_path(); - $result = db_query("SELECT e.contributor_name as Contirbutor_Name, u.mail as Email_ID, e.project_title as Title, e.contact_no as Contact, e.university as University, from_unixtime(creation_date,'%d-%m-%Y') as creation, from_unixtime(approval_date,'%d-%m-%Y') as approval, from_unixtime(actual_completion_date,'%d-%m-%Y') as Year, e.approval_status as Status FROM dwsim_flowsheet_proposal as e JOIN users as u ON e.uid = u.uid WHERE e.approval_status=3 ORDER BY actual_completion_date DESC"); + $result = db_query("SELECT e.contributor_name as contirbutor_name, u.mail as email_id, e.project_title as title, e.contact_no as contact, e.university as university, from_unixtime(creation_date,'%d-%m-%Y') as creation, from_unixtime(approval_date,'%d-%m-%Y') as approval, from_unixtime(actual_completion_date,'%d-%m-%Y') as year, e.approval_status as status FROM dwsim_flowsheet_proposal as e JOIN users as u ON e.uid = u.uid ORDER BY actual_completion_date DESC"); //var_dump($result->rowCount());die(); //$all_proposals_q = $result->execute(); @@ -327,23 +327,46 @@ function dwsim_flowsheet_download_proposals() 'Status of the proposal' ); fputcsv($fp, $items); - while($row = $result->fetchObject()) { - if($row->Status == 3){ - $Status = "Completed"; - } - else{ - $Status = "Proposal In Progress"; - } + while($row = $result->fetchObject()) + { + $status = ''; + switch ($row->status) + { + case 0: + $status = 'Pending'; + break; + case 1: + $status = 'Approved'; + break; + case 2: + $status = 'Dis-approved'; + break; + case 3: + $status = 'Completed'; + break; + default: + $status = 'Unknown'; + break; + } //$row->status + if ($row->year == 0) + { + $year = "Not Completed"; + } //$row->year == 0 + else + { + $year = date('d-m-Y', $row->year); + } + $items = array( - $row->Contirbutor_Name, - $row->Email_ID, - $row->Title, - $row->University, - $row->Contact, + $row->contirbutor_name, + $row->email_id, + $row->title, + $row->university, + $row->contact, $row->creation, $row->approval, - $row->Year, - $Status + $row->year, + $status ); fputcsv($fp, $items); } diff --git a/proposals_review_tab.inc b/proposals_review_tab.inc old mode 100644 new mode 100755 index bccb440..7584a6e --- a/proposals_review_tab.inc +++ b/proposals_review_tab.inc @@ -151,7 +151,7 @@ function _flowsheet_details_year_wise() $flowsheet_years = array( '0' => 'Please select...' ); - $result = db_query("SELECT from_unixtime(actual_completion_date, '%Y ') as Year from dwsim_flowsheet_proposal WHERE approval_status = 3"); + $result = db_query("SELECT from_unixtime(actual_completion_date, '%Y ') as Year from dwsim_flowsheet_proposal WHERE approval_status = 3 ORDER BY Year ASC"); /*$query = db_select('dwsim_flowsheet_proposal'); $query->fields('dwsim_flowsheet_proposal'); -- cgit