"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "inc/computerantivirus.class.php" between
glpi-9.3.3.tgz and glpi-9.4.0.tgz

About: GLPI is an IT and asset management software (Information Resource Manager).

computerantivirus.class.php  (glpi-9.3.3.tgz):computerantivirus.class.php  (glpi-9.4.0.tgz)
skipping to change at line 52 skipping to change at line 52
// From CommonDBChild // From CommonDBChild
static public $itemtype = 'Computer'; static public $itemtype = 'Computer';
static public $items_id = 'computers_id'; static public $items_id = 'computers_id';
public $dohistory = true; public $dohistory = true;
static function getTypeName($nb = 0) { static function getTypeName($nb = 0) {
return _n('Antivirus', 'Antiviruses', $nb); return _n('Antivirus', 'Antiviruses', $nb);
} }
/**
* @see CommonGLPI::getTabNameForItem()
**/
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
// can exists for template // can exists for template
if (($item->getType() == 'Computer') if (($item->getType() == 'Computer')
&& Computer::canView()) { && Computer::canView()) {
$nb = 0; $nb = 0;
if ($_SESSION['glpishow_count_on_tabs']) { if ($_SESSION['glpishow_count_on_tabs']) {
$nb = countElementsInTable('glpi_computerantiviruses', $nb = countElementsInTable('glpi_computerantiviruses',
["computers_id" => $item->getID(), 'is_del eted' => 0 ]); ["computers_id" => $item->getID(), 'is_del eted' => 0 ]);
} }
return self::createTabEntry(self::getTypeName(Session::getPluralNumber( )), $nb); return self::createTabEntry(self::getTypeName(Session::getPluralNumber( )), $nb);
} }
return ''; return '';
} }
/**
* @param $item CommonGLPI object
* @param $tabnum (default 1)
* @param $withtemplate (default 0)
**/
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $with template = 0) { static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $with template = 0) {
self::showForComputer($item, $withtemplate); self::showForComputer($item, $withtemplate);
return true; return true;
} }
/**
* @see CommonGLPI::defineTabs()
**/
function defineTabs($options = []) { function defineTabs($options = []) {
$ong = []; $ong = [];
$this->addDefaultFormTab($ong); $this->addDefaultFormTab($ong);
$this->addStandardTab('Log', $ong, $options); $this->addStandardTab('Log', $ong, $options);
return $ong; return $ong;
} }
/** /**
* Duplicate all antirivuses from a computer template to his clone * Duplicate all antirivuses from a computer template to his clone
* *
* @param $oldid * @param $oldid
* @param $newid * @param $newid
**/ **/
static function cloneComputer ($oldid, $newid) { static function cloneComputer($oldid, $newid) {
global $DB; global $DB;
$result = $DB->request( $result = $DB->request(
[ [
'FROM' => ComputerAntivirus::getTable(), 'FROM' => ComputerAntivirus::getTable(),
'WHERE' => ['computers_id' => $oldid], 'WHERE' => ['computers_id' => $oldid],
] ]
); );
foreach ($result as $data) { foreach ($result as $data) {
$antirivus = new self(); $antirivus = new self();
skipping to change at line 214 skipping to change at line 203
'jointype' => 'child' 'jointype' => 'child'
] ]
]; ];
return $tab; return $tab;
} }
/** /**
* Display form for antivirus * Display form for antivirus
* *
* @param $ID id of the antivirus * @param integer $ID id of the antivirus
* @param $options array * @param array $options
* *
* @return bool TRUE if form is ok * @return boolean TRUE if form is ok
**/ **/
function showForm($ID, $options = []) { function showForm($ID, $options = []) {
global $CFG_GLPI;
if (!Session::haveRight("computer", READ)) { if (!Session::haveRight("computer", READ)) {
return false; return false;
} }
$comp = new Computer(); $comp = new Computer();
if ($ID > 0) { if ($ID > 0) {
$this->check($ID, READ); $this->check($ID, READ);
$comp->getFromDB($this->fields['computers_id']); $comp->getFromDB($this->fields['computers_id']);
} else { } else {
skipping to change at line 308 skipping to change at line 296
return true; return true;
} }
/** /**
* Print the computers antiviruses * Print the computers antiviruses
* *
* @param $comp Computer object * @param $comp Computer object
* @param $withtemplate boolean Template or basic item (default 0) * @param $withtemplate boolean Template or basic item (default 0)
* *
* @return Nothing (call to classes members) * @return void
**/ **/
static function showForComputer(Computer $comp, $withtemplate = 0) { static function showForComputer(Computer $comp, $withtemplate = 0) {
global $DB; global $DB;
$ID = $comp->fields['id']; $ID = $comp->fields['id'];
if (!$comp->getFromDB($ID) if (!$comp->getFromDB($ID)
|| !$comp->can($ID, READ)) { || !$comp->can($ID, READ)) {
return false; return;
} }
$canedit = $comp->canEdit($ID); $canedit = $comp->canEdit($ID);
if ($canedit if ($canedit
&& !(!empty($withtemplate) && ($withtemplate == 2))) { && !(!empty($withtemplate) && ($withtemplate == 2))) {
echo "<div class='center firstbloc'>". echo "<div class='center firstbloc'>".
"<a class='vsubmit' href='".ComputerAntivirus::getFormURL()."?com puters_id=$ID&amp;withtemplate=". "<a class='vsubmit' href='".ComputerAntivirus::getFormURL()."?com puters_id=$ID&amp;withtemplate=".
$withtemplate."'>"; $withtemplate."'>";
echo __('Add an antivirus'); echo __('Add an antivirus');
echo "</a></div>\n"; echo "</a></div>\n";
 End of changes. 9 change blocks. 
18 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)