summaryrefslogtreecommitdiff
path: root/code_approval.inc
diff options
context:
space:
mode:
authorprashantsinalkar2016-09-28 11:14:12 +0530
committerprashantsinalkar2016-09-28 11:14:12 +0530
commit190f92390e88325e549aa3d4fd80bf93e32d3969 (patch)
treebfc827b1c4888f2f1a0e43228e170f4b3f228753 /code_approval.inc
parentbc25cb7b6b9b138bc29fcc74b96f6d4e64689e58 (diff)
downloadscilab_textbook_companion-190f92390e88325e549aa3d4fd80bf93e32d3969.tar.gz
scilab_textbook_companion-190f92390e88325e549aa3d4fd80bf93e32d3969.tar.bz2
scilab_textbook_companion-190f92390e88325e549aa3d4fd80bf93e32d3969.zip
changes mail subject header
Diffstat (limited to 'code_approval.inc')
-rwxr-xr-xcode_approval.inc46
1 files changed, 31 insertions, 15 deletions
diff --git a/code_approval.inc b/code_approval.inc
index d315228..76e0dbd 100755
--- a/code_approval.inc
+++ b/code_approval.inc
@@ -284,7 +284,7 @@ function code_approval_form_submit($form, &$form_state)
/******************************************************************************/
/********************************* BULK APPROVAL ******************************/
/******************************************************************************/
-function bulk_approval_form($form, $form_state)
+function bulk_approval_form($form, &$form_state)
{
$options_first = _bulk_list_of_books();
$options_two = _ajax_bulk_get_chapter_list();
@@ -452,7 +452,6 @@ function bulk_approval_form($form, $form_state)
}
function bulk_approval_submit_validate($form, &$form_state)
{
- //var_dump('test');
if (($form_state['values']['book_actions'] == 0) && ($form_state['values']['chapter_actions'] == 0) && ($form_state['values']['example_actions'] == 0))
drupal_set_message("Wrong selection of action. Please select any one action1", 'error');
return;
@@ -473,8 +472,10 @@ function bulk_approval_form_submit($form, &$form_state)
{
global $user;
$root_path = textbook_companion_path();
+
if ($form_state['clicked_button']['#value'] == 'Submit')
{
+ $book_name = db_query("SELECT * FROM {textbook_companion_preference} WHERE preference_id = :book_id",array(":book_id"=>form_state['values']['book']));
if ($form_state['values']['book'])
del_book_pdf($form_state['values']['book']);
if (user_access('bulk manage code'))
@@ -502,9 +503,9 @@ function bulk_approval_form_submit($form, &$form_state)
} //$chapter_data = $chapter_q->fetchObject()
drupal_set_message(t('Approved Entire Book.'), 'status');
/* email */
- $email_subject = t('Your uploaded examples have been approved');
+ $email_subject = t('[scilab.in] Your uploaded examples have been approved');
$email_body = array(
- 0 => t('Your all the uploaded examples for the book have been approved.')
+ 0 => t('Your all the uploaded examples for the book '. $book_name .' have been approved.')
);
} //($form_state['values']['book_actions'] == 1) && ($form_state['values']['chapter_actions'] == 0) && ($form_state['values']['example_actions'] == 0)
else if (($form_state['values']['book_actions'] == 2) && ($form_state['values']['chapter_actions'] == 0) && ($form_state['values']['example_actions'] == 0))
@@ -527,9 +528,9 @@ function bulk_approval_form_submit($form, &$form_state)
} //$chapter_data = $chapter_q->fetchObject()
drupal_set_message(t('Pending Review Entire Book.'), 'status');
/* email */
- $email_subject = t('Your uploaded examples have been marked as pending');
+ $email_subject = t('[scilab.in] Your uploaded examples have been marked as pending');
$email_body = array(
- 0 => t('Your all the uploaded examples for the book have been marked as pending to be review. You will be able to see the exmaples after they have been approved by one of our reviewers.')
+ 0 => t('Your all the uploaded examples for the book '. $book_name .' have been marked as pending to be review. You will be able to see the exmaples after they have been approved by one of our reviewers.')
);
} //($form_state['values']['book_actions'] == 2) && ($form_state['values']['chapter_actions'] == 0) && ($form_state['values']['example_actions'] == 0)
else if (($form_state['values']['book_actions'] == 3) && ($form_state['values']['chapter_actions'] == 0) && ($form_state['values']['example_actions'] == 0))
@@ -548,9 +549,9 @@ function bulk_approval_form_submit($form, &$form_state)
drupal_set_message(t('Error Dis-Approving and Deleting Entire Book.'), 'error');
}
/* email */
- $email_subject = t('Your uploaded examples have been marked as dis-approved');
+ $email_subject = t('[scilab.in] Your uploaded examples have been marked as dis-approved');
$email_body = array(
- 0 => t('Your all the uploaded examples for the whole book have been marked as dis-approved.
+ 0 => t('Your all the uploaded examples for the whole book '. $book_name .' have been marked as dis-approved.
Reason for dis-approval:
@@ -603,6 +604,7 @@ Reason for dis-approval:
$query->condition('id', $form_state['values']['book']);
$result = $query->execute();
$preference_data = $result->fetchObject();
+ $book_name = $preference_data->book;
$proposal_id = $preference_data->proposal_id;
/*db_query("DELETE FROM {textbook_companion_preference} WHERE proposal_id = %d", $proposal_id);*/
$query = db_delete('textbook_companion_preference');
@@ -614,7 +616,7 @@ Reason for dis-approval:
$num_deleted = $query->execute();
drupal_set_message(t('Deleted Book Proposal.'), 'status');
/* email */
- $email_subject = t('Your uploaded examples including the book proposal have been deleted');
+ $email_subject = t('[scilab.in] Your uploaded examples including the book '. $book_name .' proposal have been deleted');
$email_body = array(
0 => t('Your all the uploaded examples including the book have been deleted permanently.
@@ -641,7 +643,7 @@ Reason for deletion:
$num_updated = $query->execute();
drupal_set_message(t('Approved Entire Chapter.'), 'status');
/* email */
- $email_subject = t('Your uploaded examples have been approved');
+ $email_subject = t('[scilab.in] Your uploaded examples have been approved');
$email_body = array(
0 => t('Your all the uploaded examples for the chapter have been approved.')
);
@@ -657,7 +659,7 @@ Reason for deletion:
$num_updated = $query->execute();
drupal_set_message(t('Entire Chapter marked as Pending Review.'), 'status');
/* email */
- $email_subject = t('Your uploaded examples have been marked as pending');
+ $email_subject = t('[scilab.in] Your uploaded examples have been marked as pending');
$email_body = array(
0 => t('Your all the uploaded examples for the chapter have been marked as pending to be review.')
);
@@ -678,7 +680,7 @@ Reason for deletion:
drupal_set_message(t('Error Dis-Approving and Deleting Entire Chapter.'), 'error');
}
/* email */
- $email_subject = t('Your uploaded example have been marked as dis-approved');
+ $email_subject = t('[scilab.in] Your uploaded example have been marked as dis-approved');
$email_body = array(
0 => t('Your uploaded example for the entire chapter have been marked as dis-approved.
@@ -699,7 +701,7 @@ Reason for dis-approval:
$num_updated = $query->execute();
drupal_set_message(t('Example approved.'), 'status');
/* email */
- $email_subject = t('Your uploaded example has been approved');
+ $email_subject = t('[scilab.in] Your uploaded example has been approved');
$email_body = array(
0 => t('Your uploaded example has been approved.')
);
@@ -715,7 +717,7 @@ Reason for dis-approval:
$num_updated = $query->execute();
drupal_set_message(t('Example marked as Pending Review.'), 'status');
/* email */
- $email_subject = t('Your uploaded example has been marked as pending');
+ $email_subject = t('[scilab.in] Your uploaded example has been marked as pending');
$email_body = array(
0 => t('Your uploaded example has been marked as pending to be review.')
);
@@ -731,7 +733,7 @@ Reason for dis-approval:
drupal_set_message(t('Error Dis-Approving and Deleting Example.'), 'error');
}
/* email */
- $email_subject = t('Your uploaded example has been marked as dis-approved');
+ $email_subject = t('[scilab.in] Your uploaded example has been marked as dis-approved');
$email_body = array(
0 => t('Your uploaded example has been marked as dis-approved.
@@ -744,6 +746,20 @@ Reason for dis-approval:
if ($email_subject)
{
$email_to = $user->mail;
+ $from = variable_get('textbook_companion_from_email', '');
+ $bcc = variable_get('textbook_companion_emails', '');
+ $cc = variable_get('textbook_companion_cc_emails', '');
+ //$params['proposal_disapproved']['proposal_id'] = $proposal_id;
+ //$params['proposal_disapproved']['user_id'] = $row->uid;
+ $params['standard']['headers'] = array(
+ 'From' => $from,
+ 'MIME-Version' => '1.0',
+ 'Content-Type' => 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer' => 'Drupal',
+ 'Cc' => $cc,
+ 'Bcc' => $bcc
+ );
$params['standard']['subject'] = $email_subject;
$params['standard']['body'] = $email_body;
if (!drupal_mail('textbook_companion', 'standard', $email_to, language_default(), $params, variable_get('textbook_companion_from_email', NULL), TRUE))