* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * sfWidgetFormInputFile represents an upload HTML input tag. * * @package symfony * @subpackage widget * @author Fabien Potencier * @version SVN: $Id$ */ class sfWidgetFormSaveFile extends sfWidgetFormInputFile { /** * @param string $name The element name * @param string $value The value displayed in this widget * @param array $attributes An array of HTML attributes to be merged with the default HTML attributes * @param array $errors An array of errors for the field * * @return string An HTML tag string * * @see sfWidgetForm */ public function render($name, $value = null, $attributes = array(), $errors = array()) { sfLoader::loadHelpers(array('Asset','Url','Javascript')); $attributes = array_merge(array('type' => $this->getOption('type'), 'name' => $name, 'value' => $value), $attributes); $tags = $this->renderTag('input', $attributes ); if($attributes['value']) { $tags .= $this->renderContentTag('a', image_tag('/sfFormGuiPlugin/images/uploaded_file', 'width=30 title='.$attributes['value']), array('href' => '/'.$attributes['value'], 'target' => '_blank' )); $tags .= link_to(image_tag('/sfFormGuiPlugin/images/delete_file', 'width=30 title='.$attributes['value']), 'sfFormGuiResponse/delete?id='.$attributes['responseQuestion_id'] ); } return $tags; } }