/** * Show table with linked licenses to user * @param Software $software * @return bool */ private static function showUsersLicenses(Software $software) { global $DB; $softwareId = $software->getField("id"); $totalRecordsCount = self::countLicenses($software); $currentPage = isset($_GET["start"]) ? $_GET["start"] : 0; $sortingOrder = SortingOrder::getFromString($_GET["order"]); $columnKeys = array_keys(self::getColumns()); $sortingColumn = array_key_exists($_GET["sort"], self::getColumns()) ? $_GET["sort"] : reset($columnKeys); $queryResult = $DB->query(self::getDataQuery($softwareId, $currentPage, $sortingColumn, $sortingOrder)); $options = PluginFpsoftwareConfig::getConfigValues(array('group_by_users')); Html::printAjaxPager(self::getTypeName(2), $currentPage, $totalRecordsCount); echo self::printTableBegin(); echo self::printGridColumnsHeaders($sortingOrder, $sortingColumn); if ($totalRecordsCount > 0) { while ($data = $DB->fetch_assoc($queryResult)) { echo "<tr class='tab_bg_1'>"; echo "<td class='left'><a href='softwarelicense.form.php?id=" . $data['license_id'] . "'>" . $data["license_name"] . "</a> - " . $data["license_serial"] . " (" . $data["license_type"] . ") " . "</td>"; echo "<td class='left'><a href='user.form.php?id=" . $data['user_id'] . "'>" . $data["user_name"] . "</a></td>"; if ($options['group_by_users']) { $computers = array(); if ($data['computer_ids']) { $computer_ids = explode(';|;', $data['computer_ids']); $computer_names = explode(';|;', $data['computer_names']); foreach ($computer_ids as $index => $computer_id) { $computers[] = " <a href='computer.form.php?id=" . $computer_id . "'>" . $computer_names[$index] . "</a>"; } } echo "<td class='left'>"; echo implode("<br /><br />", $computers) . "</td>"; } else { echo "<td class='left'><a href='computer.form.php?id=" . $data['computer_id'] . "'>" . $data["computer_name"] . "</a></td>"; } echo "<td class='left'><a href='location.form.php?id=" . $data['location_id'] . "'>" . $data["location_name"] . "</a></td>"; echo "</tr>"; } } else { echo "<tr class='tab_bg_1'><td class='center' colspan='3'>No results.</td></tr>"; } Html::printAjaxPager(self::getTypeName(2), $currentPage, $totalRecordsCount); echo self::printTableEnd(); return true; }
<?php include '../../../inc/includes.php'; PluginFpsoftwareVersionhelper::checkRights("config", READ); $config = new PluginFpsoftwareConfig(); if (isset($_POST["update"])) { if (isset($_POST['group_by_users'])) { PluginFpsoftwareConfig::setConfigValues(array('group_by_users' => (int) (bool) $_POST['group_by_users'])); } HTML::back(); } HTML::header('Configuration of FP Software plugin'); $config->showFormDisplay(); HTML::footer();