Ejemplo n.º 1
0
 public static function updateLid($lidID, $lidData)
 {
     global $db;
     // check if exists
     if (Lids::getLid($lidID)) {
         return $db->update('lidsForReview', $lidData, ['id' => $lidID]);
     }
     return -1;
 }
Ejemplo n.º 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));
});
Ejemplo n.º 3
0
});
$this->respond(['GET', 'POST'], '/get/[i:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $result = Lids::getLid($id);
    if ($result) {
        $response->json(Result::success('', $result));
    } else {
        $response->json(Result::error('Lid not found'));
    }
});
$this->respond(['GET', 'POST'], '/edit/[:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $data = json_decode($request->body());
    $result = Lids::updateLid($id, $data);
    if ($result > 0) {
        $response->json(Result::success('Lid Updated.'));
    } elseif ($result === 0) {
        $response->json(Result::success('Lid not Updated.'));
    } else {
        $response->json(Result::error('Lid not found'));
    }
});
$this->respond(['GET', 'POST'], '/delete/[:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $result = Lids::deleteLid($id);
    if ($result > 0) {
        $response->json(Result::success('Lid Deleted.'));
    } else {
        $response->json(Result::error('Lid not Deleted'));
    }
});