function Example_Ajax() { global $page, $addonRelativeCode; //prepare the page $page->head_js[] = $addonRelativeCode . 'static/02_script.js'; $page->admin_js = true; //get request parameters and execute any commands $string = ''; if (isset($_REQUEST['string'])) { $string = $_REQUEST['string']; } $cmd = common::GetCommand(); switch ($cmd) { case 'randomstring': $string = common::RandomString(10); break; } //display the form echo '<h2>Example Ajax Requests</h2>'; echo '<form method="post" action="' . $page->title . '">'; echo 'Text: <input type="text" name="string" value="' . htmlspecialchars($string) . '" size="30" />'; echo ' <input type="submit" class="gpajax" value="Post Form Asynchronosly" /> '; echo common::Link($page->title, 'Get Random String', 'cmd=randomstring', 'name="gpajax"'); echo '</form>'; //output the $_REQUEST variable echo '<h3>Request</h3>'; echo showArray($_REQUEST); //plugin example navigation gpPlugin::incl('navigation.php'); PluginExampleNavigation(); }
function Example_Map() { global $page, $addonRelativeCode; //add css and js to <head> $page->head .= '<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />'; $page->head .= '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=en"></script>'; $page->head .= '<script type="text/javascript" src="' . $addonRelativeCode . '/static/01_script.js"></script>'; //html contents of the page echo '<h2>Display a Google Map With Directions</h2>'; echo '<div id="input">'; echo '<input id="map_address" type="textbox" value="starting point" />'; echo '<input type="button" value="calculate route" id="calc_route_button" />'; echo '</div>'; echo '<div id="directionsPanel" style="float:right;width:300px;"></div>'; echo '<div id="map_canvas" style="width:500px;height:500px;"></div>'; //plugin example navigation gpPlugin::incl('navigation.php'); PluginExampleNavigation(); }