function DisplayForm() { $grid = new SimpleGrid(); // define heading $grid->AddHeadingRow(true); $grid->AddCell("A"); $grid->AddCell("B"); $grid->AddCell("A + B"); $grid->AddCell("A x B"); // define data for ($r = 3; $r <= 9; $r += 2) { $a = $r; $b = $r - 2; $grid->AddDataRow(); $grid->AddCell($a); $grid->AddCell($b); $grid->AddCell("<input type='text' size='3' name='p_" . $a . "_" . $b . "'>"); $grid->AddCell("<input type='text' size='3' name='t_" . $a . "_" . $b . "'>"); } echo "<div id='explanation'>This example shows how to use a SimpleGrid within a form.</div>"; echo "<p><strong>Try this simple math quiz:</strong>"; echo "<p><form method='post'>"; echo "<input type='hidden' name='action' value='calc_result'>"; echo "<input type='submit' value='Submit Answers'><p>"; $grid->Render("ex1", 2); echo "</form>"; }
<div id='explanation'> This grid was created using the <a href='../grids.html'>SimpleGrid</a> plug-in! Compare it to ex1simple.php - which is a LiveGrid. </div> <div> <button onclick="ExportGridClient('plain')">Export from client to HTML Table</button> <button onclick="ExportGridClient('owc')" id="owc">Export from client to OWC spreadsheet</button> <button onclick="ExportGridServer('xl')">Export from server to Excel</button> <button onclick="ExportGridServer('csv')">Export from server to CSV</button> </div> <?php $numcol = 15; $grid = new SimpleGrid(); $grid->AddHeadingRow(true); for ($c = 1; $c <= $numcol; $c++) { $grid->AddCell("Column {$c}"); } for ($r = 1; $r <= 100; $r++) { $grid->AddDataRow(); $grid->AddCell($r); for ($c = 2; $c <= $numcol; $c++) { $grid->AddCell("Cell {$r}:{$c}"); } } $fmt = isset($_GET["fmt"]) ? $_GET["fmt"] : ""; switch (strtolower($fmt)) { case "xl": $grid->RenderExcel("rico.xls");
<pre> // filterUI='t' --> text box // filterUI='s' --> select list var grid_options = { useUnformattedColWidth: false, FilterLocation: -1, // put filter on a new header row columnSpecs: [,,{filterUI:'t',width:150}, {filterUI:'t',width:100}, {filterUI:'s',width:100}, {type:'date',width:90}, {type:'date',width:90}] }; </pre> </div> <p><button onclick='ex3.printVisible()'>Export</button> <?php $grid = new SimpleGrid(); $grid->AddHeadingRow(false); $grid->AddCell("ID"); $grid->AddCell("ID"); $grid->AddCell("Shipment"); $grid->SetCellAttr("colspan", 3); $grid->AddCell("Date"); $grid->SetCellAttr("colspan", 2); $grid->AddHeadingRow(true); $grid->AddCell("Order"); $grid->AddCell("Customer"); $grid->AddCell("Name"); $grid->AddCell("City"); $grid->AddCell("Country"); $grid->AddCell("Order"); $grid->AddCell("Ship");
/** * Build grid from ACF layouts * */ protected function build_simple_grid($section_contents) { $grid = new SimpleGrid($section_contents['select_grid_items'], $this->element); $this->output .= $grid->embed(); }
function exchange_token_form_callback() { $results = ''; if (empty(check_ajax_referer('exchange-token-form-nonce', 'security', false))) { echo '<div class="loader-pointer section__helper">' . __('Whoa... where did YOU come from?', EXCHANGE_PLUGIN) . '</div>'; wp_die(); } if (!empty($_POST['prid']) && !empty($_POST['update_id']) && !empty($_POST['token'])) { $pr_obj = BaseController::exchange_factory($_POST['prid'], 'token-form'); $pr_token = $_POST['token']; $c_obj = BaseController::exchange_factory($_POST['update_id'], 'token-form'); $story_page = get_option('options_story_update_form_page'); $s_obj = get_post($story_page); if (!$pr_obj instanceof Programme_Round) { echo '<div class="loader-pointer section__helper">' . __('We could not find the right data. Are you sure you have the right link?') . '</div>'; wp_die(); } // Create array for griditems. $simplegrid = new SimpleGrid(); if ($s_obj instanceof WP_Post) { $simplegrid->add_grid_item($pr_obj->create_token_form_cta($s_obj, $pr_token, $c_obj)); } if ($c_obj instanceof Collaboration) { $simplegrid->add_grid_item($pr_obj->create_token_form_cta($c_obj, $pr_token)); } if (!empty($c_obj->participants)) { foreach ($c_obj->participants as $p) { $simplegrid->add_grid_item($pr_obj->create_token_form_cta($p, $pr_token)); } } // echo '<pre>' . print_r( $simplegrid, true ) . '</pre>'; // wp_die(); echo $simplegrid->embed(); wp_die(); } else { echo '<div class="loader-pointer section__helper">' . __('We did not receive the request correctly. Make sure you\'ve selected your collaboration and try again!') . '</div>'; wp_die(); } }