X-Git-Url: https://git.llucax.com/software/bife/bife-all.git/blobdiff_plain/3658b126d4873c96dd3b08af6619795790e23ac2..2ca13aad316873633c3fd9ba59ee2f5579d90272:/src/BIFE/Album.php?ds=sidebyside diff --git a/src/BIFE/Album.php b/src/BIFE/Album.php index b3fd409..ff08c40 100644 --- a/src/BIFE/Album.php +++ b/src/BIFE/Album.php @@ -98,12 +98,14 @@ class BIFE_Album extends BIFE_Widget { */ function render(&$template) // ~X2C { - $template->loadTemplateFile('bife_album.html'); + $template->group = 'album'; $root = $this->attrs['DIR']; $list = $this->getList(); $tot = count($list); $rows = ceil($tot / $this->attrs['COLUMNS']); + $html_rows = ''; for ($row = 0; $row < $rows; $row++) { + $html_cells = ''; for ($col = 0; $col < $this->attrs['COLUMNS']; $col++) { $cur = $row * $this->attrs['COLUMNS'] + $col; if ($photo = @$list[$cur]) { @@ -113,22 +115,23 @@ class BIFE_Album extends BIFE_Widget { // FIXME - Si no se pudo crear el thumb, devuelve null // (ver si se agrega otro template para indicar error // o algo asi). - $photo['URL'] = $this->attrs['LINK-URL'] . '?BIFE_ALBUM_FILE=' . - urlencode($photo['FILE']); + $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']); + $photo['URL'] .= '&BIFE=' . + urlencode($this->attrs['LINK-BIFE']); } - $template->setVariable($photo); - $template->parse('ITEM'); + $html_cell = $template->parse('item', $photo); } else { - $template->touchBlock('EMPTY'); - $template->parse('EMPTY'); + $html_cell = $template->parse('empty'); } + $html_cells .= $template->parse('cell', 'CONTENTS', $html_cell); } - $template->parse('ROW'); + $html_rows .= $template->parse('row', 'CONTENTS', $html_cells); } - $template->setVariable('DESC', $this->getDescription()); - return $template->get(); + return $template->parse( + 'body', + array('DESC' => $this->getDescription(), 'CONTENTS' => $html_rows)); } // -X2C @@ -158,7 +161,7 @@ Returns an array of associative arrays with this keys: if (is_readable("$root/$file") and in_array($ext, $exts)) { $thumb = $this->getThumbFilename("$root/$file"); $return[] = array( - 'FILE' => "$root/$name", + 'FILE' => "$root/$file", 'DESC' => $name, 'THUMB' => is_readable($thumb) ? $thumb : null, );