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(); } } } } }
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"; } } } }
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(); }
function login() { if ($email == null) { echo "E-Mail is a required field."; //you can't leave it blank } else { ProgressIndicator::ShowWithTitle("Loading..."); ProgressIndicator::Hide(); //Closes the ProgressIndicator when everything is done AndroidAction::GoHome(); } }
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(); }
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(); } } } }
function back() { AndroidAction::GoHome(); }
function logout() { StorageAPI::Remove("token"); AndroidAction::GoHome(); }
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(); } }
function delete() { $isOk = new InputBoolean(); $isOk = Interop::Confirm("Do you want to delete your cart?"); if ($isOk == true) { ProgressIndicator::Show(); $url = "http://demo.kikapptools.com/magento/apiKikApp/api.php?metodo=clearUserCart&customerToken=" . $token; $httpClient = new httpClient(); $result = $httpClient->Execute('GET', $url); $sdt_rs = array("error" => DataType::Character(50)); Data::FromJson($sdt_rs, $result); $rs = new InputText(300); $rs = $sdt_rs["error"]; ProgressIndicator::Hide(); if ($rs == "0") { AndroidAction::GoHome(); } else { echo $rs; } } }
function logout() { ProgressIndicator::Show(); $url = "http://demo.kikapptools.com/magento/apiKikApp/api.php?metodo=logout&customerToken=" . $token; $hc = new httpClient(); $rs = $hc->Execute("GET", $url); ProgressIndicator::Hide(); StorageAPI::Remove("token"); AndroidAction::GoHome(); }
function clickme() { echo "You are going to the home page again!"; AndroidAction::GoHome(); //returns to the app home page. }