예제 #1
0
 public static function updateConversation($conversationID, $conversationData)
 {
     global $db;
     // check if exists
     if (Conversations::getConversation($conversationID)) {
         //            if (isset($conversationData['contact'])) {
         //                $contactID = $conversationData['contact'];
         //                $contact = Contacts::getContact($contactID);
         //                $conversationData['investor'] = $contact['investor'];
         //            }
         return $db->update('conversations', $conversationData, ['id' => $conversationID]);
     }
     return -1;
 }
예제 #2
0
 private static function getLastCall($investorID)
 {
     $conversations = Conversations::getInvestorConversations($investorID);
     if (empty($conversations)) {
         $investorData = self::getInvestor($investorID);
         return $investorData['created'];
     }
     usort($conversations, function ($a1, $a2) {
         $v1 = strtotime($a1['date']);
         $v2 = strtotime($a2['date']);
         return $v2 - $v1;
         // $v2 - $v1 to reverse direction
     });
     return $conversations[0]['date'];
 }
예제 #3
0
include 'Contacts.class.php';
include 'Groups.class.php';
include 'Conversations.class.php';
$request = RestUtils::processRequest();
switch (strtolower($request->getElement())) {
    case 'restsystem':
        $element = new System($request);
        break;
    case 'restprofiles':
        $element = new Profiles($request);
        break;
    case 'restgroups':
        $element = new Groups($request);
        break;
    case 'restcontacts':
        $element = new Contacts($request);
        break;
    case 'restconversations':
        $element = new Conversations($request);
        break;
}
$response = $element->dispatcher($request);
if ($response === false) {
    RestUtils::error(501);
}
if (strpos($request->getHttpAccept(), 'xml')) {
    $type = 'xml';
} else {
    $type = 'json';
}
RestUtils::sendResponse($response->getStatus(), $response->getBody(), $type);
예제 #4
0
    Notes::deleteInvestorNotes($id);
    Assets::deleteInvestorAssets($id);
    Logs::deleteInvestorLogs($id);
    Contacts::deleteInvestorContacts($id);
    if ($investorResult > 0) {
        $response->json(Result::success('Investor Deleted.'));
    } else {
        $response->json(Result::error('Investor not Deleted'));
    }
});
$this->respond(['GET', 'POST'], '/get/[i:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $investorData = Investors::getInvestor($id);
    $investorContacts = Contacts::getInvestorContacts($id);
    $investorAssets = Assets::getInvestorAssets($id);
    $investorProfiles = InvestmentProfiles::getInvestorProfiles($id);
    $investorBuyLogs = Logs::getInvestorLogs($id);
    $investorSellLogs = Logs::getInvestorAssetsLogs($id);
    $investorConversations = Conversations::getInvestorConversations($id);
    $investorNotes = Notes::getInvestorNotes($id);
    $result = array("investorData" => $investorData, "investorContacts" => $investorContacts, "investorAssets" => $investorAssets, "investorProfiles" => $investorProfiles, "investorBuyLogs" => $investorBuyLogs, "investorSellLogs" => $investorSellLogs, "investorConversations" => $investorConversations, "investorNotes" => $investorNotes);
    if ($investorData) {
        $response->json(Result::success('', $result));
    } else {
        $response->json(Result::error('Investor not found'));
    }
});
$this->respond(['GET', 'POST'], '/get/all', function ($request, $response, $service, $app) {
    $result = Investors::getAllInvestors();
    $response->json(Result::success('', $result));
});
예제 #5
0
    $id = $request->param('id');
    $result = Conversations::getConversation($id);
    if ($result) {
        $response->json(Result::success('', $result));
    } else {
        $response->json(Result::error('Conversation not found'));
    }
});
$this->respond(['GET', 'POST'], '/edit/[:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $data = json_decode($request->body(), true);
    $oldConv = Conversations::getConversation($id);
    Logs::createLogOnConversationSave($data, $oldConv);
    $result = Conversations::updateConversation($id, $data);
    if ($result > 0) {
        $response->json(Result::success('Conversation Updated.'));
    } elseif ($result === 0) {
        $response->json(Result::success('Conversation not Updated.'));
    } else {
        $response->json(Result::error('Conversation not found'));
    }
});
$this->respond(['GET', 'POST'], '/delete/[:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $result = Conversations::deleteConversation($id);
    if ($result > 0) {
        $response->json(Result::success('Conversation Deleted.'));
    } else {
        $response->json(Result::error('Conversation not Deleted'));
    }
});
예제 #6
0
<?php

session_start();
include_once "classes/Conversations.class.php";
echo "<div class=\"modal fade bs-example-modal-lg\" id=\"upmenu_mesajlar_modal\"  tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"basicModal\" aria-hidden=\"true\" >";
echo "<div class=\"modal-dialog modal-lg \">";
echo "<div class=\"modal-content\" style=\"background-color:#e6e6e6;\">";
echo "<div  class=\"modal-header\" style=\"background-color:#e6e6e6;border-bottom:1px solid #c7d0d5;\">";
echo "<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>";
echo "<p style=\"color:#ec583a;margin-left:4%;font-size:23px;font-family: Verdana,Geneva,sans-serif;\">";
echo "<img src=\"images/headerfil2.jpg\" style=\"margin-right:2%;max-width:10%;\"/>";
echo "Mesaj kutusu ";
echo "</p>";
echo "</div>";
echo "<div class=\"modal-body\" style=\"background-color:#e6e6e6;\">";
$myConversations = new Conversations(array($_SESSION["user_name"]));
$myConversations->ConversationsToHTML();
echo "</div>";
echo "</div>";
echo "</div>";
echo " </div>";
예제 #7
0
$this->respond(['GET', 'POST'], '/edit/[:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $contactData = json_decode($request->body());
    $result = Contacts::updateContact($id, $contactData);
    if ($result > 0) {
        $response->json(Result::success('Contact Updated.'));
    } elseif ($result === 0) {
        $response->json(Result::success('Contact not Updated.'));
    } else {
        $response->json(Result::error('Contact not found'));
    }
});
$this->respond(['GET', 'POST'], '/delete/[:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $contactResult = Contacts::deleteContact($id);
    Conversations::deleteContactConversations($id);
    if ($contactResult > 0) {
        $response->json(Result::success('Contact Deleted.'));
    } else {
        $response->json(Result::error('Contact not Deleted'));
    }
});
$this->respond(['GET', 'POST'], '/get/all-for-index', function ($request, $response, $service, $app) {
    $result = Contacts::getAllContactsForIndex();
    $response->json(Result::success('', $result));
});
$this->respond(['GET', 'POST'], '/get/all', function ($request, $response, $service, $app) {
    $result = Contacts::getAllContacts();
    $response->json(Result::success('', $result));
});
$this->respond(['GET', 'POST'], '/get-investor-contacts/[i:id]', function ($request, $response, $service, $app) {