本文整理汇总了PHP中Dropdown::showOutputFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP Dropdown::showOutputFormat方法的具体用法?PHP Dropdown::showOutputFormat怎么用?PHP Dropdown::showOutputFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dropdown
的用法示例。
在下文中一共展示了Dropdown::showOutputFormat方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printPager
/**
* Print pager for search option (first/previous/next/last)
*
* @param $start from witch item we start
* @param $numrows total items
* @param $target page would be open when click on the option (last,previous etc)
* @param $parameters parameters would be passed on the URL.
* @param $item_type_output item type display - if >0 display export PDF et Sylk form
* (default 0)
* @param $item_type_output_param item type parameter for export (default 0)
* @param $additional_info Additional information to display (default '')
*
* @return nothing (print a pager)
*
**/
static function printPager($start, $numrows, $target, $parameters, $item_type_output = 0, $item_type_output_param = 0, $additional_info = '')
{
global $CFG_GLPI;
$list_limit = $_SESSION['glpilist_limit'];
// Forward is the next step forward
$forward = $start + $list_limit;
// This is the end, my friend
$end = $numrows - $list_limit;
// Human readable count starts here
$current_start = $start + 1;
// And the human is viewing from start to end
$current_end = $current_start + $list_limit - 1;
if ($current_end > $numrows) {
$current_end = $numrows;
}
// Empty case
if ($current_end == 0) {
$current_start = 0;
}
// Backward browsing
if ($current_start - $list_limit <= 0) {
$back = 0;
} else {
$back = $start - $list_limit;
}
// Print it
echo "<div><table class='tab_cadre_pager'>";
echo "<tr>";
if (strpos($target, '?') == false) {
$fulltarget = $target . "?" . $parameters;
} else {
$fulltarget = $target . "&" . $parameters;
}
// Back and fast backward button
if (!$start == 0) {
echo "<th class='left'>";
echo "<a href='{$fulltarget}&start=0'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/first.png' alt=\"" . __s('Start') . "\" title=\"" . __s('Start') . "\" class='pointer'>";
echo "</a></th>";
echo "<th class='left'>";
echo "<a href='{$fulltarget}&start={$back}'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/left.png' alt=\"" . __s('Previous') . "\" title=\"" . __s('Previous') . "\" class='pointer'>";
echo "</a></th>";
}
// Print the "where am I?"
echo "<td width='31%' class='tab_bg_2'>";
self::printPagerForm("{$fulltarget}&start={$start}");
echo "</td>";
if (!empty($additional_info)) {
echo "<td class='tab_bg_2'>";
echo $additional_info;
echo "</td>";
}
if (!empty($item_type_output) && isset($_SESSION["glpiactiveprofile"]) && $_SESSION["glpiactiveprofile"]["interface"] == "central") {
echo "<td class='tab_bg_2 responsive_hidden' width='30%'>";
echo "<form method='GET' action='" . $CFG_GLPI["root_doc"] . "/front/report.dynamic.php'\n target='_blank'>";
echo Html::hidden('item_type', array('value' => $item_type_output));
if ($item_type_output_param != 0) {
echo Html::hidden('item_type_param', array('value' => Toolbox::prepareArrayForInput($item_type_output_param)));
}
$split = explode("&", $parameters);
for ($i = 0; $i < count($split); $i++) {
$pos = Toolbox::strpos($split[$i], '=');
$length = Toolbox::strlen($split[$i]);
echo Html::hidden(Toolbox::substr($split[$i], 0, $pos), array('value' => urldecode(Toolbox::substr($split[$i], $pos + 1))));
}
Dropdown::showOutputFormat();
Html::closeForm();
echo "</td>";
}
echo "<td width='20%' class='tab_bg_2 b'>";
//TRANS: %1$d, %2$d, %3$d are page numbers
printf(__('From %1$d to %2$d on %3$d'), $current_start, $current_end, $numrows);
echo "</td>\n";
// Forward and fast forward button
if ($forward < $numrows) {
echo "<th class='right'>";
echo "<a href='{$fulltarget}&start={$forward}'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/right.png' alt=\"" . __s('Next') . "\" title=\"" . __s('Next') . "\" class='pointer'>";
echo "</a></th>\n";
echo "<th class='right'>";
echo "<a href='{$fulltarget}&start={$end}'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/last.png' alt=\"" . __s('End') . "\" title=\"" . __s('End') . "\" class='pointer'>";
echo "</a></th>\n";
}
//.........这里部分代码省略.........
示例2: foreach
foreach ($val as $k => $v) {
echo "<input type='hidden' name='" . $key . "[{$k}]' value='{$v}' >";
if (!empty($param)) {
$param .= "&";
}
$param .= $key . "[" . $k . "]=" . urlencode($v);
}
} else {
echo "<input type='hidden' name='{$key}' value='{$val}' >";
if (!empty($param)) {
$param .= "&";
}
$param .= "{$key}=" . urlencode($val);
}
}
Dropdown::showOutputFormat();
Html::closeForm();
echo "</td></tr>";
echo "</table></div>";
Html::printPager($start, $nbtot, $_SERVER['PHP_SELF'], $param);
}
}
}
if ($nbtot > 0) {
$nbcols = $DB->num_fields($result);
$nbrows = $DB->numrows($result);
$num = 1;
$link = $_SERVER['PHP_SELF'];
$order = 'ASC';
$issort = false;
echo Search::showHeader($output_type, $nbrows, $nbcols, true);
示例3: printPager
/**
* Print pager for search option (first/previous/next/last)
*
* @param $start from witch item we start
* @param $numrows total items
* @param $target page would be open when click on the option (last,previous etc)
* @param $parameters parameters would be passed on the URL.
* @param $item_type_output item type display - if >0 display export PDF et Sylk form
* (default 0)
* @param $item_type_output_param item type parameter for export (default 0)
* @param $additional_info Additional information to display (default '')
*
* @return nothing (print a pager)
*
* */
function printPager($start, $numrows, $target, $parameters, $item_type_output = 0, $item_type_output_param = 0, $additional_info = '')
{
global $CFG_GLPI;
$list_limit = $_SESSION['glpilist_limit'];
// Forward is the next step forward
$forward = $start + $list_limit;
// This is the end, my friend
$end = $numrows - $list_limit;
// Human readable count starts here
$current_start = $start + 1;
// And the human is viewing from start to end
$current_end = $current_start + $list_limit - 1;
if ($current_end > $numrows) {
$current_end = $numrows;
}
// Empty case
if ($current_end == 0) {
$current_start = 0;
}
// Backward browsing
if ($current_start - $list_limit <= 0) {
$back = 0;
} else {
$back = $start - $list_limit;
}
// Print it
echo "<div><table class='tab_cadre_pager'>";
echo "<tr>";
// Back and fast backward button
if (!$start == 0) {
echo "<th class='left'>";
echo "<a href='{$target}?{$parameters}&start=0'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/first.png' alt=\"" . __s('Start') . "\" title=\"" . __s('Start') . "\">";
echo "</a></th>";
echo "<th class='left'>";
echo "<a href='{$target}?{$parameters}&start={$back}'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/left.png' alt=\"" . __s('Previous') . "\" title=\"" . __s('Previous') . "\">";
echo "</a></th>";
}
// Print the "where am I?"
echo "<td width='50%' class='tab_bg_2'>";
Html::printPagerForm("{$target}?{$parameters}&start={$start}");
echo "</td>";
if (!empty($additional_info)) {
echo "<td class='tab_bg_2'>";
echo $additional_info;
echo "</td>";
}
if (!empty($item_type_output) && isset($_SESSION["glpiactiveprofile"]) && $_SESSION["glpiactiveprofile"]["interface"] == "central") {
echo "<td class='tab_bg_2' width='30%'>";
echo "<form method='GET' action='" . $target . "' target='_blank'>";
echo Html::hidden('item_type', array('value' => $item_type_output));
if ($item_type_output_param != 0) {
echo Html::hidden('item_type_param', array('value' => Toolbox::prepareArrayForInput($item_type_output_param)));
}
$split = explode("&", $parameters);
for ($i = 0; $i < count($split); $i++) {
$pos = Toolbox::strpos($split[$i], '=');
$length = Toolbox::strlen($split[$i]);
echo Html::hidden(Toolbox::substr($split[$i], 0, $pos), array('value' => urldecode(Toolbox::substr($split[$i], $pos + 1))));
}
Dropdown::showOutputFormat();
$this->showCSVOptions();
echo "<script type='text/javascript'>";
echo "\$('select[name=display_type]').change(function() {\r\n switch(\$(this).val()){\r\n case '3' :case '-3' :\r\n \$('#display_csv_preferences').css('display', 'block');\r\n break;\r\n default : \r\n \$('#display_csv_preferences').css('display', 'none');\r\n break;\r\n }\r\n });";
echo "</script>";
Html::closeForm();
echo "</td>";
}
echo "<td width='50%' class='tab_bg_2 b'>";
//TRANS: %1$d, %2$d, %3$d are page numbers
printf(__('From %1$d to %2$d on %3$d'), $current_start, $current_end, $numrows);
echo "</td>\n";
// Forward and fast forward button
if ($forward < $numrows) {
echo "<th class='right'>";
echo "<a href='{$target}?{$parameters}&start={$forward}'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/right.png' alt=\"" . __s('Next') . "\" title=\"" . __s('Next') . "\">";
echo "</a></th>\n";
echo "<th class='right'>";
echo "<a href='{$target}?{$parameters}&start={$end}'>";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/last.png' alt=\"" . __s('End') . "\" title=\"" . __s('End') . "\">";
echo "</a></th>\n";
}
// End pager
//.........这里部分代码省略.........
示例4: execute
/**
* Execute the report
*
* @param $options array
**/
function execute($options = array())
{
global $DB, $CFG_GLPI, $HEADER_LOADED;
// Require (for pager) when not called by displayCriteriasForm
$this->manageCriteriasValues();
if (isset($_POST['list_limit'])) {
$_SESSION['glpilist_limit'] = $_POST['list_limit'];
unset($_POST['list_limit']);
}
$limit = $_SESSION['glpilist_limit'];
if (isset($_POST["display_type"])) {
$output_type = $_POST["display_type"];
if ($output_type < 0) {
$output_type = -$output_type;
$limit = 0;
}
} else {
$output_type = Search::HTML_OUTPUT;
}
$title = $this->title;
if ($this->subname) {
$title = sprintf(__('%1$s - %2$s'), $title, $this->subname);
}
$res = $DB->query($this->sql);
$nbtot = $res ? $DB->numrows($res) : 0;
if ($limit) {
$start = isset($_GET["start"]) ? $_GET["start"] : 0;
if ($start >= $nbtot) {
$start = 0;
}
if ($start > 0 || $start + $limit < $nbtot) {
$res = $DB->query($this->sql . " LIMIT {$start},{$limit}");
}
} else {
$start = 0;
}
if ($nbtot == 0) {
if (!$HEADER_LOADED) {
Html::header($title, $_SERVER['PHP_SELF'], "utils", "report");
Report::title();
}
echo "<div class='center'><font class='red b'>" . __('No item found') . "</font></div>";
Html::footer();
} else {
if ($output_type == Search::PDF_OUTPUT_PORTRAIT || $output_type == Search::PDF_OUTPUT_LANDSCAPE) {
include GLPI_ROOT . "/lib/ezpdf/class.ezpdf.php";
} else {
if ($output_type == Search::HTML_OUTPUT) {
if (!$HEADER_LOADED) {
Html::header($title, $_SERVER['PHP_SELF'], "utils", "report");
Report::title();
}
echo "<div class='center'><table class='tab_cadre_fixe'>";
echo "<tr><th>" . $title . "</th></tr>\n";
echo "<tr class='tab_bg_2 center'><td class='center'>";
echo "<form method='POST' action='" . $_SERVER["PHP_SELF"] . "?start={$start}'>\n";
$param = "";
foreach ($_POST as $key => $val) {
if (is_array($val)) {
foreach ($val as $k => $v) {
echo "<input type='hidden' name='" . $key . "[{$k}]' value='{$v}' >";
if (!empty($param)) {
$param .= "&";
}
$param .= $key . "[" . $k . "]=" . urlencode($v);
}
} else {
echo "<input type='hidden' name='" . $key . "' value='{$val}' >";
if (!empty($param)) {
$param .= "&";
}
$param .= "{$key}=" . urlencode($val);
}
}
Dropdown::showOutputFormat();
Html::closeForm();
echo "</td></tr>";
echo "</table></div>";
Html::printPager($start, $nbtot, $_SERVER['PHP_SELF'], $param);
}
}
}
if (!isset($_POST["display_type"]) || $_POST["display_type"] == Search::HTML_OUTPUT) {
if (isset($options['withmassiveaction']) && class_exists($options['withmassiveaction'])) {
echo "<form method='post' name='massiveaction_form' id='massiveaction_form' action=\"" . $CFG_GLPI["root_doc"] . "/front/massiveaction.php\">";
}
}
plugin_reports_checkRight($this->plug, $this->name, "r");
if ($res && $nbtot > 0) {
$nbcols = $DB->num_fields($res);
$nbrows = $DB->numrows($res);
echo Search::showHeader($output_type, $nbrows, $nbcols, true);
echo Search::showNewLine($output_type);
$num = 1;
// fill $sqlcols with default sql query fields so we can validate $columns
//.........这里部分代码省略.........
示例5: showResult
public function showResult($output_type, $limit = 0)
{
global $DB;
$arrayRet = $this->execQuery($_POST);
$result = $arrayRet['query_result'];
$query = $arrayRet['query'];
$nbtot = $result ? $DB->numrows($result) : 0;
if ($limit) {
$start = isset($_GET["start"]) ? $_GET["start"] : 0;
if ($start >= $nbtot) {
$start = 0;
}
if ($start > 0 || $start + $limit < $nbtot) {
$result = $DB->query($query . " LIMIT {$start},{$limit}");
}
} else {
$start = 0;
}
$nbCols = $DB->num_fields($result);
$nbrows = $DB->numrows($result);
$groupByRackName = true;
if (isset($_POST['groupByRackName']) && $_POST['groupByRackName'] == "on") {
$groupByRackName = false;
}
$title = date("d/m/Y H:i");
if ($nbtot == 0) {
echo "<div class='center'><font class='red b'>" . __("No item found") . "</font></div>";
Html::footer();
} else {
if ($output_type == Search::PDF_OUTPUT_LANDSCAPE || $output_type == Search::PDF_OUTPUT_PORTRAIT) {
include GLPI_ROOT . "/lib/ezpdf/class.ezpdf.php";
} else {
if ($output_type == Search::HTML_OUTPUT) {
echo "<div class='center'><table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th>{$title}</th></tr>\n";
echo "<tr class='tab_bg_2 center'><td class='center'>";
echo "<form method='POST' action='" . $_SERVER["PHP_SELF"] . "?start={$start}' target='_blank'>\n";
$param = "";
foreach ($_POST as $key => $val) {
if (is_array($val)) {
foreach ($val as $k => $v) {
echo "<input type='hidden' name='" . $key . "[{$k}]' value='{$v}' >";
if (!empty($param)) {
$param .= "&";
}
$param .= $key . "[" . $k . "]=" . urlencode($v);
}
} else {
echo "<input type='hidden' name='{$key}' value='{$val}' >";
if (!empty($param)) {
$param .= "&";
}
$param .= "{$key}=" . urlencode($val);
}
}
echo "<input type='hidden' name='result_search_reports' value='searchdone' >";
$param .= "&result_search_reports=searchdone&target=_blank";
Dropdown::showOutputFormat();
Html::closeForm();
echo "</td></tr>";
echo "</table></div>";
Html::printPager($start, $nbtot, $_SERVER['PHP_SELF'], $param);
}
}
}
if ($nbtot > 0) {
if ($output_type == Search::HTML_OUTPUT) {
echo "<form method='POST' action='" . $_SERVER["PHP_SELF"] . "?start={$start}'>\n";
}
echo Search::showHeader($output_type, $nbrows, $nbCols, true);
$showAllFieds = true;
$listFields = array();
$cptField = 0;
$showAllFieds = (!isset($_POST['cb_object_name']) || $_POST['cb_object_name'] != "on") && (!isset($_POST['cb_object_location']) || $_POST['cb_object_location'] != "on") && (!isset($_POST['cb_group']) || $_POST['cb_group'] != "on") && (!isset($_POST['cb_manufacturer']) || $_POST['cb_manufacturer'] != "on") && (!isset($_POST['cb_model']) || $_POST['cb_model'] != "on") && (!isset($_POST['cb_serial_number']) || $_POST['cb_serial_number'] != "on");
$num = 1;
$cptRow = 1;
if (!$showAllFieds) {
$this->showTitle($output_type, $num, __("Bay name", "racks"), 'name', false);
$cptField++;
$this->showTitle($output_type, $num, _n("Place", "Places", 1, "racks"), 'location', false);
$cptField++;
$this->showTitle($output_type, $num, _n("Location", "Locations", 1, "racks"), 'roomlocation', false);
$cptField++;
$this->showTitle($output_type, $num, __("U", "racks"), 'u', false);
$cptField++;
$this->showTitle($output_type, $num, __("Front", "racks") . " / " . __("Back", "racks"), 'front_rear', false);
$cptField++;
if (isset($_POST['cb_object_name']) && $_POST['cb_object_name'] == "on") {
$listFields['object_name'] = $_POST['cb_object_name'];
$this->showTitle($output_type, $num, __("Object name", "racks"), 'object_name', false);
$cptField++;
}
// Lieu
if (isset($_POST['cb_object_location']) && $_POST['cb_object_location'] == "on") {
$listFields['object_location'] = $_POST['cb_object_location'];
$this->showTitle($output_type, $num, __("Object location", "racks"), 'object_location', false);
$cptField++;
}
// Groupe
if (isset($_POST['cb_group']) && $_POST['cb_group'] == "on") {
//.........这里部分代码省略.........