Gino Multimedia  0.1
Modulo di gestione di contenuti multimediali per Gino CMS
 Tutto Strutture dati File Funzioni Variabili Gruppi Pagine
class.multimediaAudio.php
Vai alla documentazione di questo file.
1 <?php
27 
28  function __construct($id, $instance) {
29 
30  parent::__construct($id, $instance);
31 
32  }
33 
41  public function structure($id) {
42 
43  $structure = parent::structure($id);
44 
45  $structure['type'] = new hiddenField(array(
46  'name'=>'type',
47  'required'=>true,
48  'label'=>$this->_fields_label['type'],
49  'value'=>AUDIO_CHOICE
50  ));
51 
52  $base_path = $this->_controller->getBaseAbsPath('audio');
53 
54  $structure['mpeg_filename'] = new fileField(array(
55  'name'=>'mpeg_filename',
56  'value'=>$this->mpeg_filename,
57  'label'=>$this->_fields_label['mpeg_filename'],
58  'lenght'=>100,
59  'extensions'=>array('mp3'),
60  'path'=>$base_path
61  ));
62 
63  $structure['ogg_filename'] = new fileField(array(
64  'name'=>'ogg_filename',
65  'value'=>$this->ogg_filename,
66  'label'=>$this->_fields_label['ogg_filename'],
67  'lenght'=>100,
68  'extensions'=>array('ogg'),
69  'path'=>$base_path
70  ));
71 
72  return $structure;
73  }
74 
81  public function thumbPath($controller) {
82 
83  if($this->thumb) {
84  return $controller->getBasePath('thumb').'/'.$this->thumb;
85  }
86  else {
87  return $controller->defaultAudioThumbPath();
88  }
89 
90  }
91 
99  public function getMoogalleryListJs($controller, $media_base_url) {
100 
101  $name = "<a href=\"".$media_base_url.'/'.$this->id."\">".$this->name."</a>";
102 
103  $description = $this->description;
104  if($this->tags) {
105  $description .= "<p>"._('Tag:').' '.$this->tags."</p>";
106  }
107 
108  $credits = $this->credits;
109  if($this->license) {
110  $license = new multimediaLicense($this->license, $controller);
111  $credits .= "<br />"._("Licenza: ")."<a href=\"".$license->url."\" target=\"_blank\">".$license->name."</a>";
112  }
113 
114  $js = "{
115  thumb: '".$this->thumbPath($controller)."',
116  mpeg: '".($this->mpeg_filename ? $controller->getBasePath('audio')."/".$this->mpeg_filename : '')."',
117  ogg: '".($this->ogg_filename ? $controller->getBasePath('audio')."/".$this->ogg_filename : '')."',
118  title: '".jsVar($name)."',
119  description: '".jsVar($description)."',
120  credits: '".jsVar($credits)."'
121  }";
122 
123  return $js;
124 
125  }
126 
133  public function show($controller) {
134 
135  $buffer = "<audio controls=\"controls\">";
136  if($this->ogg_filename) {
137  $buffer .= "<source type=\"audio/ogg\" src=\"".$controller->getBasePath('audio')."/".$this->ogg_filename."\">";
138  }
139  if($this->mpeg_filename) {
140  $buffer .= "<source type=\"audio/mpeg\" src=\"".$controller->getBasePath('audio')."/".$this->mpeg_filename."\">";
141  }
142  $buffer .= _("Il tuo browser non supporta l'elemento audio");
143  $buffer .= "</audio>";
144 
145  return $buffer;
146 
147  }
148 
149 }
150 
151 ?>