$object->dialogCreateAlert("Result", "Right Answer"); $object->dialogSetPositiveButtonText("Next"); $object->dialogShow(); $next = $object->dialogGetResponse(); if ($next["result"]->which == "positive") { $object->dialogCreateAlert("What is the new Database developed by Google?"); $ans22 = array("NoSQL", "MongoDB", "F1", "CouchDB"); $object->dialogSetItems($ans22); $object->dialogShow(); $ans2 = $object->dialogGetResponse(); $ans2m = "F1"; if ($ans22[$ans2["result"]->item] == $ans2m) { $object->dialogCreateAlert("Result", "Right Answer"); $object->dialogSetPositiveButtonText("Next"); $object->dialogShow(); $next = $object->dialogGetResponse(); if ($next["result"]->which == "positive") { $object->makeToast("Thank You for playing"); $object->exit(); exit(0); } } } } break; case "exit": $object->makeToast("Thank You for visiting"); $object->exit(); exit(0); break; }
$url = "http://widgets.fabulously40.com/horoscope.json?sign=" . $zodiac[$result['result']->item]; // Downloading the horoscope might take a while... $droid->dialogCreateSpinnerProgress("Retrieving information...", "Please wait"); $droid->dialogShow(); // Downloading and de-json-ing $result = json_decode(file_get_contents($url)); // we are ready! $droid->vibrate(); // Close spinner $droid->dialogDismiss(); $theFuture = html_entity_decode($result->horoscope->horoscope, ENT_QUOTES, "UTF-8"); // Something is wrong with '... $theFuture = str_replace("'", "'", $theFuture); $theFuture .= "\n\n[widgets.fabulously40.com]"; $droid->dialogCreateAlert("Your Future is here " . $result->horoscope->sign . "!", $theFuture); $droid->dialogSetPositiveButtonText("Exit"); $droid->dialogShow(); // Wait for user input to continue script $droid->dialogGetResponse(); $action = "bye"; break; case "bye": $droid->makeToast("Trust the PFAewok!"); $droid->exit(); exit; break; } // Main switch } // main while // EOF