| 128 |
drupal_goto("node/{$node->nid}/edit"); |
drupal_goto("node/{$node->nid}/edit"); |
| 129 |
} |
} |
| 130 |
|
|
|
|
|
| 131 |
/** |
/** |
| 132 |
* Generates the PDF-ouput of the Webform |
* Generates the PDF-ouput of the Webform |
| 133 |
* It first constructs the XFDF from the Webform's fields, then it sends that data to MY server (whereon is |
* It first constructs the XFDF from the Webform's fields, then it sends that data to MY server (whereon is |
| 142 |
*/ |
*/ |
| 143 |
function generate_pdf($nid, $sid){ |
function generate_pdf($nid, $sid){ |
| 144 |
include_once(drupal_get_path('module','webform_pdf').'/xfdf.inc'); |
include_once(drupal_get_path('module','webform_pdf').'/xfdf.inc'); |
| 145 |
|
include_once(drupal_get_path('module','webform').'/components/date.inc'); |
| 146 |
$host='http://'.$_SERVER['SERVER_NAME']; |
$host='http://'.$_SERVER['SERVER_NAME']; |
| 147 |
|
|
| 148 |
$text_fields=array(); |
$text_fields=array(); |
| 149 |
$orig_fields=variable_get('webform_pdf_orig_fields',array()); |
$orig_fields=variable_get('webform_pdf_orig_fields',array()); |
| 150 |
//composite primary key= nid sid cid |
//composite primary key= nid sid cid |
| 151 |
foreach($orig_fields[$nid] as $key=>$value){ |
foreach($orig_fields[$nid] as $key=>$value){ |
| 152 |
$text_fields[$value]=db_result(db_query(" |
|
| 153 |
SELECT s.data |
$component_type=db_result(db_query("SELECT c.type FROM {webform_component} c |
| 154 |
FROM {webform_submitted_data} s, {webform_component} c |
WHERE c.nid=%d AND c.form_key='%s'",$nid,$key)); |
| 155 |
WHERE s.nid=%d AND s.sid=%d AND s.cid=c.cid AND c.form_key=\"%s\"", |
if($component_type=='date'){ |
| 156 |
$nid, $sid, $key |
$date=db_fetch_array(db_query("SELECT * FROM {webform_submitted_data} WHERE nid=129 AND cid=50")); |
| 157 |
)); |
$date=webform_expand_date($date); |
| 158 |
|
$timestamp=mktime(0, 0, 0, $date['#value']['month'], $date['#value']['day'], $date['#value']['year']); |
| 159 |
|
$text_fields[$value]=date("M d, Y",$timestamp); |
| 160 |
|
} |
| 161 |
|
else{ |
| 162 |
|
$text_fields[$value]=db_result(db_query("SELECT s.data |
| 163 |
|
FROM {webform_submitted_data} s, {webform_component} c |
| 164 |
|
WHERE s.nid=%d AND s.sid=%d AND s.cid=c.cid AND c.form_key=\"%s\"", |
| 165 |
|
$nid, $sid, $key)); |
| 166 |
|
} |
| 167 |
} |
} |
| 168 |
|
|
| 169 |
$form_name = "webform_{$nid}"; |
$form_name = "webform_{$nid}"; |