2013-11-25 00:02:07 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace FML\Controls;
|
|
|
|
|
|
|
|
/**
|
2014-01-19 19:30:21 +01:00
|
|
|
* FileEntry Control
|
|
|
|
* (CMlFileEntry)
|
2013-11-25 00:02:07 +01:00
|
|
|
*
|
|
|
|
* @author steeffeen
|
|
|
|
*/
|
|
|
|
class FileEntry extends Entry {
|
2014-01-21 20:30:40 +01:00
|
|
|
/*
|
2013-12-31 02:55:19 +01:00
|
|
|
* Protected Properties
|
2013-11-25 00:02:07 +01:00
|
|
|
*/
|
|
|
|
protected $folder = '';
|
|
|
|
|
2014-01-19 19:30:21 +01:00
|
|
|
/**
|
|
|
|
* Create a new FileEntry Control
|
|
|
|
*
|
|
|
|
* @param string $id (optional) Control Id
|
|
|
|
* @return \FML\Controls\FileEntry
|
|
|
|
*/
|
|
|
|
public static function create($id = null) {
|
|
|
|
$fileEntry = new FileEntry($id);
|
|
|
|
return $fileEntry;
|
|
|
|
}
|
|
|
|
|
2013-11-25 00:02:07 +01:00
|
|
|
/**
|
2013-12-31 02:55:19 +01:00
|
|
|
* Construct a new FileEntry Control
|
2013-11-25 00:02:07 +01:00
|
|
|
*
|
2014-01-12 00:51:46 +01:00
|
|
|
* @param string $id (optional) Control Id
|
2013-11-25 00:02:07 +01:00
|
|
|
*/
|
|
|
|
public function __construct($id = null) {
|
|
|
|
parent::__construct($id);
|
|
|
|
$this->tagName = 'fileentry';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2013-12-31 02:55:19 +01:00
|
|
|
* Set Folder
|
2013-11-25 00:02:07 +01:00
|
|
|
*
|
2014-01-12 00:51:46 +01:00
|
|
|
* @param string $folder Base Folder
|
2013-11-25 00:02:07 +01:00
|
|
|
* @return \FML\Controls\FileEntry
|
|
|
|
*/
|
|
|
|
public function setFolder($folder) {
|
2014-01-12 00:51:46 +01:00
|
|
|
$this->folder = (string) $folder;
|
2013-11-25 00:02:07 +01:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @see \FML\Entry::render()
|
|
|
|
*/
|
|
|
|
public function render(\DOMDocument $domDocument) {
|
2014-01-12 00:51:46 +01:00
|
|
|
$xmlElement = parent::render($domDocument);
|
|
|
|
if ($this->folder) {
|
|
|
|
$xmlElement->setAttribute('folder', $this->folder);
|
|
|
|
}
|
|
|
|
return $xmlElement;
|
2013-11-25 00:02:07 +01:00
|
|
|
}
|
|
|
|
}
|