Ejemplo n.º 1
0
/**
 * 
 * 
 * @return be_vse_data
 */
function execute()
{
    $registeredEntry = new be_vse_data();
    try {
        $access = "RW";
        include './inc/incWebServiceAPIKeyValidation.php';
        $entryToAdd = new be_vse_data();
        $entryToAdd->app_id = filter_input(INPUT_GET, "app_id");
        $entryToAdd->vse_label = filter_input(INPUT_GET, "label");
        $entryToAdd->vse_value = filter_input(INPUT_GET, "value");
        $entryToAdd->vse_type = filter_input(INPUT_GET, "type");
        $entryToAdd->vse_annotations = filter_input(INPUT_GET, "annotations");
        $entryToAdd->captured_datetime = filter_input(INPUT_GET, "captured_datetime");
        if (!isset($entryToAdd->captured_datetime) || $entryToAdd->captured_datetime == '') {
            $dateX = new DateTime();
            $entryToAdd->captured_datetime = $dateX->format("Y-m-d H:i:s.u");
        }
        if (validate($entryToAdd)) {
            $registeredEntry = da_vse_data::AddEntry($entryToAdd);
        } else {
            die("Parámetros Inválidos");
        }
    } catch (Exception $ex) {
        die("EXCEPTION " . $ex->getCode());
    }
    return $registeredEntry;
}
Ejemplo n.º 2
0
/**
 * 
 * 
 * @return be_vse_data
 */
function execute()
{
    $entries = new be_vse_data();
    try {
        $access = "RO";
        include './inc/incWebServiceAPIKeyValidation.php';
        $parameters = collectParameters();
        if (validate($parameters)) {
            $entries = da_vse_data::GetEntries($parameters->app_id, $parameters->optional_label, $parameters->optional_last_limit);
        } else {
            die("Parámetros Inválidos");
        }
    } catch (Exception $ex) {
        die("EXCEPTION " . $ex->getCode());
    }
    return $entries;
}
Ejemplo n.º 3
0
 public static function GenerateCSV()
 {
     try {
         $app_id = 0;
         //THIS WILL BE OVERRIDEN BY THE INCLUDE
         $account_id = 0;
         //THIS WILL BE OVERRIDEN BY THE INCLUDE
         $access = "RO";
         include './inc/incWebServiceAPIKeyValidation.php';
         $parameters = CSVWebService::collectParameters();
         $parameters->app_id = $app_id;
         $parameters->account_id = $account_id;
         $entries = da_vse_data::GetEntries($parameters->app_id, $parameters->value_label, $parameters->count_limit);
         $csv = CSVWebService::generateCSVContent($entries);
         return $csv;
     } catch (Exception $ex) {
         return $ex;
     }
     return null;
 }
Ejemplo n.º 4
0
/**
 * 
 * 
 * @return be_vse_data
 */
function execute()
{
    $response = new simpleResponse();
    $entries = null;
    try {
        $access = "RO";
        include './inc/incWebServiceAPIKeyValidation.php';
        $parameters = collectParameters();
        if (validate($parameters)) {
            $entries = da_vse_data::GetEntries($parameters->app_id, $parameters->optional_label, $parameters->optional_last_limit);
            $response->status = "OK";
            $response->message = "SUCCESS";
            $response->data = $entries;
        } else {
            $response->status = "ERROR";
            //die("Parámetros Inválidos");
        }
    } catch (Exception $ex) {
        $response->status = "EXCEPTION";
        $response->message = $ex->getMessage();
        //die("EXCEPTION " . $ex->getCode());
    }
    return $response;
    // $response = new simpleResponse();
    // try {
    //     $account_id = 0;
    //     include './inc/incWebServiceSessionValidation.php';
    //     if ($account_id > 0) {
    //         $apps = da_apps_registry::GetListOfApps($account_id);
    //         $response->status = "OK";
    //         $response->message = "SUCCESS";
    //         $response->data = $apps;
    //     } else {
    //         $response->status = "ERROR";
    //     }
    // } catch (Exception $ex) {
    //     $response->status = "EXCEPTION";
    //     $response->message = $ex->getMessage();
    // }
    // return $response;
}
/**
 * 
 * 
 * @return be_vse_data
 */
function execute()
{
    $result = new simpleResponse();
    $result->status = "OK";
    $result->message = "SUCCESS";
    try {
        $access = "RO";
        include './inc/incWebServiceAPIKeyValidation.php';
        $parameters = collectParameters();
        if (validate($parameters)) {
            $result->data = da_vse_data::GetLastEntry($parameters->app_id, $parameters->optional_label);
            $result->status = "OK";
            $result->message = "SUCCESS";
        } else {
            $result->status = "ERROR";
            $result->message = "ERROR";
        }
    } catch (Exception $ex) {
        $result->status = "EXCEPTION";
        $result->message = "EXCEPTION";
    }
    return $result;
}
/**
 * 
 * 
 * @return be_vse_data
 */
function execute()
{
    $response = new simpleResponse();
    $entries = null;
    try {
        $access = "RO";
        include './inc/incWebServiceAPIKeyValidation.php';
        $parameters = collectParameters();
        if (validate($parameters)) {
            $entries = da_vse_data::GetEntriesForWidget($parameters->widget_id, $parameters->optional_max_limit, $parameters->last_entry_id);
            $response->status = "OK";
            $response->message = "SUCCESS";
            $response->data = $entries;
        } else {
            $response->status = "ERROR";
            //die("Parámetros Inválidos");
        }
    } catch (Exception $ex) {
        $response->status = "EXCEPTION";
        $response->message = $ex->getMessage();
        //die("EXCEPTION " . $ex->getCode());
    }
    return $response;
}
Ejemplo n.º 7
0
 private static function createVSEEntry($params)
 {
     $vseEntry = new be_vse_data();
     $vseEntry->app_id = $params->app_id;
     $vseEntry->vse_label = $params->vse_label;
     $fileSimpleObject = new stdClass();
     $fileSimpleObject->file_name = $params->file_name;
     $fileSimpleObject->file_guid = $params->file_guid;
     $vseEntry->vse_value = json_encode($fileSimpleObject);
     $vseEntry->vse_type = "_FILE_";
     $vseEntry->vse_annotations = $params->vse_annotations;
     $vseEntry->captured_datetime = $params->captured_datetime;
     $savedEntry = da_vse_data::AddEntry($vseEntry);
     return $savedEntry;
 }
Ejemplo n.º 8
0
 public static function Test()
 {
     ReportInfo("TESTING GetEntriesDorWidget...");
     $result = da_vse_data::GetEntriesForWidget(1, 0, 0);
     print_r($result);
     ReportInfo("FINISHED TEST");
 }
Ejemplo n.º 9
0
 /**
  * 
  * @param type $app_id
  * @param type $optional_label Use it to clear entries of an specific label for the provided app.
  * @return boolean
  */
 public static function ClearEntries($app_id, $optional_label)
 {
     $sqlCommand = "DELETE FROM vse_data " . " WHERE app_id = ? AND (vse_label = ? OR ? = '') ";
     $paramTypeSpec = "iss";
     $mysqli = DA_Helper::mysqli_connect();
     if ($mysqli->connect_errno) {
         $msg = "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         throw new Exception($msg, $mysqli->errno);
     }
     if (!($stmt = $mysqli->prepare($sqlCommand))) {
         $msg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->bind_param($paramTypeSpec, $app_id, $optional_label, $optional_label)) {
         $msg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->execute()) {
         $msg = "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     $stmt->close();
     $retrievedEntries = da_vse_data::GetEntries($app_id, $optional_label, 0);
     return $retrievedEntries;
 }