/** * disable monitor entries * * @param args json params converted into an array * id key contains an array of ids to remove * @throws none * @return array containing result and possible error messages */ public function ajax_disableMonitorEntry($args) { try { // table is based on type argument $flag = strcmp($args['status'], 'disable'); if ($args['type'] == 'port_monitors') { require_once 'portMonitorEntry.php'; foreach ($args['id'] as $v) { $ent = new portMonitorEntry($this->db); $ent->id = $v; if ($flag) { $ent->enable(); } else { $ent->disable(); } } } elseif ($args['type'] == 'certificate_monitors') { require_once 'certificateMonitorEntry.php'; foreach ($args['id'] as $v) { $ent = new certificateMonitorEntry($this->db); $ent->id = $v; if ($flag) { $ent->enable(); } else { $ent->disable(); } } } elseif ($args['type'] == 'snmp_monitors') { require_once 'SNMPMonitorEntry.php'; foreach ($args['id'] as $v) { $ent = new SNMPMonitorEntry($this->db); $ent->id = $v; if ($flag) { $ent->enable(); } else { $ent->disable(); } } } elseif ($args['type'] == 'shell_monitors') { require_once 'shellMonitorEntry.php'; foreach ($args['id'] as $v) { $ent = new shellMonitorEntry($this->db); $ent->id = $v; if ($flag) { $ent->enable(); } else { $ent->disable(); } } } elseif ($args['type'] == 'url_monitors') { require_once 'urlMonitorEntry.php'; foreach ($args['id'] as $v) { $ent = new urlMonitorEntry($this->db); $ent->id = $v; if ($flag) { $ent->enable(); } else { $ent->disable(); } } } else { return array('result' => 'failure', 'error' => 'unknown type: ' . $args['type']); } } catch (Exception $e) { return array('result' => 'failure', 'error' => $e->getMessage()); } return array('result' => 'success'); }