Пример #1
1
function login()
{
    if ($username == null) {
        echo "E-Mail is a required field.";
    } else {
        if ($password == null) {
            echo "Password is a required field.";
        } else {
            ProgressIndicator::Show();
            $url = "http://demo.kikapptools.com/Gastos/crud/Login.php";
            $httpClient_post = new httpClient();
            $inputMetodo = new InputText();
            $inputMetodo->setValue("login");
            $httpClient_post->addVariable('username', $username);
            $httpClient_post->addVariable('password', $password);
            $result = $httpClient_post->Execute('POST', $url);
            $id_user = new InputText();
            $struct = array("response" => DataType::Character(50));
            Data::FromJson($struct, $result);
            $id_user = $struct['response'];
            ProgressIndicator::Hide();
            if ($id_user != "0") {
                StorageAPI::Set("token", $id_user);
                AndroidAction::GoHome();
            } else {
                echo "Wrong user or password";
            }
        }
    }
}
Пример #2
0
function save()
{
    if ($email == null) {
        echo "EMail is a required field.";
    } else {
        if ($password == null) {
            echo "Password is a required field.";
        } else {
            if ($password != $password_2) {
                echo "Please make sure your passwords match.";
            } else {
                ProgressIndicator::Show();
                $url = "http://demo.kikapptools.com/Gastos/crud/Register.php";
                $http = new httpClient();
                $http->addVariable('username', $email);
                $http->addVariable('passcode', $password);
                //lo de pasar la clave a md5 lo hace el Register.php
                $result = $http->Execute('POST', $url);
                $struct = array("id_usuario" => DataType::Character(101));
                Data::FromJson($struct, $result);
                $id_user = new InputText(100);
                $id_user = $struct['id_usuario'];
                if ($id_user == "0") {
                    echo "User already signed up";
                } else {
                    echo "Signed up succesfully.";
                    StorageAPI::Set("token", $id_user);
                    AndroidAction::GoHome();
                }
            }
        }
    }
}
Пример #3
0
function login()
{
    if ($email == null) {
        echo "E-Mail is a required field.";
    } else {
        if ($pass == null) {
            echo "Password is a required field.";
        } else {
            ProgressIndicator::Show();
            $url = "http://demo.kikapptools.com/magento/apiKikApp/api.php?metodo=login";
            $httpClient_post = new httpClient();
            $httpClient_post->addVariable('email', $email);
            $httpClient_post->addVariable('password', $pass);
            $result = $httpClient_post->Execute('POST', $url);
            $customerToken = new InputText();
            $userName = new InputText();
            $response = array("customerToken" => DataType::Character(150), "userName" => DataType::Character(150));
            Data::FromJson($response, $result);
            $customerToken = $response['customerToken'];
            $userName = $response['userName'];
            ProgressIndicator::Hide();
            if ($customerToken != "") {
                StorageAPI::Set("token", $customerToken);
                StorageAPI::Set("userName", $userName);
                AndroidAction::GoHome();
            } else {
                echo "Invalid user";
            }
        }
    }
}
Пример #4
0
function save()
{
    if ($username == null) {
        echo "E-Mail is a required field.";
    } else {
        if ($password == null) {
            echo "Password is a required field.";
        } else {
            if ($password != $password2) {
                echo "Please make sure your passwords match.";
            } else {
                ProgressIndicator::Show();
                $url = "http://demo.kikapptools.com/Gastos/crud/updateUser.php";
                $httpClient_post = new httpClient();
                $inputMetodo = new InputText();
                $inputMetodo->setValue("login");
                $httpClient_post->addVariable('username', $username);
                $httpClient_post->addVariable('password', $password);
                $httpClient_post->addVariable('id', $token);
                $result = $httpClient_post->Execute('POST', $url);
                $id_user = new InputText();
                $struct = array("response" => DataType::Character(50));
                Data::FromJson($struct, $result);
                $id_user = $struct['response'];
                ProgressIndicator::Hide();
                AndroidAction::GoHome();
            }
        }
    }
}
Пример #5
0
function confirm()
{
    $token = StorageAPI::Get("token");
    ProgressIndicator::ShowWithTitle("Adding budget...");
    $httpUpdate = new httpClient();
    $httpUpdate->addVariable('money', $money_value);
    $httpUpdate->addVariable('dates', $input_date);
    $httpUpdate->addVariable("id", $token);
    $httpUpdate->Execute('POST', "http://demo.kikapptools.com/Gastos/crud/updateAccount.php");
    ProgressIndicator::Hide();
    AndroidAction::GoHome();
}
Пример #6
0
function save()
{
    ProgressIndicator::Show();
    $httpUpdate = new httpClient();
    $httpUpdate->addVariable('id', $id);
    $httpUpdate->addVariable('name', $name);
    $httpUpdate->addVariable('address', $address);
    $httpUpdate->addVariable('phone', $phone);
    $httpUpdate->addVariable('image', $image);
    $httpUpdate->Execute('POST', "http://demo.kikapptools.com/CRMManager/crud/updateCompany.php");
    ProgressIndicator::Hide();
    return;
}
Пример #7
0
function save()
{
    ProgressIndicator::Show();
    $request = new httpClient();
    $request->addVariable('taskID', $id);
    $request->addVariable('status', $status);
    $request->addVariable('task', $name);
    $request->addVariable('imagen', $imagen);
    $result = $request->Execute('POST', "http://52.34.247.215/frameWorkExamples/taskManager/crud/updateTask.php");
    $sdtError = array("response" => type::Character(100));
    Data::FromJson($sdtError, $result);
    $rsValue = new InputText(100);
    $rsValue = $sdtError['response'];
    ProgressIndicator::Hide();
    $win->Open("main");
}
Пример #8
0
function save()
{
    if ($name == null) {
        echo "Name is a required field.";
    } else {
        if ($lastname == null) {
            echo "Last name is a required field.";
        } else {
            if ($email == null) {
                echo "E-Mail is a required field.";
            } else {
                if ($password == null) {
                    echo "Password is a required field.";
                } else {
                    if ($password != $password_2) {
                        echo "Please make sure your passwords match.";
                    } else {
                        ProgressIndicator::Show();
                        $url = "http://demo.kikapptools.com/magento/apiKikApp/api.php?metodo=createUser";
                        $http = new httpClient();
                        $http->addVariable('name', $name);
                        $http->addVariable('lastname', $lastname);
                        $http->addVariable('email', $email);
                        $http->addVariable('password', $password);
                        $rs = $http->Execute("POST", $url);
                        $sdt_rs = array("error" => DataType::Character(300));
                        Data::FromJson($sdtError, $rs);
                        $rs = new InputText(300);
                        $rs = $sdt_rs['error'];
                        ProgressIndicator::Hide();
                        if ($rs == "0") {
                            echo "User created successfully!";
                            $win->Open("Login");
                        } else {
                            echo $rs;
                        }
                    }
                }
            }
        }
    }
}
Пример #9
0
function clientStart()
{
    $token = StorageAPI::Get("token");
    $url = "http://demo.kikapptools.com/Gastos/crud/getAccount.php";
    $httpClient = new httpClient();
    $httpClient->addVariable("id", $token);
    $result = $httpClient->Execute('POST', $url);
    $struct = array("money" => DataType::Numeric(11));
    Data::FromJson($struct, $result);
    $input = $struct['money'];
}
Пример #10
0
function save()
{
    ProgressIndicator::Show();
    $url = "http://demo.kikapptools.com/magento/apiKikApp/api.php?metodo=updateUser";
    $hc = new httpClient();
    $hc->addVariable("name", $name);
    $hc->addVariable("lastname", $last_name);
    $hc->addVariable("email", $email);
    $hc->addVariable("customerToken", $token);
    $rs = $hc->Execute("POST", $url);
    $sdt_rs = array("error" => DataType::Character(300));
    Data::FromJson($sdtError, $rs);
    $rs = new InputText(300);
    $rs = $sdt_rs['error'];
    ProgressIndicator::Hide();
    if ($rs == "0") {
        echo "User updated successfully!";
        $win->Refresh();
    } else {
        echo $rs;
    }
}
Пример #11
0
function delete()
{
    $isOk = new InputBoolean();
    $isOk = Interop::Confirm("Do you want to delete company ?");
    if ($isOk == true) {
        ProgressIndicator::Show();
        $httpC = new httpClient();
        $httpC->addVariable("CompanyId", $id);
        $httpC->Execute('POST', "http://demo.kikapptools.com/CRMManager/crud/deleteCompany.php");
        ProgressIndicator::Hide();
        return;
    }
}
Пример #12
0
function save()
{
    ProgressIndicator::Show();
    //Make JSON request with variables
    $request = new httpClient();
    $request->addVariable('task', $name);
    $request->addVariable('taskID', $id);
    $request->addVariable('created_at', $date);
    $request->addVariable('description', $description);
    $url = "http://demo.kikapptools.com/taskManager/crud/updateTask.php";
    $result = $request->Execute("POST", $url);
    //Cast response data type
    $sdtError = array("response" => DataType::Character(100));
    Data::FromJson($sdtError, $result);
    $rsValue = new InputText(100);
    $rsValue = $sdtError['response'];
    if ($addToCalendar) {
        Calendar::Schedule($name, $date, $date, "10:00:00", "11:00:00", $name);
    }
    ProgressIndicator::Hide();
    $win->Open("main");
}
Пример #13
0
function save()
{
    //Check form values
    if ($name == null) {
        echo "Name is a required field.";
    } else {
        $compareDefaultDate = new InputDate();
        if ($date == $compareDefaultDate) {
            echo "Date is a required field.";
        } else {
            if ($description == null) {
                echo "Please provide a description";
            } else {
                ProgressIndicator::Show();
                //Make JSON request with variables
                $request = new httpClient();
                $request->addVariable('task', $name);
                $request->addVariable('taskID', $id);
                $request->addVariable('created_at', $date);
                $request->addVariable('description', $description);
                $url = "http://demo.kikapptools.com/taskManager/crud/addTask.php";
                $result = $request->Execute("POST", $url);
                //Cast response data type
                $sdtError = array("response" => DataType::Character(100));
                Data::FromJson($sdtError, $result);
                $rsValue = new InputText(100);
                $rsValue = $sdtError['response'];
                if ($addToCalendar) {
                    Calendar::Schedule($name, $date, $date, "10:00:00", "11:00:00", $name);
                }
                ProgressIndicator::Hide();
                //returns to the app home page.
                AndroidAction::GoHome();
            }
        }
    }
}
Пример #14
0
function confirm()
{
    $token = StorageAPI::Get("token");
    ProgressIndicator::ShowWithTitle("Inserting movement...");
    $httpUpdate = new httpClient();
    $httpUpdate->addVariable('value', $input_value);
    $httpUpdate->addVariable('moveType', $moveType);
    $httpUpdate->addVariable('description', $input_desc);
    $httpUpdate->addVariable("id", $token);
    $httpUpdate->addVariable('idCat', $dc_cat);
    $httpUpdate->addVariable('dates', $input_date);
    $httpUpdate->Execute('POST', "http://demo.kikapptools.com/Gastos/crud/insertMovements.php");
    ProgressIndicator::Hide();
    AndroidAction::GoHome();
}
Пример #15
0
function delete()
{
    $input_boolean = new InputBoolean();
    $input_boolean = Interop::Confirm("Are you sure you want to delete this movement?");
    if ($input_boolean) {
        ProgressIndicator::ShowWithTitle("Deleting...");
        $httpC = new httpClient();
        $httpC->addVariable("idMov", $idMov_trans);
        $httpC->addVariable('value', $value);
        $httpC->addVariable('dates', $date);
        $httpC->addVariable('move_type', $move_type);
        $httpC->addVariable("id", $token);
        $httpC->Execute('POST', "http://demo.kikapptools.com/Gastos/crud/deleteMovement.php");
        ProgressIndicator::Hide();
        return;
    }
}