예제 #1
0
<?php

require_once 'HTML/AJAX/Helper.php';
$helper = new HTML_AJAX_Helper();
var_dump($helper->isAJAX());
예제 #2
0
파일: Help.php 프로젝트: swat30/safeballot
<?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();
}
예제 #3
0
?>

</head>
<body>
<?php 
// output a custom loading message
echo $ajaxHelper->loadingMessage("Waiting on the Server ...");
?>

<div id="updateTarget">I'm an update Target</div>
<?php 
// update the element using ajax
echo $ajaxHelper->updateElement('updateTarget', array('test', 'echo_string', 'Some text to echo'), 'replace', true);
?>


<p>Was this page loaded using AJAX: <?php 
var_dump($ajaxHelper->isAJAX());
?>
</p>

Below is the output of HTML_AJAX_Helper::isAJAX() on content loaded from AJAX
<div id="updateTarget2"></div>
<?php 
echo $ajaxHelper->updateElement('updateTarget2', 'support/isajax.php', 'replace', true);
?>

</body>
</html>
<?php 
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
예제 #4
0
파일: EComm.php 프로젝트: anas/feedstore
 /**
  * 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");
 }