private static function build_row($lead_id, $atts) { ?> <tbody> <tr> <?php GFPDFEWidgetsAndShortcode_Shortcode::get_lead_row($lead_id, $atts, self::$fields); ?> <td><a href="<?php echo $atts['action']; ?> "><?php echo $atts['text']; ?> </a></td> </tr> </tbody> <?php }
private static function build_rows($leads, $atts) { global $gfpdf; /* * Get the PDF configuration node */ $templates = $gfpdf->get_template($atts['form_id'], true); /* exit early if templates not found */ if ($templates === false) { /* * TODO: log error about no PDF templates on this node */ return false; } /* * Ensure our PDF template name matches one of the values pulled from the DB */ if (strlen($atts['template']) > 0) { if (is_array($templates) && !in_array($atts['template'], $templates) || $atts['template'] !== $templates) { /* * TODO: log error about no PDF templates on this node */ return false; } $atts['template'] = array(array('template' => $atts['template'])); } else { $atts['template'] = is_array($templates) ? $templates : array(array('template' => $templates)); } /* * start buffering */ ob_start(); ?> <tbody> <?php foreach ($leads as $l) { ?> <tr> <?php GFPDFEWidgetsAndShortcode_Shortcode::get_lead_row($l->id, $atts, self::$fields); if ($atts['pdf']) { /* * Output the PDF link */ ?> <td> <?php foreach ($atts['template'] as $t) { ?> <a class="gfpdfe_pdf_view_link" target="_blank" href="<?php echo site_url('/'); ?> ?gf_pdf=1& fid=<?php echo $atts['form_id']; ?> & lid=<?php echo $l->id; ?> & template=<?php echo $t['template']; ?> <?php echo $atts['action'] === 'download' ? '&download=1' : ''; ?> "><?php echo $atts['text']; ?> </a> <?php } ?> </td> <?php } /* * Check if we need to add an 'edit' link */ if ($atts['edit'] === true) { $nonce = wp_create_nonce('gfpdfe_edit_' . $l->id); ?> <td><a href="?action=update&lid=<?php echo $l->id; ?> &nonce=<?php echo $nonce; ?> ">Edit</a></td> <?php } ?> </tr> <?php } ?> </tbody> <?php $html = ob_get_clean(); return $html; }