-
Notifications
You must be signed in to change notification settings - Fork 3
/
upload_code.inc
executable file
·550 lines (547 loc) · 21.9 KB
/
upload_code.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
<?php
// $Id$
function om_pssp_abstract()
{
global $user;
$return_html = "";
$proposal_data = om_pssp_get_proposal();
if (!$proposal_data)
{
drupal_goto('powersystems');
return;
} //!$proposal_data
//$return_html .= l('Upload abstract', 'powersystems/pssp/abstract-code/upload') . '<br />';
/* get experiment list */
$query = db_select('om_pssp_submitted_abstracts');
$query->fields('om_pssp_submitted_abstracts');
$query->condition('proposal_id', $proposal_data->id);
$abstracts_q = $query->execute()->fetchObject();
$query_pro = db_select('om_pssp_proposal');
$query_pro->fields('om_pssp_proposal');
$query_pro->condition('id', $proposal_data->id);
$abstracts_pro = $query_pro->execute()->fetchObject();
$query_pdf = db_select('om_pssp_submitted_abstracts_file');
$query_pdf->fields('om_pssp_submitted_abstracts_file');
$query_pdf->condition('proposal_id', $proposal_data->id);
$query_pdf->condition('filetype', 'A');
$abstracts_pdf = $query_pdf->execute()->fetchObject();
if($abstracts_q->other_libraries_used == 1)
{
$other_libraries_used = "Yes";
}
else
{
$other_libraries_used = "No";
}
if ($abstracts_pdf == TRUE)
{
if ($abstracts_pdf->filename != "NULL" || $abstracts_pdf->filename != "")
{
$abstract_filename = $abstracts_pdf->filename;
//$abstract_filename = l($abstracts_pdf->filename, 'powersystems/pssp/download/project-file/' . $proposal_data->id);
} //$abstracts_pdf->filename != "NULL" || $abstracts_pdf->filename != ""
else
{
$abstract_filename = "File not uploaded";
}
} //$abstracts_pdf == TRUE
else
{
$abstract_filename = "File not uploaded";
}
$query_process = db_select('om_pssp_submitted_abstracts_file');
$query_process->fields('om_pssp_submitted_abstracts_file');
$query_process->condition('proposal_id', $proposal_data->id);
$query_process->condition('filetype', 'S');
$abstracts_query_process = $query_process->execute()->fetchObject();
if ($abstracts_query_process == TRUE)
{
if ($abstracts_query_process->filename != "NULL" || $abstracts_query_process->filename != "")
{
$abstracts_query_process_filename = $abstracts_query_process->filename;
//$abstracts_query_process_filename = l($abstracts_query_process->filename, 'powersystems/pssp/download/project-file/' . $proposal_data->id);
} //$abstracts_query_process->filename != "NULL" || $abstracts_query_process->filename != ""
else
{
$abstracts_query_process_filename = "File not uploaded";
}
if ($abstracts_q->is_submitted == '')
{
$url = l('Upload abstract', 'powersystems/pssp/abstract-code/upload');
} //$abstracts_q->is_submitted == ''
else if ($abstracts_q->is_submitted == 1)
{
$url = "";
} //$abstracts_q->is_submitted == 1
else if ($abstracts_q->is_submitted == 0)
{
$url = l('Edit', 'powersystems/pssp/abstract-code/upload');
} //$abstracts_q->is_submitted == 0
} //$abstracts_query_process == TRUE
else
{
$url = l('Upload abstract', 'powersystems/pssp/abstract-code/upload');
$abstracts_query_process_filename = "File not uploaded";
}
$return_html .= '<strong>Contributor Name:</strong><br />' . $proposal_data->name_title . ' ' . $proposal_data->contributor_name . '<br /><br />';
$return_html .= '<strong>Title of the power system simulation Project:</strong><br />' . $proposal_data->project_title . '<br /><br />';
$return_html .= '<strong>Other Libraries used:</strong><br />' . $other_libraries_used . '<br /><br />';
$return_html .= '<strong>Uploaded abstract of the project:</strong><br />' . $abstract_filename . '<br /><br />';
$return_html .= '<strong>Uploaded project files:</strong><br />' . $abstracts_query_process_filename . '<br /><br />';
$return_html .= $url . '<br />';
return $return_html;
}
function om_pssp_upload_abstract_code_form($form, &$form_state)
{
global $user;
$form['#attributes'] = array(
'enctype' => "multipart/form-data"
);
/* get current proposal */
//$proposal_id = (int) arg(3);
$uid = $user->uid;
$query = db_select('om_pssp_proposal');
$query->fields('om_pssp_proposal');
$query->condition('uid', $uid);
$query->condition('approval_status', '1');
$proposal_q = $query->execute();
if ($proposal_q)
{
if ($proposal_data = $proposal_q->fetchObject())
{
/* everything ok */
} //$proposal_data = $proposal_q->fetchObject()
else
{
drupal_set_message(t('Invalid proposal selected. Please try again.'), 'error');
drupal_goto('powersystems/pssp/abstract-code');
return;
}
} //$proposal_q
else
{
drupal_set_message(t('Invalid proposal selected. Please try again.'), 'error');
drupal_goto('powersystems/pssp/abstract-code');
return;
}
$query = db_select('om_pssp_submitted_abstracts');
$query->fields('om_pssp_submitted_abstracts');
$query->condition('proposal_id', $proposal_data->id);
$abstracts_q = $query->execute()->fetchObject();
if ($abstracts_q)
{
if ($abstracts_q->is_submitted == 1)
{
drupal_set_message(t('You have already submited your project files, hence you can not upload more code, for any query please write to us.'), 'error', $repeat = FALSE);
drupal_goto('powersystems/pssp/abstract-code');
//return;
} //$abstracts_q->is_submitted == 1
} //$abstracts_q->is_submitted == 1
$form['project_title'] = array(
'#type' => 'item',
'#markup' => $proposal_data->project_title,
'#title' => t('Title of the Power system simulation Project')
);
$form['contributor_name'] = array(
'#type' => 'item',
'#markup' => $proposal_data->contributor_name,
'#title' => t('Contributor Name')
);
$form['other_libraries'] = array(
'#type' => 'radios',
'#title' => t('Other Modelica Libraries Used'),
'#options' => array(
'1' => 'Yes',
'0' => 'No',
),
'#default_value' => $abstracts_q->other_libraries_used,
'#required' => TRUE
);
$existing_uploaded_A_file = default_value_for_uploaded_files("A", $proposal_data->id);
if (!$existing_uploaded_A_file)
{
$existing_uploaded_A_file = new stdClass();
$existing_uploaded_A_file->filename = "No file uploaded";
} //!$existing_uploaded_A_file
$form['upload_an_abstract'] = array(
'#type' => 'file',
'#title' => t('Upload an abstract of the project.') ,
//'#required' => TRUE,
'#description' => t(t('<span style="color:red;">Current File :</span> ' . $existing_uploaded_A_file->filename . '<br />' . t('<span style="color:red;">Allowed file extensions : ') . variable_get('om_pssp_abstract_upload_extensions', '') . '</span>'
)));
$existing_uploaded_S_file = default_value_for_uploaded_files("S", $proposal_data->id);
if (!$existing_uploaded_S_file)
{
$existing_uploaded_S_file = new stdClass();
$existing_uploaded_S_file->filename = "No file uploaded";
} //!$existing_uploaded_S_file
$form['upload_om_pssp_developed_process'] = array(
'#type' => 'file',
'#title' => t('Upload the Project Files'),
//'#required' => TRUE,
'#description' => t('<span style="color:red;">Current File :</span> ' . $existing_uploaded_S_file->filename . '<br />Separate filenames with underscore. No spaces or any special characters allowed in filename.') . '<br />' . t('<span style="color:red;">Allowed file extensions : ') . variable_get('om_pssp_project_files_extensions', '') . '</span>'
);
$form['prop_id'] = array(
'#type' => 'hidden',
'#value' => $proposal_data->id
);
$form['imp_note'] = array(
'#type' => 'item',
'#markup' => t('Note: <span style="color:red;">*It is mandatory to keep the OpenIPSL as a sub-package within the submitted package.</span>')
);
/*
$form['is_submitted'] = array(
'#type' => 'checkboxes',
//'#title' => t('Terms And Conditions'),
'#options' => array(
'status' => t('I have uploaded the project files')
),
'#required' => TRUE
);*/
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
'#submit' => array(
'om_pssp_upload_abstract_code_form_submit'
)
);
$form['cancel'] = array(
'#type' => 'item',
'#markup' => l(t('Cancel'), 'powersystems/pssp/abstract-code')
);
return $form;
}
///////////////////////////////////////////////////////////////
function om_pssp_upload_abstract_code_form_validate($form, &$form_state)
{
if (isset($_FILES['files']))
{
/* check if file is uploaded */
$existing_uploaded_A_file = default_value_for_uploaded_files("A", $form_state['values']['prop_id']);
$existing_uploaded_S_file = default_value_for_uploaded_files("S", $form_state['values']['prop_id']);
if (!$existing_uploaded_S_file)
{
if (!($_FILES['files']['name']['upload_om_pssp_developed_process']))
form_set_error('upload_om_pssp_developed_process', t('Please upload the file.'));
} //!$existing_uploaded_S_file
if (!$existing_uploaded_A_file)
{
if (!($_FILES['files']['name']['upload_an_abstract']))
form_set_error('upload_an_abstract', t('Please upload the file.'));
} //!$existing_uploaded_A_file
/* check for valid filename extensions */
if ($_FILES['files']['name']['upload_an_udc'] || $_FILES['files']['name']['upload_an_abstract'] || $_FILES['files']['name']['upload_om_pssp_developed_process'])
{
foreach ($_FILES['files']['name'] as $file_form_name => $file_name)
{
if ($file_name)
{
/* checking file type */
if (strstr($file_form_name, 'upload_om_pssp_developed_process'))
$file_type = 'S';
else if (strstr($file_form_name, 'upload_an_abstract'))
$file_type = 'A';
else
$file_type = 'U';
$allowed_extensions_str = '';
switch ($file_type)
{
case 'S':
$allowed_extensions_str = variable_get('om_pssp_project_files_extensions', '');
break;
case 'A':
$allowed_extensions_str = variable_get('om_pssp_abstract_upload_extensions', '');
break;
} //$file_type
$allowed_extensions = explode(',', $allowed_extensions_str);
$tmp_ext = explode('.', strtolower($_FILES['files']['name'][$file_form_name]));
$temp_extension = end($tmp_ext);
if (!in_array($temp_extension, $allowed_extensions))
form_set_error($file_form_name, t('Only file with ' . $allowed_extensions_str . ' extensions can be uploaded.'));
if ($_FILES['files']['size'][$file_form_name] <= 0)
form_set_error($file_form_name, t('File size cannot be zero.'));
/* check if valid file name */
if (!om_pssp_check_valid_filename($_FILES['files']['name'][$file_form_name]))
form_set_error($file_form_name, t('Invalid file name specified. Only alphabets and numbers are allowed as a valid filename.'));
} //$file_name
} //$_FILES['files']['name'] as $file_form_name => $file_name
} //$_FILES['files']['name'] as $file_form_name => $file_name
} //isset($_FILES['files'])
// drupal_add_js('jQuery(document).ready(function () { alert("Hello!"); });', 'inline');
// drupal_static_reset('drupal_add_js') ;
}
function om_pssp_upload_abstract_code_form_submit($form, &$form_state)
{
global $user;
$v = $form_state['values'];
if($form_state['values']['other_libraries'] == 1)
{
$other_libraries_used = 1;
}
else{
$other_libraries_used = 0;
}
$root_path = om_pssp_path();
$proposal_data = om_pssp_get_proposal();
$proposal_id = $proposal_data->id;
if (!$proposal_data)
{
drupal_goto('powersystems');
return;
} //!$proposal_data
$proposal_id = $proposal_data->id;
$proposal_directory = $proposal_data->directory_name;
/* create proposal folder if not present */
//$dest_path = $proposal_directory . '/';
$dest_path_project_files = $proposal_directory . '/project_files/';
if (!is_dir($root_path . $dest_path_project_files))
mkdir($root_path . $dest_path_project_files);
$proposal_id = $proposal_data->id;
$query_s = "SELECT * FROM {om_pssp_submitted_abstracts} WHERE proposal_id = :proposal_id";
$args_s = array(
":proposal_id" => $proposal_id
);
$query_s_result = db_query($query_s, $args_s)->fetchObject();
if (!$query_s_result)
{
/* creating solution database entry */
$query = "INSERT INTO {om_pssp_submitted_abstracts} (
proposal_id,
approver_uid,
abstract_approval_status,
other_libraries_used,
abstract_upload_date,
abstract_approval_date,
is_submitted) VALUES (:proposal_id, :approver_uid, :abstract_approval_status, :other_libraries_used, :abstract_upload_date, :abstract_approval_date, :is_submitted)";
$args = array(
":proposal_id" => $proposal_id,
":approver_uid" => 0,
":abstract_approval_status" => 0,
":other_libraries_used" => $other_libraries_used,
":abstract_upload_date" => time(),
":abstract_approval_date" => 0,
":is_submitted" => 1
);
$submitted_abstract_id = db_query($query, $args, array(
'return' => Database::RETURN_INSERT_ID
));
$query1 = "UPDATE {om_pssp_proposal} SET is_submitted = :is_submitted WHERE id = :id";
$args1 = array(
":is_submitted" => 1,
":id" => $proposal_id
);
db_query($query1,$args1);
drupal_set_message('Abstract uploaded successfully.', 'status');
} //!$query_s_result
else
{
$query = "UPDATE {om_pssp_submitted_abstracts} SET
other_libraries_used = :other_libraries_used,
abstract_upload_date =:abstract_upload_date,
is_submitted= :is_submitted
WHERE proposal_id = :proposal_id
";
$args = array(
":other_libraries_used" => $other_libraries_used,
":abstract_upload_date" => time(),
":is_submitted" => 1,
":proposal_id" => $proposal_id
);
$submitted_abstract_id = db_query($query, $args, array(
'return' => Database::RETURN_INSERT_ID
));
$query1 = "UPDATE {om_pssp_proposal} SET is_submitted = :is_submitted WHERE id = :id";
$args1 = array(
":is_submitted" => 1,
":id" => $proposal_id
);
db_query($query1,$args1);
drupal_set_message('Abstract updated successfully.', 'status');
}
foreach ($_FILES['files']['name'] as $file_form_name => $file_name)
{
if ($file_name)
{
/* checking file type */
if (strstr($file_form_name, 'upload_om_pssp_developed_process'))
{
$file_type = 'S';
} //strstr($file_form_name, 'upload_om_pssp_developed_process')
else if (strstr($file_form_name, 'upload_an_abstract'))
{
$file_type = 'A';
}
else
{
$file_type = 'U';
}
switch ($file_type)
{
case 'S':
if (file_exists($root_path . $dest_path_project_files . $_FILES['files']['name'][$file_form_name]))
{
//unlink($root_path . $dest_path . $_FILES['files']['name'][$file_form_name]);
drupal_set_message(t("File !filename already exists hence overwirtten the exisitng file ", array(
'!filename' => $_FILES['files']['name'][$file_form_name]
)), 'error');
} //file_exists($root_path . $dest_path . $_FILES['files']['name'][$file_form_name])
/* uploading file */
else if (move_uploaded_file($_FILES['files']['tmp_name'][$file_form_name], $root_path . $dest_path_project_files . $_FILES['files']['name'][$file_form_name]))
{
/* for uploaded files making an entry in the database */
$query_ab_f = "SELECT * FROM om_pssp_submitted_abstracts_file WHERE proposal_id = :proposal_id AND filetype =
:filetype";
$args_ab_f = array(
":proposal_id" => $proposal_id,
":filetype" => $file_type
);
$query_ab_f_result = db_query($query_ab_f, $args_ab_f)->fetchObject();
if (!$query_ab_f_result)
{
$query = "INSERT INTO {om_pssp_submitted_abstracts_file} (submitted_abstract_id, proposal_id, uid, approvar_uid, filename, filepath, filemime, filesize, filetype, timestamp)
VALUES (:submitted_abstract_id, :proposal_id, :uid, :approvar_uid, :filename, :filepath, :filemime, :filesize, :filetype, :timestamp)";
$args = array(
":submitted_abstract_id" => $submitted_abstract_id,
":proposal_id" => $proposal_id,
":uid" => $user->uid,
":approvar_uid" => 0,
":filename" => $_FILES['files']['name'][$file_form_name],
":filepath" => $_FILES['files']['name'][$file_form_name],
":filemime" => mime_content_type($root_path . $dest_path_project_files . $_FILES['files']['name'][$file_form_name]),
":filesize" => $_FILES['files']['size'][$file_form_name],
":filetype" => $file_type,
":timestamp" => time()
);
db_query($query, $args);
drupal_set_message($file_name . ' uploaded successfully.', 'status');
} //!$query_ab_f_result
else
{
unlink($root_path . $dest_path_project_files . $query_ab_f_result->filename);
$query = "UPDATE {om_pssp_submitted_abstracts_file} SET filename = :filename, filepath=:filepath, filemime=:filemime, filesize=:filesize, timestamp=:timestamp WHERE proposal_id = :proposal_id AND filetype = :filetype";
$args = array(
":filename" => $_FILES['files']['name'][$file_form_name],
":filepath" => $file_path . $_FILES['files']['name'][$file_form_name],
":filemime" => mime_content_type($root_path . $dest_path_project_files . $_FILES['files']['name'][$file_form_name]),
":filesize" => $_FILES['files']['size'][$file_form_name],
":timestamp" => time(),
":proposal_id" => $proposal_id,
":filetype" => $file_type
);
db_query($query, $args);
drupal_set_message($file_name . ' file updated successfully.', 'status');
}
} //move_uploaded_file($_FILES['files']['tmp_name'][$file_form_name], $root_path . $dest_path . $_FILES['files']['name'][$file_form_name])
else
{
drupal_set_message('Error uploading file : ' . $dest_path_project_files . $file_name, 'error');
}
break;
case 'A':
if (file_exists($root_path . $dest_path_project_files . $_FILES['files']['name'][$file_form_name]))
{
//unlink($root_path . $dest_path . $_FILES['files']['name'][$file_form_name]);
drupal_set_message(t("File !filename already exists hence overwirtten the exisitng file ", array(
'!filename' => $_FILES['files']['name'][$file_form_name]
)), 'error');
} //file_exists($root_path . $dest_path . $_FILES['files']['name'][$file_form_name])
/* uploading file */
else if (move_uploaded_file($_FILES['files']['tmp_name'][$file_form_name], $root_path . $dest_path_project_files . $_FILES['files']['name'][$file_form_name]))
{
/* for uploaded files making an entry in the database */
$query_ab_f = "SELECT * FROM om_pssp_submitted_abstracts_file WHERE proposal_id = :proposal_id AND filetype =
:filetype";
$args_ab_f = array(
":proposal_id" => $proposal_id,
":filetype" => $file_type
);
$query_ab_f_result = db_query($query_ab_f, $args_ab_f)->fetchObject();
if (!$query_ab_f_result)
{
$query = "INSERT INTO {om_pssp_submitted_abstracts_file} (submitted_abstract_id, proposal_id, uid, approvar_uid, filename, filepath, filemime, filesize, filetype, timestamp)
VALUES (:submitted_abstract_id, :proposal_id, :uid, :approvar_uid, :filename, :filepath, :filemime, :filesize, :filetype, :timestamp)";
$args = array(
":submitted_abstract_id" => $submitted_abstract_id,
":proposal_id" => $proposal_id,
":uid" => $user->uid,
":approvar_uid" => 0,
":filename" => $_FILES['files']['name'][$file_form_name],
":filepath" => $_FILES['files']['name'][$file_form_name],
":filemime" => mime_content_type($root_path . $dest_path_project_files . $_FILES['files']['name'][$file_form_name]),
":filesize" => $_FILES['files']['size'][$file_form_name],
":filetype" => $file_type,
":timestamp" => time()
);
db_query($query, $args);
drupal_set_message($file_name . ' uploaded successfully.', 'status');
} //!$query_ab_f_result
else
{
unlink($root_path . $dest_path_project_files . $query_ab_f_result->filename);
$query = "UPDATE {om_pssp_submitted_abstracts_file} SET filename = :filename, filepath=:filepath, filemime=:filemime, filesize=:filesize, timestamp=:timestamp WHERE proposal_id = :proposal_id AND filetype = :filetype";
$args = array(
":filename" => $_FILES['files']['name'][$file_form_name],
":filepath" => $file_path . $_FILES['files']['name'][$file_form_name],
":filemime" => mime_content_type($root_path . $dest_path_project_files . $_FILES['files']['name'][$file_form_name]),
":filesize" => $_FILES['files']['size'][$file_form_name],
":timestamp" => time(),
":proposal_id" => $proposal_id,
":filetype" => $file_type
);
db_query($query, $args);
drupal_set_message($file_name . ' file updated successfully.', 'status');
}
} //move_uploaded_file($_FILES['files']['tmp_name'][$file_form_name], $root_path . $dest_path . $_FILES['files']['name'][$file_form_name])
else
{
drupal_set_message('Error uploading file : ' . $dest_path_project_files . $file_name, 'error');
}
break;
} //$file_type
} //$file_name
} //$_FILES['files']['name'] as $file_form_name => $file_name
/* sending email */
$email_to = $user->mail;
$from = variable_get('om_pssp_from_email', '');
$bcc = variable_get('om_pssp_emails', '');
$cc = variable_get('om_pssp_cc_emails', '');
$params['abstract_uploaded']['proposal_id'] = $proposal_id;
$params['abstract_uploaded']['submitted_abstract_id'] = $submitted_abstract_id;
$params['abstract_uploaded']['user_id'] = $user->uid;
$params['abstract_uploaded']['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
);
if (!drupal_mail('om_pssp', 'abstract_uploaded', $email_to, language_default(), $params, $from, TRUE))
drupal_set_message('Error sending email message.', 'error');
drupal_goto('powersystems/pssp/abstract-code');
}
function default_value_for_uploaded_files($filetype, $proposal_id)
{
$query = db_select('om_pssp_submitted_abstracts_file');
$query->fields('om_pssp_submitted_abstracts_file');
$query->condition('proposal_id', $proposal_id);
$selected_files_array = "";
if ($filetype == "A")
{
$query->condition('filetype', $filetype);
$filetype_q = $query->execute()->fetchObject();
return $filetype_q;
} //$filetype == "A"
elseif ($filetype == "S")
{
$query->condition('filetype', $filetype);
$filetype_q = $query->execute()->fetchObject();
return $filetype_q;
}
else
{
return;
}
return;
}