コード例 #1
0
 public static function updateTrackedAsset($trackedAssetID, $trackedAssetData)
 {
     global $db;
     // check if exists
     if (TrackedAssets::getTrackedAsset($trackedAssetID)) {
         return $db->update('trackedAssets', $trackedAssetData, ['id' => $trackedAssetID]);
     }
     return -1;
 }
コード例 #2
0
<?php

$this->respond(['GET', 'POST'], '/get/control-data', function ($request, $response, $service, $app) {
    $processLogs = Logs::getProcessLogs();
    $processForCheckLogs = Logs::getProcessForCheckLogs();
    $marketingListLogs = Logs::getMarketingListLogs();
    $demands = Demands::getDemands();
    $lids = Lids::getLids();
    $trackedAssets = TrackedAssets::getTrackedAssets();
    $investors = Investors::getInvestorsForControlPanel();
    $notifications = Notifications::getAllNotificationsToShow();
    $result = array("processLogs" => $processLogs, "processForCheckLogs" => $processForCheckLogs, "marketingListLogs" => $marketingListLogs, "demands" => $demands, "lids" => $lids, "trackedAssets" => $trackedAssets, "investors" => $investors, "notifications" => $notifications);
    $response->json(Result::success('', $result));
});
コード例 #3
0
});
$this->respond(['GET', 'POST'], '/get/[i:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $result = TrackedAssets::getTrackedAsset($id);
    if ($result) {
        $response->json(Result::success('', $result));
    } else {
        $response->json(Result::error('TrackedAsset not found'));
    }
});
$this->respond(['GET', 'POST'], '/edit/[:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $data = json_decode($request->body());
    $result = TrackedAssets::updateTrackedAsset($id, $data);
    if ($result > 0) {
        $response->json(Result::success('TrackedAsset Updated.'));
    } elseif ($result === 0) {
        $response->json(Result::success('TrackedAsset not Updated.'));
    } else {
        $response->json(Result::error('TrackedAsset not found'));
    }
});
$this->respond(['GET', 'POST'], '/delete/[:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $result = TrackedAssets::deleteTrackedAsset($id);
    if ($result > 0) {
        $response->json(Result::success('TrackedAsset Deleted.'));
    } else {
        $response->json(Result::error('TrackedAsset not Deleted'));
    }
});