* @package tao */ class tao_helpers_form_elements_xhtml_File extends tao_helpers_form_elements_File { use XhtmlRenderingTrait; /** * Short description of method feed * * @access public * @author Joel Bout, */ public function feed() { if (isset($_FILES[$this->getName()])) { $this->setValue($_FILES[$this->getName()]); } else { throw new tao_helpers_form_Exception('cannot evaluate the element ' . __CLASS__); } } /** * Short description of method render * * @access public * @author Joel Bout, * @return string */ public function render() { if (! empty($this->value)) { if (common_Utils::isUri($this->value)) { $referencer = $this->getServiceLocator()->get(FileReferenceSerializer::SERVICE_ID); /** @var File $file */ $file = $referencer->unserialize($this->value); if (!$file->exists()) { $referencer->cleanup($this->value); } } } $returnValue = $this->renderLabel(); $returnValue .= ""; $returnValue .= "renderAttributes(); $returnValue .= " value='{$this->value}' />"; return (string) $returnValue; } /** * Short description of method getEvaluatedValue * * @access public * @author Joel Bout, * @return mixed */ public function getEvaluatedValue() { return $this->getRawValue(); } public function getServiceLocator() { return ServiceManager::getServiceManager(); } }