freenet-router |
Subversion Repositories: |
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";
}
}