Exemple #1
0
function delete_note($conn)
{
    $validate = array('note_id' => array('validation' => 'OSS_DIGIT', 'e_message' => 'illegal:' . _('Note ID')));
    $validation_errors = validate_form_fields('POST', $validate);
    if (is_array($validation_errors) && !empty($validation_errors)) {
        Av_exception::throw_error(Av_exception::USER_ERROR, _('Error! Note could not be deleted'));
    }
    $note_id = POST('note_id');
    $result = Notes::delete($conn, $note_id);
    if ($result == TRUE) {
        $data['msg'] = _('Note deleted successfully');
    } else {
        Av_exception::throw_error(Av_exception::USER_ERROR, _('Error! Note could not be deleted'));
    }
    return $data;
}
    Session::logcheck('environment-menu', 'PolicyNetworks');
} else {
    ossim_error(_('Invalid asset type value'));
    exit;
}
ossim_valid($id, OSS_HEX, 'illegal:' . _('Asset ID'));
ossim_valid($type, OSS_LETTER, OSS_SCORE, 'illegal:' . _('Asset Type'));
if (ossim_error()) {
    die(ossim_error());
}
$db = new ossim_db();
$conn = $db->connect();
$msg = '';
if ($id_note > 0) {
    // delete note
    if (Notes::delete($conn, $id_note)) {
        $msg = 'deleted';
    } else {
        $msg = 'error';
    }
} elseif (POST('action') == 'new') {
    $txt = POST('txt');
    ossim_valid($txt, OSS_TEXT, OSS_PUNC_EXT, 'illegal:' . _('Note text'));
    if (ossim_error()) {
        echo ossim_error();
    } else {
        if (Notes::insert($conn, $type, gmdate('Y-m-d H:i:s'), Session::get_session_user(), $id, $txt)) {
            $msg = 'created';
        } else {
            $msg = 'error';
        }
Exemple #3
0
         }
     }
     break;
 case "update_note":
     if ($_SESSION['user']['type'] == ADMIN || $_SESSION['user']['type'] == SUPERADMIN) {
         $note = new Notes($db);
         $result = $note->updateNote($data['note'], $data['id']);
         if ($result->resultado) {
             echo 'ok';
         }
     }
     break;
 case "delete_note":
     if ($_SESSION['user']['type'] == ADMIN || $_SESSION['user']['type'] == SUPERADMIN) {
         $note = new Notes($db);
         $result = $note->delete($data['id']);
         if ($result->resultado) {
             echo 'ok';
         }
     }
     break;
 case "insert_cita":
     if ($_SESSION['user']['type'] == ADMIN || $_SESSION['user']['type'] == SUPERADMIN) {
         $calendar = new Calendar($db);
         if (!isset($data['calendar']['id_patient'])) {
             $data['calendar']['id_patient'] = $_SESSION['user']['id'];
         }
         $result = $calendar->insertInCalendar('cita', $data['calendar']);
         if ($result->resultado) {
             $pct = new Patient($db);
             $info_paciente = $pct->getPatient('info', $data['calendar']['id_patient']);