Example #1
0
use Vanuatu\Util;
//
// MOSTRA TELA DE ERRO PARA AÇÃO NÃO DEFINIDA
//
if (empty($VNT->fw->url->parameters->action)) {
    $errorPage = new Template(Util::normalizePath($VNT->app->folder->template, "error.phtml"), ["code" => Log::error(), "message" => "nenhuma ação definida"]);
    echo $errorPage;
    die;
}
//
// EXECUTA AÇÕES
//
switch ($VNT->fw->url->parameters->action) {
    //
    // EXEMPLO DE URL
    //   /view
    //   /event:insert
    //   /form:cadastro_pessoa
    //   /path:group:dados_pessoais%3Einput:cpf
    //   /file:people.yaml
    //
    case "view":
        echo $form = new Form(Form::getFormActionFromText($VNT->fw->url->parameters->event), $VNT->fw->url->parameters->file, $VNT->fw->url->parameters->form, $VNT->fw->url->parameters->path);
        break;
        //
    //
    case "exec":
        $form = new Form(Form::getFormActionFromText($VNT->fw->url->parameters->event), $VNT->fw->url->parameters->file, $VNT->fw->url->parameters->form, $VNT->fw->url->parameters->path, $_REQUEST);
        $form->execEvent(Form::VALIDATE);
        break;
}