/[drupal]/contributions/modules/webform_pdf/pdf_webform.inc
ViewVC logotype

Diff of /contributions/modules/webform_pdf/pdf_webform.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.6, Thu Sep 18 17:33:30 2008 UTC revision 1.7, Fri Sep 19 01:31:54 2008 UTC
# Line 128  function webform_pdf_upload_form_submit( Line 128  function webform_pdf_upload_form_submit(
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
# Line 143  function webform_pdf_upload_form_submit( Line 142  function webform_pdf_upload_form_submit(
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}";

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.2