Пример #1
0
try {
    switch ($_POST['method']) {
        case 'account':
            $acc = $mite->getAccount();
            outputKeyVal($acc);
            break;
        case 'customers':
        case 'projects':
        case 'users':
        case 'services':
            $name = $_POST['name'] ? $_POST['name'] : '';
            $email = isset($_POST['email']) && $_POST['email'] ? $_POST['email'] : false;
            $limit = $_POST['limit'] ? $_POST['limit'] : false;
            $offset = $_POST['offset'] ? $_POST['offset'] : false;
            if ($_POST['method'] == 'customers') {
                $e = $mite->getCustomers($name, $limit, $offset);
            } elseif ($_POST['method'] == 'projects') {
                $e = $mite->getProjects($name, $limit, $offset);
            } elseif ($_POST['method'] == 'users') {
                $e = $mite->getUsers($name, $email, $limit, $offset);
            } elseif ($_POST['method'] == 'services') {
                $e = $mite->getServices($name, $limit, $offset);
            }
            for ($e->rewind(); $e->valid(); $e->next()) {
                outputKeyVal($e->current());
            }
            break;
        case 'times':
            $e = $mite->getTimes(array(), array(), array(), array(), null, false, false, false, false, null, 5, false);
            for ($e->rewind(); $e->valid(); $e->next()) {
                outputKeyVal($e->current());