Skip to content

Commit

Permalink
Remove obsolete PluginFusionInventoryPrintersHistoryConfig class. See…
Browse files Browse the repository at this point in the history
… release fusioninventory#47
  • Loading branch information
Vincent MAZZONI committed Apr 30, 2010
1 parent e1b0bfd commit cd25203
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 231 deletions.
3 changes: 0 additions & 3 deletions front/plugin_fusioninventory.functionalities.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@

commonHeader($LANG['plugin_fusioninventory']["functionalities"][0],$_SERVER["PHP_SELF"],"plugins","fusioninventory","summary");

//$config = new PluginFusionInventoryConfig;
//$print_config = new PluginFusionInventoryPrintersHistoryConfig;

if (isset($_POST['update'])) {

if (empty($_POST['cleaning_days'])) {
Expand Down
51 changes: 0 additions & 51 deletions front/plugin_fusioninventory.printer_history_config.form.php

This file was deleted.

5 changes: 0 additions & 5 deletions hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -1402,11 +1402,6 @@ function plugin_headings_fusioninventory_printerErrors($type, $ID) {
$errors->showForm(PRINTER_TYPE, GLPI_ROOT . '/plugins/fusioninventory/front/plugin_fusioninventory.errors.form.php', $_GET["ID"]);
}

function plugin_headings_fusioninventory_printerCronConfig($type, $ID) {
$print_config = new PluginFusionInventoryPrintersHistoryConfig;
$print_config->showForm(GLPI_ROOT . '/plugins/fusioninventory/front/plugin_fusioninventory.printer_history_config.form.php', $_GET["ID"]);
}

function plugin_headings_fusioninventory_networkingInfo($type, $ID) {
$snmp = new PluginFusionInventoryNetworking;
$snmp->showForm(GLPI_ROOT . '/plugins/fusioninventory/front/plugin_fusioninventory.switch_info.form.php', $ID);
Expand Down
172 changes: 0 additions & 172 deletions inc/snmp.printers.history.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,176 +190,4 @@ function showForm($target, $ID) {
}
}

class PluginFusionInventoryPrintersHistoryConfig extends CommonDBTM {

function __construct() {
$this->table="glpi_plugin_fusioninventory_printers_history_config";
$this->type=-1;
}

/**
* To get value of one specific cron
*
* @return value of the counter setting
* @return -1 if no entry found
* @return false if DB connexion error (which implies same value as no activation)
*/
function getCounterValue($ID) {
global $DB;

$query = "SELECT `counter`
FROM ".$this->table."
WHERE `FK_printers` = '".$ID."';";
if ($result = $DB->query($query)) {
if ($this->fields = $DB->fetch_row($result)) {
return $this->fields['0'];
} else {
return -1;
}
}
return false;
}

/**
* To get counter state from FK_printers (i.e. : printer ID)
*
* @param $ID : ID of the printer (equiv to FK_printers into table)
* @return true if get an entry, otherwise false
*/
function getDataFromPrinterId($ID) {
global $DB;
$query = "SELECT `ID`, `counter`
FROM ".$this->table."
WHERE `FK_printers` = '".$ID."';";
if ($result = $DB->query($query)) {
if ($DB->numrows($result) == 1) {
$this->fields = $DB->fetch_assoc($result);
return true;
}
}
return false;
}

/**
* set cron to 1 for all printers -- not used
*
*/
function setAll() {
global $DB;
$query= "SELECT `ID`
FROM `glpi_printers`
WHERE 1;";
if ($result=$DB->query($query)) {
$end = $DB->numrows($result);
if (($end = $DB->numrows($result)) > 0) {
$fields = $DB->fetch_row($result);
$input['counter'] = 1;
for ($i=0; $i<$end; $i++) {
$input['FK_printers'] = $fields['0'];
$this->updateOne($input);
$fields = $DB->fetch_row($result);
}
}
}
}

/**
* set cron to 0 for all printers -- not used
*
*/
function unsetAll() {
global $DB;
$query = "UPDATE ".$this->table."
SET `counter`='0'
WHERE 1;";
$DB->query($query);
}

/**
* Gets the number and all the IDs of activated printers
*
* @return $datas :
* - $datas['number'] for the number of activated printers
* - $datas['$i'] : contains the activated printers ID
*/
function getAllActivated() {
global $DB;

$config = new PluginFusionInventoryConfig;
$statement = $config->getValue("statement_default_value");

$datas=array();

// if statement is not active by default, get exceptions
if (!$statement) {
$query = "SELECT `FK_printers`
FROM ".$this->table."
WHERE `counter` = '1';";
// if statement is active by default, get all without the exceptions
} else {
$query= "SELECT `glpi_printers`.`ID`
FROM `glpi_printers`
LEFT JOIN ".$this->table." ON `glpi_printers`.`ID`=".$this->table.".`FK_printers`
WHERE ".$this->table.".`counter` != '0'
OR ".$this->table.".`counter` IS NULL;";
}

if ($result = $DB->query($query)) {
$i = 0;
while ($data=$DB->fetch_row($result)) {
$data['FK_printers'] = $data[0];
unset($data[0]);
$datas["$i"] = $data;
$i++;
}
$datas['number'] = count($datas);
return $datas;
}
return false;
}

function updateOne($input) {
// if exists
if ($this->getDataFromPrinterId($input['FK_printers'])) {
// default value (-1) : no entry in DB
$input['ID'] = $this->fields['ID'];
if ($input['counter'] == -1) {
$this->delete($input);
} else if ($this->fields['counter'] != $input['counter']) {
$this->update($input);
}
} else {
if ($input['counter'] != -1) {
$this->add($input);
}
}
}

function showForm($target,$ID) {
global $LANG;

if (PluginFusioninventory::haveRight("snmp_printers","w")) {
echo "<br>";
echo "<div align='center'><form method='post' name='printer_history_config_form'
id='printer_history_config_form' action=\"".$target."\">";

echo "<table class='tab_cadre' cellpadding='5'><tr><th colspan='2'>";
echo $LANG['plugin_fusioninventory']["cron"][0]." :</th></tr>";

echo "<tr class='tab_bg_1'>";
echo "<td>".$LANG['plugin_fusioninventory']["cron"][1]."</td>";
echo "<td align='center'>";
PluginFusioninventoryDropdown::showYesNo("counter", $this->getCounterValue($ID));
echo "</td>";
echo "</tr>";

echo "<tr class='tab_bg_1'><td colspan='2'>";
echo "<input type='hidden' name='FK_printers' value='".$ID."'>";
echo "<div align='center'><input type='submit' name='update' value=\"".$LANG["buttons"][2].
"\" class='submit' ></div></td></tr>";
echo "</table></form></div>";
}
}
}

?>

0 comments on commit cd25203

Please sign in to comment.