diff options
author | prashantsinalkar | 2017-02-17 17:16:56 +0530 |
---|---|---|
committer | prashantsinalkar | 2017-02-17 17:20:00 +0530 |
commit | a7b48bccc6416df002a292675e4b92bc34ab835d (patch) | |
tree | 9ba2c28fd17bf42592c562107f52a7ba28c7b13a /email.inc | |
parent | 42519ec5dda38f644c4a90fb32c8f82eb78b56f5 (diff) | |
download | dwsim_flowsheet-a7b48bccc6416df002a292675e4b92bc34ab835d.tar.gz dwsim_flowsheet-a7b48bccc6416df002a292675e4b92bc34ab835d.tar.bz2 dwsim_flowsheet-a7b48bccc6416df002a292675e4b92bc34ab835d.zip |
added proposal delete and rename function and formatted the code
Diffstat (limited to 'email.inc')
-rwxr-xr-x | email.inc | 684 |
1 files changed, 419 insertions, 265 deletions
@@ -3,42 +3,71 @@ * Implementation of hook_mail(). */ function dwsim_flowsheet_mail($key, &$message, $params) - { - global $user; - $language = $message['language']; - //$language = user_preferred_language($user); - switch ($key) - { - - case 'dwsim_flowsheet_proposal_received': - /* initializing data */ - // $proposal_q = db_query("SELECT * FROM {dwsim_flowsheet_proposal} WHERE id = %d LIMIT 1", $params['proposal_received']['proposal_id']); - // $proposal_data = $proposal_q->fetchObject(); - $query = db_select('dwsim_flowsheet_proposal'); - $query->fields('dwsim_flowsheet_proposal'); - $query->condition('id', $params['dwsim_flowsheet_proposal_received']['proposal_id']); - $query->range(0, 1); - $proposal_data = $query->execute()->fetchObject(); - $user_data = user_load($params['proposal_received']['user_id']); - $message['headers'] = $params['proposal_received']['headers']; - $message['subject'] = t('[!site_name][Flowsheeting Project] Your DWSIM Chemical Process Flowsheeting Project proposal has been received', array( - '!site_name' => variable_get('site_name', '') - ), array( - 'language' => $language->language - )); - $message['body'] = array( - 'body' => t(' +{ + global $user; + $language = $message['language']; + //$language = user_preferred_language($user); + switch ($key) + { + case 'dwsim_flowsheet_proposal_received': + /* initializing data */ + $query = db_select('dwsim_flowsheet_proposal'); + $query->fields('dwsim_flowsheet_proposal'); + $query->condition('id', $params['dwsim_flowsheet_proposal_received']['proposal_id']); + $query->range(0, 1); + $proposal_data = $query->execute()->fetchObject(); + $user_data = user_load($params['dwsim_flowsheet_proposal_received']['user_id']); + if ($proposal_data->user_defined_compounds_used_in_process == NULL) + { + $user_defined_compounds_used_in_process = "Not Entered"; + } //$proposal_data->user_defined_compounds_used_in_process == NULL + else + { + $user_defined_compounds_used_in_process = $proposal_data->user_defined_compounds_used_in_process; + } + if ($proposal_data->user_defined_compound_filepath == "NULL") + { + $file_name = "File not uploaded"; + } //$proposal_data->user_defined_compound_filepath == NULL + else + { + $file_name = basename($proposal_data->user_defined_compound_filepath); + } + $message['headers'] = $params['dwsim_flowsheet_proposal_received']['headers']; + $message['subject'] = t('[!site_name][Flowsheeting Project] Your DWSIM Flowsheeting Project 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 DWSIM Chemical Process Flowsheeting Project with the following details: +We have received your DWSIM Flowsheeting Project proposal with the following details: -Full Name : ' . $proposal_data->name_title . ' ' . $proposal_data->name . ' +Full Name : ' . $proposal_data->name_title . ' ' . $proposal_data->student_name . ' Email : ' . $user_data->mail . ' -Contact No. : ' . $proposal_data->contact_ph . ' -Department/Branch : ' . $proposal_data->department . ' +Month and Year of Award of Degree : ' . $proposal_data->month_year_of_degree . ' University/Institute : ' . $proposal_data->university . ' City : ' . $proposal_data->city . ' State : ' . $proposal_data->state . ' +Country : ' . $proposal_data->country . ' + +Project Guide : ' . $proposal_data->project_guide_name . ' +Project Guide Email : ' . $proposal_data->project_guide_email_id . ' + +DWSIM Version : ' . $proposal_data->version . ' + +Project Title : ' . $proposal_data->project_title . ' + +Name of compound for which process development is carried out : ' . $proposal_data->process_development_compound_name . ' + +List of compounds from DWSIM Database used in process flowsheet : ' . $proposal_data->dwsim_database_compound_name . ' + +List of user defined compounds used in process flowsheet : ' . $user_defined_compounds_used_in_process . ' + +Uploaded user defined compound : ' . $file_name . ' + Your proposal is under review. You will soon receive an email when same has been approved/disapproved. @@ -47,198 +76,323 @@ 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 'dwsim_flowsheet_proposal_disapproved': - /* initializing data */ - // $proposal_q = db_query("SELECT * FROM {dwsim_flowsheet_proposal} WHERE id = %d LIMIT 1", $params['proposal_disapproved']['proposal_id']); - //$proposal_data = $proposal_q->fetchObject(); - $query = db_select('dwsim_flowsheet_proposal'); - $query->fields('dwsim_flowsheet_proposal'); - $query->condition('id', $params['dwsim_flowsheet_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"; - } - - $user_data = user_load($params['dwsim_flowsheet_proposal_disapproved']['user_id']); - $message['headers'] = $params['dwsim_flowsheet_proposal_disapproved']['headers']; - $message['subject'] = t('[!site_name] Your DWSIM flowsheet proposal has been disapproved', array( - '!site_name' => variable_get('site_name', '') - ), array( - 'language' => $language->language - )); - $message['body'] = array( - 'body' => t(' + '!site_name' => variable_get('site_name', ''), + '!user_name' => $user_data->name + ), array( + 'language' => $language->language + )) + ); + break; + case 'dwsim_flowsheet_proposal_disapproved': + /* initializing data */ + $query = db_select('dwsim_flowsheet_proposal'); + $query->fields('dwsim_flowsheet_proposal'); + $query->condition('id', $params['dwsim_flowsheet_proposal_disapproved']['proposal_id']); + $query->range(0, 1); + $proposal_data = $query->execute()->fetchObject(); + $user_data = user_load($params['dwsim_flowsheet_proposal_disapproved']['user_id']); + if ($proposal_data->user_defined_compounds_used_in_process == NULL) + { + $user_defined_compounds_used_in_process = "Not Entered"; + } //$proposal_data->user_defined_compounds_used_in_process == NULL + else + { + $user_defined_compounds_used_in_process = $proposal_data->user_defined_compounds_used_in_process; + } + if ($proposal_data->user_defined_compound_filepath == "NULL") + { + $file_name = "File not uploaded"; + } //$proposal_data->user_defined_compound_filepath == NULL + else + { + $file_name = basename($proposal_data->user_defined_compound_filepath); + } + $message['headers'] = $params['dwsim_flowsheet_proposal_disapproved']['headers']; + $message['subject'] = t('[!site_name][Flowsheeting Project] Your DWSIM Flowsheeting Project 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 DWSIM Flowsheeing Project proposal details have been dis-approved. +Your DWSIM Flowsheeting Project proposal with the following details has been disapproved : + +Full Name : ' . $proposal_data->name_title . ' ' . $proposal_data->student_name . ' +Email : ' . $user_data->mail . ' +Month and Year of Award of Degree : ' . $proposal_data->month_year_of_degree . ' +University/Institute : ' . $proposal_data->university . ' +City : ' . $proposal_data->city . ' +State : ' . $proposal_data->state . ' +Country : ' . $proposal_data->country . ' + +Project Guide : ' . $proposal_data->project_guide_name . ' +Project Guide Email : ' . $proposal_data->project_guide_email_id . ' + +Project Title : ' . $proposal_data->project_title . ' + +Name of compound for which process development is carried out : ' . $proposal_data->process_development_compound_name . ' + +List of compounds from DWSIM Database used in process flowsheet : ' . $proposal_data->dwsim_database_compound_name . ' + +List of user defined compounds used in process flowsheet : ' . $user_defined_compounds_used_in_process . ' + +Uploaded user defined compound : ' . $file_name . ' + -Reason for disapproval: ' . $proposal_data->message . ' +Reason for dissapproval : ' . $proposal_data->dissapproval_reason . ' -Full Name : ' . $proposal_data->name_title . ' ' . $proposal_data->name . ' + +Your are eligible to propose a new flowsheeting proposal. + +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 'dwsim_flowsheet_proposal_approved': + /* initializing data */ + $query = db_select('dwsim_flowsheet_proposal'); + $query->fields('dwsim_flowsheet_proposal'); + $query->condition('id', $params['dwsim_flowsheet_proposal_approved']['proposal_id']); + $query->range(0, 1); + $proposal_data = $query->execute()->fetchObject(); + $user_data = user_load($params['dwsim_flowsheet_proposal_approved']['user_id']); + if ($proposal_data->user_defined_compounds_used_in_process == NULL) + { + $user_defined_compounds_used_in_process = "Not Entered"; + } //$proposal_data->user_defined_compounds_used_in_process == NULL + else + { + $user_defined_compounds_used_in_process = $proposal_data->user_defined_compounds_used_in_process; + } + if ($proposal_data->user_defined_compound_filepath == "NULL") + { + $file_name = "File not uploaded"; + } //$proposal_data->user_defined_compound_filepath == NULL + else + { + $file_name = $params['dwsim_flowsheet_proposal_approved']['file_name']; + } + $message['headers'] = $params['dwsim_flowsheet_proposal_approved']['headers']; + $message['subject'] = t('[!site_name][Flowsheeting Project] Your DWSIM Flowsheeting Project proposal has been approved', array( + '!site_name' => variable_get('site_name', '') + ), array( + 'language' => $language->language + )); + $message['body'] = array( + 'body' => t(' +Dear !user_name, + +Your DWSIM Flowsheeting Project proposal with the following details has been approved: + +Full Name : ' . $proposal_data->name_title . ' ' . $proposal_data->student_name . ' Email : ' . $user_data->mail . ' -Contact No. : ' . $proposal_data->contact_ph . ' -Department/Branch : ' . $proposal_data->department . ' +Month and Year of Award of Degree : ' . $proposal_data->month_year_of_degree . ' University/Institute : ' . $proposal_data->university . ' City : ' . $proposal_data->city . ' State : ' . $proposal_data->state . ' +Country : ' . $proposal_data->country . ' + +Project Guide : ' . $proposal_data->project_guide_name . ' +Project Guide Email : ' . $proposal_data->project_guide_email_id . ' -Solution Provided By : ' . $solution_provider_user . ' +Project Title : ' . $proposal_data->project_title . ' -List of experiments : ' . $experiment_list . ' +Name of compound for which process development is carried out : ' . $proposal_data->process_development_compound_name . ' -Uploaded Sample Code : ' . $samplecodefilename . ' +List of compounds from DWSIM Database used in process flowsheet : ' . $proposal_data->dwsim_database_compound_name . ' +List of user defined compounds used in process flowsheet : ' . $user_defined_compounds_used_in_process . ' + +Uploaded user defined compound : ' . $file_name . ' + + + +You can upload your abstract using abstract submission interface. 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 'dwsim_flowsheet_proposal_approved': - /* initializing data */ - // $proposal_q = db_query("SELECT * FROM {dwsim_flowsheet_proposal} WHERE id = %d LIMIT 1", $params['proposal_approved']['proposal_id']); - $query = db_select('dwsim_flowsheet_proposal'); - $query->fields('dwsim_flowsheet_proposal'); - $query->condition('id', $params['proposal_approved']['proposal_id']); - $query->range(0, 1); - $proposal_q = $query->execute(); - $proposal_data = $proposal_q->fetchObject(); - - - $user_data = user_load($params['proposal_approved']['user_id']); - $message['headers'] = $params['proposal_approved']['headers']; - $message['subject'] = t('[!site_name][Flowsheeting Project] Your DWSIM flowsheet proposal has been approved', array( - '!site_name' => variable_get('site_name', '') - ), array( - 'language' => $language->language - )); - $message['body'] = array( - 0 => t(' + '!site_name' => variable_get('site_name', ''), + '!user_name' => $user_data->name + ), array( + 'language' => $language->language + )) + ); + break; + case 'dwsim_flowsheet_proposal_completed': + /* initializing data */ + $query = db_select('dwsim_flowsheet_proposal'); + $query->fields('dwsim_flowsheet_proposal'); + $query->condition('id', $params['dwsim_flowsheet_proposal_approved']['proposal_id']); + $query->range(0, 1); + $proposal_data = $query->execute()->fetchObject(); + $user_data = user_load($params['dwsim_flowsheet_proposal_approved']['user_id']); + if ($proposal_data->user_defined_compounds_used_in_process == NULL) + { + $user_defined_compounds_used_in_process = "Not Entered"; + } //$proposal_data->user_defined_compounds_used_in_process == NULL + else + { + $user_defined_compounds_used_in_process = $proposal_data->user_defined_compounds_used_in_process; + } + if ($proposal_data->user_defined_compound_filepath == "NULL") + { + $file_name = "File not uploaded"; + } //$proposal_data->user_defined_compound_filepath == NULL + else + { + $file_name = $params['dwsim_flowsheet_proposal_approved']['file_name']; + } + $message['headers'] = $params['dwsim_flowsheet_proposal_approved']['headers']; + $message['subject'] = t('[!site_name][Flowsheeting Project] Your DWSIM Flowsheeting Project proposal has been completed', array( + '!site_name' => variable_get('site_name', '') + ), array( + 'language' => $language->language + )); + $message['body'] = array( + 'body' => t(' Dear !user_name, -Congratulations! Your DWSIM Flowsheet proposal with the below details has been approved: +You have completed your DWSIM Flowsheeting Project with the following details: Full Name : ' . $proposal_data->name_title . ' ' . $proposal_data->student_name . ' Email : ' . $user_data->mail . ' -Month and year of award of degree : ' . $proposal_data->month_year_of_degree . ' +Month and Year of Award of Degree : ' . $proposal_data->month_year_of_degree . ' University/Institute : ' . $proposal_data->university . ' -Project guide name : ' . $proposal_data->project_guide_name . ' -Project guide email : ' . $proposal_data->project_guide_email_id . ' City : ' . $proposal_data->city . ' State : ' . $proposal_data->state . ' Country : ' . $proposal_data->country . ' +Project Guide : ' . $proposal_data->project_guide_name . ' +Project Guide Email : ' . $proposal_data->project_guide_email_id . ' + +Project Title : ' . $proposal_data->project_title . ' + +Name of compound for which process development is carried out : ' . $proposal_data->process_development_compound_name . ' + +List of compounds from DWSIM Database used in process flowsheet : ' . $proposal_data->dwsim_database_compound_name . ' + +List of user defined compounds used in process flowsheet : ' . $user_defined_compounds_used_in_process . ' + +Uploaded user defined compound : ' . $file_name . ' -Please ensure that ALL the guidelines for coding are strictly followed: -http://dwsim.fossee.in/dwsim-flowsheet-project/dwsim-flowsheet-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 'dwsim_flowsheet_proposal_completed': - /* initializing data */ - $query = db_select('dwsim_flowsheet_proposal'); - $query->fields('dwsim_flowsheet_proposal'); - $query->condition('id', $params['proposal_completed']['proposal_id']); - $query->range(0, 1); - $proposal_q = $query->execute(); - $proposal_data = $proposal_q->fetchObject(); - $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 DWSIM flowsheet', array( - '!site_name' => variable_get('site_name', '') - ), array( - 'language' => $language->language - )); - $message['body'] = array( - 'body' => t(' + '!site_name' => variable_get('site_name', ''), + '!user_name' => $user_data->name + ), array( + 'language' => $language->language + )) + ); + break; + case 'dwsim_flowsheet_proposal_deleted': + /* initializing data */ + $query = db_select('dwsim_flowsheet_proposal'); + $query->fields('dwsim_flowsheet_proposal'); + $query->condition('id', $params['dwsim_flowsheet_proposal_deleted']['proposal_id']); + $query->range(0, 1); + $proposal_data = $query->execute()->fetchObject(); + $user_data = user_load($params['dwsim_flowsheet_proposal_deleted']['user_id']); + if ($proposal_data->user_defined_compounds_used_in_process == NULL) + { + $user_defined_compounds_used_in_process = "Not Entered"; + } //$proposal_data->user_defined_compounds_used_in_process == NULL + else + { + $user_defined_compounds_used_in_process = $proposal_data->user_defined_compounds_used_in_process; + } + if ($proposal_data->user_defined_compound_filepath == "NULL") + { + $file_name = "File not uploaded"; + } //$proposal_data->user_defined_compound_filepath == NULL + else + { + $file_name = $params['dwsim_flowsheet_proposal_approved']['file_name']; + } + $message['headers'] = $params['dwsim_flowsheet_proposal_deleted']['headers']; + $message['subject'] = t('[!site_name][Flowsheeting Project] Your DWSIM Flowsheeting Project proposal has been deleted', array( + '!site_name' => variable_get('site_name', '') + ), array( + 'language' => $language->language + )); + $message['body'] = array( + 'body' => t(' Dear !user_name, -Following DWSIM flowsheet has been completed sucessfully : +Your DWSIM Flowsheeting Project proposal with the following details has been deleted : -Full Name : ' . $proposal_data->name_title . ' ' . $proposal_data->name . ' +Full Name : ' . $proposal_data->name_title . ' ' . $proposal_data->student_name . ' Email : ' . $user_data->mail . ' -Contact No. : ' . $proposal_data->contact_ph . ' -Department/Branch : ' . $proposal_data->department . ' +Month and Year of Award of Degree : ' . $proposal_data->month_year_of_degree . ' University/Institute : ' . $proposal_data->university . ' City : ' . $proposal_data->city . ' State : ' . $proposal_data->state . ' +Country : ' . $proposal_data->country . ' + +Project Guide : ' . $proposal_data->project_guide_name . ' +Project Guide Email : ' . $proposal_data->project_guide_email_id . ' +Project Title : ' . $proposal_data->project_title . ' -Solution Provided By : ' . $solution_provider_user . ' +Name of compound for which process development is carried out : ' . $proposal_data->process_development_compound_name . ' -List of experiments : ' . $experiment_list . ' +List of compounds from DWSIM Database used in process flowsheet : ' . $proposal_data->dwsim_database_compound_name . ' -Your Lab solution is now available at following link to download. +List of user defined compounds used in process flowsheet : ' . $user_defined_compounds_used_in_process . ' -http://dwsim.fossee.in/dwsim-flowsheet/dwsim-flowsheet-run/' . $proposal_data->id . ' +Uploaded user defined compound : ' . $file_name . ' -Now you should be able to propose a new DWSIM flowsheet. -Please ensure that ALL the codes follow guidelines at http://dwsim.fossee.in/flowsheeting-project/coding-guidelines-flowsheeting +You can propose a new flowsheet project proposal. 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 {dwsim_flowsheet_solution} WHERE id = %d LIMIT 1", $params['solution_uploaded']['solution_id']); - $query = db_select('dwsim_flowsheet_solution'); - $query->fields('dwsim_flowsheet_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('dwsim_flowsheet_experiment'); - $query->fields('dwsim_flowsheet_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 DWSIM flowsheet solution', array( - '!site_name' => variable_get('site_name', '') - ), array( - 'language' => $language->language - )); - $message['headers'] = $params['solution_uploaded']['headers']; - $message['body'] = array( - 'body' => t(' + '!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 {dwsim_flowsheet_solution} WHERE id = %d LIMIT 1", $params['solution_uploaded']['solution_id']); + $query = db_select('dwsim_flowsheet_solution'); + $query->fields('dwsim_flowsheet_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('dwsim_flowsheet_experiment'); + $query->fields('dwsim_flowsheet_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 DWSIM flowsheet 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: @@ -254,36 +408,36 @@ 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 {dwsim_flowsheet_solution} WHERE id = %d LIMIT 1", $params['solution_approved']['solution_id']); - $query = db_select('dwsim_flowsheet_solution'); - $query->fields('dwsim_flowsheet_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('dwsim_flowsheet_experiment'); - $query->fields('dwsim_flowsheet_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 DWSIM flowsheet solution has been approved', array( - '!site_name' => variable_get('site_name', '') - ), array( - 'language' => $language->language - )); - $message['body'] = array( - 'body' => t(' + '!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 {dwsim_flowsheet_solution} WHERE id = %d LIMIT 1", $params['solution_approved']['solution_id']); + $query = db_select('dwsim_flowsheet_solution'); + $query->fields('dwsim_flowsheet_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('dwsim_flowsheet_experiment'); + $query->fields('dwsim_flowsheet_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 DWSIM flowsheet 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: @@ -299,23 +453,23 @@ 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 DWSIM flowsheet solution has been disapproved', array( - '!site_name' => variable_get('site_name', '') - ), array( - 'language' => $language->language - )); - $message['body'] = array( - 'body' => t(' + '!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 DWSIM flowsheet 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: @@ -330,23 +484,23 @@ 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 DWSIM flowsheet solution', array( - '!site_name' => variable_get('site_name', '') - ), array( - 'language' => $language->language - )); - $message['body'] = array( - 'body' => t(' + '!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 DWSIM flowsheet 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 : @@ -362,24 +516,24 @@ 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(' + '!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 : @@ -391,17 +545,17 @@ 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; - } - } + '!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; + } //$key +} |