예제 #1
0
 public static function getAllAssets()
 {
     global $db;
     $assets = $db->select('assets', '*');
     $ans = [];
     foreach ($assets as $asset) {
         $assetInvestors = Investors::getAssetInvestors($asset['id']);
         $asset['lastUpdate'] = convertToDisplayFormat($asset['lastUpdate']);
         $asset = Assets::setCalculatedFields($asset);
         $asset['investors'] = $assetInvestors;
         array_push($ans, $asset);
     }
     return $ans;
 }
예제 #2
0
 public static function getAssetContacts($assetID)
 {
     global $db;
     $contacts = $db->select('assetContacts', ['[><]contacts' => ["contact" => "id"], '[><]assets' => ["asset" => "id"]], ['contacts.id'], ['assets.id' => $assetID]);
     $toReturn = [];
     foreach ($contacts as $contact) {
         array_push($toReturn, Contacts::getContact($contact['id']));
     }
     // Adding investors contacts
     $assetInvestors = Investors::getAssetInvestors($assetID);
     foreach ($assetInvestors as $investor) {
         $investorContacts = Contacts::getInvestorContacts($investor['id']);
         $toReturn = array_merge($toReturn, $investorContacts);
     }
     return array_unique($toReturn, SORT_REGULAR);
 }
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
    header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
}
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=building.doc");
// Load system.
require_once __DIR__ . '/../libs/medoo-db/medoo.min.php';
require_once __DIR__ . '/../libs/medoo-db/db.php';
require_once __DIR__ . '/../loader/load-user-system.php';
require_once __DIR__ . '/../loader/load-models.php';
if (!User::isLoggedIn()) {
    die;
}
if (isset($_GET['id'])) {
    $asset = Assets::getAsset($_GET['id']);
    $investors = Investors::getAssetInvestors($_GET['id']);
} else {
    die;
}
?>
<html  dir="rtl" lang="he">

<head>
    <meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
    <style>
        <!--
        /* Font Definitions */
        @font-face {
            font-family: "Cambria Math";
            panose-1: 2 4 5 3 5 4 6 3 2 4;
        }
예제 #4
0
    }
});
$this->respond(['GET', 'POST'], '/get/[i:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $assetData = Assets::getAsset($id);
    $assetInvestors = Investors::getAssetInvestors($id);
    $result = array("assetData" => $assetData, "assetInvestors" => $assetInvestors);
    if ($assetData) {
        $response->json(Result::success('', $result));
    } else {
        $response->json(Result::error('Asset not found'));
    }
});
$this->respond(['GET', 'POST'], '/get-for-edit/[i:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $assetData = Assets::getAsset($id);
    $assetContacts = Contacts::getAssetContacts($id);
    $assetInvestors = Investors::getAssetInvestors($id);
    $assetAreas = RentAreas::getAssetRentAreas($id);
    $assetProcesses = RentProcesses::getAssetRentProcesses($id);
    $result = array("assetData" => $assetData, "assetContacts" => $assetContacts, "assetInvestors" => $assetInvestors, "assetAreas" => $assetAreas, "assetProcesses" => $assetProcesses);
    if ($assetData) {
        $response->json(Result::success('', $result));
    } else {
        $response->json(Result::error('Asset not found'));
    }
});
$this->respond(['GET', 'POST'], '/get/all', function ($request, $response, $service, $app) {
    $result = Assets::getAllAssets();
    $response->json(Result::success('', $result));
});