<?php

namespace FacturaScripts\Plugins\Partes\Lib\Widget;

use FacturaScripts\Core\Lib\Widget\BaseWidget;
use FacturaScripts\Dinamic\Model\TareaProyecto;

/**
 * Description of WidgetHtml
 *
 * @author Carlos Garcia Gomez <carlos@facturascripts.com>
 */
class WidgetMostrarTarea extends BaseWidget
{

    /**
     * 
     * @param array $data
     */
    public function __construct($data)
    {
        parent::__construct($data);
    }

    /**
     * Adds needed assets to the asset manager.
     */
    protected function assets()
    {

    }

    /**
     * 
     * @param string $type
     * @param string $extraClass
     *
     * @return string
     */
    protected function inputHtml($type = 'text', $extraClass = '')
    {
        return parent::inputHtml($type, $extraClass);
    }

    protected function show()
    {
        $idtarea = $this->value;

        $tarea = new TareaProyecto();
        if (false === $tarea->loadFromCode($idtarea)) {
            return '';
        }

        return '<a href="' . $tarea->url() . '">' . $tarea->nombre . '</a>';
    }




}
