if ($back < 0) { $back = 0; } $next = $eu + $limit; if ($next > $recordCount) { $next = 0; } try { //https://api.scraperwiki.com/api/1.0/datastore/sqlite?format=jsondict&name=california_craigslist_synth_collector&query=select%20*%20from%20%60swdata%60%20limit%2010%2C10 $data = file_get_contents("https://api.scraperwiki.com/api/1.0/datastore/sqlite?format=jsondict&name={$sourcescraper}&query=select%20*%20from%20%60swdata%60%20limit%20{$start}%2C{$limit}"); if (!empty($data)) { $dataDecoded = json_decode($data); //print_r($dataDecoded); if (!empty($dataDecoded)) { if (!isset($dataDecoded->error)) { buildTable($dataDecoded); } else { //echo $dataDecoded->error; } } } } catch (Exception $e) { //echo "There is no data for this manufacturer.<br/>"; } function buildTable($data) { //print "<tr><th></th><th>Post</th><th>Synth</th><th>Item price</th><th>Item date</th>"; $counter = 0; foreach ($data as $d) { $imageSources = $d->post_item_images; print "<div class='item'>";
$selectedtxt4 = "selected='selected'"; $caption = _CO_PUBLISHER_REJECTED; $cond = " WHERE status = " . _PUBLISHER_STATUS_REJECTED . " "; $status_explaination = _AM_PUBLISHER_REJECTED_ITEM_EXP; break; } /* -- Code to show selected terms -- */ echo "<form name='pick' id='pick' action='" . $_SERVER['PHP_SELF'] . "' method='POST' style='margin: 0;'>"; echo "\n <table width='100%' cellspacing='1' cellpadding='2' border='0' style='border-left: 1px solid silver; border-top: 1px solid silver; border-right: 1px solid silver;'>\n <tr>\n <td><span style='font-weight: bold; font-variant: small-caps;'>" . _AM_PUBLISHER_SHOWING . " " . $caption . "</span></td>\n <td align='right'>" . _AM_PUBLISHER_SELECT_SORT . "\n <select name='sortsel' onchange='submit()'>\n <option value='itemid' {$sorttxtitemid}>" . _AM_PUBLISHER_ID . "</option>\n <option value='title' {$sorttxttitle}>" . _AM_PUBLISHER_TITLE . "</option>\n <option value='datesub' {$sorttxtcreated}>" . _AM_PUBLISHER_CREATED . "</option>\n <option value='weight' {$sorttxtweight}>" . _CO_PUBLISHER_WEIGHT . "</option>\n </select>\n <select name='ordersel' onchange='submit()'>\n <option value='ASC' {$ordertxtasc}>" . _AM_PUBLISHER_ASC . "</option>\n <option value='DESC' {$ordertxtdesc}>" . _AM_PUBLISHER_DESC . "</option>\n </select>\n " . _AM_PUBLISHER_SELECT_STATUS . " :\n <select name='statussel' onchange='submit()'>\n <option value='0' {$selectedtxt0}>" . _AM_PUBLISHER_ALL . " [{$totalitems}]</option>\n <option value='1' {$selectedtxt1}>" . _CO_PUBLISHER_SUBMITTED . " [{$totalsubmitted}]</option>\n <option value='2' {$selectedtxt2}>" . _CO_PUBLISHER_PUBLISHED . " [{$totalpublished}]</option>\n <option value='3' {$selectedtxt3}>" . _CO_PUBLISHER_OFFLINE . " [{$totaloffline}]</option>\n <option value='4' {$selectedtxt4}>" . _CO_PUBLISHER_REJECTED . " [{$totalrejected}]</option>\n </select>\n </td>\n </tr>\n </table>\n </form>"; // Get number of entries in the selected state $statusSelected = $statussel == 0 ? -1 : $statussel; $numrows = $publisher->getItemHandler()->getItemsCount(-1, $statusSelected); // creating the Q&As objects $itemsObj = $publisher->getItemHandler()->getItems($publisher->getConfig('idxcat_perpage'), $startentry, $statusSelected, -1, $sortsel, $ordersel); $totalItemsOnPage = count($itemsObj); buildTable(); if ($numrows > 0) { for ($i = 0; $i < $totalItemsOnPage; ++$i) { // Creating the category object to which this item is linked $categoryObj = $itemsObj[$i]->category(); $approve = ''; switch ($itemsObj[$i]->getVar('status')) { case _PUBLISHER_STATUS_SUBMITTED: $statustxt = _CO_PUBLISHER_SUBMITTED; $approve = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->getVar('itemid') . "'><img src='" . \XoopsBaseConfig::get('url') . "/modules/" . $publisher->getModule()->dirname() . "/images/links/approve.gif' title='" . _AM_PUBLISHER_SUBMISSION_MODERATE . "' alt='" . _AM_PUBLISHER_SUBMISSION_MODERATE . "' /></a> "; $clone = ''; $delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->getVar('itemid') . "'><img src='" . \XoopsBaseConfig::get('url') . "/modules/" . $publisher->getModule()->dirname() . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "' /></a>"; $modify = ""; break; case _PUBLISHER_STATUS_PUBLISHED: $statustxt = _CO_PUBLISHER_PUBLISHED;
/** * Convert JSON data to HTML table * * @param $data * @param int $child * @return string */ function buildTable($data, $child = 0) { $table = ''; $width = '100%'; $style = ''; $ctr = 0; if ($data) { $table = '<table class="table table-striped table-bordered table-hover">'; $table .= '<tbody>'; foreach ($data as $key => $value) { $table .= '<tr style="background-color:' . trColor($ctr) . '">'; $table .= '<td class="vert-align-middle"> <strong>' . $key . '</strong></td><td class="vert-align-middle">'; if (is_array($value)) { $table .= buildTable($value, 1); } elseif (preg_match('/.gif/i', $value) || preg_match('/.png/i', $value) || preg_match('/.jpeg/i', $value) || preg_match('/.jpg/i', $value) || preg_match('/.bmp/i', $value)) { $table .= buildImage($value); } else { $trimmed_key = trim($key); if (stripos($trimmed_key, 'is_') === 0 || stripos($trimmed_key, 'has_') === 0 || stripos($trimmed_key, 'can_') === 0 || stripos($trimmed_key, 'was_') === 0) { $table .= ' ' . $value ? 'true' : 'false'; } else { $table .= ' ' . $value; } } $table .= '</td></tr>'; $ctr++; } $table .= '</tbody>'; $table .= '</table>'; } else { $table .= 'Empty array'; } return $table; }
$name = buildExternalIdString($prefix, $item['external_id'] . ': ' . $item['name']); // create linked icons $exec_history_link = "<a href=\"javascript:openExecHistoryWindow({$item['tc_id']});\">" . "<img title=\"{$labels['execution_history']}\" src=\"{$history_img}\" /></a> "; $edit_link = "<a href=\"javascript:openTCEditWindow({$gui->tproject_id},{$item['tc_id']});\">" . "<img title=\"{$labels['design']}\" src=\"{$edit_img}\" /></a> "; $link = "<!-- " . sprintf("%010d", $item['external_id']) . " -->" . $exec_history_link . $edit_link . $name; $row = array($verbosePath, $link); if ($args->show_platforms) { $row[] = $item['platform_name']; } if ($_SESSION['testprojectOptions']->testPriorityEnabled) { $row[] = $tplan_mgr->urgencyImportanceToPriorityLevel($item['priority']); } $row[] = strip_tags($item['summary']); $data[] = $row; } $gui->tableSet[] = buildTable($data, $args->tproject_id, $args->show_platforms, $_SESSION['testprojectOptions']->testPriorityEnabled); } } $gui->warning_msg = lang_get($msg_key); $smarty = new TLSmarty(); $smarty->assign('gui', $gui); $smarty->display($templateCfg->template_dir . $templateCfg->default_template); /** * * */ function buildTable($data, $tproject_id, $show_platforms, $priorityMgmtEnabled) { $key2search = array('testsuite', 'testcase', 'platform', 'priority', 'summary'); foreach ($key2search as $key) { $labels[$key] = lang_get($key);
<?php include_once 'json_viewer_functions.php'; $errors = array(); $post_data = ['api_path' => '', 'parameters' => '']; $data_table = ''; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $result = validate($_POST); $errors = $result['errors']; $post_data = $_POST; if (!$errors) { $result = execute($post_data['api_path'], $post_data['parameters']); $result = json_decode($result, true); $data_table = buildTable($result); } } ?> <!DOCTYPE html> <html class="no-js" lang="en"> <head> <meta charset="utf-8" /> <meta http-equiv="x-ua-compatible" content="ie=edge" /> <title>Masarap Dito API JSON Viewer</title> <meta name="description" content="Masarap Dito API JSON Viewer" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="css/bootstrap.css" /> <link rel="stylesheet" href="css/styles.css" /> </head> <body> <div class="container"> <h1>Masarap Dito API JSON Viewer</h1>
foreach ($metrics as &$item) { $row = array(); $row[] = join(" / ", $path_info[$item['tcase_id']]); $row[] = "<!-- " . sprintf("%010d", $item['external_id']) . " -->" . sprintf($links['full'], $item['tcase_id'], $item['tcase_id']) . $item['full_external_id'] . ': ' . $item['name']; if ($args->show_platforms) { $row[] = $platformCache[$item['platform_id']]['name']; } if ($gui->options->testPriorityEnabled) { // THIS HAS TO BE REFACTORED, because we can no do lot of calls // because performance will be BAD $row[] = $tplan_mgr->urgencyImportanceToPriorityLevel($item['urg_imp']); } $row[] = strip_tags($item['summary']); $data[] = $row; } $gui->tableSet[] = buildTable($data, $args->tproject_id, $args->show_platforms, $gui->options->testPriorityEnabled); } } $gui->warning_msg = lang_get($msg_key); $smarty->assign('gui', $gui); $smarty->display($templateCfg->template_dir . $templateCfg->default_template); /** * * */ function buildTable($data, $tproject_id, $show_platforms, $priorityMgmtEnabled) { $key2search = array('testsuite', 'testcase', 'platform', 'priority', 'summary'); foreach ($key2search as $key) { $labels[$key] = lang_get($key); }
table { font-family: Verdana; border-collapse: collapse; } tbody { text-align: justify; font-size: 12px; } thead { color: #454545; font-size: 13px; } th { border: solid 1px; border-color: black; } td { border: solid 1px; } #highlight { background-color: black; color: white; } </style> </head> <body> <?php echo buildTable($users); ?> </body> </html>
<head> <title>Utilisateurs</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <h1>Utilisateurs dans la base de données</h1> <div> <?php if (isset($_GET['idToDelete'])) { $idToDelete = $_REQUEST['idToDelete']; deleteUser($idToDelete); } if (!isset($_GET['id'])) { buildTable(selectAllUsers()); } else { $id = $_REQUEST['id']; buildTableOneUser(selectOneUser($id)); } ?> </div> <br /> <?php echo $stateConnection; ?> <br /><br /> <a href="index.php">Index</a> - <a href="login.php">Login</a> - <a href="utilisateurs.php">Utilisateurs</a> - <a href="choisirSport.php">Chosir un sport</a>
} ?> <h2>document</h2> <?php echo buildTable(getDocumentParams()); ?> <h2>remote</h2> <?php echo buildTable(getRemoteParams()); ?> <h2>server</h2> <?php echo buildTable(getServerParams()); ?> <h2>links</h2> <table> <tbody> <tr> <td><a href="<?php echo $_SERVER['REQUEST_URI']; ?> ">myself</a></td> </tr><tr> <td><a href="/">root</a></td> </tr><tr> <td><a href="http://google.com">Google</a></td> </tr>
text-align: left; padding: 5px; } td { text-align: right; padding: 5px; } table, tr, th, td { border: 1px solid black; border-collapse: collapse; } </style> </head> <body> <?php function buildTable($name, $phone, $age, $address) { echo "<table>"; echo "<tr><th>Name</th><td>{$name}</td></tr>"; echo "<tr><th>Phone number</th><td>{$phone}</td></tr>"; echo "<tr><th>Age</th><td>{$age}</td></tr>"; echo "<tr><th>Address</th><td>{$address}</td></tr>"; echo "</table><br/>"; } buildTable("Gosho", "0882-321-423", 24, "Hadji Dimitar"); buildTable("Pesho", "0884-888-888", 67, "Suhata Reka"); ?> </body> </html>
<?php ////////////////////////////////////////////// //index.php (TESTING PURPOSES ONLY) ///////////////////////////////////////////// //require the include files require_once 'includes/std.form.class.inc'; require_once 'includes/std.table.class.inc'; require_once 'includes/std.html.class.inc'; require_once 'includes/std.div.class.inc'; require_once 'includes/functions.php'; //testing $html = new html("ChangeLog Management", "style.css"); $results = buildResults("select url as URL, nav_bar as Bar, description as Description from links where active = 1"); $table = buildTable($results); $page = $html->Content($table); $page .= $html->page_end(); echo $page;