function smarty_function_ajaxcall($params, &$smarty)
{
    require_once 'HTML/AJAX/Helper.php';
    $target = @$params['target'];
    $call = @$params['call'];
    $type = !is_null(@$params['type']) ? @$params['type'] : 'replace';
    $ajaxHelper = new HTML_AJAX_Helper();
    $ajaxHelper->serverUrl = '/AJAX/server.php';
    if (@isset($params['stubs'])) {
        $stubs = split(',', $params['stubs']);
        foreach ($stubs as $stub) {
            $ajaxHelper->stubs[] = $stub;
        }
    }
    if (@(!$smarty->hasJSlibs)) {
        echo $ajaxHelper->setupAJAX();
    }
    $smarty->hasJSlibs = true;
    if (@is_null($params['loadJS'])) {
        //	echo $ajaxHelper->loadingMessage ( "Waiting on the Server ...", null, 'position: absolute; top: 0; left: 0; display: none;' );
        echo $ajaxHelper->updateElement($params['target'], $params['call'], $type, true);
        echo '<div id="' . $target . '">&nbsp;</div>';
    }
}
Beispiel #2
0
/**
 * Example of Using HTML_AJAX_Action see support/testHaa.class.php
 *
 * @category   HTML
 * @package    AJAX
 * @author     Joshua Eichorn <*****@*****.**>
 * @copyright  2005 Joshua Eichorn
 * @license    http://www.opensource.org/licenses/lgpl-license.php  LGPL
 * @version    Release: @package_version@
 * @link       http://pear.php.net/package/HTML_AJAX
 */
// include the helper class
require_once 'HTML/AJAX/Helper.php';
// create an instance and set the server url
$ajaxHelper = new HTML_AJAX_Helper();
$ajaxHelper->serverUrl = 'auto_server.php';
$ajaxHelper->jsLibraries[] = array('haserializer');
$ajaxHelper->stubs[] = 'testHaa';
?>
<html>
<head>

<?php 
echo $ajaxHelper->setupAJAX();
?>
<script type="text/javascript">
var remote = new testHaa();
</script>

<style type="text/css">
Beispiel #3
0
 * Example of Using HTML_AJAX_Helper
 *
 * HTML_AJAX_Helper takes care of basic JavaScript and HTML generation that is needed in many AJAX requests
 *
 * @category   HTML
 * @package    AJAX
 * @author     Joshua Eichorn <*****@*****.**>
 * @copyright  2005 Joshua Eichorn
 * @license    http://www.opensource.org/licenses/lgpl-license.php  LGPL
 * @version    Release: @package_version@
 * @link       http://pear.php.net/package/HTML_AJAX
 */
// include the helper class
require_once 'HTML/AJAX/Helper.php';
// create an instance and set the server url
$ajaxHelper = new HTML_AJAX_Helper();
$ajaxHelper->serverUrl = 'auto_server.php';
$ajaxHelper->jsLibraries[] = 'customLib';
?>
<html>
<head>

<?php 
// output a javascript neded to setup HTML_AJAX
// by default this is all the libraries shipped with HTML_AJAX, take a look at $ajaxHelper->jsLibraries to edit the list
echo $ajaxHelper->setupAJAX();
?>

</head>
<body>
<?php 
Beispiel #4
0
<?php

require_once 'HTML/AJAX/Helper.php';
$helper = new HTML_AJAX_Helper();
var_dump($helper->isAJAX());
Beispiel #5
0
 * Example of Using HTML_AJAX_Helper
 *
 * HTML_AJAX_Helper takes care of basic JavaScript and HTML generation that is needed in many AJAX requests
 *
 * @category   HTML
 * @package    AJAX
 * @author     Joshua Eichorn <*****@*****.**>
 * @copyright  2005 Joshua Eichorn
 * @license    http://www.opensource.org/licenses/lgpl-license.php  LGPL
 * @version    Release: 0.5.6
 * @link       http://pear.php.net/package/HTML_AJAX
 */
// include the helper class
require_once 'HTML/AJAX/Helper.php';
// create an instance and set the server url
$ajaxHelper = new HTML_AJAX_Helper();
$ajaxHelper->serverUrl = 'server.php?gzip=true';
$ajaxHelper->jsLibraries[] = 'customLib';
?>
<html>
<head>

<?php 
// output a javascript neded to setup HTML_AJAX
// by default this is all the libraries shipped with HTML_AJAX, take a look at $ajaxHelper->jsLibraries to edit the list
echo $ajaxHelper->setupAJAX();
?>

</head>
<body>
<?php 
Beispiel #6
0
<?php

include '../include/Site.php';
require_once 'HTML/AJAX/Helper.php';
$ajaxHelper = new HTML_AJAX_Helper();
class Help
{
    private $title;
    private $body;
    function __construct($helpid = null)
    {
        $sql = 'select * from help where helpid="' . $helpid . '"';
        $help = Database::singleton()->query_fetch($sql);
        $this->title = $help['title'];
        $this->body = $help['body'];
    }
    function __toString()
    {
        return '<strong>' . $this->title . '</strong><br />' . $this->body;
    }
}
if ($ajaxHelper->isAJAX()) {
    $help = new Help($_REQUEST['helpid']);
    echo $help->__toString();
}
Beispiel #7
0
<?php

require_once 'HTML/AJAX/Helper.php';
$objAjaxHelper = new HTML_AJAX_Helper();
$objAjaxHelper->serverUrl = './php/auto_server.php';
$objAjaxHelper->jsLibraries[] = 'haserializer';
$objAjaxHelper->stubs[] = 'login';
$strAjaxScript = $objAjaxHelper->setupAJAX();
?>
<html>
<head>
	<title>Form validation (v2) with HTML_AJAX</title>
	<!-- HTML_AJAX -->
	<?php 
echo $strAjaxScript;
?>
	<script type="text/javascript">
		/**
		 * Basic page initialization
		 */
		function initPage() {
			// Set up the labels so they know the associated input elements
			var arrLabels = document.getElementsByTagName("label");
			for (var i=0; i < arrLabels.length; i++) {
				var objTemp = arrLabels[i];
				var strFor = objTemp.getAttribute('for');

				// Fix the attributes
				if (strFor != '') {
					// Set the ID of the label
					objTemp.setAttribute('id', 'l' + strFor);
Beispiel #8
0
 /**
  * Display a tree to the user
  * 
  * This function is called when the user is viewing the categories tree, the product types tree, or the suppliers tree
  * Only the categories tree has a hierarchy in it
  * This function is called the first time as a regular call and then it is called as an ajax call everytime the user clicks on a category (or product type or supplier)
  * 
  * @return string
  */
 public function handleTree($action, $page)
 {
     if ($action != "Category" && $action != "Supplier" && $action != "ProductType") {
         $action = "Category";
     }
     $ajaxHelper = new HTML_AJAX_Helper();
     if ($ajaxHelper->isAJAX()) {
         $this->smarty->assign('ajax', 1);
     }
     $groups = call_user_func(array($action, 'getAll'), true, $page);
     //Get all the records
     $this->smarty->assign('groups', $groups);
     $this->smarty->assign('action', $action);
     return $this->smarty->fetch("GroupTree.tpl");
 }