summaryrefslogtreecommitdiff
path: root/email.inc
diff options
context:
space:
mode:
Diffstat (limited to 'email.inc')
-rwxr-xr-xemail.inc916
1 files changed, 513 insertions, 403 deletions
diff --git a/email.inc b/email.inc
index 0f7f650..6900d0b 100755
--- a/email.inc
+++ b/email.inc
@@ -1,52 +1,54 @@
<?php
-
/**
* Implementation of hook_mail().
*/
function lab_migration_mail($key, &$message, $params)
-{
-
- global $user;
- $language = $message['language'];
- //$language = user_preferred_language($user);
- switch ($key)
{
- case 'solution_proposal_approved':
-
- /* initializing data */
- //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['solution_proposal_approved']['proposal_id']);
- $query = db_select('lab_migration_proposal');
- $query->fields('lab_migration_proposal');
- $query->condition('id', $params['solution_proposal_approved']['proposal_id']);
- $query->range(0, 1);
- $proposal_q = $query->execute();
- $proposal_data = $proposal_q->fetchObject();
-
- if ($proposal_data->solution_display == 1) {
- $solution_display = 'Yes';
- } else {
- $solution_display = 'No';
- }
-
- // $experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['solution_proposal_approved']['proposal_id'], 1);
- $query = db_select('lab_migration_experiment');
- $query->fields('lab_migration_experiment');
- $query->condition('proposal_id', $params['solution_proposal_approved']['proposal_id']);
- $query->orderBy('number', 'ASC');
- $experiment_q = $query->execute();
- $experiment_list = '
+ global $user;
+ $language = $message['language'];
+ //$language = user_preferred_language($user);
+ switch ($key)
+ {
+ case 'solution_proposal_approved':
+ /* initializing data */
+ //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['solution_proposal_approved']['proposal_id']);
+ $query = db_select('lab_migration_proposal');
+ $query->fields('lab_migration_proposal');
+ $query->condition('id', $params['solution_proposal_approved']['proposal_id']);
+ $query->range(0, 1);
+ $proposal_q = $query->execute();
+ $proposal_data = $proposal_q->fetchObject();
+ if ($proposal_data->solution_display == 1)
+ {
+ $solution_display = 'Yes';
+ }
+ else
+ {
+ $solution_display = 'No';
+ }
+ // $experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['solution_proposal_approved']['proposal_id'], 1);
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('proposal_id', $params['solution_proposal_approved']['proposal_id']);
+ $query->orderBy('number', 'ASC');
+ $experiment_q = $query->execute();
+ $experiment_list = '
';
- while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .='<p>'. $experiment_data->number . ') ' . $experiment_data->title . '<br> Description : '.$experiment_data->description.'<br>';
- $experiment_list .=' ';
- $experiment_list .='</p>';
- }
-
- $user_data = user_load($params['solution_proposal_approved']['user_id']);
-
- $message['headers'] = $params['solution_proposal_approved']['headers'];
- $message['subject'] = t('[!site_name] Lab Migration Solution Proposal Approval', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
- $message['body'] = array(0 => t('
+ while ($experiment_data = $experiment_q->fetchObject())
+ {
+ $experiment_list .= '<p>' . $experiment_data->number . ') ' . $experiment_data->title . '<br> Description : ' . $experiment_data->description . '<br>';
+ $experiment_list .= ' ';
+ $experiment_list .= '</p>';
+ }
+ $user_data = user_load($params['solution_proposal_approved']['user_id']);
+ $message['headers'] = $params['solution_proposal_approved']['headers'];
+ $message['subject'] = t('[!site_name] Lab Migration Solution Proposal Approval', array(
+ '!site_name' => variable_get('site_name', '')
+ ), array(
+ 'language' => $language->language
+ ));
+ $message['body'] = array(
+ 0 => t('
Dear !user_name,
Your following Lab migration solution proposal has been approved:
@@ -56,8 +58,8 @@ Email : ' . $user_data->mail . '
Contact No. : ' . $proposal_data->solution_provider_contact_ph . '
Department/Branch : ' . $proposal_data->solution_provider_department . '
University/Institute : ' . $proposal_data->solution_provider_university . '
-City : '.$proposal_data->city.'
-State : '.$proposal_data->state.'
+City : ' . $proposal_data->city . '
+State : ' . $proposal_data->state . '
List of experiments : ' . $experiment_list . '
@@ -66,16 +68,24 @@ Please ensure that ALL the codes follow guidelines at http://dwsim.fossee.in/lab
Best Wishes,
!site_name Team,
-FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
-
- break;
-
- case 'solution_proposal_disapproved':
- $user_data = user_load($params['solution_proposal_disapproved']['user_id']);
-
- $message['headers'] = $params['solution_proposal_disapproved']['headers'];
- $message['subject'] = t('[!site_name] Lab Migration Solution Disapproval', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
- $message['body'] = array('body' => t('
+FOSSEE,IIT Bombay', array(
+ '!site_name' => variable_get('site_name', ''),
+ '!user_name' => $user_data->name
+ ), array(
+ 'language' => $language->language
+ ))
+ );
+ break;
+ case 'solution_proposal_disapproved':
+ $user_data = user_load($params['solution_proposal_disapproved']['user_id']);
+ $message['headers'] = $params['solution_proposal_disapproved']['headers'];
+ $message['subject'] = t('[!site_name] Lab Migration Solution Disapproval', array(
+ '!site_name' => variable_get('site_name', '')
+ ), array(
+ 'language' => $language->language
+ ));
+ $message['body'] = array(
+ 'body' => t('
Dear !user_name,
Your Lab migration solution proposal has been disapproved.
@@ -85,65 +95,76 @@ Reason: ' . $params['solution_proposal_disapproved']['message'] . '
Best Wishes,
!site_name Team,
-FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
-
- break;
-
- case 'proposal_received':
-
- /* initializing data */
- // $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_received']['proposal_id']);
- // $proposal_data = $proposal_q->fetchObject();
-
- $query = db_select('lab_migration_proposal');
+FOSSEE,IIT Bombay', array(
+ '!site_name' => variable_get('site_name', ''),
+ '!user_name' => $user_data->name
+ ), array(
+ 'language' => $language->language
+ ))
+ );
+ break;
+ case 'proposal_received':
+ /* initializing data */
+ // $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_received']['proposal_id']);
+ // $proposal_data = $proposal_q->fetchObject();
+ $query = db_select('lab_migration_proposal');
$query->fields('lab_migration_proposal');
$query->condition('id', $params['proposal_received']['proposal_id']);
$query->range(0, 1);
$proposal_data = $query->execute()->fetchObject();
-
- $samplecodefilename="";
- if(strlen($proposal_data->samplefilepath)>=5){
- $samplecodefilename=substr($proposal_data->samplefilepath, strrpos($proposal_data->samplefilepath, '/') + 1);
- }else{
- $samplecodefilename="Not provided";
- }
-
- if ($proposal_data->solution_display == 1) {
- $solution_display = 'Yes';
- } else {
- $solution_display = 'No';
- }
-
- if ($proposal_data->solution_provider_uid == 0) {
- $solution_provider_user = 'Open';
- } else if ($proposal_data->solution_provider_uid == $proposal_data->uid) {
- $solution_provider_user = 'Proposer';
- } else {
- $solution_provider_user = 'Unknown';
- }
-
- // $experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number",
- // $params['proposal_received']['proposal_id'], 1);
-
- $query = db_select('lab_migration_experiment');
+ /* $samplecodefilename = "";
+ if (strlen($proposal_data->samplefilepath) >= 5)
+ {
+ $samplecodefilename = substr($proposal_data->samplefilepath, strrpos($proposal_data->samplefilepath, '/') + 1);
+ }
+ else
+ {
+ $samplecodefilename = "Not provided";
+ }*/
+ if ($proposal_data->solution_display == 1)
+ {
+ $solution_display = 'Yes';
+ }
+ else
+ {
+ $solution_display = 'No';
+ }
+ if ($proposal_data->solution_provider_uid == 0)
+ {
+ $solution_provider_user = 'Open';
+ }
+ else if ($proposal_data->solution_provider_uid == $proposal_data->uid)
+ {
+ $solution_provider_user = 'Proposer';
+ }
+ else
+ {
+ $solution_provider_user = 'Unknown';
+ }
+ // $experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number",
+ // $params['proposal_received']['proposal_id'], 1);
+ $query = db_select('lab_migration_experiment');
$query->fields('lab_migration_experiment');
$query->condition('proposal_id', $params['proposal_received']['proposal_id']);
$query->orderBy('number', 'ASC');
- $experiment_q = $query->execute();
-
- $experiment_list = '
+ $experiment_q = $query->execute();
+ $experiment_list = '
';
- while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .='<p>'. $experiment_data->number . ') ' . $experiment_data->title . '<br> Description : '.$experiment_data->description.'<br>';
- $experiment_list .=' ';
- $experiment_list .='</p>';
- }
-
- $user_data = user_load($params['proposal_received']['user_id']);
- $message['headers'] = $params['proposal_received']['headers'];
- $message['subject'] = t('[!site_name] Your Lab migration proposal has been received', array('!site_name' => variable_get('site_name', '')),array('language' => $language->language));
-
- $message['body'] = array('body' => t('
+ while ($experiment_data = $experiment_q->fetchObject())
+ {
+ $experiment_list .= '<p>' . $experiment_data->number . ') ' . $experiment_data->title . '<br> Description : ' . $experiment_data->description . '<br>';
+ $experiment_list .= ' ';
+ $experiment_list .= '</p>';
+ }
+ $user_data = user_load($params['proposal_received']['user_id']);
+ $message['headers'] = $params['proposal_received']['headers'];
+ $message['subject'] = t('[!site_name] Your Lab migration proposal has been received', array(
+ '!site_name' => variable_get('site_name', '')
+ ), array(
+ 'language' => $language->language
+ ));
+ $message['body'] = array(
+ 'body' => t('
Dear !user_name,
We have received your Lab migration proposal with the following details:
@@ -153,77 +174,88 @@ Email : ' . $user_data->mail . '
Contact No. : ' . $proposal_data->contact_ph . '
Department/Branch : ' . $proposal_data->department . '
University/Institute : ' . $proposal_data->university . '
-City : '.$proposal_data->city.'
-State : '.$proposal_data->state.'
+City : ' . $proposal_data->city . '
+State : ' . $proposal_data->state . '
Solution Provided By : ' . $solution_provider_user . '
List of experiments : ' . $experiment_list . '
-Uploaded Sample Code : '.$samplecodefilename.'
-
Your proposal is under review. You will soon receive an email when same has been approved/disapproved.
Best Wishes,
!site_name Team,
-FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
-
-
-
- break;
-
- case 'proposal_disapproved':
-
- /* initializing data */
- // $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_disapproved']['proposal_id']);
- //$proposal_data = $proposal_q->fetchObject();
- $query = db_select('lab_migration_proposal');
+FOSSEE,IIT Bombay', array(
+ '!site_name' => variable_get('site_name', ''),
+ '!user_name' => $user_data->name
+ ), array(
+ 'language' => $language->language
+ ))
+ );
+ break;
+ case 'proposal_disapproved':
+ /* initializing data */
+ // $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_disapproved']['proposal_id']);
+ //$proposal_data = $proposal_q->fetchObject();
+ $query = db_select('lab_migration_proposal');
$query->fields('lab_migration_proposal');
$query->condition('id', $params['proposal_disapproved']['proposal_id']);
$query->range(0, 1);
$proposal_data = $query->execute()->fetchObject();
-
- $samplecodefilename="";
- if(strlen($proposal_data->samplefilepath)>=5){
- $samplecodefilename=substr($proposal_data->samplefilepath, strrpos($proposal_data->samplefilepath, '/') + 1);
- }else{
- $samplecodefilename="Not provided";
- }
-
- if ($proposal_data->solution_display == 1) {
- $solution_display = 'Yes';
- } else {
- $solution_display = 'No';
- }
-
- if ($proposal_data->solution_provider_uid == 0) {
- $solution_provider_user = 'Open';
- } else if ($proposal_data->solution_provider_uid == $proposal_data->uid) {
- $solution_provider_user = 'Proposer';
- } else {
- $solution_provider_user = 'Unknown';
- }
-
- // $experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['proposal_disapproved']['proposal_id'], 1);
- $query = db_select('lab_migration_experiment');
- $query->fields('lab_migration_experiment');
- $query->condition('proposal_id', $params['proposal_disapproved']['proposal_id']);
- $query->orderBy('number', 'ASC');
- $experiment_q = $query->execute();
- $experiment_list = '
+ $samplecodefilename = "";
+ if (strlen($proposal_data->samplefilepath) >= 5)
+ {
+ $samplecodefilename = substr($proposal_data->samplefilepath, strrpos($proposal_data->samplefilepath, '/') + 1);
+ }
+ else
+ {
+ $samplecodefilename = "Not provided";
+ }
+ if ($proposal_data->solution_display == 1)
+ {
+ $solution_display = 'Yes';
+ }
+ else
+ {
+ $solution_display = 'No';
+ }
+ if ($proposal_data->solution_provider_uid == 0)
+ {
+ $solution_provider_user = 'Open';
+ }
+ else if ($proposal_data->solution_provider_uid == $proposal_data->uid)
+ {
+ $solution_provider_user = 'Proposer';
+ }
+ else
+ {
+ $solution_provider_user = 'Unknown';
+ }
+ // $experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['proposal_disapproved']['proposal_id'], 1);
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('proposal_id', $params['proposal_disapproved']['proposal_id']);
+ $query->orderBy('number', 'ASC');
+ $experiment_q = $query->execute();
+ $experiment_list = '
';
- while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .='<p>'. $experiment_data->number . ') ' . $experiment_data->title . '<br> Description : '.$experiment_data->description.'<br>';
- $experiment_list .=' ';
- $experiment_list .='</p>';
- }
-
- $user_data = user_load($params['proposal_disapproved']['user_id']);
- $message['headers'] = $params['proposal_disapproved']['headers'];
- $message['subject'] = t('[!site_name] Your Lab migration proposal has been disapproved', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
- $message['body'] = array('body' => t('
+ while ($experiment_data = $experiment_q->fetchObject())
+ {
+ $experiment_list .= '<p>' . $experiment_data->number . ') ' . $experiment_data->title . '<br> Description : ' . $experiment_data->description . '<br>';
+ $experiment_list .= ' ';
+ $experiment_list .= '</p>';
+ }
+ $user_data = user_load($params['proposal_disapproved']['user_id']);
+ $message['headers'] = $params['proposal_disapproved']['headers'];
+ $message['subject'] = t('[!site_name] Your Lab migration proposal has been disapproved', array(
+ '!site_name' => variable_get('site_name', '')
+ ), array(
+ 'language' => $language->language
+ ));
+ $message['body'] = array(
+ 'body' => t('
Dear !user_name,
We regret to inform you that all the Experiments of your Lab with following details have been dis-approved.
@@ -235,74 +267,88 @@ Email : ' . $user_data->mail . '
Contact No. : ' . $proposal_data->contact_ph . '
Department/Branch : ' . $proposal_data->department . '
University/Institute : ' . $proposal_data->university . '
-City : '.$proposal_data->city.'
-State : '.$proposal_data->state.'
+City : ' . $proposal_data->city . '
+State : ' . $proposal_data->state . '
Solution Provided By : ' . $solution_provider_user . '
List of experiments : ' . $experiment_list . '
-Uploaded Sample Code : '.$samplecodefilename.'
+Uploaded Sample Code : ' . $samplecodefilename . '
Best Wishes,
!site_name Team,
-FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
-
- break;
-
- case 'proposal_approved':
-
- /* initializing data */
- // $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_approved']['proposal_id']);
-
- $query = db_select('lab_migration_proposal');
- $query->fields('lab_migration_proposal');
- $query->condition('id', $params['proposal_approved']['proposal_id']);
- $query->range(0, 1);
- $proposal_q = $query->execute();
- $proposal_data = $proposal_q->fetchObject();
- $samplecodefilename="";
- if(strlen($proposal_data->samplefilepath)>=5){
- $samplecodefilename=substr($proposal_data->samplefilepath, strrpos($proposal_data->samplefilepath, '/') + 1);
- }else{
- $samplecodefilename="Not provided";
- }
- if ($proposal_data->solution_display == 1) {
- $solution_display = 'Yes';
- } else {
- $solution_display = 'No';
- }
-
- if ($proposal_data->solution_provider_uid == 0) {
- $solution_provider_user = 'Open';
- } else if ($proposal_data->solution_provider_uid == $proposal_data->uid) {
- $solution_provider_user = 'Proposer';
- } else {
- $solution_provider_user = 'Unknown';
- }
-
- //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['proposal_approved']['proposal_id'], 1);
- $query = db_select('lab_migration_experiment');
- $query->fields('lab_migration_experiment');
- $query->condition('proposal_id', $params['proposal_approved']['proposal_id']);
- $query->orderBy('number', 'ASC');
- $experiment_q = $query->execute();
-
- $experiment_list = '
+FOSSEE,IIT Bombay', array(
+ '!site_name' => variable_get('site_name', ''),
+ '!user_name' => $user_data->name
+ ), array(
+ 'language' => $language->language
+ ))
+ );
+ break;
+ case 'proposal_approved':
+ /* initializing data */
+ // $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_approved']['proposal_id']);
+ $query = db_select('lab_migration_proposal');
+ $query->fields('lab_migration_proposal');
+ $query->condition('id', $params['proposal_approved']['proposal_id']);
+ $query->range(0, 1);
+ $proposal_q = $query->execute();
+ $proposal_data = $proposal_q->fetchObject();
+ /* $samplecodefilename = "";
+ if (strlen($proposal_data->samplefilepath) >= 5)
+ {
+ $samplecodefilename = substr($proposal_data->samplefilepath, strrpos($proposal_data->samplefilepath, '/') + 1);
+ }
+ else
+ {
+ $samplecodefilename = "Not provided";
+ }*/
+ if ($proposal_data->solution_display == 1)
+ {
+ $solution_display = 'Yes';
+ }
+ else
+ {
+ $solution_display = 'No';
+ }
+ if ($proposal_data->solution_provider_uid == 0)
+ {
+ $solution_provider_user = 'Open';
+ }
+ else if ($proposal_data->solution_provider_uid == $proposal_data->uid)
+ {
+ $solution_provider_user = 'Proposer';
+ }
+ else
+ {
+ $solution_provider_user = 'Unknown';
+ }
+ //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['proposal_approved']['proposal_id'], 1);
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('proposal_id', $params['proposal_approved']['proposal_id']);
+ $query->orderBy('number', 'ASC');
+ $experiment_q = $query->execute();
+ $experiment_list = '
';
- while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .='<p>'. $experiment_data->number . ') ' . $experiment_data->title . '<br> Description : '.$experiment_data->description.'<br>';
- $experiment_list .=' ';
- $experiment_list .='</p>';
- }
-
- $user_data = user_load($params['proposal_approved']['user_id']);
- $message['headers'] = $params['proposal_approved']['headers'];
- $message['subject'] = t('[!site_name] Your Lab migration proposal has been approved',
- array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
- $message['body'] = array(0 => t('
+ while ($experiment_data = $experiment_q->fetchObject())
+ {
+ $experiment_list .= '<p>' . $experiment_data->number . ') ' . $experiment_data->title . '<br> Description : ' . $experiment_data->description . '<br>';
+ $experiment_list .= ' ';
+ $experiment_list .= '</p>';
+ }
+ $user_data = user_load($params['proposal_approved']['user_id']);
+ $message['headers'] = $params['proposal_approved']['headers'];
+ $message['subject'] = t('[!site_name] Your Lab migration proposal has been approved', array(
+ '!site_name' => variable_get('site_name', '')
+ ), array(
+ 'language' => $language->language
+ ));
+ $message['body'] = array(
+ 0 => t('
Dear !user_name,
Congratulations! Your Lab migration proposal with the below details has been approved:
@@ -312,72 +358,84 @@ Email : ' . $user_data->mail . '
Contact No. : ' . $proposal_data->contact_ph . '
Department/Branch : ' . $proposal_data->department . '
University/Institute : ' . $proposal_data->university . '
-City : '.$proposal_data->city.'
-State : '.$proposal_data->state.'
+City : ' . $proposal_data->city . '
+State : ' . $proposal_data->state . '
Solution Provided By : ' . $solution_provider_user . '
List of experiments : ' . $experiment_list . '
-Uploaded Sample Code : '.$samplecodefilename.'
-
Please ensure that ALL the guidelines for coding are strictly followed:
http://dwsim.fossee.in/lab-migration-project/lab-migration-guidelines
Best Wishes,
!site_name Team,
-FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
-
- break;
-
- case 'proposal_completed':
-
- /* initializing data */
- //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_completed']['proposal_id']);
- $query = db_select('lab_migration_proposal');
- $query->fields('lab_migration_proposal');
- $query->condition('id', $params['proposal_completed']['proposal_id']);
- $query->range(0, 1);
- $proposal_q = $query->execute();
- $proposal_data = $proposal_q->fetchObject();
-
- if ($proposal_data->solution_display == 1) {
- $solution_display = 'Yes';
- } else {
- $solution_display = 'No';
- }
-
- if ($proposal_data->solution_provider_uid == 0) {
- $solution_provider_user = 'Open';
- } else if ($proposal_data->solution_provider_uid == $proposal_data->uid) {
- $solution_provider_user = 'Proposer';
- } else {
- $user_data = user_load($proposal_data->solution_provider_uid);
- if (!$user_data) {
- $solution_provider_user = 'Unknown';
- }
- }
-
- //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['proposal_completed']['proposal_id'], 1);
- $query = db_select('lab_migration_experiment');
- $query->fields('lab_migration_experiment');
- $query->condition('proposal_id', $params['proposal_completed']['proposal_id']);
- $query->orderBy('number', 'ASC');
- $experiment_q = $query->execute();
- $experiment_list = '
+FOSSEE,IIT Bombay', array(
+ '!site_name' => variable_get('site_name', ''),
+ '!user_name' => $user_data->name
+ ), array(
+ 'language' => $language->language
+ ))
+ );
+ break;
+ case 'proposal_completed':
+ /* initializing data */
+ //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_completed']['proposal_id']);
+ $query = db_select('lab_migration_proposal');
+ $query->fields('lab_migration_proposal');
+ $query->condition('id', $params['proposal_completed']['proposal_id']);
+ $query->range(0, 1);
+ $proposal_q = $query->execute();
+ $proposal_data = $proposal_q->fetchObject();
+ if ($proposal_data->solution_display == 1)
+ {
+ $solution_display = 'Yes';
+ }
+ else
+ {
+ $solution_display = 'No';
+ }
+ if ($proposal_data->solution_provider_uid == 0)
+ {
+ $solution_provider_user = 'Open';
+ }
+ else if ($proposal_data->solution_provider_uid == $proposal_data->uid)
+ {
+ $solution_provider_user = 'Proposer';
+ }
+ else
+ {
+ $user_data = user_load($proposal_data->solution_provider_uid);
+ if (!$user_data)
+ {
+ $solution_provider_user = 'Unknown';
+ }
+ }
+ //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['proposal_completed']['proposal_id'], 1);
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('proposal_id', $params['proposal_completed']['proposal_id']);
+ $query->orderBy('number', 'ASC');
+ $experiment_q = $query->execute();
+ $experiment_list = '
';
- while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .='<p>'. $experiment_data->number . ') ' . $experiment_data->title . '<br> Description : '.$experiment_data->description.'<br>';
- $experiment_list .=' ';
- $experiment_list .='</p>';
- }
-
- $user_data = user_load($params['proposal_completed']['user_id']);
- $message['headers'] = $params['proposal_completed']['headers'];
- $message['subject'] = t('[!site_name] Congratulations for completion of the Lab migration', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
- $message['body'] = array('body' => t('
+ while ($experiment_data = $experiment_q->fetchObject())
+ {
+ $experiment_list .= '<p>' . $experiment_data->number . ') ' . $experiment_data->title . '<br> Description : ' . $experiment_data->description . '<br>';
+ $experiment_list .= ' ';
+ $experiment_list .= '</p>';
+ }
+ $user_data = user_load($params['proposal_completed']['user_id']);
+ $message['headers'] = $params['proposal_completed']['headers'];
+ $message['subject'] = t('[!site_name] Congratulations for completion of the Lab migration', array(
+ '!site_name' => variable_get('site_name', '')
+ ), array(
+ 'language' => $language->language
+ ));
+ $message['body'] = array(
+ 'body' => t('
Dear !user_name,
Following Lab migration has been completed sucessfully :
@@ -387,8 +445,8 @@ Email : ' . $user_data->mail . '
Contact No. : ' . $proposal_data->contact_ph . '
Department/Branch : ' . $proposal_data->department . '
University/Institute : ' . $proposal_data->university . '
-City : '.$proposal_data->city.'
-State : '.$proposal_data->state.'
+City : ' . $proposal_data->city . '
+State : ' . $proposal_data->state . '
Solution Provided By : ' . $solution_provider_user . '
@@ -406,45 +464,54 @@ Please ensure that ALL the codes follow guidelines at http://dwsim.fossee.in/lab
Best Wishes,
!site_name Team,
-FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
-
- break;
-
- case 'solution_proposal_received':
-
- /* initializing data */
- //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['solution_proposal_received']['proposal_id']);
- $query = db_select('lab_migration_proposal');
- $query->fields('lab_migration_proposal');
- $query->condition('id', $params['solution_proposal_received']['proposal_id']);
- $query->range(0, 1);
- $proposal_q = $query->execute();
- $proposal_data = $proposal_q->fetchObject();
-
- if ($proposal_data->solution_display == 1) {
- $solution_display = 'Yes';
- } else {
- $solution_display = 'No';
- }
-
- //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['solution_proposal_received']['proposal_id'], 1);
- $query = db_select('lab_migration_experiment');
- $query->fields('lab_migration_experiment');
- $query->condition('proposal_id', $params['solution_proposal_received']['proposal_id']);
- $query->orderBy('number', 'ASC');
- $experiment_q = $query->execute();
- $experiment_list = '
+FOSSEE,IIT Bombay', array(
+ '!site_name' => variable_get('site_name', ''),
+ '!user_name' => $user_data->name
+ ), array(
+ 'language' => $language->language
+ ))
+ );
+ break;
+ case 'solution_proposal_received':
+ /* initializing data */
+ //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['solution_proposal_received']['proposal_id']);
+ $query = db_select('lab_migration_proposal');
+ $query->fields('lab_migration_proposal');
+ $query->condition('id', $params['solution_proposal_received']['proposal_id']);
+ $query->range(0, 1);
+ $proposal_q = $query->execute();
+ $proposal_data = $proposal_q->fetchObject();
+ if ($proposal_data->solution_display == 1)
+ {
+ $solution_display = 'Yes';
+ }
+ else
+ {
+ $solution_display = 'No';
+ }
+ //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['solution_proposal_received']['proposal_id'], 1);
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('proposal_id', $params['solution_proposal_received']['proposal_id']);
+ $query->orderBy('number', 'ASC');
+ $experiment_q = $query->execute();
+ $experiment_list = '
';
- while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .='<p>'. $experiment_data->number . ') ' . $experiment_data->title . '<br> Description : '.$experiment_data->description.'<br>';
- $experiment_list .=' ';
- $experiment_list .='</p>';
- }
-
- $user_data = user_load($params['solution_proposal_received']['user_id']);
- $message['headers'] = $params['solution_proposal_received']['headers'];
- $message['subject'] = t('[!site_name] Your Lab migration solution proposal has been received', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
- $message['body'] = array('body' => t('
+ while ($experiment_data = $experiment_q->fetchObject())
+ {
+ $experiment_list .= '<p>' . $experiment_data->number . ') ' . $experiment_data->title . '<br> Description : ' . $experiment_data->description . '<br>';
+ $experiment_list .= ' ';
+ $experiment_list .= '</p>';
+ }
+ $user_data = user_load($params['solution_proposal_received']['user_id']);
+ $message['headers'] = $params['solution_proposal_received']['headers'];
+ $message['subject'] = t('[!site_name] Your Lab migration solution proposal has been received', array(
+ '!site_name' => variable_get('site_name', '')
+ ), array(
+ 'language' => $language->language
+ ));
+ $message['body'] = array(
+ 'body' => t('
Dear !user_name,
We have received your proposal for solution for following Lab migration :
@@ -454,11 +521,11 @@ Email : ' . $user_data->mail . '
Contact No. : ' . $proposal_data->contact_ph . '
Department/Branch : ' . $proposal_data->department . '
University/Institute : ' . $proposal_data->university . '
-City : '.$proposal_data->city.'
-State : '.$proposal_data->state.'
+City : ' . $proposal_data->city . '
+State : ' . $proposal_data->state . '
-Solution Provided By : ' . $proposal_data->name_title .'
+Solution Provided By : ' . $proposal_data->name_title . '
List of experiments : ' . $experiment_list . '
@@ -469,31 +536,37 @@ Please ensure that ALL the codes follow guidelines at http://dwsim.fossee.in/lab
Best Wishes,
!site_name Team,
-FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
-
- break;
-
- case 'solution_uploaded':
- // $solution_q = db_query("SELECT * FROM {lab_migration_solution} WHERE id = %d LIMIT 1", $params['solution_uploaded']['solution_id']);
- $query = db_select('lab_migration_solution');
- $query->fields('lab_migration_solution');
- $query->condition('id', $params['solution_uploaded']['solution_id']);
- $query->range(0, 1);
- $solution_q = $query->execute();
- $solution_data = $solution_q->fetchObject();
-
- $query = db_select('lab_migration_experiment');
- $query->fields('lab_migration_experiment');
- $query->condition('id', $solution_data->experiment_id);
- $query->range(0, 1);
- $experiment_q = $query->execute();
- $experiment_data = $experiment_q->fetchObject();
-
- $user_data = user_load($params['solution_uploaded']['user_id']);
-
- $message['subject'] = t('[!site_name] You have uploaded Lab migration solution', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
- $message['headers'] = $params['solution_uploaded']['headers'];
- $message['body'] = array('body' => t('
+FOSSEE,IIT Bombay', array(
+ '!site_name' => variable_get('site_name', ''),
+ '!user_name' => $user_data->name
+ ), array(
+ 'language' => $language->language
+ ))
+ );
+ break;
+ case 'solution_uploaded':
+ // $solution_q = db_query("SELECT * FROM {lab_migration_solution} WHERE id = %d LIMIT 1", $params['solution_uploaded']['solution_id']);
+ $query = db_select('lab_migration_solution');
+ $query->fields('lab_migration_solution');
+ $query->condition('id', $params['solution_uploaded']['solution_id']);
+ $query->range(0, 1);
+ $solution_q = $query->execute();
+ $solution_data = $solution_q->fetchObject();
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('id', $solution_data->experiment_id);
+ $query->range(0, 1);
+ $experiment_q = $query->execute();
+ $experiment_data = $experiment_q->fetchObject();
+ $user_data = user_load($params['solution_uploaded']['user_id']);
+ $message['subject'] = t('[!site_name] You have uploaded Lab migration solution', array(
+ '!site_name' => variable_get('site_name', '')
+ ), array(
+ 'language' => $language->language
+ ));
+ $message['headers'] = $params['solution_uploaded']['headers'];
+ $message['body'] = array(
+ 'body' => t('
Dear !user_name,
You have uploaded the following solution:
@@ -501,37 +574,44 @@ You have uploaded the following solution:
Experiment Title : ' . $experiment_data->title . '
Solution number : ' . $solution_data->code_number . '
-Caption : ' . $solution_data->caption . '
+Caption : ' . $solution_data->caption . '
The solution is under review. You will be notified when it has been approved.
Best Wishes,
!site_name Team,
-FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
-
- break;
-
- case 'solution_approved':
- //$solution_q = db_query("SELECT * FROM {lab_migration_solution} WHERE id = %d LIMIT 1", $params['solution_approved']['solution_id']);
- $query = db_select('lab_migration_solution');
- $query->fields('lab_migration_solution');
- $query->condition('id', $params['solution_approved']['solution_id']);
- $query->range(0, 1);
- $solution_q = $query->execute();
- $solution_data = $solution_q->fetchObject();
-
- $query = db_select('lab_migration_experiment');
- $query->fields('lab_migration_experiment');
- $query->condition('id', $solution_data->experiment_id);
- $query->range(0, 1);
- $experiment_q = $query->execute();
- $experiment_data = $experiment_q->fetchObject();
-
- $user_data = user_load($params['solution_approved']['user_id']);
- $message['headers'] = $params['solution_approved']['headers'];
- $message['subject'] = t('[!site_name] Your uploaded Lab migration solution has been approved', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
- $message['body'] = array('body' => t('
+FOSSEE,IIT Bombay', array(
+ '!site_name' => variable_get('site_name', ''),
+ '!user_name' => $user_data->name
+ ), array(
+ 'language' => $language->language
+ ))
+ );
+ break;
+ case 'solution_approved':
+ //$solution_q = db_query("SELECT * FROM {lab_migration_solution} WHERE id = %d LIMIT 1", $params['solution_approved']['solution_id']);
+ $query = db_select('lab_migration_solution');
+ $query->fields('lab_migration_solution');
+ $query->condition('id', $params['solution_approved']['solution_id']);
+ $query->range(0, 1);
+ $solution_q = $query->execute();
+ $solution_data = $solution_q->fetchObject();
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('id', $solution_data->experiment_id);
+ $query->range(0, 1);
+ $experiment_q = $query->execute();
+ $experiment_data = $experiment_q->fetchObject();
+ $user_data = user_load($params['solution_approved']['user_id']);
+ $message['headers'] = $params['solution_approved']['headers'];
+ $message['subject'] = t('[!site_name] Your uploaded Lab migration solution has been approved', array(
+ '!site_name' => variable_get('site_name', '')
+ ), array(
+ 'language' => $language->language
+ ));
+ $message['body'] = array(
+ 'body' => t('
Dear !user_name,
Your following solution has been approved:
@@ -539,22 +619,31 @@ Your following solution has been approved:
Experiment Title : ' . $experiment_data->title . '
Solution number : ' . $solution_data->code_number . '
-Caption : ' . $solution_data->caption . '
+Caption : ' . $solution_data->caption . '
Please ensure that ALL the codes follow guidelines at http://dwsim.fossee.in/lab-migration-project/lab-migration-guidelines
Best Wishes,
!site_name Team,
-FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
-
- break;
-
- case 'solution_disapproved':
- $user_data = user_load($params['solution_disapproved']['user_id']);
- $message['headers'] = $params['solution_disapproved']['headers'];
- $message['subject'] = t('[!site_name] Your uploaded Lab migration solution has been disapproved', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
- $message['body'] = array('body' => t('
+FOSSEE,IIT Bombay', array(
+ '!site_name' => variable_get('site_name', ''),
+ '!user_name' => $user_data->name
+ ), array(
+ 'language' => $language->language
+ ))
+ );
+ break;
+ case 'solution_disapproved':
+ $user_data = user_load($params['solution_disapproved']['user_id']);
+ $message['headers'] = $params['solution_disapproved']['headers'];
+ $message['subject'] = t('[!site_name] Your uploaded Lab migration solution has been disapproved', array(
+ '!site_name' => variable_get('site_name', '')
+ ), array(
+ 'language' => $language->language
+ ));
+ $message['body'] = array(
+ 'body' => t('
Dear !user_name,
Your following solution has been disapproved:
@@ -568,15 +657,24 @@ Reason for dis-approval : ' . $params['solution_disapproved']['message'] . '
Best Wishes,
!site_name Team,
-FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
-
- break;
-
- case 'solution_deleted_user':
- $user_data = user_load($params['solution_deleted_user']['user_id']);
- $message['headers'] = $params['solution_deleted_user']['headers'];
- $message['subject'] = t('[!site_name] User has deleted pending Lab migration solution', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
- $message['body'] = array('body' => t('
+FOSSEE,IIT Bombay', array(
+ '!site_name' => variable_get('site_name', ''),
+ '!user_name' => $user_data->name
+ ), array(
+ 'language' => $language->language
+ ))
+ );
+ break;
+ case 'solution_deleted_user':
+ $user_data = user_load($params['solution_deleted_user']['user_id']);
+ $message['headers'] = $params['solution_deleted_user']['headers'];
+ $message['subject'] = t('[!site_name] User has deleted pending Lab migration solution', array(
+ '!site_name' => variable_get('site_name', '')
+ ), array(
+ 'language' => $language->language
+ ));
+ $message['body'] = array(
+ 'body' => t('
Dear !user_name,
Your following pending solution has been deleted :
@@ -591,16 +689,25 @@ Caption : ' . $params['solution_deleted_user']['solution_caption'] . '
Best Wishes,
!site_name Team,
-FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
-
- break;
-
- case 'dependency_uploaded':
- $user_data = user_load($params['dependency_uploaded']['user_id']);
- $dependency_files = implode(',', $params['dependency_uploaded']['dependency_names']);
- $message['headers'] = $params['dependency_uploaded']['headers'];
- $message['subject'] = t('[!site_name] You have uploaded dependency file', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
- $message['body'] = array('body' => t('
+FOSSEE,IIT Bombay', array(
+ '!site_name' => variable_get('site_name', ''),
+ '!user_name' => $user_data->name
+ ), array(
+ 'language' => $language->language
+ ))
+ );
+ break;
+ case 'dependency_uploaded':
+ $user_data = user_load($params['dependency_uploaded']['user_id']);
+ $dependency_files = implode(',', $params['dependency_uploaded']['dependency_names']);
+ $message['headers'] = $params['dependency_uploaded']['headers'];
+ $message['subject'] = t('[!site_name] You have uploaded dependency file', array(
+ '!site_name' => variable_get('site_name', '')
+ ), array(
+ 'language' => $language->language
+ ));
+ $message['body'] = array(
+ 'body' => t('
Dear !user_name,
You have uploaded following dependency files :
@@ -611,15 +718,18 @@ Please ensure that ALL the codes follow guidelines at http://dwsim.fossee.in/lab
Best Wishes,
!site_name Team,
-FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
-
- break;
-
- case 'standard':
- $message['subject'] = $params['standard']['subject'];
- $message['body'] = $params['standard']['body'];
- $message['headers'] = $params['standard']['headers'];
- break;
+FOSSEE,IIT Bombay', array(
+ '!site_name' => variable_get('site_name', ''),
+ '!user_name' => $user_data->name
+ ), array(
+ 'language' => $language->language
+ ))
+ );
+ break;
+ case 'standard':
+ $message['subject'] = $params['standard']['subject'];
+ $message['body'] = $params['standard']['body'];
+ $message['headers'] = $params['standard']['headers'];
+ break;
+ }
}
-}
-