Fix asText dei mediaRender ora richiede array default nullo

This commit is contained in:
Lorenzo Giacomelli
2016-01-26 14:59:13 +01:00
parent 78666d6552
commit 51c4ca115a
6 changed files with 21 additions and 17 deletions
+2 -2
View File
@@ -2,7 +2,7 @@
interface MediaRendererInterface{
public function asText();
public function render();
public function asText(array $opt = array()) ;
public function render(array $opt = array());
}
?>
@@ -7,12 +7,12 @@ class MediaHtml5 implements MediaRendererInterface{
$this->code = $code;
}
public function asText(){
public function asText(array $opt = array()){
return $this->code;
}
public function render(){
echo $this->asText();
public function render(array $opt = array()){
echo $this->asText($opt);
}
}
?>
@@ -6,12 +6,16 @@ class MediaImage implements MediaRendererInterface{
$this->id = $id;
}
public function asText($size){
public function asText(array $opt = array()){
$size = "small";
if(sizeof($opt)>0 && array_key_exists("size", $opt)){
$size = $opt["size"];
}
return '<img src="'.GUIHandler::getBaseUrl().'getImage.php?id='.$this->id.'&size='.$size.'"/>';
}
public function render($size = "small"){
echo $this->asText($size);
public function render(array $opt = array ()){
echo $this->asText($opt);
}
}
?>
@@ -7,12 +7,12 @@ class MediaLocalVideo implements MediaRendererInterface{
$this->id = $id;
}
public function asText(){
public function asText(array $opt = array()){
return $this->id;
}
public function render(){
echo $this->asText();
public function render(array $opt = array()){
echo $this->asText($opt);
}
}
?>
@@ -7,12 +7,12 @@ class MediaPdf implements MediaRendererInterface{
$this->id = $model;
}
public function asText(){
public function asText(array $opt = array()){
return $this->id;
}
public function render(){
echo $this->asText();
public function render(array $opt = array()){
echo $this->asText($opt);
}
}
?>
@@ -7,14 +7,14 @@ class MediaYoutube implements MediaRendererInterface{
$this->link = $link;
}
public function asText(){
public function asText(array $opt = array()){
return '<iframe width="420" height="315"
src=\"'.$this->link.'?autoplay=0\">
</iframe>';
}
public function render(){
echo $this->asText();
public function render(array $opt = array()){
echo $this->asText($opt);
}
}
?>