Exemple #1
0
        $values = $form->process(array(&$this, 'formValues'), false);
        $menuBar['back'] = '/ushop/tax/overview';
        $values['tax_code'] = strtoupper($values['tax_code']);
        //check then enter the record.
        $res = $this->update($values, $ushop->db_name . 'tax_codes', array('where' => 'tax_code_id=' . $this->registry->params['id']));
        if ($res) {
            $params['TYPE'] = 'pass';
            $params['MESSAGE'] = '<h2>Tax code was successfully edited.</h2>';
        } else {
            $params['TYPE'] = 'error';
            $params['MESSAGE'] = '<h2>Tax code could not be edited due to an error.</h2>';
        }
        // done!
    } else {
        $form->setDefaults(array('tax_code' => $rows[0]->tax_code, 'tax_rate_id' => $rows[0]->tax_rate_id, 'description' => $rows[0]->description));
        $renderer = new UthandoForm(__SITE_PATH . '/templates/' . $template);
        $renderer->setFormTemplate('form');
        $renderer->setHeaderTemplate('header');
        $renderer->setElementTemplate('element');
        $form->accept($renderer);
        // output the form
        $this->content .= $renderer->toHtml();
    }
    if (isset($params)) {
        $params['CONTENT'] = $this->makeMessageBar($menuBar, 24);
        $this->content .= $this->message($params);
    }
} else {
    header("Location:" . $this->get('config.server.web_url'));
    exit;
}