/** * Very simple combinate multiple templates from generate_template() into one XML templates * */ function generate_templates($type, $params) { $templates_xml = '<?xml version="1.0"?>' . PHP_EOL . '<templates>' . PHP_EOL; if (!is_array_assoc($params)) { foreach ($params as $entry) { $template = generate_template($type, $entry); $templates_xml .= PHP_EOL . preg_replace('/^\\s*<\\?xml.+?\\?>\\s*(<template)/s', '\\1', $template); } } else { $template = generate_template($type, $params); $templates_xml .= PHP_EOL . preg_replace('/^\\s*<\\?xml.+?\\?>\\s*(<template)/s', '\\1', $template); } $templates_xml .= PHP_EOL . '</templates>' . PHP_EOL; return $templates_xml; }
$dims = new stdClass(); $dims->coords = array(); $page_dims[] = $dims; blended_print_page_header($pdf, $dims, "9901984610272", "22222222201", $headeroptions); $pdf->writeHTMLCell($columnsWidth, 1, '', '', $question->textHtml, $borderDescription, 0, 0, false); //$pdf->SetXY(10,10); // no importa el inicio en Y draw_multichoice_question($pdf, $dims, $question, $columnsWidth, 0, $markSize); draw_multichoice_question($pdf, $dims, $question2, $columnsWidth, 0, $markSize); $pdf->SetY(max($dims->coords[$question->id]->Y + $dims->coords[$question->id]->H, $dims->coords[$question2->id]->Y + $dims->coords[$question2->id]->H)); //TODO:row draw_multichoice_question($pdf, $dims, $question3, $columnsWidth, 0, $markSize); //Close and output PDF document $pdf->setLastH(1); // affects the inter-line space //illustrate_layout($pdf,$dims); $text = generate_template($dims, $fieldname); $pdf->writeHTMLCell('', '', '', '', $text, 1); $pdf->Output('labels.pdf', 'I'); /** * Draws a multichoice question with many options on the TCPDF object. * It relies on the current X,Y pointer of the TCPDF context. * * Generates some metrics about the layout. * retuns an object with the following structure: * object->coords[]->X * ->Y * ->H * ->W * ->marks[]->X * ->Y * ->H
/** * @dataProvider providerGenerateTemplate * @group templates */ public function testGenerateTemplate($type, $array, $result) { $template = generate_template($type, $array); $template = preg_replace('/<template type="' . $type . '".+?>/', '<template>', $template); $this->assertSame($result, $template); }
print_success($message . "<p>Association inserted as " . $assoc_id . "</p>"); unset($vars); // Clean vars for use with new associations } else { print_warning($message . "<p>Association creation failed.</p>"); dbDelete('alert_tests', "`alert_test_id` = ?", array($check_id)); // Undo alert checker create } } else { print_error($message . "<p>Alert creation failed. Please note that the alert name <b>must</b> be unique.</p>"); } } else { print_warning($message . "Missing required data."); } if (OBS_DEBUG) { print_message("<h4>TEMPLATE:<h4> <pre>" . escape_html(generate_template('alert', array_merge($check_array, $vars))) . "</pre>", 'console', FALSE); } } ?> <form name="form1" method="post" action="<?php echo generate_url(array('page' => 'add_alert_check')); ?> " class="form-horizontal"> <div class="row"> <div class="col-md-6"> <?php $box_args = array('title' => 'New Checker Details', 'header-border' => TRUE, 'padding' => TRUE); echo generate_box_open($box_args);