本文整理汇总了PHP中Html::printPager方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::printPager方法的具体用法?PHP Html::printPager怎么用?PHP Html::printPager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::printPager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showMinimalList
//.........这里部分代码省略.........
$GROUPBY = " GROUP BY `" . $itemtable . "`.`id`";
}
}
}
$query .= $GROUPBY;
//// 4 - ORDER
$ORDER = " ORDER BY `id` ";
foreach ($toview as $key => $val) {
if ($p['sort'] == $val) {
$ORDER = Search::addOrderBy($itemtype, $p['sort'], $p['order'], $key);
}
}
$query .= $ORDER;
// Get it from database
if ($result = $DB->query($query)) {
$numrows = $DB->numrows($result);
$globallinkto = Search::getArrayUrlLink("field", $p['field']) . Search::getArrayUrlLink("link", $p['link']) . Search::getArrayUrlLink("contains", $p['contains']) . Search::getArrayUrlLink("field2", $p['field2']) . Search::getArrayUrlLink("contains2", $p['contains2']) . Search::getArrayUrlLink("itemtype2", $p['itemtype2']) . Search::getArrayUrlLink("link2", $p['link2']);
$parameters = "sort=" . $p['sort'] . "&order=" . $p['order'] . $globallinkto;
if ($output_type == Search::GLOBAL_SEARCH) {
if (class_exists($itemtype)) {
echo "<div class='center'><h2>" . $this->getTypeName();
// More items
if ($numrows > $p['start'] + Search::GLOBAL_DISPLAY_COUNT) {
echo " <a href='{$target}?{$parameters}'>" . __('All') . "</a>";
}
echo "</h2></div>\n";
} else {
return false;
}
}
if ($p['start'] < $numrows) {
// Pager
if ($output_type == Search::HTML_OUTPUT) {
Html::printPager($p['start'], $numrows, $target, $parameters, $itemtype);
}
//massive action
$sel = "";
if (isset($_GET["select"]) && $_GET["select"] == "all") {
$sel = "checked";
}
// Add toview elements
$nbcols = $toview_count;
if ($output_type == Search::HTML_OUTPUT) {
// HTML display - massive modif
$nbcols++;
}
// Define begin and end var for loop
// Search case
$begin_display = $p['start'];
$end_display = $p['start'] + $LIST_LIMIT;
// Export All case
if ($p['export_all']) {
$begin_display = 0;
$end_display = $numrows;
}
// Display List Header
echo Search::showHeader($output_type, $end_display - $begin_display + 1, $nbcols);
$header_num = 1;
// Display column Headers for toview items
echo Search::showNewLine($output_type);
// Display column Headers for toview items
foreach ($toview as $key => $val) {
$linkto = '';
if (!isset($searchopt[$itemtype][$val]['nosort']) || !$searchopt[$itemtype][$val]['nosort']) {
$linkto = "{$target}?itemtype={$itemtype}&sort=" . $val . "&order=" . ($p['order'] == "ASC" ? "DESC" : "ASC") . "&start=" . $p['start'] . $globallinkto;
}
示例2: __
echo "<td class='right'>" . __('Show graphics') . "</td>";
echo "<td rowspan='2' class='center'>";
echo "<input type='submit' class='submit' name='submit' value=\"" . __s('Display report') . "\"></td>" . "</tr>";
echo "<tr class='tab_bg_2'><td class='right'>" . __('End date') . "</td><td>";
Html::showDateField("date2", array('value' => $_GET["date2"]));
echo "</td><td class='center'>";
echo "<input type='hidden' name='value2' value='" . $_GET["value2"] . "'>";
Dropdown::showYesNo('showgraph', $_GET['showgraph']);
echo "</td></tr>";
echo "</table>";
// form using GET method : CRSF not needed
echo "</form>";
echo "</div>";
$val = Stat::getItems($_GET["itemtype"], $_GET["date1"], $_GET["date2"], $_GET["type"], $_GET["value2"]);
$params = array('type' => $_GET["type"], 'date1' => $_GET["date1"], 'date2' => $_GET["date2"], 'value2' => $_GET["value2"], 'start' => $_GET["start"]);
Html::printPager($_GET['start'], count($val), $CFG_GLPI['root_doc'] . '/front/stat.tracking.php', "date1=" . $_GET["date1"] . "&date2=" . $_GET["date2"] . "&type=" . $_GET["type"] . "&showgraph=" . $_GET["showgraph"] . "&itemtype=" . $_GET["itemtype"] . "&value2=" . $_GET['value2'], 'Stat', $params);
if (!$_GET['showgraph']) {
Stat::showTable($_GET["itemtype"], $_GET["type"], $_GET["date1"], $_GET["date2"], $_GET['start'], $val, $_GET['value2']);
} else {
$data = Stat::getDatas($_GET["itemtype"], $_GET["type"], $_GET["date1"], $_GET["date2"], $_GET['start'], $val, $_GET['value2']);
if (isset($data['opened']) && is_array($data['opened'])) {
foreach ($data['opened'] as $key => $val) {
$newkey = Toolbox::unclean_cross_side_scripting_deep(Html::clean($key));
$cleandata[$newkey] = $val;
}
Stat::showGraph(array(__('Number opened') => $cleandata), array('title' => __('Number opened'), 'showtotal' => 1, 'unit' => $item->getTypeName(Session::getPluralNumber()), 'type' => 'pie'));
}
if (isset($data['solved']) && is_array($data['solved'])) {
foreach ($data['solved'] as $key => $val) {
$newkey = Toolbox::unclean_cross_side_scripting_deep(Html::clean($key));
$cleandata[$newkey] = $val;
示例3: showComputersToAdd
/**
* Display a list of computers to add or to link
*
* @param plugin_ocsinventoryng_ocsservers_id the ID of the ocs server
* @param advanced display detail about the computer import or not (target entity, matched rules, etc.)
* @param check indicates if checkboxes are checked or not
* @param start display a list of computers starting at rowX
* @param entity a list of entities in which computers can be added or linked
* @param tolinked false for an import, true for a link
*
* @return nothing
**/
static function showComputersToAdd($serverId, $advanced, $check, $start, $entity = 0, $tolinked = false)
{
global $DB, $CFG_GLPI;
if (!Session::haveRight("plugin_ocsinventoryng", UPDATE)) {
return false;
}
$title = __('Import new computers', 'ocsinventoryng');
if ($tolinked) {
$title = __('Link new OCSNG computers to existing GLPI computers', 'ocsinventoryng');
}
$target = $CFG_GLPI['root_doc'] . '/plugins/ocsinventoryng/front/ocsng.import.php';
if ($tolinked) {
$target = $CFG_GLPI['root_doc'] . '/plugins/ocsinventoryng/front/ocsng.link.php';
}
// Get all links between glpi and OCS
$query_glpi = "SELECT ocsid\n FROM `glpi_plugin_ocsinventoryng_ocslinks`\n WHERE `plugin_ocsinventoryng_ocsservers_id` = '{$serverId}'";
$result_glpi = $DB->query($query_glpi);
$already_linked = array();
if ($DB->numrows($result_glpi) > 0) {
while ($data = $DB->fetch_array($result_glpi)) {
$already_linked[] = $data["ocsid"];
}
}
$cfg_ocs = self::getConfig($serverId);
$computerOptions = array('OFFSET' => $start, 'MAX_RECORDS' => $_SESSION['glpilist_limit'], 'ORDER' => 'LASTDATE', 'FILTER' => array('EXCLUDE_IDS' => $already_linked), 'DISPLAY' => array('CHECKSUM' => PluginOcsinventoryngOcsClient::CHECKSUM_BIOS), 'ORDER' => 'NAME');
if ($cfg_ocs["tag_limit"] and $tag_limit = explode("\$", trim($cfg_ocs["tag_limit"]))) {
$computerOptions['FILTER']['TAGS'] = $tag_limit;
}
if ($cfg_ocs["tag_exclude"] and $tag_exclude = explode("\$", trim($cfg_ocs["tag_exclude"]))) {
$computerOptions['FILTER']['EXCLUDE_TAGS'] = $tag_exclude;
}
$ocsClient = self::getDBocs($serverId);
$ocsResult = $ocsClient->getComputers($computerOptions);
if (isset($ocsResult['COMPUTERS'])) {
$computers = $ocsResult['COMPUTERS'];
if (count($computers)) {
// Get all hardware from OCS DB
$hardware = array();
foreach ($computers as $data) {
$data = Toolbox::clean_cross_side_scripting_deep(Toolbox::addslashes_deep($data));
$id = $data['META']['ID'];
$hardware[$id]["date"] = $data['META']["LASTDATE"];
$hardware[$id]["name"] = $data['META']["NAME"];
$hardware[$id]["TAG"] = $data['META']["TAG"];
$hardware[$id]["id"] = $data['META']["ID"];
if (isset($data['BIOS']) && count($data['BIOS'])) {
$hardware[$id]["serial"] = $data['BIOS']["SSN"];
$hardware[$id]["model"] = $data['BIOS']["SMODEL"];
$hardware[$id]["manufacturer"] = $data['BIOS']["SMANUFACTURER"];
} else {
$hardware[$id]["serial"] = '';
$hardware[$id]["model"] = '';
$hardware[$id]["manufacturer"] = '';
}
}
if ($tolinked && count($hardware)) {
echo "<div class='center b'>" . __('Caution! The imported data (see your configuration) will overwrite the existing one', 'ocsinventoryng') . "</div>";
}
echo "<div class='center'>";
if ($numrows = $ocsResult['TOTAL_COUNT']) {
$parameters = "check={$check}";
Html::printPager($start, $numrows, $target, $parameters);
//Show preview form only in import even in multi-entity mode because computer import
//can be refused by a rule
if (!$tolinked) {
echo "<div class='firstbloc'>";
echo "<form method='post' name='ocsng_import_mode' id='ocsng_import_mode'\n action='{$target}'>\n";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('Manual import mode', 'ocsinventoryng') . "</th></tr>\n";
echo "<tr class='tab_bg_1'><td class='center'>";
if ($advanced) {
Html::showSimpleForm($target, 'change_import_mode', __('Disable preview', 'ocsinventoryng'), array('id' => 'false'));
} else {
Html::showSimpleForm($target, 'change_import_mode', __('Enable preview', 'ocsinventoryng'), array('id' => 'true'));
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td class='center b'>" . __('Check first that duplicates have been correctly managed in OCSNG', 'ocsinventoryng') . "</td>";
echo "</tr></table>";
Html::closeForm();
echo "</div>";
}
echo "<form method='post' name='ocsng_form' id='ocsng_form' action='{$target}'>";
if (!$tolinked) {
self::checkBox($target);
}
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><td colspan='" . ($advanced || $tolinked ? 10 : 7) . "' class='center'>";
echo "<input class='submit' type='submit' name='import_ok' value=\"" . _sx('button', 'Import', 'ocsinventoryng') . "\">";
//.........这里部分代码省略.........
示例4: displayDatas
/**
* Display datas extracted from DB
*
* @param $data array of search datas prepared to get datas
*
* @return nothing
**/
static function displayDatas(array &$data)
{
global $CFG_GLPI;
$item = null;
if (class_exists($data['itemtype'])) {
$item = new $data['itemtype']();
}
$rand = mt_rand();
if (!isset($data['data']) || !isset($data['data']['totalcount'])) {
return false;
}
// Contruct Pager parameters
$globallinkto = Toolbox::append_params(array('criteria' => Toolbox::stripslashes_deep($data['search']['criteria']), 'metacriteria' => Toolbox::stripslashes_deep($data['search']['metacriteria'])), '&');
$parameters = "sort=" . $data['search']['sort'] . "&order=" . $data['search']['order'] . '&' . $globallinkto;
if (isset($_GET['_in_modal'])) {
$parameters .= "&_in_modal=1";
}
// Global search header
if ($data['display_type'] == self::GLOBAL_SEARCH) {
if ($data['item']) {
echo "<div class='center'><h2>" . $data['item']->getTypeName();
// More items
if ($data['data']['totalcount'] > $data['search']['start'] + self::GLOBAL_DISPLAY_COUNT) {
echo " <a href='" . $data['search']['target'] . "?{$parameters}'>" . __('All') . "</a>";
}
echo "</h2></div>\n";
} else {
return false;
}
}
// If the begin of the view is before the number of items
if ($data['data']['count'] > 0) {
// Display pager only for HTML
if ($data['display_type'] == self::HTML_OUTPUT) {
// For plugin add new parameter if available
if ($plug = isPluginItemType($data['itemtype'])) {
$function = 'plugin_' . $plug['plugin'] . '_addParamFordynamicReport';
if (function_exists($function)) {
$out = $function($data['itemtype']);
if (is_array($out) && count($out)) {
$parameters .= Toolbox::append_params($out, '&');
}
}
}
$search_config_top = "";
$search_config_bottom = "";
if (!isset($_GET['_in_modal']) && Session::haveRightsOr('search_config', array(DisplayPreference::PERSONAL, DisplayPreference::GENERAL))) {
$search_config_top = $search_config_bottom = "<div class='pager_controls'><img alt=\"" . __s('Select default items to show') . "\" title=\"" . __s('Select default items to show') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/options_search.png' ";
$search_config_top .= " class='pointer' onClick=\"";
$search_config_top .= Html::jsGetElementbyID('search_config_top') . ".dialog('open');\">";
$search_config_bottom .= " class='pointer' onClick=\"";
$search_config_bottom .= Html::jsGetElementbyID('search_config_bottom') . ".dialog('open');\">";
$search_config_top .= Ajax::createIframeModalWindow('search_config_top', $CFG_GLPI["root_doc"] . "/front/displaypreference.form.php?itemtype=" . $data['itemtype'], array('title' => __('Select default items to show'), 'reloadonclose' => true, 'display' => false));
$search_config_bottom .= Ajax::createIframeModalWindow('search_config_bottom', $CFG_GLPI["root_doc"] . "/front/displaypreference.form.php?itemtype=" . $data['itemtype'], array('title' => __('Select default items to show'), 'reloadonclose' => true, 'display' => false));
}
if ($item !== null && $item->maybeDeleted()) {
$delete_ctrl = self::isDeletedSwitch($data['search']['is_deleted']);
$search_config_top .= $delete_ctrl;
}
Html::printPager($data['search']['start'], $data['data']['totalcount'], $data['search']['target'], $parameters, $data['itemtype'], 0, $search_config_top);
$search_config_top .= "</div>";
$search_config_bottom .= "</div>";
}
// Define begin and end var for loop
// Search case
$begin_display = $data['data']['begin'];
$end_display = $data['data']['end'];
// Form to massive actions
$isadmin = $data['item'] && $data['item']->canUpdate();
if (!$isadmin && InfoCom::canApplyOn($data['itemtype'])) {
$isadmin = Infocom::canUpdate() || Infocom::canCreate();
}
if ($data['itemtype'] != 'AllAssets') {
$showmassiveactions = count(MassiveAction::getAllMassiveActions($data['item'], $data['search']['is_deleted']));
} else {
$showmassiveactions = true;
}
$massformid = 'massform' . $data['itemtype'];
if ($showmassiveactions && $data['display_type'] == self::HTML_OUTPUT) {
Html::openMassiveActionsForm($massformid);
$massiveactionparams = $data['search']['massiveactionparams'];
$massiveactionparams['num_displayed'] = $end_display - $begin_display;
$massiveactionparams['fixed'] = false;
$massiveactionparams['is_deleted'] = $data['search']['is_deleted'];
$massiveactionparams['container'] = $massformid;
Html::showMassiveActions($massiveactionparams);
}
// Compute number of columns to display
// Add toview elements
$nbcols = count($data['data']['cols']);
if ($data['display_type'] == self::HTML_OUTPUT && $showmassiveactions) {
// HTML display - massive modif
$nbcols++;
//.........这里部分代码省略.........
示例5: showList
//.........这里部分代码省略.........
}
// If the begin of the view is before the number of items
if ($p['start'] < $numrows) {
// Display pager only for HTML
if ($output_type == self::HTML_OUTPUT) {
// For plugin add new parameter if available
if ($plug = isPluginItemType($itemtype)) {
$function = 'plugin_' . $plug['plugin'] . '_addParamFordynamicReport';
if (function_exists($function)) {
$out = $function($itemtype);
if (is_array($out) && count($out)) {
foreach ($out as $key => $val) {
if (is_array($val)) {
$parameters .= self::getArrayUrlLink($key, $val);
} else {
$parameters .= "&{$key}={$val}";
}
}
}
}
}
$search_config = "";
if (Session::haveRight("search_config", DisplayPreference::GENERAL)) {
//|| Session::haveRight("search_config_global",CREATE)) {
// Ajax::createModalWindow('searchconfig_window',
// $CFG_GLPI['root_doc']."/ajax/searchconfig.php?itemtype=$itemtype",
// array('title' => __('Select default items to show'),
// 'width' => '1000'));
// $tmp = " class='pointer' onClick=\"searchconfig_window.show()\"";
$tmp = " class='pointer' onClick=\"var w = window.open('" . $CFG_GLPI["root_doc"] . "/front/popup.php?popup=search_config&itemtype={$itemtype}' ,'glpipopup', " . "'height=400, width=1000, top=100, left=100, scrollbars=yes'); w.focus();\"";
$search_config = "<img alt=\"" . __s('Select default items to show') . "\" title=\"" . __s('Select default items to show') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/options_search.png' ";
$search_config .= $tmp . ">";
}
Html::printPager($p['start'], $numrows, $target, $parameters, $itemtype, 0, $search_config);
}
// Define begin and end var for loop
// Search case
$begin_display = $p['start'];
$end_display = min($numrows, $p['start'] + $LIST_LIMIT);
// No search Case
if ($nosearch) {
$begin_display = 0;
$end_display = min($numrows - $p['start'], $LIST_LIMIT);
}
// Export All case
if ($p['export_all']) {
$begin_display = 0;
$end_display = $numrows;
}
// Form to massive actions
$isadmin = $item && $item->canUpdate();
if (!$isadmin && in_array($itemtype, $CFG_GLPI["infocom_types"])) {
$isadmin = Infocom::canUpdate() || Infocom::canCreate();
}
$showmassiveactions = false;
if ($itemtype != 'AllAssets') {
$showmassiveactions = count($item->getAllMassiveActions($p['is_deleted']));
if ($showmassiveactions && $output_type == self::HTML_OUTPUT) {
Html::openMassiveActionsForm('massform' . $itemtype);
$massiveactionparams = array('num_displayed' => $end_display - $begin_display, 'fixed' => false, 'is_deleted' => $p['is_deleted']);
Html::showMassiveActions($itemtype, $massiveactionparams);
}
}
// Compute number of columns to display
// Add toview elements
$nbcols = $toview_count;
示例6: showList
/**
* Print a nice tab for last event
*
* Print a great tab to present lasts events occured on glpi
*
* @param $target where to go when complete
* @param $order order by clause occurences (eg: ) (default 'DESC')
* @param $sort order by clause occurences (eg: date) (defaut 'date')
* @param $start (default 0)
**/
static function showList($target, $order = 'DESC', $sort = 'date', $start = 0)
{
global $DB, $CFG_GLPI;
// Show events from $result in table form
list($logItemtype, $logService) = self::logArray();
// Columns of the Table
$items = array("type" => array(__('Source'), ""), "items_id" => array(__('ID'), ""), "date" => array(__('Date'), ""), "service" => array(__('Service'), "width='8%'"), "level" => array(__('Level'), "width='8%'"), "message" => array(__('Message'), "width='50%'"));
// define default sorting
if (!isset($items[$sort])) {
$sort = "date";
}
if ($order != "ASC") {
$order = "DESC";
}
// Query Database
$query_limit = "SELECT *\n FROM `glpi_events`\n ORDER BY `{$sort}` {$order}\n LIMIT " . intval($start) . "," . intval($_SESSION['glpilist_limit']);
// Number of results
$numrows = countElementsInTable("glpi_events");
// Get results
$result = $DB->query($query_limit);
$number = $DB->numrows($result);
// No Events in database
if ($number < 1) {
echo "<div class='center b'>" . __('No Event') . "</div>";
return;
}
// Output events
$i = 0;
echo "<div class='center'>";
$parameters = "sort={$sort}&order={$order}";
Html::printPager($start, $numrows, $target, $parameters);
echo "<table class='tab_cadre_fixehov'>";
echo "<tr>";
foreach ($items as $field => $args) {
echo "<th " . $args[1] . "";
if ($sort == $field) {
echo " class='order_{$order}' ";
}
echo "><a href='{$target}?sort={$field}&order=" . ($order == "ASC" ? "DESC" : "ASC") . "'>" . $args[0] . "</a></th>";
}
echo "</tr>";
while ($i < $number) {
$ID = $DB->result($result, $i, "id");
$items_id = $DB->result($result, $i, "items_id");
$type = $DB->result($result, $i, "type");
$date = $DB->result($result, $i, "date");
$service = $DB->result($result, $i, "service");
$level = $DB->result($result, $i, "level");
$message = $DB->result($result, $i, "message");
$itemtype = " ";
if (isset($logItemtype[$type])) {
$itemtype = $logItemtype[$type];
} else {
$type = getSingular($type);
if ($item = getItemForItemtype($type)) {
$itemtype = $item->getTypeName(1);
}
}
echo "<tr class='tab_bg_2'>";
echo "<td>{$itemtype}</td>";
echo "<td class='center b'>";
self::displayItemLogID($type, $items_id);
echo "</td><td>" . Html::convDateTime($date) . "</td>";
echo "<td class='center'>" . (isset($logService[$service]) ? $logService[$service] : $service);
echo "</td><td class='center'>" . $level . "</td><td>" . $message . "</td></tr>";
$i++;
}
echo "</table></div><br>";
}
示例7: showReport
function showReport($params)
{
global $CFG_GLPI;
$PluginAddressingReport = new PluginAddressingReport();
// Default values of parameters
$default_values["start"] = $start = 0;
$default_values["id"] = $id = 0;
$default_values["export"] = $export = false;
foreach ($default_values as $key => $val) {
if (isset($params[$key])) {
${$key} = $params[$key];
}
}
if ($this->getFromDB($id)) {
$result = $this->compute($start);
$nbipf = 0;
// ip libres
$nbipr = 0;
// ip reservees
$nbipt = 0;
// ip trouvees
$nbipd = 0;
// doublons
foreach ($result as $ip => $lines) {
if (count($lines)) {
if (count($lines) > 1) {
$nbipd++;
}
if (isset($lines[0]['pname']) && strstr($lines[0]['pname'], "reserv")) {
$nbipr++;
}
$nbipt++;
} else {
$nbipf++;
}
}
////title
echo "<div class='spaced'>";
echo "<table class='tab_cadre_fixe'><tr class='tab_bg_2 left'>";
echo "<td>";
if ($this->fields['free_ip']) {
echo __('Number of free ip', 'addressing') . " " . $nbipf . "<br>";
}
if ($this->fields['reserved_ip']) {
echo __('Number of reserved ip', 'addressing') . " " . $nbipr . "<br>";
}
if ($this->fields['alloted_ip']) {
echo __('Number of assigned ip (no doubles)', 'addressing') . " " . $nbipt . "<br>";
}
if ($this->fields['double_ip']) {
echo __('Doubles', 'addressing') . " " . $nbipd . "<br>";
}
echo "</td>";
echo "<td>";
if ($this->fields['double_ip']) {
echo "<span class='plugin_addressing_ip_double'>" . __('Red row', 'addressing') . "</span> - " . __('Same Ip', 'addressing') . "<br>";
}
if (isset($this->fields['use_ping']) && $this->fields['use_ping']) {
echo __('Ping free Ip', 'addressing') . "<br>";
echo "<span class='plugin_addressing_ping_off'>" . __('Ping: got a response - used Ip', 'addressing') . "</span><br>";
echo "<span class='plugin_addressing_ping_on'>" . __('Ping: no response - free Ip', 'addressing') . "</span>";
} else {
echo "<span class='plugin_addressing_ip_free'>" . __('Blue row', 'addressing') . "</span> - " . __('Free Ip', 'addressing') . "<br>";
}
echo "</td></tr>";
echo "<tr><td colspan='2' align='center'>";
echo "<a href='./report.form.php?id=" . $this->getID() . "&export=true'>" . __('Export') . "</a>";
echo "</td></tr>";
echo "</table>";
echo "</div>";
$numrows = 1 + ip2long($this->fields['end_ip']) - ip2long($this->fields['begin_ip']);
if (strpos($_SERVER['PHP_SELF'], "report.form.php")) {
Html::printPager($start, $numrows, $_SERVER['PHP_SELF'], "start={$start}&id=" . $id, 'PluginAddressingReport');
} else {
Html::printAjaxPager("", $start, $numrows);
}
//////////////////////////liste ips////////////////////////////////////////////////////////////
$ping_response = $PluginAddressingReport->displayReport($result, $this);
if ($this->fields['use_ping']) {
$total_realfreeip = $nbipf - $ping_response;
echo "<table class='tab_cadre_fixe'><tr class='tab_bg_2 center'>";
echo "<td>";
echo __('Real free Ip (Ping=KO)', 'addressing') . " " . $total_realfreeip;
echo "</td></tr>";
echo "</table>";
}
echo "</div>";
} else {
echo "<div class='center'>" . "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/warning.png\" alt='warning'><br><br><b>" . __('Problem detected with the IP Range', 'addressing') . "</b></div>";
}
}
示例8: showSnmpDeviceToUpdate
/**
* @param $plugin_ocsinventoryng_ocsservers_id
* @param $check
* @param $start
* @return bool|void
*/
static function showSnmpDeviceToUpdate($plugin_ocsinventoryng_ocsservers_id, $check, $start)
{
global $DB, $CFG_GLPI;
PluginOcsinventoryngOcsServer::checkOCSconnection($plugin_ocsinventoryng_ocsservers_id);
if (!Session::haveRight("plugin_ocsinventoryng", UPDATE)) {
return false;
}
// Get linked computer ids in GLPI
$already_linked_query = "SELECT `glpi_plugin_ocsinventoryng_snmpocslinks`.`ocs_id` AS ocsid\n FROM `glpi_plugin_ocsinventoryng_snmpocslinks`\n WHERE `glpi_plugin_ocsinventoryng_snmpocslinks`.`plugin_ocsinventoryng_ocsservers_id`\n = '{$plugin_ocsinventoryng_ocsservers_id}'";
$already_linked_result = $DB->query($already_linked_query);
if ($DB->numrows($already_linked_result) == 0) {
echo "<div class='center b'>" . __('No new SNMP device to be updated', 'ocsinventoryng') . "</div>";
return;
}
$already_linked_ids = array();
while ($data = $DB->fetch_assoc($already_linked_result)) {
$already_linked_ids[] = $data['ocsid'];
}
// Fetch linked items from ocs
$ocsClient = PluginOcsinventoryngOcsServer::getDBocs($plugin_ocsinventoryng_ocsservers_id);
$ocsResult = $ocsClient->getSnmp(array('ORDER' => 'LASTDATE', 'FILTER' => array('IDS' => $already_linked_ids)));
if (isset($ocsResult['SNMP'])) {
if (count($ocsResult['SNMP']) > 0) {
// Get all ids of the returned items
$ocs_snmp_ids = array();
$hardware = array();
$snmps = array_slice($ocsResult['SNMP'], $start, $_SESSION['glpilist_limit']);
foreach ($snmps as $snmp) {
$LASTDATE = $snmp['META']['LASTDATE'];
$ocs_snmp_inv[$snmp['META']['ID']] = $LASTDATE;
$NAME = $snmp['META']['NAME'];
$ocs_snmp_name[$snmp['META']['ID']] = $NAME;
$ID = $snmp['META']['ID'];
$ocs_snmp_ids[] = $ID;
if (isset($snmp['PRINTER'])) {
$TYPE = "printer";
} else {
$TYPE = "";
}
$ocs_snmp_type[$snmp['META']['ID']] = $TYPE;
}
// query snmp links
$query = "SELECT * FROM `glpi_plugin_ocsinventoryng_snmpocslinks`\n WHERE `glpi_plugin_ocsinventoryng_snmpocslinks`.`ocs_id` IN (" . implode(',', $ocs_snmp_ids) . ")";
$result = $DB->query($query);
// Get all links between glpi and OCS
$already_linked = array();
if ($DB->numrows($result) > 0) {
while ($data = $DB->fetch_assoc($result)) {
$data = Toolbox::clean_cross_side_scripting_deep(Toolbox::addslashes_deep($data));
$format = 'Y-m-d H:i:s';
// $last_glpi_update = DateTime::createFromFormat($format, $data['last_update']);
// $last_ocs_inventory = DateTime::createFromFormat($format, $ocs_snmp_inv[$data['ocs_id']]);
//TODOSNMP comment for test
//if ($last_ocs_inventory > $last_glpi_update) {
$already_linked[$data['id']] = $data;
//}
}
}
echo "<div class='center'>";
echo "<h2>" . __('Snmp device updated in OCSNG', 'ocsinventoryng') . "</h2>";
$target = $CFG_GLPI['root_doc'] . '/plugins/ocsinventoryng/front/ocsngsnmp.sync.php';
if (($numrows = $ocsResult['TOTAL_COUNT']) > 0) {
$parameters = "check={$check}";
Html::printPager($start, $numrows, $target, $parameters);
echo "<form method='post' id='ocsng_form' name='ocsng_form' action='" . $target . "'>";
PluginOcsinventoryngOcsServer::checkBox($target);
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><td colspan='6' class='center'>";
echo "<input class='submit' type='submit' name='update_ok' value=\"" . _sx('button', 'Synchronize', 'ocsinventoryng') . "\">";
echo " <input class='submit' type='submit' name='delete' value=\"" . _sx('button', 'Delete link', 'ocsinventoryng') . "\">";
echo "</td></tr>\n";
echo "<tr>";
echo "<th>" . __('GLPI Object', 'ocsinventoryng') . "</th>";
echo "<th>" . __('Item type') . "</th>";
echo "<th>" . __('OCS SNMP device', 'ocsinventoryng') . "</th>";
echo "<th>" . __('Import date in GLPI', 'ocsinventoryng') . "</th>";
echo "<th>" . __('Last OCSNG SNMP inventory date', 'ocsinventoryng') . "</th>";
echo "<th> </th></tr>\n";
foreach ($already_linked as $ID => $tab) {
echo "<tr class='tab_bg_2 center'>";
$item = new $tab["itemtype"]();
$item->getFromDB($tab["items_id"]);
echo "<td>" . $item->getLink() . "</td>\n";
echo "<td>" . $item->getTypeName() . "</td>\n";
echo "<td>" . $ocs_snmp_name[$tab["ocs_id"]] . "</td>\n";
echo "<td>" . Html::convDateTime($tab["last_update"]) . "</td>\n";
echo "<td>" . Html::convDateTime($ocs_snmp_inv[$tab["ocs_id"]]) . "</td>\n";
echo "<td><input type='checkbox' name='toupdate[" . $tab["id"] . "]' " . ($check == "all" ? "checked" : "") . ">";
echo "</td></tr>\n";
}
echo "<tr class='tab_bg_1'><td colspan='6' class='center'>";
echo "<input class='submit' type='submit' name='update_ok' value=\"" . _sx('button', 'Synchronize', 'ocsinventoryng') . "\">";
echo " <input class='submit' type='submit' name='delete' value=\"" . _sx('button', 'Delete link', 'ocsinventoryng') . "\">";
echo "<input type=hidden name='plugin_ocsinventoryng_ocsservers_id' " . "value='{$plugin_ocsinventoryng_ocsservers_id}'>";
//.........这里部分代码省略.........
示例9: showComputersToAdd
/**
* Display a list of computers to add or to link
*
* @param plugin_ocsinventoryng_ocsservers_id the ID of the ocs server
* @param advanced display detail about the computer import or not (target entity, matched rules, etc.)
* @param check indicates if checkboxes are checked or not
* @param start display a list of computers starting at rowX
* @param entity a list of entities in which computers can be added or linked
* @param tolinked false for an import, true for a link
*
* @return nothing
**/
static function showComputersToAdd($plugin_ocsinventoryng_ocsservers_id, $advanced, $check, $start, $entity = 0, $tolinked = false)
{
global $DB, $PluginOcsinventoryngDBocs, $CFG_GLPI;
if (!plugin_ocsinventoryng_haveRight("ocsng", "w")) {
return false;
}
$target = $CFG_GLPI['root_doc'] . '/plugins/ocsinventoryng/front/ocsng.import.php';
if ($tolinked) {
$target = $CFG_GLPI['root_doc'] . '/plugins/ocsinventoryng/front/ocsng.link.php';
}
$cfg_ocs = self::getConfig($plugin_ocsinventoryng_ocsservers_id);
$WHERE = self::getTagLimit($cfg_ocs);
$query_ocs = "SELECT `hardware`.*,\n `accountinfo`.`TAG` AS TAG,\n `bios`.`SSN` AS SERIAL,\n `bios`.`SMODEL`,\n `bios`.`SMANUFACTURER`\n FROM `hardware`\n INNER JOIN `accountinfo` ON (`hardware`.`id` = `accountinfo`.`HARDWARE_ID`)\n INNER JOIN `bios` ON (`hardware`.`id` = `bios`.`HARDWARE_ID`)" . (!empty($WHERE) ? "WHERE {$WHERE}" : "") . "\n ORDER BY `hardware`.`NAME`";
$result_ocs = $PluginOcsinventoryngDBocs->query($query_ocs);
// Existing OCS - GLPI link
$query_glpi = "SELECT*\n FROM `glpi_plugin_ocsinventoryng_ocslinks`\n WHERE `plugin_ocsinventoryng_ocsservers_id`\n = '{$plugin_ocsinventoryng_ocsservers_id}'";
$result_glpi = $DB->query($query_glpi);
if ($PluginOcsinventoryngDBocs->numrows($result_ocs) > 0) {
// Get all hardware from OCS DB
$hardware = array();
while ($data = $PluginOcsinventoryngDBocs->fetch_array($result_ocs)) {
$data = Toolbox::clean_cross_side_scripting_deep(Toolbox::addslashes_deep($data));
$hardware[$data["ID"]]["date"] = $data["LASTDATE"];
$hardware[$data["ID"]]["name"] = $data["NAME"];
$hardware[$data["ID"]]["TAG"] = $data["TAG"];
$hardware[$data["ID"]]["id"] = $data["ID"];
$hardware[$data["ID"]]["serial"] = $data["SERIAL"];
$hardware[$data["ID"]]["model"] = $data["SMODEL"];
$hardware[$data["ID"]]["manufacturer"] = $data["SMANUFACTURER"];
$query_network = "SELECT*\n FROM `networks`\n WHERE `HARDWARE_ID` = '" . $data["ID"] . "'";
//Get network informations for this computer
//Ignore informations that contains "??"
foreach ($PluginOcsinventoryngDBocs->request($query_network) as $network) {
if (isset($network['IPADDRESS']) && $network['IPADDRESS'] != '??') {
$hardware[$data["ID"]]['IPADDRESS'][] = $network['IPADDRESS'];
}
if (isset($network['IPSUBNET']) && $network['IPSUBNET'] != '??') {
$hardware[$data["ID"]]['IPSUBNET'][] = $network['IPSUBNET'];
}
if (isset($network['MACADDRESS']) && $network['MACADDR'] != '??') {
$hardware[$data["ID"]]['MACADDRESS'][] = $network['MACADDR'];
}
}
}
// Get all links between glpi and OCS
$already_linked = array();
if ($DB->numrows($result_glpi) > 0) {
while ($data = $PluginOcsinventoryngDBocs->fetch_array($result_glpi)) {
$already_linked[$data["ocsid"]] = $data["last_update"];
}
}
// Clean $hardware from already linked element
if (count($already_linked) > 0) {
foreach ($already_linked as $ID => $date) {
if (isset($hardware[$ID]) && isset($already_linked[$ID])) {
unset($hardware[$ID]);
}
}
}
if ($tolinked && count($hardware)) {
echo "<div class='center b'>" . __('Caution! The imported data (see your configuration) will overwrite the existing one', 'ocsinventoryng') . "</div>";
}
echo "<div class='center'>";
if (($numrows = count($hardware)) > 0) {
$parameters = "check={$check}";
Html::printPager($start, $numrows, $target, $parameters);
// delete end
array_splice($hardware, $start + $_SESSION['glpilist_limit']);
// delete begin
if ($start > 0) {
array_splice($hardware, 0, $start);
}
//Show preview form only in import even in multi-entity mode because computer import
//can be refused by a rule
if (!$tolinked) {
echo "<div class='firstbloc'>";
echo "<form method='post' name='ocsng_import_mode' id='ocsng_import_mode'\n action='{$target}'>\n";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('Manual import mode', 'ocsinventoryng') . "</th></tr>\n";
echo "<tr class='tab_bg_1'><td class='center'>";
if ($advanced) {
Html::showSimpleForm($target, 'change_import_mode', __('Disable preview', 'ocsinventoryng'), array('id' => 'false'));
} else {
Html::showSimpleForm($target, 'change_import_mode', __('Enable preview', 'ocsinventoryng'), array('id' => 'true'));
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td class='center b'>" . __('Check first that duplicates have been correctly managed in OCSNG', 'ocsinventoryng') . "</td>";
echo "</tr></table>";
//.........这里部分代码省略.........
示例10: showItems
/**
* @param $target
* @param $date1
* @param $date2
* @param $start
**/
static function showItems($target, $date1, $date2, $start)
{
global $DB, $CFG_GLPI;
$view_entities = Session::isMultiEntitiesMode();
if ($view_entities) {
$entities = getAllDatasFromTable('glpi_entities');
}
$output_type = Search::HTML_OUTPUT;
if (isset($_GET["display_type"])) {
$output_type = $_GET["display_type"];
}
if (empty($date2)) {
$date2 = date("Y-m-d");
}
$date2 .= " 23:59:59";
// 1 an par defaut
if (empty($date1)) {
$date1 = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d"), date("Y") - 1));
}
$date1 .= " 00:00:00";
$query = "SELECT `glpi_items_tickets`.`itemtype`,\n `glpi_items_tickets`.`items_id`,\n COUNT(*) AS NB\n FROM `glpi_tickets`\n LEFT JOIN `glpi_items_tickets`\n ON (`glpi_tickets`.`id` = `glpi_items_tickets`.`tickets_id`)\n WHERE `date` <= '{$date2}'\n AND `glpi_tickets`.`date` >= '{$date1}' " . getEntitiesRestrictRequest("AND", "glpi_tickets") . "\n AND `glpi_items_tickets`.`itemtype` <> ''\n AND `glpi_items_tickets`.`items_id` > 0\n GROUP BY `glpi_items_tickets`.`itemtype`, `glpi_items_tickets`.`items_id`\n ORDER BY NB DESC";
$result = $DB->query($query);
$numrows = $DB->numrows($result);
if ($numrows > 0) {
if ($output_type == Search::HTML_OUTPUT) {
Html::printPager($start, $numrows, $target, "date1=" . $date1 . "&date2=" . $date2 . "&type=hardwares&start={$start}", 'Stat');
echo "<div class='center'>";
}
$end_display = $start + $_SESSION['glpilist_limit'];
if (isset($_GET['export_all'])) {
$end_display = $numrows;
}
echo Search::showHeader($output_type, $end_display - $start + 1, 2, 1);
$header_num = 1;
echo Search::showNewLine($output_type);
echo Search::showHeaderItem($output_type, _n('Associated element', 'Associated elements', 2), $header_num);
if ($view_entities) {
echo Search::showHeaderItem($output_type, __('Entity'), $header_num);
}
echo Search::showHeaderItem($output_type, __('Number of tickets'), $header_num);
echo Search::showEndLine($output_type);
$DB->data_seek($result, $start);
$i = $start;
if (isset($_GET['export_all'])) {
$start = 0;
}
for ($i = $start; $i < $numrows && $i < $end_display; $i++) {
$item_num = 1;
// Get data and increment loop variables
$data = $DB->fetch_assoc($result);
if (!($item = getItemForItemtype($data["itemtype"]))) {
continue;
}
if ($item->getFromDB($data["items_id"])) {
echo Search::showNewLine($output_type, $i % 2);
echo Search::showItem($output_type, sprintf(__('%1$s - %2$s'), $item->getTypeName(), $item->getLink()), $item_num, $i - $start + 1, "class='center'" . " " . ($item->isDeleted() ? " class='deleted' " : ""));
if ($view_entities) {
$ent = $item->getEntityID();
$ent = $entities[$ent]['completename'];
echo Search::showItem($output_type, $ent, $item_num, $i - $start + 1, "class='center'" . " " . ($item->isDeleted() ? " class='deleted' " : ""));
}
echo Search::showItem($output_type, $data["NB"], $item_num, $i - $start + 1, "class='center'" . " " . ($item->isDeleted() ? " class='deleted' " : ""));
}
}
echo Search::showFooter($output_type);
if ($output_type == Search::HTML_OUTPUT) {
echo "</div>";
}
}
}
示例11: showHardware
/**
* show hardware to be identified, or identified and imported, or just the hardware with agents installed on them
* @param type $hardware array
* @param type $lim integer
* @param int|type $start integer
* @param type $ipAdress string
* @param type $status string
* @param $subnet
* @param $action
* @global type $CFG_GLPI
*/
static function showHardware($hardware, $lim, $start = 0, $ipAdress, $status, $subnet, $action)
{
global $CFG_GLPI, $DB;
$output_type = Search::HTML_OUTPUT;
//0
$link = $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/ipdiscover.import.php";
$return = $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/ipdiscover.php";
$returnargs = "subnetsChoice={$subnet}&action={$action}";
$reload = "ip={$ipAdress}&status={$status}&action={$action}";
$backValues = "?b[]={$ipAdress}&b[]={$status}";
if ($status == "inventoried") {
$status_name = __('Inventoried', 'ocsinventoryng');
} elseif ($status == "imported") {
$status_name = __('Imported / Linked', 'ocsinventoryng');
} elseif ($status == "noninventoried") {
$status_name = __('Non Inventoried', 'ocsinventoryng');
} else {
$status_name = __('Identified', 'ocsinventoryng');
}
$subnet_name = self::getSubnetNamebyIP($ipAdress);
echo "<div class='center'>";
echo "<h2>" . __('Subnet', 'ocsinventoryng') . " " . $subnet_name . " (" . $ipAdress . ") - " . $status_name;
echo " ";
$refresh = $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/ipdiscover.import.php?" . $reload;
Html::showSimpleForm($refresh, 'refresh', _sx('button', 'Refresh'), array(), $CFG_GLPI["root_doc"] . "/plugins/ocsinventoryng/pics/synchro.png");
echo "</h2>";
echo "</div>";
if ($subnet >= 0) {
$back = __('Back');
echo "<div class='center'><a href='{$return}?{$returnargs}'>{$back}</div>";
}
echo Html::printPager($start, count($hardware), $link, $reload);
echo Search::showNewLine($output_type, true);
if (empty($hardware)) {
echo "<div class='center b'><br>" . __('No new IPDiscover device to import', 'ocsinventoryng') . "</div>";
Html::displayBackLink();
} else {
$header_num = 1;
switch ($status) {
case "inventoried":
echo "<table width='100%'class='tab_cadrehov'>\n";
echo Search::showHeaderItem($output_type, __('User'), $header_num);
echo Search::showHeaderItem($output_type, __('Name'), $header_num);
echo Search::showHeaderItem($output_type, __('System'), $header_num);
echo Search::showHeaderItem($output_type, __('Version of the operating system'), $header_num);
echo Search::showHeaderItem($output_type, __('IP address'), $header_num);
echo Search::showHeaderItem($output_type, __('Last OCSNG inventory date', 'ocsinventoryng'), $header_num);
echo Search::showEndLine($output_type);
$row_num = 1;
for ($i = $start; $i < $lim + $start; $i++) {
if (isset($hardware[$i])) {
$row_num++;
$item_num = 1;
echo Search::showNewLine($output_type, $row_num % 2);
echo Search::showItem($output_type, $hardware[$i]["userid"], $item_num, $row_num);
echo Search::showItem($output_type, $hardware[$i]["name"], $item_num, $row_num);
echo Search::showItem($output_type, $hardware[$i]["osname"], $item_num, $row_num);
echo Search::showItem($output_type, $hardware[$i]["osversion"], $item_num, $row_num);
echo Search::showItem($output_type, $hardware[$i]["ipaddr"], $item_num, $row_num);
echo Search::showItem($output_type, Html::convDateTime($hardware[$i]["lastdate"]), $item_num, $row_num);
echo Search::showEndLine($output_type);
}
}
echo "</table>\n";
break;
case "imported":
$target = $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/ipdiscover.import.php" . $backValues;
self::checkBox($target);
echo "<form method='post' id='ipdiscover_form' name='ipdiscover_form' action='{$target}'>";
echo "<div class='center' style=\"width=100%\">";
echo "<input type='submit' class='submit' name='deletelink' value=\"" . _sx('button', 'Delete link', 'ocsinventoryng') . "\"></div>";
echo "<table width='100%'class='tab_cadrehov'>\n";
echo Search::showHeaderItem($output_type, __('Item'), $header_num);
echo Search::showHeaderItem($output_type, __('Item type'), $header_num);
echo Search::showHeaderItem($output_type, __('MAC address'), $header_num);
echo Search::showHeaderItem($output_type, __('IP address'), $header_num);
echo Search::showHeaderItem($output_type, __('Location'), $header_num);
echo Search::showHeaderItem($output_type, __('Import date in GLPI', 'ocsinventoryng'), $header_num);
echo Search::showHeaderItem($output_type, __('Subnet'), $header_num);
echo Search::showHeaderItem($output_type, __(' '), $header_num);
echo Search::showEndLine($output_type);
$row_num = 1;
for ($i = $start; $i < $lim + $start; $i++) {
if (isset($hardware[$i])) {
$row_num++;
$item_num = 1;
echo Search::showNewLine($output_type, $row_num % 2);
$class = getItemForItemtype($hardware[$i]["itemtype"]);
$class->getFromDB($hardware[$i]["items_id"]);
//.........这里部分代码省略.........
示例12: urlencode
}
$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);
echo Search::showNewLine($output_type);
showTitle($output_type, $num, __('Entity'), 'entity', true);
showTitle($output_type, $num, __('Type'), 'type');
showTitle($output_type, $num, __('Name'), 'name', true);
示例13: showLdapGroups
/** Show LDAP groups to add or synchronise in an entity
*
* @param $target target page for the form
* @param $start where to start the list
* @param $sync synchronise or add ? (default 0)
* @param $filter ldap filter to use (default '')
* @param $filter2 second ldap filter to use (which case ?) (default '')
* @param $entity working entity
* @param $order display order (default DESC)
*
* @return nothing
**/
static function showLdapGroups($target, $start, $sync = 0, $filter = '', $filter2 = '', $entity, $order = 'DESC')
{
echo "<br>";
$limitexceeded = false;
$ldap_groups = self::getAllGroups($_SESSION["ldap_server"], $filter, $filter2, $entity, $limitexceeded, $order);
if (is_array($ldap_groups)) {
$numrows = count($ldap_groups);
$rand = mt_rand();
$colspan = Session::isMultiEntitiesMode() ? 5 : 4;
if ($numrows > 0) {
self::displaySizeLimitWarning($limitexceeded);
$parameters = '';
Html::printPager($start, $numrows, $target, $parameters);
// delete end
array_splice($ldap_groups, $start + $_SESSION['glpilist_limit']);
// delete begin
if ($start > 0) {
array_splice($ldap_groups, 0, $start);
}
echo "<div class='center'>";
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => min($_SESSION['glpilist_limit'], count($ldap_groups)), 'container' => 'mass' . __CLASS__ . $rand, 'specific_actions' => array(__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'import_group' => _sx('button', 'Import')), 'extraparams' => array('massive_action_fields' => array('dn', 'ldap_import_type', 'ldap_import_entities', 'ldap_import_recursive')));
Html::showMassiveActions($massiveactionparams);
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th width='10'>";
Html::showCheckbox(array('criterion' => array('tag_for_massive' => 'select_item')));
echo "</th>";
$header_num = 0;
echo Search::showHeaderItem(Search::HTML_OUTPUT, __('Group'), $header_num, $target . "?order=" . ($order == "DESC" ? "ASC" : "DESC"), 1, $order);
echo "<th>" . __('Group DN') . "</th>";
echo "<th>" . __('Destination entity') . "</th>";
if (Session::isMultiEntitiesMode()) {
echo "<th>" . __('Child entities') . "</th>";
}
echo "</tr>";
$dn_index = 0;
foreach ($ldap_groups as $groupinfos) {
$group = $groupinfos["cn"];
$group_dn = $groupinfos["dn"];
$search_type = $groupinfos["search_type"];
echo "<tr class='tab_bg_2 center'>";
echo "<td>";
echo Html::hidden("dn[{$dn_index}]", array('value' => $group_dn, 'data-glpicore-ma-tags' => 'common'));
echo Html::hidden("ldap_import_type[{$dn_index}]", array('value' => $search_type, 'data-glpicore-ma-tags' => 'common'));
Html::showMassiveActionCheckBox(__CLASS__, $dn_index, array('massive_tags' => 'select_item'));
echo "</td>";
echo "<td>" . $group . "</td>";
echo "<td>" . $group_dn . "</td>";
echo "<td>";
Entity::dropdown(array('value' => $entity, 'name' => "ldap_import_entities[{$dn_index}]", 'specific_tags' => array('data-glpicore-ma-tags' => 'common')));
echo "</td>";
if (Session::isMultiEntitiesMode()) {
echo "<td>";
Html::showCheckbox(array('name' => "ldap_import_recursive[{$dn_index}]", 'specific_tags' => array('data-glpicore-ma-tags' => 'common')));
echo "</td>";
} else {
echo Html::hidden("ldap_import_recursive[{$dn_index}]", array('value' => 0, 'data-glpicore-ma-tags' => 'common'));
}
echo "</tr>\n";
$dn_index++;
}
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
echo "</div>";
Html::printPager($start, $numrows, $target, $parameters);
} else {
echo "<div class='center b'>" . __('No group to be imported') . "</div>";
}
} else {
echo "<div class='center b'>" . __('No group to be imported') . "</div>";
}
}
示例14: showMinimalList
//.........这里部分代码省略.........
}
$query .= $ORDER;
// Get it from database
if ($result = $DB->query($query)) {
$numrows = $DB->numrows($result);
$globallinkto = Search::getArrayUrlLink("field", $p['field']) . Search::getArrayUrlLink("link", $p['link']) . Search::getArrayUrlLink("contains", $p['contains']) . Search::getArrayUrlLink("searchtype", $p['searchtype']) . Search::getArrayUrlLink("field2", $p['field2']) . Search::getArrayUrlLink("contains2", $p['contains2']) . Search::getArrayUrlLink("searchtype2", $p['searchtype2']) . Search::getArrayUrlLink("itemtype2", $p['itemtype2']) . Search::getArrayUrlLink("link2", $p['link2']);
$parameters = "sort=" . $p['sort'] . "&order=" . $p['order'] . $globallinkto;
if ($output_type == Search::GLOBAL_SEARCH) {
if (class_exists($itemtype)) {
echo "<div class='center'><h2>" . $this->getTypeName();
// More items
if ($numrows > $p['start'] + Search::GLOBAL_DISPLAY_COUNT) {
echo " <a href='{$target}?{$parameters}'>" . __('All') . "</a>";
}
echo "</h2></div>\n";
} else {
return false;
}
}
if ($p['start'] < $numrows) {
// Pager
if ($output_type == Search::HTML_OUTPUT) {
// HTML display - massive modif
$search_config = "";
if ($item->canCreate() && $canedit) {
$tmp = " class='pointer' onClick=\"var w = window.open('" . $CFG_GLPI["root_doc"] . "/front/popup.php?popup=search_config&itemtype=" . $itemtype . "' ,'glpipopup', " . "'height=400, width=1000, top=100, left=100, scrollbars=yes' ); w.focus();\"";
$search_config = "<img alt='" . __('Select default items to show') . "' title='" . __('Select default items to show') . "' src='" . $CFG_GLPI["root_doc"] . "/pics/options_search.png' ";
$search_config .= $tmp . ">";
}
//echo Search::showHeaderItem($output_type,$search_config,$header_num,"",0,$p['order']);
}
// Pager
if ($output_type == Search::HTML_OUTPUT) {
Html::printPager($p['start'], $numrows, $target, $parameters, $itemtype, 0, $search_config);
echo "<br>";
}
// Define begin and end var for loop
// Search case
$begin_display = $p['start'];
$end_display = $p['start'] + $LIST_LIMIT;
// Export All case
if ($p['export_all']) {
$begin_display = 0;
$end_display = $numrows;
}
//massive action
$sel = "";
if (isset($_GET["select"]) && $_GET["select"] == "all") {
$sel = "checked";
}
if ($item->canCreate() && $canedit && $output_type == Search::HTML_OUTPUT && $p['withtemplate'] != 2) {
Html::openMassiveActionsForm('massform' . $itemtype);
$massiveactionparams = array('num_displayed' => $end_display - $begin_display, 'fixed' => false, 'is_deleted' => $p['is_deleted']);
Html::showMassiveActions("PluginResourcesDirectory", $massiveactionparams);
}
// Add toview elements
$nbcols = $toview_count;
if ($output_type == Search::HTML_OUTPUT) {
// HTML display - massive modif
$nbcols++;
}
// Display List Header
echo Search::showHeader($output_type, $end_display - $begin_display + 1, $nbcols);
$header_num = 1;
// Display column Headers for toview items
$headers_line = '';
示例15: showBoard
function showBoard($width = '', $limit = '')
{
global $DB, $CFG_GLPI;
$order = "ASC";
if (isset($_GET['order'])) {
$order = $_GET['order'];
}
$where = '';
if ($limit == 'hosts') {
$where = "`plugin_monitoring_services_id`='0' ";
} else {
if ($limit == 'services') {
$where = "`plugin_monitoring_services_id`>0 ";
}
}
if (isset($_GET['field'])) {
foreach ($_GET['field'] as $key => $value) {
$wheretmp = '';
if (isset($_GET['link'][$key])) {
$wheretmp .= " " . $_GET['link'][$key] . " ";
}
$wheretmp .= Search::addWhere("", 0, "PluginMonitoringService", $_GET['field'][$key], $_GET['searchtype'][$key], $_GET['contains'][$key]);
if (!strstr($wheretmp, "``.``")) {
if ($where != '' and !isset($_GET['link'][$key])) {
$where .= " AND ";
}
$where .= $wheretmp;
}
}
}
if ($where != '') {
$where = "(" . $where;
$where .= ") AND ";
}
$where .= ' `glpi_plugin_monitoring_services`.`entities_id` IN (' . $_SESSION['glpiactiveentities_string'] . ')';
if ($where != '') {
$where = " WHERE " . $where;
$where = str_replace("`" . getTableForItemType("PluginMonitoringDisplay") . "`.", "", $where);
}
$leftjoin = '';
$leftjoin .= " LEFT JOIN `glpi_plugin_monitoring_components`\n ON `plugin_monitoring_components_id` = \n `glpi_plugin_monitoring_components`.`id` ";
$leftjoin .= " LEFT JOIN `glpi_entities`\n ON `" . getTableForItemType("PluginMonitoringService") . "`.`entities_id` = \n `glpi_entities`.`id`";
if (isset($_GET['field'])) {
foreach ($_GET['field'] as $value) {
if ($value == '20' or $value == '21' or $value == '22') {
$leftjoin .= " LEFT JOIN `glpi_plugin_monitoring_componentscatalogs_hosts`\n ON `plugin_monitoring_componentscatalogs_hosts_id` = \n `glpi_plugin_monitoring_componentscatalogs_hosts`.`id` ";
} else {
if ($value == '7') {
} else {
if ($value == '8') {
if (!strstr($leftjoin, 'LEFT JOIN `glpi_plugin_monitoring_componentscatalogs_hosts`')) {
$leftjoin .= " LEFT JOIN `glpi_plugin_monitoring_componentscatalogs_hosts`\n ON `plugin_monitoring_componentscatalogs_hosts_id` = \n `glpi_plugin_monitoring_componentscatalogs_hosts`.`id` ";
}
if (!strstr($leftjoin, 'LEFT JOIN `glpi_plugin_monitoring_componentscatalogs`')) {
$leftjoin .= " LEFT JOIN `glpi_plugin_monitoring_componentscatalogs`\n ON `glpi_plugin_monitoring_componentscatalogs_hosts`.`plugin_monitoring_componentscalalog_id` = \n `glpi_plugin_monitoring_componentscatalogs`.`id` ";
}
}
}
}
}
}
// * ORDER
$ORDERQUERY = " ORDER BY `name` ";
$toview = array(3, 6, 7, 10, 4, 9);
$toviewComplete = array('ITEM_0' => 'state', 'ITEM_1' => 'completename', 'ITEM_2' => 'component_name', 'ITEM_3' => 'state', 'ITEM_4' => 'last_check', 'ITEM_5' => 'event');
foreach ($toview as $key => $val) {
if ($_GET['sort'] == $val) {
$ORDERQUERY = Search::addOrderBy("PluginMonitoringService", $_GET['sort'], $_GET['order'], $key);
foreach ($toviewComplete as $keyi => $vali) {
$ORDERQUERY = str_replace($keyi, $vali, $ORDERQUERY);
}
}
}
$query = "SELECT `" . getTableForItemType("PluginMonitoringService") . "`.*,\n `glpi_plugin_monitoring_components`.`name` as component_name, \n `glpi_entities`.`completename`\n FROM `" . getTableForItemType("PluginMonitoringService") . "`\n " . $leftjoin . "\n " . $where . "\n " . $ORDERQUERY;
$result = $DB->query($query);
$start = 0;
if (isset($_GET["start"])) {
$start = $_GET["start"];
}
$numrows = $DB->numrows($result);
$parameters = '';
$globallinkto = Search::getArrayUrlLink("field", $_GET['field']) . Search::getArrayUrlLink("link", $_GET['link']) . Search::getArrayUrlLink("contains", $_GET['contains']) . Search::getArrayUrlLink("searchtype", $_GET['searchtype']) . Search::getArrayUrlLink("field2", $_GET['field2']) . Search::getArrayUrlLink("contains2", $_GET['contains2']) . Search::getArrayUrlLink("itemtype2", $_GET['itemtype2']) . Search::getArrayUrlLink("searchtype2", $_GET['searchtype2']) . Search::getArrayUrlLink("link2", $_GET['link2']);
$parameters = "sort=" . $_GET['sort'] . "&order=" . $_GET['order'] . $globallinkto;
Html::printPager($_GET['start'], $numrows, $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/service.php", $parameters);
$limit = $numrows;
if ($_SESSION["glpilist_limit"] < $numrows) {
$limit = $_SESSION["glpilist_limit"];
}
$query .= " LIMIT " . intval($start) . "," . intval($_SESSION['glpilist_limit']);
$result = $DB->query($query);
echo '<div id="custom_date" style="display:none"></div>';
echo '<div id="custom_time" style="display:none"></div>';
if ($width == '') {
echo "<table class='tab_cadrehov' style='width:100%;'>";
} else {
echo "<table class='tab_cadrehov' style='width:100%;'>";
}
$num = 0;
echo "<tr class='tab_bg_1'>";
$this->showHeaderItem(__('Status'), 3, $num, $start, $globallinkto);
//.........这里部分代码省略.........