summaryrefslogtreecommitdiff
path: root/notes.inc
diff options
context:
space:
mode:
authorprashant2015-11-04 19:06:22 +0530
committerprashant2015-11-04 19:06:22 +0530
commit1ba859d4f6b4fc64ac51eadc6bc1a5fa40869590 (patch)
tree1b4947d59b876ad80c053b0432250720b8e4207f /notes.inc
parentdee787c3aa6237b6bf732cdcd205265d10f26b97 (diff)
downloadDWSIM_lab_migration-1ba859d4f6b4fc64ac51eadc6bc1a5fa40869590.tar.gz
DWSIM_lab_migration-1ba859d4f6b4fc64ac51eadc6bc1a5fa40869590.tar.bz2
DWSIM_lab_migration-1ba859d4f6b4fc64ac51eadc6bc1a5fa40869590.zip
changed mail functions and formated the code
Diffstat (limited to 'notes.inc')
-rwxr-xr-xnotes.inc203
1 files changed, 94 insertions, 109 deletions
diff --git a/notes.inc b/notes.inc
index 8b0bc98..8e7c144 100755
--- a/notes.inc
+++ b/notes.inc
@@ -1,119 +1,104 @@
<?php
// $Id$
-
/******************************************************************************/
/***************************** BOOK NOTES *************************************/
/******************************************************************************/
-
-function lab_migration_lab_notes_form($form_state)
-{
- global $user;
-
- /* get current proposal */
- $proposal_id = (int)arg(3);
- //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $proposal_id);
- $query = db_select('lab_migration_proposal');
- $query->fields('lab_migration_proposal');
- $query->condition('id', $proposal_id);
- $query->range(0, 1);
- $proposal_q = $query->execute();
- $proposal_data = $proposal_q->fetchObject();
- if (!$proposal_data)
+function lab_migration_lab_notes_form($form,$form_state)
{
- drupal_set_message(t('Invalid lab selected. Please try again.'), 'error');
- drupal_goto('lab_migration/code_approval');
- return;
+ global $user;
+ /* get current proposal */
+ $proposal_id = (int) arg(3);
+ //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $proposal_id);
+ $query = db_select('lab_migration_proposal');
+ $query->fields('lab_migration_proposal');
+ $query->condition('id', $proposal_id);
+ $query->range(0, 1);
+ $proposal_q = $query->execute();
+ $proposal_data = $proposal_q->fetchObject();
+ if (!$proposal_data)
+ {
+ drupal_set_message(t('Invalid lab selected. Please try again.'), 'error');
+ drupal_goto('lab-migration/code-approval');
+ return;
+ }
+ /* get current notes */
+ $notes = '';
+ //$notes_q = db_query("SELECT * FROM {lab_migration_notes} WHERE proposal_id = %d LIMIT 1", $proposal_id);
+ $query = db_select('lab_migration_notes');
+ $query->fields('lab_migration_notes');
+ $query->condition('proposal_id', $proposal_id);
+ $query->range(0, 1);
+ $notes_q = $query->execute();
+ if ($notes_q)
+ {
+ $notes_data = $notes_q->fetchObject();
+ $notes = $notes_data->notes;
+ }
+ $form['lab_details'] = array(
+ '#type' => 'item',
+ '#value' => '<span style="color: rgb(128, 0, 0);"><strong>About the Lab</strong></span><br />' . '<strong>Proposer:</strong> ' . $proposal_data->name . '<br />' . '<strong>Title of the Lab:</strong> ' . $proposal_data->lab_title . '<br />'
+ );
+ $form['notes'] = array(
+ '#type' => 'textarea',
+ '#rows' => 20,
+ '#title' => t('Notes for Reviewers'),
+ '#default_value' => $notes
+ );
+ $form['submit'] = array(
+ '#type' => 'submit',
+ '#value' => t('Submit')
+ );
+ $form['cancel'] = array(
+ '#type' => 'markup',
+ '#value' => l(t('Back'), 'lab-migration/code-approval')
+ );
+ return $form;
}
-
- /* get current notes */
- $notes = '';
- //$notes_q = db_query("SELECT * FROM {lab_migration_notes} WHERE proposal_id = %d LIMIT 1", $proposal_id);
- $query = db_select('lab_migration_notes');
- $query->fields('lab_migration_notes');
- $query->condition('proposal_id', $proposal_id);
- $query->range(0, 1);
- $notes_q = $query->execute();
-
- if ($notes_q)
- {
- $notes_data = $notes_q->fetchObject();
- $notes = $notes_data->notes;
- }
-
- $form['lab_details'] = array(
- '#type' => 'item',
- '#value' => '<span style="color: rgb(128, 0, 0);"><strong>About the Lab</strong></span><br />' .
- '<strong>Proposer:</strong> ' . $proposal_data->name . '<br />' .
- '<strong>Title of the Lab:</strong> ' . $proposal_data->lab_title . '<br />'
- );
-
- $form['notes'] = array(
- '#type' => 'textarea',
- '#rows' => 20,
- '#title' => t('Notes for Reviewers'),
- '#default_value' => $notes,
- );
-
- $form['submit'] = array(
- '#type' => 'submit',
- '#value' => t('Submit')
- );
-
- $form['cancel'] = array(
- '#type' => 'markup',
- '#value' => l(t('Back'), 'lab_migration/code_approval'),
- );
- return $form;
-}
-
function lab_migration_lab_notes_form_submit($form, &$form_state)
-{
- global $user;
-
- /* get current proposal */
- $proposal_id = (int)arg(3);
- //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $proposal_id);
- $query = db_select('lab_migration_proposal');
- $query->fields('lab_migration_proposal');
- $query->condition('id', $proposal_id);
- $query->range(0, 1);
- $proposal_q = $query->execute();
- $proposal_data = $proposal_q->fetchObject();
- if (!$proposal_data)
{
- drupal_set_message(t('Invalid lab selected. Please try again.'), 'error');
- drupal_goto('lab_migration/code_approval');
- return;
- }
-
- /* find existing notes */
- //$notes_q = db_query("SELECT * FROM {lab_migration_notes} WHERE proposal_id = %d LIMIT 1", $proposal_id);
- $query = db_select('lab_migration_notes');
- $query->fields('lab_migration_notes');
- $query->condition('proposal_id', $proposal_id);
- $query->range(0, 1);
- $notes_q = $query->execute();
-
-
- $notes_data = $notes_q->fetchObject();
-
- /* add or update notes in database */
- if ($notes_data) {
- $query = "UPDATE {lab_migration_notes} SET notes = :notes WHERE id = :notes_id";
- $args = array(
- ":notes" => $form_state['values']['notes'],
- ":notes_id" => $notes_data->id,
- );
- db_query($query, $args);
- drupal_set_message('Notes updated successfully.', 'status');
- } else {
- $query = "INSERT INTO {lab_migration_notes} (proposal_id, notes) VALUES (:proposal_id, :notes)";
- $args = array(
- ":proposal_id" => $proposal_id,
- ":notes" =>$form_state['values']['notes'],
- );
- db_query($query, $args);
- drupal_set_message('Notes added successfully.', 'status');
+ global $user;
+ /* get current proposal */
+ $proposal_id = (int) arg(3);
+ //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $proposal_id);
+ $query = db_select('lab_migration_proposal');
+ $query->fields('lab_migration_proposal');
+ $query->condition('id', $proposal_id);
+ $query->range(0, 1);
+ $proposal_q = $query->execute();
+ $proposal_data = $proposal_q->fetchObject();
+ if (!$proposal_data)
+ {
+ drupal_set_message(t('Invalid lab selected. Please try again.'), 'error');
+ drupal_goto('lab-migration/code-approval');
+ return;
+ }
+ /* find existing notes */
+ //$notes_q = db_query("SELECT * FROM {lab_migration_notes} WHERE proposal_id = %d LIMIT 1", $proposal_id);
+ $query = db_select('lab_migration_notes');
+ $query->fields('lab_migration_notes');
+ $query->condition('proposal_id', $proposal_id);
+ $query->range(0, 1);
+ $notes_q = $query->execute();
+ $notes_data = $notes_q->fetchObject();
+ /* add or update notes in database */
+ if ($notes_data)
+ {
+ $query = "UPDATE {lab_migration_notes} SET notes = :notes WHERE id = :notes_id";
+ $args = array(
+ ":notes" => $form_state['values']['notes'],
+ ":notes_id" => $notes_data->id
+ );
+ db_query($query, $args);
+ drupal_set_message('Notes updated successfully.', 'status');
+ }
+ else
+ {
+ $query = "INSERT INTO {lab_migration_notes} (proposal_id, notes) VALUES (:proposal_id, :notes)";
+ $args = array(
+ ":proposal_id" => $proposal_id,
+ ":notes" => $form_state['values']['notes']
+ );
+ db_query($query, $args);
+ drupal_set_message('Notes added successfully.', 'status');
+ }
}
-}
-