/** * @param $atts array of short code attributes * @param $content string contents inside the shortcode tag * @return string value submitted to a form field as selected by $atts. See ExportToValue.php */ public function handleShortcode($atts, $content = null) { if ($content && isset($atts['form'])) { $atts['fromshortcode'] = true; $atts['content'] = $content; require_once 'ExportToHtmlTemplate.php'; $export = new ExportToHtmlTemplate(); return $export->export($atts['form'], $atts); } }
public function test_missing_lname_field() { $options = array(); $options['content'] = '${fname} ${lname} | '; $exp = new ExportToHtmlTemplate(); ob_start(); $exp->export('dates', $options); $text = ob_get_contents(); $this->assertEquals("Mike Simpson | Oya | ", $text); }
public function test_transforms() { $options = array(); $options['trans'] = 'inicio=cambiaFecha(inicio)&&fin=cambiaFecha(fin)'; $options['content'] = '${name}|${inicio}|${fin} '; $exp = new ExportToHtmlTemplate(); ob_start(); $exp->export('dates', $options); $text = ob_get_contents(); $this->assertEquals("Mike|1.1.2014|2.1.2014 Oya|5.1.2014|6.1.2014 ", $text); }
public function test_unknown_fields_with_default_trans() { $options = array(); $options['content'] = '${fname} ${anunknownfield1} ${anunknownfield2} | '; $options['trans'] = 'DefaultField(anunknownfield1,hi,anunknownfield2,there)'; $exp = new ExportToHtmlTemplate(); ob_start(); $exp->export('dates', $options); $text = ob_get_contents(); $this->assertEquals('Mike hi there | Oya hi there | ', $text); }
/** * @param $atts array of short code attributes * @param $content string contents inside the shortcode tag * @return string value submitted to a form field as selected by $atts. See ExportToValue.php */ public function handleShortcode($atts, $content = null) { if ($content && isset($atts['form'])) { $atts = $this->decodeAttributes($atts); $atts['fromshortcode'] = true; $atts['content'] = $content; require_once 'DereferenceShortcodeVars.php'; $deref = new DereferenceShortcodeVars(); $form = $deref->convert($atts['form']); require_once 'ExportToHtmlTemplate.php'; $export = new ExportToHtmlTemplate(); return $export->export($form, $atts); } return ''; }
/** * @param $formName string * @param $options array of option_name => option_value * @return void */ public function export($formName, $options = null) { if (!isset($options['submit_time'])) { return; } $this->submitTime = $options['submit_time']; unset($options['submit_time']); $options['content'] = 'TO BE REPLACED'; $options['filter'] = 'submit_time=' . $this->submitTime; parent::export($formName, $options); }
static function export($formName, $encoding, $options) { switch ($encoding) { case 'HTML': require_once 'ExportToHtmlTable.php'; $exporter = new ExportToHtmlTable(); $exporter->export($formName, $options); break; case 'HTMLBOM': // IQY callback require_once 'ExportToHtmlTable.php'; $exporter = new ExportToHtmlTable(); $exporter->setUseBom(true); $exporter->export($formName, $options); break; case 'DT': require_once 'ExportToHtmlTable.php'; if (!is_array($options)) { $options = array(); } $options['useDT'] = true; if (!isset($options['printScripts'])) { $options['printScripts'] = true; } if (!isset($options['printStyles'])) { $options['printStyles'] = 'true'; } $exporter = new ExportToHtmlTable(); $exporter->export($formName, $options); break; case 'HTMLTemplate': require_once 'ExportToHtmlTemplate.php'; $exporter = new ExportToHtmlTemplate(); $exporter->export($formName, $options); break; case 'IQY': require_once 'ExportToIqy.php'; $exporter = new ExportToIqy(); $exporter->export($formName, $options); break; case 'CSVUTF8BOM': $options['unbuffered'] = 'true'; require_once 'ExportToCsvUtf8.php'; $exporter = new ExportToCsvUtf8(); $exporter->setUseBom(true); $exporter->export($formName, $options); break; case 'TSVUTF16LEBOM': $options['unbuffered'] = 'true'; require_once 'ExportToCsvUtf16le.php'; $exporter = new ExportToCsvUtf16le(); $exporter->export($formName, $options); break; case 'GLD': require_once 'ExportToGoogleLiveData.php'; $exporter = new ExportToGoogleLiveData(); $exporter->export($formName, $options); break; case 'GSS': $options['unbuffered'] = 'true'; require_once 'ExportToGoogleSS.php'; $exporter = new ExportToGoogleSS(); $exporter->export($formName, $options); break; case 'JSON': require_once 'ExportToJson.php'; $exporter = new ExportToJson(); $exporter->export($formName, $options); break; case 'VALUE': require_once 'ExportToValue.php'; $exporter = new ExportToValue(); $exporter->export($formName, $options); break; case 'COUNT': require_once 'ExportToValue.php'; if (!is_array($options)) { $options = array(); } $options['function'] = 'count'; unset($options['show']); unset($options['hide']); $exporter = new ExportToValue(); $exporter->export($formName, $options); break; case 'CSVSJIS': require_once 'ExportToCsvUtf8.php'; $exporter = new ExportToCsvUtf8(); $exporter->setUseBom(false); $exporter->setUseShiftJIS(true); $exporter->export($formName, $options); break; case 'RSS': require_once 'ExportToRSS.php'; $exporter = new ExportToRSS(); $exporter->export($formName, $options); break; case 'ENTRY': require_once 'ExportEntry.php'; $exporter = new ExportEntry(); $exporter->export($formName, $options); break; case 'CSVUTF8': default: require_once 'ExportToCsvUtf8.php'; $exporter = new ExportToCsvUtf8(); $exporter->setUseBom(false); $exporter->export($formName, $options); break; } }