Gino Multimedia  0.1
Modulo di gestione di contenuti multimediali per Gino CMS
 Tutto Strutture dati File Funzioni Variabili Gruppi Pagine
class.multimediaImage.php
Vai alla documentazione di questo file.
1 <?php
26 
27  function __construct($id, $instance) {
28 
29  parent::__construct($id, $instance);
30 
31  }
32 
40  public function structure($id) {
41 
42  $structure = parent::structure($id);
43 
44  $structure['type'] = new hiddenField(array(
45  'name'=>'type',
46  'required'=>true,
47  'label'=>$this->_fields_label['type'],
48  'value'=>IMAGE_CHOICE
49  ));
50 
51  $base_path = $this->_controller->getBaseAbsPath('image');
52 
53  $structure['img_filename'] = new multimediaImageField(array(
54  'name'=>'img_filename',
55  'value'=>$this->img_filename,
56  'label'=>$this->_fields_label['img_filename'],
57  'lenght'=>100,
58  'extensions'=>array('jpg', 'png'),
59  'path'=>$base_path,
60  'apply_on_thumb' => true,
61  'width' => $this->_controller->getImageMaxWidth(),
62  'side_dimension'=>$this->_controller->getThumbDimension()
63  ));
64 
65  return $structure;
66  }
67 
74  public function thumbPath($controller) {
75 
76  if($this->thumb) {
77  return $controller->getBasePath('thumb').'/'.$this->thumb;
78  }
79  elseif($this->img_filename) {
80  return $controller->getBasePath('image').'/thumb_'.$this->img_filename;
81  }
82  else {
83  return $controller->defaultImageThumbPath();
84  }
85 
86  }
87 
95  public function getMoogalleryListJs($controller, $media_base_url) {
96 
97  $name = "<a href=\"".$media_base_url.'/'.$this->id."\">".$this->name."</a>";
98 
99  $description = $this->description;
100  if($this->tags) {
101  $description .= "<p>"._('Tag:').' '.$this->tags."</p>";
102  }
103 
104  $credits = $this->credits;
105  if($this->license) {
106  $license = new multimediaLicense($this->license, $controller);
107  $credits .= "<br />"._("Licenza: ")."<a href=\"".$license->url."\" target=\"_blank\">".$license->name."</a>";
108  }
109 
110  $js = "{
111  thumb: '".$this->thumbPath($controller)."',
112  img: '".$controller->getBasePath('image')."/".$this->img_filename."',
113  title: '".jsVar($name)."',
114  description: '".jsVar($description)."',
115  credits: '".jsVar($credits)."'
116  }";
117 
118  return $js;
119 
120  }
121 
128  public function show($controller) {
129 
130  $buffer = "<img src=\"".$controller->getBasePath('image')."/".$this->img_filename."\" alt=\"".jsVar($this->name)."\" title=\"".jsVar($this->name)."\"/>";
131 
132  return $buffer;
133 
134  }
135 }
136 
137 ?>