Ejemplo n.º 1
0
 protected function _deleteIdAction($path)
 {
     $in_id = array_shift($path);
     if (empty($in_id)) {
         $this->_error("ID was not provided.");
     }
     if (null == ($monitor = DAO_Monitor::getByID($in_id))) {
         $this->_error("ID is not valid.");
     }
     DAO_Monitor::delete($monitor->id);
     $out_xml = new SimpleXMLElement('<success></success>');
     $this->_render($out_xml->asXML());
 }
Ejemplo n.º 2
0
 function saveMonitorAction()
 {
     @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', ''));
     @($monitor_name = DevblocksPlatform::importGPC($_REQUEST['monitor_name'], 'string', ''));
     @($monitor_guid = DevblocksPlatform::importGPC($_REQUEST['monitor_guid'], 'string', ''));
     @($monitor_secret_key = DevblocksPlatform::importGPC($_REQUEST['monitor_secret_key'], 'string', ''));
     @($monitor_mia_secs = DevblocksPlatform::importGPC($_REQUEST['monitor_mia'], 'integer', 0));
     @($delete = DevblocksPlatform::importGPC($_REQUEST['do_delete'], 'integer', 0));
     $monitor_guid = str_replace(' ', '_', strtolower($monitor_guid));
     // Required args
     if (empty($monitor_name)) {
         $monitor_name = '(no monitor name)';
     }
     if (empty($monitor_secret_key)) {
         $monitor_secret_key = Application::generatePassword(20);
     }
     if (!empty($id)) {
         // update
         if ($delete) {
             DAO_Monitor::delete($id);
         } else {
             DAO_Monitor::update($id, array(DAO_Monitor::NAME => $monitor_name, DAO_Monitor::GUID => $monitor_guid, DAO_Monitor::SECRET_KEY => $monitor_secret_key, DAO_Monitor::MIA_SECS => $monitor_mia_secs));
         }
     } else {
         // insert
         $monitor_id = DAO_Monitor::create(array(DAO_Monitor::NAME => $monitor_name, DAO_Monitor::GUID => $monitor_guid, DAO_Monitor::SECRET_KEY => $monitor_secret_key, DAO_Monitor::MIA_SECS => $monitor_mia_secs, DAO_Monitor::LAST_UPDATED => time()));
     }
     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'monitors')));
 }