summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfossee-dell2017-08-30 11:28:42 +0530
committerfossee-dell2017-08-30 11:28:42 +0530
commit31c85860d821af590b312740157c153040f98289 (patch)
treee3a3977fffaa25e016ea5c71f7d02bb20b4a931f
parent1d1dcba8bbab9979009261148f89adcb4a8c6991 (diff)
downloadesim_circuit_simulation_project_module-31c85860d821af590b312740157c153040f98289.tar.gz
esim_circuit_simulation_project_module-31c85860d821af590b312740157c153040f98289.tar.bz2
esim_circuit_simulation_project_module-31c85860d821af590b312740157c153040f98289.zip
Minor issues fixed
-rwxr-xr-xcircuit_simulation.module14
-rwxr-xr-xcircuit_simulation_details.inc33
-rwxr-xr-xdownload.inc10
-rwxr-xr-xfull_download.inc102
-rwxr-xr-xrun.inc14
5 files changed, 99 insertions, 74 deletions
diff --git a/circuit_simulation.module b/circuit_simulation.module
index 27ebdc0..4ad4242 100755
--- a/circuit_simulation.module
+++ b/circuit_simulation.module
@@ -319,7 +319,7 @@ function circuit_simulation_menu()
$items['circuit-simulation-project/full-download/experiment'] = array(
'title' => 'Code Download',
'description' => 'Code Download',
- 'page callback' => 'circuit_simulation_download_full_experiment',
+ 'page callback' => 'circuit_simulation_download_completed_project',
'access arguments' => array(
'esim circuit simulation approve code'
),
@@ -337,7 +337,7 @@ function circuit_simulation_menu()
'file' => 'full_download.inc'
);
/* COMPLETED esim circuit simulationS */
- $items['circuit-simulation-project/completed-circuit-simulation'] = array(
+ $items['circuit-simulation-project/completed-circuit-simulations'] = array(
'title' => 'Completed Circuit Simulations',
'page callback' => 'circuit_simulation_completed_proposals_all',
'access arguments' => array(
@@ -641,6 +641,10 @@ function circuit_simulation_path()
{
return $_SERVER['DOCUMENT_ROOT'] . base_path() . 'esim_uploads/circuit_simulation_uploads/';
}
+function circuit_simulation_file_path($value='')
+{
+ return $_SERVER['DOCUMENT_ROOT'] . base_path() . 'esim_uploads/';
+}
/************************* USER VERIFICATION FUNCTIONS ************************/
function circuit_simulation_get_proposal()
{
@@ -748,7 +752,7 @@ function _df_list_of_thermodynamic_packages()
$esim_thermodynamic_packages[$esim_thermodynamic_packages_list_data->thermodynamic_packages] = $esim_thermodynamic_packages_list_data->thermodynamic_packages;
} //$esim_thermodynamic_packages_list_data = $esim_thermodynamic_packages_list->fetchObject()
return $esim_thermodynamic_packages;
-}*/
+}*//*
function _df_list_of_logical_block()
{
$esim_logical_block = array();
@@ -761,7 +765,7 @@ function _df_list_of_logical_block()
$esim_logical_block[$esim_logical_block_list_data->logical_block] = $esim_logical_block_list_data->logical_block;
} //$esim_logical_block_list_data = $esim_logical_block_list->fetchObject()
return $esim_logical_block;
-}
+}*/
function _df_list_of_states()
{
$states = array(
@@ -901,7 +905,7 @@ function CreateReadmeFileeSimCircuitSimulationProject($proposal_id)
$root_path = circuit_simulation_path();
$readme_file = fopen($root_path . $proposal_data->directory_name . "/README.txt", "w") or die("Unable to open file!");
$txt = "";
- $txt .= "About the lab";
+ $txt .= "About the Circuit Simulation";
$txt .= "\n" . "\n";
$txt .= "Title Of The Circuit Simulation Project: " . $proposal_data->project_title . "\n";
$txt .= "Proposar Name: " . $proposal_data->name_title . " " . $proposal_data->contributor_name . "\n";
diff --git a/circuit_simulation_details.inc b/circuit_simulation_details.inc
index 57d422a..64fd9f5 100755
--- a/circuit_simulation_details.inc
+++ b/circuit_simulation_details.inc
@@ -23,7 +23,8 @@ function circuit_simulation_completed_proposals_all()
$approval_date = date("Y", $row->approval_date);
$preference_rows[] = array(
$i,
- l($row->project_title, "circuit-simulation-project/esim-circuit-simulation-run/" . $row->id, array('attributes' => array('title' => 'This is a zip file containing a pdf (abstract) and a dwxml/dwxmz file which is the eSim circuit simulation which is to be viewed by right clicking on the file and opening with eSim.'))),
+ l($row->project_title, "circuit-simulation-project/esim-circuit-simulation-run/" . $row->id),
+ $row->contributor_name,
$row->university,
$approval_date
);
@@ -32,6 +33,7 @@ function circuit_simulation_completed_proposals_all()
$preference_header = array(
'No',
'Circuit Simulation Project',
+ 'Contributor Name',
'Institute',
'Year'
);
@@ -58,14 +60,31 @@ function circuit_simulation_progress_all()
else
{
$page_content .= "Work is in progress for the following circuit simulation under Circuit Simulation Project<hr>";
- $page_content .= "<ol>";
+ $preference_rows = array();
+ $i = 1;
while ($row = $result->fetchObject())
{
- $page_content .= "<li>";
- $page_content .= $row->project_title;
- $page_content .= "</li>";
+ $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()
- $page_content .= "</ol>";
+ $preference_header = array(
+ 'No',
+ 'Circuit Simulation Project',
+ 'Contributor Name',
+ 'Institute',
+ 'Year'
+ );
+ $page_content .= theme('table', array(
+ 'header' => $preference_header,
+ 'rows' => $preference_rows
+ ));
}
return $page_content;
-}
+} \ No newline at end of file
diff --git a/download.inc b/download.inc
index 1daad51..7e545ca 100755
--- a/download.inc
+++ b/download.inc
@@ -121,7 +121,7 @@ function circuit_simulation_download_solution()
while ($solution_dependency_files_row = $solution_dependency_files_q->fetchObject())
{
//$dependency_file_data = (db_query("SELECT * FROM {circuit_simulation_dependency_files} WHERE id = %d LIMIT 1", $solution_dependency_files_row->dependency_id))->fetchObject();
- $query = db_select('esim_esim_circuit_simulation_dependency_files');
+ $query = db_select('esim_circuit_simulation_dependency_files');
$query->fields('esim_circuit_simulation_dependency_files');
$query->condition('id', $solution_dependency_files_row->dependency_id);
$query->range(0, 1);
@@ -154,7 +154,7 @@ function circuit_simulation_download_experiment()
$root_path = circuit_simulation_path();
/* get solution data */
//$experiment_q = db_query("SELECT * FROM {esim_circuit_simulation_experiment} WHERE id = %d", $experiment_id);
- $query = db_select('esim_esim_circuit_simulation_experiment');
+ $query = db_select('esim_circuit_simulation_experiment');
$query->fields('esim_circuit_simulation_experiment');
$query->condition('id', $experiment_id);
$experiment_q = $query->execute();
@@ -166,7 +166,7 @@ function circuit_simulation_download_experiment()
$zip = new ZipArchive;
$zip->open($zip_filename, ZipArchive::CREATE);
//$solution_q = db_query("SELECT * FROM {esim_circuit_simulation_solution} WHERE experiment_id = %d AND approval_status = 1", $experiment_id);
- $query = db_select('esim_esim_circuit_simulation_solution');
+ $query = db_select('esim_circuit_simulation_solution');
$query->fields('esim_circuit_simulation_solution');
$query->condition('experiment_id', $experiment_id);
$query->condition('approval_status', 1);
@@ -188,14 +188,14 @@ function circuit_simulation_download_experiment()
$zip->addFile($root_path . $solution_files_row->directory_name . '/' . $solution_files_row->filepath, $EXP_PATH . $CODE_PATH . str_replace(' ', '_', ($solution_files_row->filename)));
} //$solution_files_row = $solution_files_q->fetchObject()
/* dependency files */
- $query = db_select('esim_esim_circuit_simulation_solution_dependency');
+ $query = db_select('esim_circuit_simulation_solution_dependency');
$query->fields('esim_circuit_simulation_solution_dependency');
$query->condition('solution_id', $solution_row->id);
$solution_dependency_files_q = $query->execute();
while ($solution_dependency_files_row = $solution_dependency_files_q->fetchObject())
{
//$dependency_file_data = (db_query("SELECT * FROM {circuit_simulation_dependency_files} WHERE id = %d LIMIT 1", $solution_dependency_files_row->dependency_id))->fetchObject();
- $query = db_select('esim_esim_circuit_simulation_dependency_files');
+ $query = db_select('esim_circuit_simulation_dependency_files');
$query->fields('esim_circuit_simulation_dependency_files');
$query->condition('id', $solution_dependency_files_row->dependency_id);
$query->range(0, 1);
diff --git a/full_download.inc b/full_download.inc
index 48ed080..932b4d7 100755
--- a/full_download.inc
+++ b/full_download.inc
@@ -1,45 +1,45 @@
<?php
// $Id$
-function circuit_simulation_download_full_project() {
+function circuit_simulation_download_full_project()
+{
global $user;
- $circuit_simulation_id = arg(3);
+ $id = arg(3);
$root_path = circuit_simulation_path();
$query = db_select('esim_circuit_simulation_proposal');
$query->fields('esim_circuit_simulation_proposal');
- $query->condition('id', $circuit_simulation_id);
+ $query->condition('id', $id);
$circuit_simulation_q = $query->execute();
$circuit_simulation_data = $circuit_simulation_q->fetchObject();
- $FLOWSHEET_PATH = $circuit_simulation_data->directory_name . '/';
-
+ $CIRCUITSIMULATION_PATH = $circuit_simulation_data->directory_name . '/';
/* zip filename */
$zip_filename = $root_path . 'zip-' . time() . '-' . rand(0, 999999) . '.zip';
/* creating zip archive on the server */
- //var_dump($zip_filename);die;
$zip = new ZipArchive();
- //var_dump($zip);die;
- $zip->open($zip_filename, ZipArchive::CREATE);
+ $zip->open($zip_filename, ZipArchive::CREATE);
$query = db_select('esim_circuit_simulation_proposal');
$query->fields('esim_circuit_simulation_proposal');
- $query->condition('id', $circuit_simulation_id);
+ $query->condition('id', $id);
$circuit_simulation_udc_q = $query->execute();
-
while ($circuit_simulation_udc_row = $circuit_simulation_udc_q->fetchObject()) {
- if ($circuit_simulation_udc_row->user_defined_compound_filepath || $circuit_simulation_udc_row->user_defined_compound_filepath != 'NULL') {
- $USER_DEFINED_PATH = 'user_defined_compound/';
-
- $zip->addFile($root_path . $FLOWSHEET_PATH . '/' . $circuit_simulation_udc_row->user_defined_compound_filepath, $USER_DEFINED_PATH . str_replace(' ', '_', basename($circuit_simulation_udc_row->user_defined_compound_filepath)));
- } //$circuit_simulation_udc_row->user_defined_compound_filepath || $circuit_simulation_udc_row->user_defined_compound_filepath != 'NULL'
- } //$circuit_simulation_udc_row = $circuit_simulation_udc_q->fetchObject()
- $query = db_select('esim_circuit_simulation_submitted_abstracts_file');
- $query->fields('esim_circuit_simulation_submitted_abstracts_file');
- $query->condition('proposal_id', $circuit_simulation_id);
- $circuit_simulation_f_q = $query->execute();
- while ($circuit_simulation_f_row = $circuit_simulation_f_q->fetchObject()) {
- $zip->addFile($root_path . $FLOWSHEET_PATH . '/' . $circuit_simulation_f_row->filepath, str_replace(' ', '_', basename($circuit_simulation_f_row->filename)));
- } //$circuit_simulation_f_row = $circuit_simulation_f_q->fetchObject()
- $zip_file_count = $zip->numFiles;
+ if ($circuit_simulation_udc_row->samplefilepath != 'NULL') {
+ $REFERENCE_PATH = 'reference_file/';
+ $str = substr($circuit_simulation_udc_row->samplefilepath,strrpos($circuit_simulation_udc_row->samplefilepath, '/'));
+ $resource_file =ltrim($str, '/');
+ $zip->addFile($root_path . $CIRCUITSIMULATION_PATH . $resource_file , $REFERENCE_PATH . str_replace(' ', '_', basename($resource_file)));
+ } //$CIRCUITSIMULATION_udc_row->user_defined_compound_filepath || $CIRCUITSIMULATION_udc_row->user_defined_compound_filepath != 'NULL'
+ } //$CIRCUITSIMULATION_udc_row = $CIRCUITSIMULATION_udc_q->fetchObject()
+ $query = db_select('esim_circuit_simulation_proposal');
+ $query->fields('esim_circuit_simulation_proposal');
+ $query->condition('id', $id);
+ //$circuit_simulation_f_q = $query->execute();
+ /*while ($circuit_simulation_data) {
+ $str = substr($circuit_simulation_data->samplefilepath,strrpos($circuit_simulation_data->samplefilepath, '/'));
+ $resource_file =ltrim($str, '/');
+ $zip->addFile($root_path . $CIRCUITSIMULATION_PATH . $resource_file);
+ //var_dump($root_path . $CIRCUITSIMULATION_PATH . $resource_file);die;
+ } //$CIRCUITSIMULATION_f_row = $CIRCUITSIMULATION_f_q->fetchObject()
+ */$zip_file_count = $zip->numFiles;
$zip->close();
- //var_dump($zip_file_count);die;
if ($zip_file_count > 0) {
if ($user->uid) {
/* download zip file */
@@ -67,46 +67,49 @@ function circuit_simulation_download_full_project() {
}
} //$zip_file_count > 0
else {
- drupal_set_message("There are circuit_simulation project in this proposal to download", 'error');
+ drupal_set_message("There are no circuit simulation project in this proposal to download", 'error');
drupal_goto('circuit-simulation-project/full-download/project');
}
}
function circuit_simulation_download_completed_project()
{
- global $user;
- $circuit_simulation_id = arg(3);
+ global $user;
+ $id = arg(3);
$root_path = circuit_simulation_path();
$query = db_select('esim_circuit_simulation_proposal');
$query->fields('esim_circuit_simulation_proposal');
- $query->condition('id', $circuit_simulation_id);
+ $query->condition('id', $id);
$circuit_simulation_q = $query->execute();
$circuit_simulation_data = $circuit_simulation_q->fetchObject();
- $FLOWSHEET_PATH = $circuit_simulation_data->directory_name . '/';
+ $CIRCUITSIMULATION_PATH = $circuit_simulation_data->directory_name . '/';
/* zip filename */
$zip_filename = $root_path . 'zip-' . time() . '-' . rand(0, 999999) . '.zip';
/* creating zip archive on the server */
$zip = new ZipArchive();
- //var_dump($zip);die;
$zip->open($zip_filename, ZipArchive::CREATE);
- var_dump($zip);die;
$query = db_select('esim_circuit_simulation_proposal');
$query->fields('esim_circuit_simulation_proposal');
- $query->condition('id', $circuit_simulation_id);
+ $query->condition('id', $id);
$circuit_simulation_udc_q = $query->execute();
while ($circuit_simulation_udc_row = $circuit_simulation_udc_q->fetchObject()) {
- if ($circuit_simulation_udc_row->user_defined_compound_filepath || $circuit_simulation_udc_row->user_defined_compound_filepath != 'NULL') {
- $USER_DEFINED_PATH = 'user_defined_compound/';
- $zip->addFile($root_path . $FLOWSHEET_PATH . '/' . $circuit_simulation_udc_row->user_defined_compound_filepath, $USER_DEFINED_PATH . str_replace(' ', '_', basename($circuit_simulation_udc_row->user_defined_compound_filepath)));
- } //$circuit_simulation_udc_row->user_defined_compound_filepath || $circuit_simulation_udc_row->user_defined_compound_filepath != 'NULL'
- } //$circuit_simulation_udc_row = $circuit_simulation_udc_q->fetchObject()
- $query = db_select('esim_circuit_simulation_submitted_abstracts_file');
- $query->fields('esim_circuit_simulation_submitted_abstracts_file');
- $query->condition('proposal_id', $circuit_simulation_id);
- $circuit_simulation_f_q = $query->execute();
- while ($circuit_simulation_f_row = $circuit_simulation_f_q->fetchObject()) {
- $zip->addFile($root_path . $FLOWSHEET_PATH . '/' . $circuit_simulation_f_row->filepath, str_replace(' ', '_', basename($circuit_simulation_f_row->filename)));
- } //$circuit_simulation_f_row = $circuit_simulation_f_q->fetchObject()
- $zip_file_count = $zip->numFiles;
+ if ($circuit_simulation_udc_row->samplefilepath != 'NULL') {
+ $REFERENCE_PATH = 'reference_file/';
+ $str = substr($circuit_simulation_udc_row->samplefilepath,strrpos($circuit_simulation_udc_row->samplefilepath, '/'));
+ $resource_file =ltrim($str, '/');
+ $zip->addFile($root_path . $CIRCUITSIMULATION_PATH . $resource_file , $REFERENCE_PATH . str_replace(' ', '_', basename($resource_file)));
+ } //$CIRCUITSIMULATION_udc_row->user_defined_compound_filepath || $CIRCUITSIMULATION_udc_row->user_defined_compound_filepath != 'NULL'
+ } //$CIRCUITSIMULATION_udc_row = $CIRCUITSIMULATION_udc_q->fetchObject()
+ $query = db_select('esim_circuit_simulation_proposal');
+ $query->fields('esim_circuit_simulation_proposal');
+ $query->condition('id', $id);
+ //$circuit_simulation_f_q = $query->execute();
+ /*while ($circuit_simulation_data) {
+ $str = substr($circuit_simulation_data->samplefilepath,strrpos($circuit_simulation_data->samplefilepath, '/'));
+ $resource_file =ltrim($str, '/');
+ $zip->addFile($root_path . $CIRCUITSIMULATION_PATH . $resource_file);
+ //var_dump($root_path . $CIRCUITSIMULATION_PATH . $resource_file);die;
+ } //$CIRCUITSIMULATION_f_row = $CIRCUITSIMULATION_f_q->fetchObject()
+ */$zip_file_count = $zip->numFiles;
$zip->close();
if ($zip_file_count > 0) {
if ($user->uid) {
@@ -135,8 +138,7 @@ function circuit_simulation_download_completed_project()
}
} //$zip_file_count > 0
else {
- drupal_set_message("There are circuit_simulation project in this proposal to download", 'error');
- drupal_goto('circuit-simulation-project/esim-circuit_simulation-run');
+ drupal_set_message("There are circuit simulation project in this proposal to download", 'error');
+ drupal_goto('circuit-simulation-project/full-download/project');
}
-}
-
+} \ No newline at end of file
diff --git a/run.inc b/run.inc
index cde8434..4436bd2 100755
--- a/run.inc
+++ b/run.inc
@@ -44,7 +44,7 @@ function circuit_simulation_run_form($form, &$form_state)
);
$form['selected_circuit_simulation'] = array(
'#type' => 'item',
- '#markup' => '<div id="ajax_selected_circuit_simulation">' . l('Download Circuit Simulation', 'circuit_simulationing-project/full-download/project/' . $circuit_simulation_default_value,array('attributes' => array('title' => 'This is a zip file containing a pdf (abstract) and a dwxml/dwxmz file which is the eSim circuit simulation which is to be viewed by right clicking on the file and opening with eSim.'))) . '</div>'
+ '#markup' => '<div id="ajax_selected_circuit_simulation">' . l('Download Circuit Simulation', 'circuit-simulation-project/full-download/project/' . $circuit_simulation_default_value) . '</div>'
);
}
return $form;
@@ -58,7 +58,7 @@ function circuit_simulation_project_details_callback($form, $form_state)
$circuit_simulation_details = _circuit_simulation_information($circuit_simulation_default_value);
$provider = user_load($circuit_simulation_details->uid);
if ($circuit_simulation_details->uid > 0) {
- $commands[] = ajax_command_html('#ajax_selected_circuit_simulation', l('Download Circuit Simulation', 'circuit-simulation-project/full-download/project/' . $circuit_simulation_default_valuei,array('attributes' => array('title' => 'This is a zip file containing a pdf (abstract) and a dwxml/dwxmz file which is the eSim circuit simulation which is to be viewed by right clicking on the file and opening with eSim.'))));
+ $commands[] = ajax_command_html('#ajax_selected_circuit_simulation', l('Download Circuit Simulation', 'circuit-simulation-project/full-download/project/' . $circuit_simulation_default_value));
} //$circuit_simulation_details->uid > 0
else {
$commands[] = ajax_command_html('#ajax_selected_circuit_simulation', '');
@@ -108,8 +108,8 @@ function _list_of_circuit_simulation()
'0' => 'Please select...'
);
//$lab_titles_q = db_query("SELECT * FROM {circuit_simulation_proposal} WHERE solution_display = 1 ORDER BY lab_title ASC");
- $query = db_select('circuit_simulation_proposal');
- $query->fields('circuit_simulation_proposal');
+ $query = db_select('esim_circuit_simulation_proposal');
+ $query->fields('esim_circuit_simulation_proposal');
$query->condition('approval_status', 3);
$query->orderBy('project_title', 'ASC');
$circuit_simulation_titles_q = $query->execute();
@@ -120,8 +120,8 @@ function _list_of_circuit_simulation()
}
function _circuit_simulation_information($proposal_id)
{
- $query = db_select('circuit_simulation_proposal');
- $query->fields('circuit_simulation_proposal');
+ $query = db_select('esim_circuit_simulation_proposal');
+ $query->fields('esim_circuit_simulation_proposal');
$query->condition('id', $proposal_id);
$query->condition('approval_status', 3);
$circuit_simulation_q = $query->execute();
@@ -143,7 +143,7 @@ function _circuit_simulation_details($circuit_simulation_default_value)
}else{
$reference = 'Not provided';
}
- $form['circuit_simulation_details']['#markup'] = '<span style="color: rgb(128, 0, 0);"><strong>About the Circuit Simulation</strong></span></td><td style="width: 35%;"><br />' . '<ul>' . '<li><strong>Proposer Name:</strong> ' . $circuit_simulation_details->name_title . ' ' . $circuit_simulation_details->contributor_name . '</li>' . '<li><strong>Title of the Flowhseet:</strong> ' . l($circuit_simulation_details->project_title,'circuit-simulation-project/full-download/project/' . $circuit_simulation_default_value,array('attributes' => array('title' => 'This is a zip file containing a pdf (abstract) and a dwxml/dwxmz file which is the eSim circuit simulation which is to be viewed by right clicking on the file and opening with eSim.'))) . '</li>' . '<li><strong>University:</strong> ' . $circuit_simulation_details->university . '</li>' . '<li>'.'<strong>Reference:</strong> ' . $reference .'</li>'.'</ul>';
+ $form['circuit_simulation_details']['#markup'] = '<span style="color: rgb(128, 0, 0);"><strong>About the Circuit Simulation</strong></span></td><td style="width: 35%;"><br />' . '<ul>' . '<li><strong>Proposer Name:</strong> ' . $circuit_simulation_details->name_title . ' ' . $circuit_simulation_details->contributor_name . '</li>' . '<li><strong>Title of the Flowhseet:</strong> ' . l($circuit_simulation_details->project_title,'circuit-simulation-project/full-download/project/' . $circuit_simulation_default_value) . '</li>' . '<li><strong>University:</strong> ' . $circuit_simulation_details->university . '</li>' . '<li>'.'<strong>Reference:</strong> ' . $reference .'</li>'.'</ul>';
$details = $form['circuit_simulation_details']['#markup'];
return $details;
} //$circuit_simulation_default_value != 0