Ejemplo n.º 1
0
<?php

include "system.php";
include 'class/Accounts.php';
$o = new Accounts();
$action = $_REQUEST['action'];
$o->updated = date("Y-m-d H:i:s", time());
$o->updatedby = $xoopsUser->getVar("uid");
switch ($action) {
    case "ajaxfetch":
        if ($o->fetchAccounts($_REQUEST['accounts_id'])) {
            $o->returnAccountsXML();
        } else {
            echo "<xml><errortext>Cannot retrieve accounts_id:" . $_REQUEST['accounts_id'] . "</errortext></xml>";
        }
        break;
    case "ajaxgetaccounttree":
        echo $o->showChildAccountTree(0, 0);
        break;
    case "ajaxdelete":
        $o->accounts_id = $_POST['accounts_id'];
        if (!$o->deleteAccounts($o->accounts_id)) {
            echo "Warning! Cannot delete this account due to unknown reason.";
        } else {
            echo "Delete record successfully.";
        }
        break;
    case "ajaxsave":
        $o->accounts_id = $_POST['accounts_id'];
        $o->accounts_name = $_POST['accounts_name'];
        $o->defaultlevel = $_POST['defaultlevel'];