jablonka.czprosek.czf

freenet-router

Subversion Repositories:
[/] [trunk/] [freenet-router/] [var/] [www/] [freenet-router/] [Framework/] [Libraries/] [Security/] [Model/] [Common/] [Task.php] - Rev 2

Compare with Previous - Blame - Download


<?php

namespace Phem\Libraries\Security\Model\Common;

use Phem\Core\Object;
use Phem\Libraries\Forms\Annotations\GeneratedValue;
use Phem\Libraries\Forms\Annotations\Input;
use Phem\Libraries\Forms\Annotations\Form;
use Phem\Libraries\Forms\Annotations\SignGroup;
use Phem\Libraries\Forms\Annotations\Group as AnnotationGroup;
use Phem\Environment\EnvironmentManager;

/**
 * @Form(defaultGroup="newTask")
 * @AnnotationGroup(name="newTask", caption="NovĂ˝ Task", order="3")
 */
class Task extends Object
{

    /**
     * @GeneratedValue
     */
    protected $id;
    /**
     * @Phem\Libraries\Forms\Annotations\Select(caption="Kontroler", options="getControllers", required=true, order=2)
     */
    protected $controller;
    /**
     * @Input(type="text", caption="Nazev", required=true, order=1)
     */
    protected $name;
    /**
     * @Input(type="text", caption="Popisek")
     */
    protected $description;

    public function getId()
    {
        return $this->id;
    }

    public function setId($id)
    {
        $this->id = $id;
    }

    public function getController()
    {
        return $this->controller;
    }

    public function setController($controller)
    {
        $this->controller = $controller;
    }

    public function getName()
    {
        return $this->name;
    }

    public function setName($name)
    {
        $this->name = $name;
    }

    public function getDescription()
    {
        return $this->description;
    }

    public function setDescription($description)
    {
        $this->description = $description;
    }
    
    public static function getControllers()
    {
        $opt = new \Phem\Core\Collection();
        $em = EnvironmentManager::getEntityManager();
        $controllers = $em->getRepository('Phem\Libraries\Security\Model\MySQL\Controller')->findAll();
        foreach($controllers as $c)
        {
            $value = $c->getName();
            $value.= ($c->getDescription() == null ? "" : " - ".$c->getDescription());
            $opt->put($c->getId(), $value);
        }
        return $opt;
    }

}

Powered by WebSVN 2.2.1