Example #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";
            }
        }
    }
}
Example #2
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";
            }
        }
    }
}
Example #3
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();
            }
        }
    }
}
Example #4
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();
                }
            }
        }
    }
}
Example #5
0
function load_data()
{
    $url = "http://www.devxtend.com/Gecko/samples/3_2/rest/main_load_data";
    $hc = new httpClient();
    $rs = $hc->Execute("GET", $url);
    $struct = array(array("id" => DataType::Character(6), "name" => DataType::Character(100)));
    Data::FromJson($struct, $rs);
}
function load_cat()
{
    $url = "http://demo.kikapptools.com/Gastos/crud/getCategories.php";
    $hc = new httpClient();
    $rs = $hc->Execute("GET", $url);
    $struct = array(array("idCat" => DataType::Numeric(11), "name" => DataType::Character(80), "desc" => DataType::Character(200)));
    Data::FromJson($struct, $rs);
}
Example #7
0
function loadCity()
{
    $url = "http://demo.kikapptools.com/HttpClientEjemplo/crud/getCity.php";
    $httpClient = new httpClient();
    $result = $httpClient->Execute('GET', $url);
    $struct = array("nombreCiudad" => DataType::Character(150));
    Data::FromJson($struct, $result);
    $city = $product['nombreCiudad'];
}
Example #8
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'];
}
function load_grid()
{
    $url = "http://demo.kikapptools.com/magento/apiKikApp/Categories.php?cId=" . $cat;
    $httpClient = new httpClient();
    $result = $httpClient->Execute('GET', $url);
    $struct = array(array("id" => DataType::Numeric(6), "name" => DataType::Character(150)));
    Data::FromJson($struct, $result);
    foreach ($struct as $product) {
        $id = $product['id'];
        $name = $product['name'];
    }
}
Example #10
0
function start()
{
    $url = "http://demo.kikapptools.com/CRMManager/crud/getCompanies.php?companyId=" . $id;
    $httpClient = new httpClient();
    $result = $httpClient->Execute('GET', $url);
    $struct = array("CompanyName" => DataType::Character(100), "CompanyImage" => DataType::Character(200), "CompanyPhone" => DataType::Phone(), "CompanyAddress" => DataType::Address());
    Data::FromJson($struct, $result);
    $image = $struct['CompanyImage'];
    $name = $struct['CompanyName'];
    $address = $struct['CompanyAddress'];
    $phone = $struct['CompanyPhone'];
}
Example #11
0
function load_image()
{
    $url = "http://demo.kikapptools.com/magento/apiKikApp/ProductImages.php?pId=" . $id;
    $httpClient = new httpClient();
    echo $id;
    $result = $httpClient->Execute('GET', $url);
    $str_images = array(array("url" => DataType::Character(350)));
    Data::FromJson($str_images, $result);
    foreach ($str_images as $img) {
        $image = $img['url'];
    }
}
Example #12
0
function load_images()
{
    $url = "http://demo.kikapptools.com/magento/apiGecko/productos.php?cId=0";
    $httpClient = new httpClient();
    $result = $httpClient->Execute('GET', $url);
    $struct = array(array("id" => DataType::Numeric(6), "name" => DataType::Character(150), "description" => DataType::Character(300), "pirce" => DataType::Character(10), "thumb" => DataType::Character(200)));
    Data::FromJson($struct, $result);
    foreach ($struct as $product) {
        $id = $product['id'];
        $title = $product['name'];
        $desc = $product['description'];
        $image = $product['thumb'];
    }
}
function load_companies()
{
    $url = "http://demo.kikapptools.com/CRMManager/crud/getCompanies.php";
    $httpClient = new httpClient();
    $result = $httpClient->Execute('GET', $url);
    $struct = array(array("CompanyId" => DataType::Numeric(8), "CompanyName" => DataType::Character(100), "CompanyImage" => DataType::Character(200), "CompanyAddress" => DataType::Character(200)));
    Data::FromJson($struct, $result);
    $id = new InputNumeric();
    foreach ($struct as $company) {
        $id = $company['CompanyId'];
        $image = $company['CompanyImage'];
        $name = $company['CompanyName'];
        $address = $company['CompanyAddress'];
    }
}
Example #14
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");
}
Example #15
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;
                        }
                    }
                }
            }
        }
    }
}
Example #16
0
function grid_load()
{
    $url = "http://demo.kikapptools.com/magento/apiKikApp/Products.php?cId=" . $cat;
    $httpClient = new httpClient();
    $result = $httpClient->Execute('GET', $url);
    $struct = array(array("id" => DataType::Numeric(6), "name" => DataType::Character(150), "description" => DataType::Character(300), "pirce" => DataType::Character(10), "thumb" => DataType::Character(200), "stock" => DataType::Character(50), "href" => DataType::Character(300)));
    Data::FromJson($struct, $result);
    $prodUrl = new InputText();
    $id = new InputNumeric();
    $stock = new InputText();
    foreach ($struct as $product) {
        $id = $product['id'];
        $title = $product['name'];
        $desc = $product['description'];
        $image = $product['thumb'];
        $price = $product['pirce'];
        $stock = $product['stock'];
        $prodUrl = $product['href'];
    }
}
Example #17
0
function grid_load_products()
{
    $url_prod = "http://www.demo.kikapptools.com/magento/apiGecko/productos.php?cId=0";
    //the server url
    //Remember to configurate your server url on the Manifest.xml on <services>
    $httpClient_prod = new httpClient();
    $result_prod = $httpClient_prod->Execute('GET', $url_prod);
    //you get a JSON
    //it's a list so you have an array of an array
    $struct_prod = array(array("id" => DataType::Numeric(6), "name" => DataType::Character(150), "description" => DataType::Character(300), "pirce" => DataType::Character(10), "thumb" => DataType::Character(200)));
    Data::FromJson($struct_prod, $result_prod);
    //does a merge of the structure you made and the json you got
    foreach ($struct_prod as $product) {
        $id_prod = $product['id'];
        $title_prod = $product['name'];
        $desc_prod = $product['description'];
        $image_prod = $product['thumb'];
        $price_prod = $product['pirce'];
    }
    $id_prod = new InputNumeric();
}
Example #18
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;
    }
}
Example #19
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();
            }
        }
    }
}
Example #20
0
function changeToDone()
{
    //Ask user confirmation
    $isOk = new InputBoolean();
    $isOk = Interop::Confirm("Do you want to mark this task as done ?");
    if ($isOk == true) {
        //Make JSON request
        $urlDelete = "http://demo.kikapptools.com/taskManager/crud/deleteTask.php?action=update&taskID=" . $id;
        $httpClient = new httpClient();
        $result = $httpClient->Execute('GET', $urlDelete);
        //Cast response data type
        $sdtError = array("response" => DataType::Character(100));
        Data::FromJson($sdtError, $result);
        $rsValue = new InputText(100);
        $rsValue = $sdtError['response'];
        //Refresh the screen
        $win->Refresh();
    }
}
Example #21
0
function Refresh()
{
    $token = StorageAPI::Get("token");
    $url = "http://demo.kikapptools.com/magento/apiKikApp/api.php?metodo=userCartTotal&customerToken=" . $token;
    $httpClient = new httpClient();
    $result = $httpClient->Execute("GET", $url);
    $struct = array("total" => DataType::Character(10), "tax" => DataType::Character(10), "shipping" => DataType::Character(10), "subtotal" => DataType::Character(10));
    Data::FromJson($struct, $result);
    $total = $struct["total"];
    $shipping = $struct["shipping"];
    $tax = $struct["tax"];
    $subtotal = $struct["subtotal"];
    if ($subtotal == 0) {
        $table_result->setVisible(false);
    } else {
        $table_result->setVisible(true);
    }
}
Example #22
0
function delete()
{
    $isOk = new InputBoolean();
    $isOk = Interop::Confirm("Do you want to delete this task ?");
    $urlDelete = "http://52.34.247.215/frameWorkExamples/taskManager/crud/deleteTask.php?taskID=" . $id;
    if ($isOk == true) {
        $httpClient = new httpClient();
        $result = $httpClient->Execute('GET', $urlDelete);
        $sdtError = array("response" => type::Character(100));
        Data::FromJson($sdtError, $result);
        $rsValue = new InputText(100);
        $rsValue = $sdtError['response'];
        //$win -> setCaption("Guarda");
        echo $rsValue;
        $win->Refresh();
        //return;
    }
}
Example #23
0
function add_cart()
{
    $token = new InputText(80);
    $token = StorageAPI::Get("token");
    if ($token != null) {
        ProgressIndicator::Show();
        $url_cart = "http://demo.kikapptools.com/magento/apiKikApp/api.php?metodo=addProductToCart&qty=1&productId=" . $id . "&customerToken=" . $token;
        $hc = new httpClient();
        $rs_cart = $hc->Execute("GET", $url_cart);
        $sdt_rs = array("error" => DataType::Character(300));
        Data::FromJson($sdt_rs, $rs_cart);
        $rs = new InputText(300);
        $rs = $sdt_rs['error'];
        ProgressIndicator::Hide();
        if ($rs == "0") {
            $win->Open("ShoppingCart", $token);
        } else {
            echo $rs;
        }
    } else {
        $win->Open("Login");
    }
}
Example #24
0
function removeTask()
{
    $isOk = new InputBoolean();
    $isOk = Interop::Confirm("Do you want to delete this task ?");
    if ($isOk == true) {
        //Make JSON request
        $urlDelete = "http://demo.kikapptools.com/taskManager/crud/deleteTask.php?action=delete&taskID=" . $id;
        $httpClient = new httpClient();
        $result = $httpClient->Execute('GET', $urlDelete);
        //Cast response data type
        $sdtError = array("response" => DataType::Character(100));
        Data::FromJson($sdtError, $result);
        $rsValue = new InputText(100);
        $rsValue = $sdtError['response'];
        //returns to the app home page.
        AndroidAction::GoHome();
    }
}
Example #25
0
function refresh()
{
    $url = "http://demo.kikapptools.com/Gastos/crud/getIncome.php?id=" . $token;
    $httpClient = new httpClient();
    $result = $httpClient->Execute('GET', $url);
    $struct = array("account" => DataType::Numeric(11), "value_income" => DataType::Numeric(11), "value_outcome" => DataType::Numeric(11), "value_income_month" => DataType::Numeric(11), "value_outcome_month" => DataType::Numeric(11), "label_actual_month" => DataType::Character(20));
    Data::FromJson($struct, $result);
    $input_account = $struct['account'];
    $input_income = $struct['value_income'];
    $input_outcome = $struct['value_outcome'];
    $input1 = $struct['value_income_month'];
    $input2 = $struct['value_outcome_month'];
    $label_title = $struct['label_actual_month'];
}