예제 #1
0
            foreach ($houses->houses_deposits() as $p) {
                $houses_deposits[] = array('id' => $p->deposits['id'], 'rent' => $p->deposits["rent"], 'date' => $p->deposits["date"], 'status' => $p->deposits["status"]);
            }
            $data = array('house_id' => $houses['id'], 'house_name' => $houses['name'], 'house_address' => $houses['address'], 'house_fixed_date' => $houses['due_date'], 'house_entry_date' => $houses['entry_date'], 'house_rent' => $houses['rent'], 'house_no_of_rooms' => $houses['totalrooms'], 'house_totaldeposit' => $houses['totaldeposit'], 'house_totaldepositleft' => $houses['depositleft'], 'house_dthbill' => $houses['dthbill'], 'house_dthbilldate' => $houses['dthbilldate'], 'house_dthbilldays' => days($houses['dthbilldate']), 'house_powerbill' => $houses['powerbill'], 'house_powerbilldate' => $houses['powerbilldate'], 'house_electricitybilldate' => $houses['electricitybilldate'], 'house_powerbilldays' => days($houses['powerbilldate']), 'house_wifibill' => $houses['wifibill'], 'house_wifibilldate' => $houses['wifibilldate'], 'house_wifibilldays' => days($houses['wifibilldate']), 'house_owner' => array('id' => $houses->owners['id'], 'name' => $houses->owners['owner_name'], 'address' => $houses->owners['owner_address'], 'phone' => $houses->owners['owner_phone'], 'email' => $houses->owners['owner_email']), 'tenants' => $houses_tenants, 'deposits' => $houses_deposits);
        }
    }
    $houses = array('aaData' => $data);
    $app->response()->header('content-type', 'application/json');
    echo json_encode($houses);
});
$app->get('/tenants(/:id)', function ($id = null) use($app, $db) {
    $tenants_deposits = array();
    if ($id == null) {
        $data = array();
        $count = 0;
        foreach ($db->tenants() as $tenants) {
            $days = days($tenants['entry_date']);
            //  $dthdays = days($houses['house_rent_due_date']);
            //  foreach ($houses->houses_tenants() as $p) {
            //      $count++;
            //         $houses_tenants[] = array('name'=>$p->tenants["name"],
            //          'phone'=>$p->tenants["phone"]);
            // }
            $data[] = array('id' => $tenants['id'], 'address' => $tenants['address'], 'name' => $tenants['name'], 'phone' => $tenants['phone'], 'company' => $tenants['company'], 'rent' => $tenants['rent'], 'totaldeposit' => $tenants['totaldeposit'], 'depositleft' => $tenants['depositleft'], 'entry_date' => $tenants['entry_date'], 'is_verified' => $tenants['isVerified'], 'deposits' => $tenants_deposits, 'is_Paid' => $tenants['isPaid']);
        }
    } else {
        $data = null;
        $houses_tenants = array();
        if ($tenants = $db->tenants()->where('id', $id)->fetch()) {
            $days = days($tenants['entry_date']);
            foreach ($tenants->tenants_deposits() as $p) {
예제 #2
0
    if (isset($_SESSION['admin'])) {
        $data = $_SESSION['admin'];
    } else {
        $data = false;
    }
    $app->response()->header('Content-Type', 'application/json');
    echo json_encode($data);
});
$app->get("/auth/logout/admin", function () use($app) {
    unset($_SESSION['admin']);
});
$app->post("/auth/process/user", function () use($app, $db) {
    $array = (array) json_decode($app->request()->getBody());
    $email = $array['email'];
    $password = $array['password'];
    $person = $db->tenants()->where('email', $email)->where('password', $password);
    $count = count($person);
    if ($count == 1) {
        $p = $person->fetch();
        if ($p['isVerified'] == '0') {
            $data = array('login_success' => "false", 'login_attempt_by' => $email, 'message' => "You are not Verified please wait for Homigo Verification.");
        } else {
            $_SESSION['user'] = $email;
            $_SESSION['id'] = $p['id'];
            $data = array('login_success' => "true", 'login_attempt_by' => $email, 'message' => "Successfull sigin");
        }
    } else {
        $data = array('login_success' => "false", 'login_attempt_by' => $email, 'message' => "please provide correct details");
    }
    $app->response()->header('Content-Type', 'application/json');
    echo json_encode($data);
예제 #3
0
            $data[] = array('id' => $t['id'], 'address' => $t['owner_address'], 'name' => $t['owner_name'], 'phone' => $t['owner_phone'], 'email' => $t['owner_email']);
        }
    } else {
        $data = null;
        if ($t = $db->owners()->where('id', $id)->fetch()) {
            $data[] = array('id' => $t['id'], 'address' => $t['owner_address'], 'name' => $t['owner_name'], 'phone' => $t['owner_phone'], 'email' => $t['owner_email']);
        }
    }
    $owners = array('aaData' => $data);
    $app->response()->header('content-type', 'application/json');
    echo json_encode($owners);
});
$app->get('/tenants/search/:id', function ($id = null) use($app, $db) {
    $data = array();
    $count = 0;
    foreach ($db->tenants()->where("name LIKE ?", "%" . $id . "%") as $tenants) {
        $days = days($tenants['entry_date']);
        //  $dthdays = days($houses['house_rent_due_date']);
        //  foreach ($houses->houses_tenants() as $p) {
        //      $count++;
        //         $houses_tenants[] = array('name'=>$p->tenants["name"],
        //          'phone'=>$p->tenants["phone"]);
        // }
        $data[] = array('id' => $tenants['id'], 'address' => $tenants['address'], 'name' => $tenants['name'], 'phone' => $tenants['phone'], 'company' => $tenants['company'], 'rent' => $tenants['rent'], 'totaldeposit' => $tenants['totaldeposit'], 'depositleft' => $tenants['depositleft'], 'entry_date' => $tenants['entry_date'], 'rent_date' => $days);
    }
    $tenants = array('aaData' => $data);
    $app->response()->header('content-type', 'application/json');
    echo json_encode($tenants);
});
$app->get('/owners/search/:id', function ($id = null) use($app, $db) {
    $data = array();