* @access public
*/
class BIFE_Album extends BIFE_Widget {
- /**
- * Attributes.
- *
- * @var array $attrs
- * @access public
- */
- var $attrs;
-
// ~X2C
// +X2C Operation 22
'THUMBSFORMAT' => 'jpeg',
'THUMBSDIR' => '.thumbs',
'EXTENSIONS' => 'png,jpg,jpeg,PNG,JPG,JPEG',
- 'SELECTED' => '',
'MAXROWS' => 0,
'COLUMNS' => 4,
+ 'LINK-BIFE' => 'photo.xbf',
+ 'LINK-URL' => '',
// TODO - agregar atributo para el LINK, ver de hacer el
// widget de un link.
);
- $this->attrs = array_merge($defaults, $attrs);
- $this->attrs['EXTENSIONS'] = explode(',', $this->attrs['EXTENSIONS']);
+ $attrs = array_merge($defaults, $attrs);
+ $attrs['EXTENSIONS'] = explode(',', $attrs['EXTENSIONS']);
+ parent::__construct($attrs);
}
// -X2C
function render(&$template) // ~X2C
{
$template->loadTemplateFile('bife_album.html');
- $template->addBlockFile('ITEMS', 'ITEM', 'bife_album_item.html');
$root = $this->attrs['DIR'];
$list = $this->getList();
$tot = count($list);
for ($col = 0; $col < $this->attrs['COLUMNS']; $col++) {
$cur = $row * $this->attrs['COLUMNS'] + $col;
if ($photo = @$list[$cur]) {
- $selected = ($photo['file'] === $this->attrs['SELECTED']);
- if (is_null($photo['thumb'])) {
- $photo['thumb'] = $this->makeThumb($photo['file']);
+ if (is_null($photo['THUMB'])) {
+ $photo['THUMB'] = $this->makeThumb($photo['FILE']);
}
// FIXME - Si no se pudo crear el thumb, devuelve null
// (ver si se agrega otro template para indicar error
// o algo asi).
- $template->setVariable(
- array(
- 'PHOTO' => $photo['file'],
- 'DESC' => $photo['desc'],
- 'THUMB' => $photo['thumb'],
- )
- );
- $template->parse('ITEM');
- } else {
- if (!@$empty) {
- $template->replaceBlockFile('ITEM',
- 'bife_album_emptyitem.html', true);
- $empty = true;
+ $photo['URL'] = $this->attrs['LINK-URL'] . '?BIFE_ALBUM_FILE=' .
+ urlencode($photo['FILE']);
+ if ($this->attrs['LINK-BIFE']) {
+ $photo['URL'] .= '&BIFE=' . urlencode($this->attrs['LINK-BIFE']);
}
- $template->touchBlock('ITEM');
+ $template->setVariable($photo);
$template->parse('ITEM');
+ } else {
+ $template->touchBlock('EMPTY');
+ $template->parse('EMPTY');
}
}
- $template->parse('FILA');
+ $template->parse('ROW');
}
$template->setVariable('DESC', $this->getDescription());
return $template->get();
if (is_readable("$root/$file") and in_array($ext, $exts)) {
$thumb = $this->getThumbFilename("$root/$file");
$return[] = array(
- 'file' => "$root/$name",
- 'desc' => $name,
- 'thumb' => is_readable($thumb) ? $thumb : null,
+ 'FILE' => "$root/$name",
+ 'DESC' => $name,
+ 'THUMB' => is_readable($thumb) ? $thumb : null,
);
}
}
} // -X2C Class :Album
-?>
\ No newline at end of file
+?>