summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcustom_model.module41
-rwxr-xr-xcustom_model_details.inc4
-rwxr-xr-xmanage_proposal.inc59
-rwxr-xr-xproposal.inc9
-rwxr-xr-xproposals_review_tab.inc207
5 files changed, 314 insertions, 6 deletions
diff --git a/custom_model.module b/custom_model.module
index 046c667..c65ecc3 100755
--- a/custom_model.module
+++ b/custom_model.module
@@ -69,7 +69,7 @@ function custom_model_menu()
'custom model manage proposal'
),
'type' => MENU_LOCAL_TASK,
- 'weight' => 4,
+ 'weight' => 2,
'file' => 'manage_proposal.inc'
);
$items['custom-model/manage-proposal/idea-proposals'] = array(
@@ -81,9 +81,46 @@ function custom_model_menu()
'custom model manage proposal'
),
'type' => MENU_LOCAL_TASK,
- 'weight' => 5,
+ 'weight' => 3,
'file' => 'manage_proposal.inc'
);
+ $items['custom-model/manage-proposal/approved-proposals'] = array(
+ 'title' => 'Approved Proposals',
+ 'description' => 'Approved Proposals',
+ 'page callback' => 'dwsim_custom_model_approved_tab',
+ 'access callback' => 'user_access',
+ 'access arguments' => array(
+ 'custom model manage proposal'
+ ),
+ 'type' => MENU_LOCAL_TASK,
+ 'weight' => 4,
+ 'file' => 'proposals_review_tab.inc'
+ );
+ $items['custom-model/manage-proposal/uploaded-proposals'] = array(
+ 'title' => 'Uploaded Proposals',
+ 'description' => 'Uploaded Proposals',
+ 'page callback' => 'dwsim_custom_model_uploaded_tab',
+ 'access callback' => 'user_access',
+ 'access arguments' => array(
+ 'custom model manage proposal'
+ ),
+ 'type' => MENU_LOCAL_TASK,
+ 'weight' => 5,
+ 'file' => 'proposals_review_tab.inc'
+ );
+ $items['custom-model/manage-proposal/completed-proposals'] = array(
+ 'title' => 'Completed Proposals',
+ 'description' => 'Completed Proposals',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('dwsim_custom_model_completed_tab_form'),
+ 'access callback' => 'user_access',
+ 'access arguments' => array(
+ 'custom model manage proposal'
+ ),
+ 'type' => MENU_LOCAL_TASK,
+ 'weight' => 6,
+ 'file' => 'proposals_review_tab.inc'
+ );
$items['custom-model/manage-proposal/approve'] = array(
'title' => 'Approve Proposal',
'description' => 'Approve Proposal',
diff --git a/custom_model_details.inc b/custom_model_details.inc
index 592a8b3..903eec8 100755
--- a/custom_model_details.inc
+++ b/custom_model_details.inc
@@ -19,7 +19,7 @@ function custom_model_completed_proposals_all()
{
$output .= "Work has been completed for the following custom model. We welcome your contributions." . "<hr>";
$preference_rows = array();
- $i = 1;
+ $i = $result->rowCount();
while ($row = $result->fetchObject())
{
$proposal_id = $row->id;
@@ -31,7 +31,7 @@ function custom_model_completed_proposals_all()
$row->university,
$completion_date
);
- $i++;
+ $i--;
} //$row = $result->fetchObject()
$preference_header = array(
'No',
diff --git a/manage_proposal.inc b/manage_proposal.inc
index 9b7341e..2fe9066 100755
--- a/manage_proposal.inc
+++ b/manage_proposal.inc
@@ -703,6 +703,11 @@ function custom_model_proposal_edit_form($form, &$form_state)
'#required' => TRUE,
'#default_value' => $proposal_data->contributor_name
);
+ $form['contributor_contact_no'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Contact No.'),
+ '#default_value' => $proposal_data->contact_no
+ );
$form['student_email_id'] = array(
'#type' => 'item',
'#title' => t('Email'),
@@ -730,6 +735,28 @@ function custom_model_proposal_edit_form($form, &$form_state)
'#required' => TRUE,
'#default_value' => $proposal_data->university
);
+ $form['department'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Department / Branch'),
+ '#options' => _cm_list_of_departments(),
+ '#default_value' => $proposal_data->department
+ );
+ $form['other_department'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Department/Branch name not in list'),
+ '#size' => 100,
+ '#attributes' => array(
+ 'placeholder' => t('Enter your department name')
+ ),
+ '#states' => array(
+ 'visible' => array(
+ ':input[name="department"]' => array(
+ 'value' => 'Others'
+ )
+ )
+ ),
+ '#default_value' => $proposal_data->other_department
+ );
$form['country'] = array(
'#type' => 'select',
'#title' => t('Country'),
@@ -827,6 +854,12 @@ function custom_model_proposal_edit_form($form, &$form_state)
'placeholder' => 'Insert pincode of your city/ village....'
)
);
+ $form['version'] = array(
+ '#type' => 'textfield',
+ '#title' => t('DWSIM Version'),
+ '#options' => _list_of_software_versions(),
+ '#default_value' => $proposal_data->version,
+ );
$form['project_title'] = array(
'#type' => 'textarea',
'#title' => t('Title of the Custom Model'),
@@ -836,14 +869,36 @@ function custom_model_proposal_edit_form($form, &$form_state)
'#default_value' => $proposal_data->project_title
);
$form['reference'] = array(
- '#type' => 'textarea',
+ '#type' => 'textfield',
'#title' => t('Reference'),
'#size' => 10000,
'#attributes' => array(
- 'placeholder' => 'Links of must be provided....'
+ 'placeholder' => 'Enter Reference'
),
'#default_value' => $proposal_data->reference
);
+ $form['script_used'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Script used to create the Custom Model'),
+ /*'#options' => array(
+ 'Scilab' => 'Scilab',
+ 'IronPython' => 'IronPython'
+ ),*/
+ '#default_value' => $proposal_data->script_used
+ );
+ /*$form['samplefile'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Upload Abstract of Custom Model'),
+ '#collapsible' => FALSE,
+ '#collapsed' => FALSE
+ );*/
+ $form/*['samplefile']*/['samplefilepath'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Uploaded Abstract of Custom Model'),
+ //'#title' => t('Upload circuit diagram'),
+ '#default_value' => $proposal_data->samplefilepath
+ );
+
$form['delete_proposal'] = array(
'#type' => 'checkbox',
'#title' => t('Delete Proposal')
diff --git a/proposal.inc b/proposal.inc
index 2f644b1..633f360 100755
--- a/proposal.inc
+++ b/proposal.inc
@@ -228,6 +228,15 @@ function custom_model_proposal_form($form, &$form_state, $no_js_use = FALSE)
'#description' => t('Maximum character limit is 250'),
'#required' => TRUE
);
+ $form['reference'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Reference'),
+ '#size' => 10000,
+ '#attributes' => array(
+ 'placeholder' => 'Enter Reference'
+ ),
+ '#required' => TRUE,
+ );
$form['script_used'] = array(
'#type' => 'select',
'#title' => t('Script used to create the Custom Model'),
diff --git a/proposals_review_tab.inc b/proposals_review_tab.inc
new file mode 100755
index 0000000..4b90a81
--- /dev/null
+++ b/proposals_review_tab.inc
@@ -0,0 +1,207 @@
+<?php
+
+//Proposal tab for reviewing approved proposals
+function dwsim_custom_model_approved_tab()
+{
+ $page_content = "";
+ $result = db_query("SELECT * from custom_model_proposal where id not in (select proposal_id from custom_model_submitted_abstracts) AND approval_status = 1 order by approval_date desc");
+ if ($result->rowCount() == 0)
+ {
+ $page_content .= "Approved Proposals under Custom Model Project: " . $result->rowCount() . "<hr>";
+ } //$result->rowCount() == 0
+ else
+ {
+ $page_content .= "Approved Proposals under Custom Model 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',
+ 'Custom Model Project',
+ 'Contributor Name',
+ 'University / Institute',
+ 'Year of Completion'
+ );
+ $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_custom_model_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 custom_model_proposal as dfp JOIN custom_model_submitted_abstracts as dfa on dfa.proposal_id = dfp.id where dfp.id in (select proposal_id from custom_model_submitted_abstracts) AND approval_status = 1");
+
+ if ($result->rowCount() == 0)
+ {
+ $page_content .= "Uploaded Proposals under Custom Model Project: " . $result->rowCount() . "<hr>";
+ }
+ else
+ {
+ $page_content .= "Uploaded Proposals under Custom Model 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',
+ 'Custom Model Project',
+ 'Contributor Name',
+ 'University / Institute',
+ 'Year of Completion'
+ );
+ $page_content .= theme('table', array(
+ 'header' => $preference_header,
+ 'rows' => $preference_rows
+ ));
+ }
+ return $page_content;
+}
+
+
+///////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////
+
+//Proposal tab for reviewing Completed proposals
+
+function dwsim_custom_model_completed_tab_form($form, $form_state)
+{
+ $options_first = _custom_model_details_year_wise();
+ $selected = isset($form_state['values']['howmany_select']) ? $form_state['values']['howmany_select'] : key($options_first);
+ $form = array();
+ $form['howmany_select'] = array(
+ '#title' => t('Sorting projects according to year:'),
+ '#type' => 'select',
+ '#options' => _custom_model_details_year_wise(),
+ /*'#options' => array(
+ 'Please select...' => 'Please select...',
+ '2017' => '2017',
+ '2018' => '2018',
+ '2019' => '2019',
+ '2020' => '2020',
+ '2021' => '2021'),*/
+ '#default_value' => $selected,
+ '#ajax' => array(
+ 'callback' => 'ajax_example_autocheckboxes_callback',
+ ),
+ '#suffix' => '<div id="ajax-selected-custom-model"></div>'
+
+ );
+ return $form;
+}
+
+
+function ajax_example_autocheckboxes_callback($form, $form_state)
+{
+ $commands = array();
+ $custom_model_project_default_value = $form_state['values']['howmany_select'];
+ if ($custom_model_project_default_value != 0)
+ {
+ $form['howmany_select']['#options'] = array('Please select...' => 'Please select...');
+ $commands[] = ajax_command_html('#ajax-selected-custom-model', _custom_model_details($custom_model_project_default_value));
+ $commands[] = ajax_command_replace('#ajax_selected_custom_model_action', drupal_render($form['howmany_select']));
+
+ }
+ else
+ {
+ $form['howmany_select']['#options'] = array('Please select...' => 'Please select...');
+ $commands[] = ajax_command_data('#ajax_selected_custom_model', 'form_state_value_select', $form_state['values']['howmany_select']);
+ }
+ return array(
+ '#type' => 'ajax',
+ '#commands' => $commands
+ );
+}
+
+
+function _custom_model_details_year_wise()
+ {
+ $custom_model_years = array(
+ '0' => 'Please select...'
+ );
+ $result = db_query("SELECT from_unixtime(actual_completion_date, '%Y ') as Year from custom_model_proposal WHERE approval_status = 3 ORDER BY Year ASC");
+ while ($year_wise_list_data = $result->fetchObject())
+ {
+ $custom_model_years[$year_wise_list_data->Year] = $year_wise_list_data->Year;
+ }
+ return $custom_model_years;
+ }
+
+
+function _custom_model_details($custom_model_proposal_id)
+{
+ $output = "";
+ $result = db_query("SELECT * from {custom_model_proposal} WHERE approval_status = 3 and from_unixtime(actual_completion_date, '%Y') = :year",
+ array(
+ ':year' => $custom_model_proposal_id)
+ );
+
+ if ($result->rowCount() == 0)
+ {
+ $output .= "Work has been completed for the following custom model Project:" . $result->rowCount() . "<hr>";
+
+ }
+ else
+ {
+ $output .= "Work has been completed for the following custom model Project:" . $result->rowCount() . "<hr>";
+ $preference_rows = array();
+ $i = 1;
+ while ($row = $result->fetchObject())
+ {
+ $proposal_id = $row->id;
+ $completion_date = date("Y", $row->actual_completion_date);
+ $preference_rows[] = array(
+ $i,
+ l($row->project_title, "custom-model/custom-model-run/" . $row->id) . t("<br><strong>(Script used: ") . $row->script_used . t(")</strong>"),
+ $row->contributor_name,
+ $row->university,
+ $completion_date
+ );
+ $i++;
+ } //$row = $result->fetchObject()
+ $preference_header = array(
+ 'No',
+ 'Custom Model Project',
+ 'Contributor Name',
+ 'University / Institute',
+ 'Year of Completion'
+ );
+ $output .= theme('table', array(
+ 'header' => $preference_header,
+ 'rows' => $preference_rows
+ ));
+ }
+ return $output;
+ } \ No newline at end of file