jablonka.czprosek.czf

freenet-router

Subversion Repositories:
[/] [trunk/] [freenet-router/] [var/] [www/] [freenet-router/] [Framework/] [Controllers/] [FormController.php] - Rev 2

Compare with Previous - Blame - Download


<?php

namespace Phem\Controllers;

use Phem\Controllers\SimpleViewController;
use Phem\Libraries\Forms\AnnotationFormBuilder;
use Srovnavac\Libraries\Environment\EnvironmentManager;

/**
 * Administration
 * 
 * @author Jakub PetrŞílka <petrzilka@czweb.net>
 */
class FormController extends SimpleViewController
{

    function __construct()
    {
        parent::__construct();
        $classPathArray = explode("\\", get_class($this));
        $classShortName = end($classPathArray);
        $controllerName = str_replace("Controller", "", $classShortName);
        
        $this->getModel()->set('updateFormUrl', EnvironmentManager::getLinkBuilder()->link(array("controller" => $controllerName, "task" => "updateForm")));
    }

    public function updateForm()
    {
        $data = EnvironmentManager::getSubmittedFormObject();
        $ab = new AnnotationFormBuilder();
        $form = $ab->buildForm(get_class($data), $data);
        $this->model->put("form", $form);
        $this->template = "@Phem/simpleForm.twig";
    }

}

Powered by WebSVN 2.2.1