本文整理匯總了PHP中FormLib::queryStringtoJSON方法的典型用法代碼示例。如果您正苦於以下問題:PHP FormLib::queryStringtoJSON方法的具體用法?PHP FormLib::queryStringtoJSON怎麽用?PHP FormLib::queryStringtoJSON使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FormLib
的用法示例。
在下文中一共展示了FormLib::queryStringtoJSON方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: row
/**
Format data for display
@param $data a two dimensional array of data
@param $headers a header row (optional)
@param $format output format (html | xls | csv)
@return formatted string
*/
public function render_data($data, $headers = array(), $footers = array(), $format = 'html')
{
$url = $this->config->get('URL');
$ret = "";
switch (strtolower($format)) {
case 'html':
if ($this->multi_counter == 1) {
if (!$this->new_tablesorter) {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
// windows has trouble with symlinks
$this->add_css_file($url . 'src/javascript/tablesorter-2.0.5b/themes/blue/style.css');
} else {
$this->add_css_file($url . 'src/javascript/tablesorter/themes/blue/style.css');
}
} else {
$this->add_css_file($url . 'src/javascript/tablesorter-2.22.1/css/theme.bootstrap.css');
}
if (!$this->window_dressing) {
$ret .= '<!DOCTYPE html><html><head>' . '<meta http-equiv="Content-Type" ' . 'content="text/html; charset=iso-8859-1">' . '</head><body>';
$ret .= '<script type="text/javascript">
function highlightCell(e)
{
if ($(this).css(\'background-color\') != \'rgb(255, 255, 0)\') {
$(this).css(\'background-color\',\'yellow\');
} else {
$(this).css(\'background-color\',\'\');
}
}
</script>';
}
$ret .= '<div id="pre-report-content">';
$uri = filter_input(INPUT_SERVER, 'REQUEST_URI');
if (\COREPOS\Fannie\API\data\DataConvert::excelSupport()) {
$ret .= sprintf('<a href="%s%sexcel=xls">Download Excel</a>
', $uri, strstr($uri, '?') === false ? '?' : '&');
}
$json = FormLib::queryStringtoJSON(filter_input(INPUT_SERVER, 'QUERY_STRING'));
$ret .= sprintf('<a href="%s%sexcel=csv">Download CSV</a>
<a href="?json=%s">Back</a>', $uri, strstr($uri, '?') === false ? '?' : '&', base64_encode($json));
$ret = array_reduce($this->defaultDescriptionContent(count($data)), function ($carry, $line) {
return $carry . (substr($line, 0, 1) == '<' ? '' : '<br />') . $line;
}, $ret);
$ret = array_reduce($this->report_description_content(), function ($carry, $line) {
return $carry . (substr($line, 0, 1) == '<' ? '' : '<br />') . $line;
}, $ret);
$ret .= '</div>';
}
if ($this->sortable || $this->no_sort_but_style) {
$ret .= '<table class="mySortableTable tablesorter tablesorter-bootstrap">';
} else {
$ret .= '<table class="mySortableTable" cellspacing="0"
cellpadding="4" border="1">' . "\n";
}
break;
case 'csv':
foreach ($this->defaultDescriptionContent(count($data)) as $line) {
$ret .= $this->csvLine(array(strip_tags($line)));
}
foreach ($this->report_description_content() as $line) {
$ret .= $this->csvLine(array(strip_tags($line)));
}
case 'xls':
break;
}
if (!empty($headers)) {
$headers1 = $this->select_headers(False);
if (!$this->multi_report_mode && strtolower($format) != 'xls') {
$this->header_index++;
}
switch (strtolower($format)) {
case 'html':
$ret .= '<thead>' . "\n";
$ret .= $this->htmlLine($headers1, True);
$ret .= '</thead>' . "\n";
break;
case 'csv':
$ret .= $this->csvLine($headers1);
break;
case 'xls':
break;
}
}
for ($i = 0; $i < count($data); $i++) {
switch (strtolower($format)) {
case 'html':
if ($i == 0) {
$ret .= "<tbody>\n";
}
$ret .= $this->htmlLine($data[$i]);
if ($i == count($data) - 1) {
$ret .= "</tbody>\n";
}
//.........這裏部分代碼省略.........