]> git.llucax.com Git - software/bife/bife-all.git/blobdiff - src/BIFE/Album.php
- Added a new simple template system: Hooks + IT = HIT.
[software/bife/bife-all.git] / src / BIFE / Album.php
index b3fd40915dddfc889b836c4ddc0d7a337c4b6d0d..ff08c401a0ad49a876035f67c0746b8adb767dd5 100644 (file)
@@ -98,12 +98,14 @@ class BIFE_Album extends BIFE_Widget {
      */
     function render(&$template) // ~X2C
     {
      */
     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']);
         $root = $this->attrs['DIR'];
         $list = $this->getList();
         $tot  = count($list);
         $rows = ceil($tot / $this->attrs['COLUMNS']);
+        $html_rows = '';
         for ($row = 0; $row < $rows; $row++) {
         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]) {
             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).
                     // 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']) {
                     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 {
                 } 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
 
     }
     // -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(
                 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,
                     );
                         'DESC'  => $name,
                         'THUMB' => is_readable($thumb) ? $thumb : null,
                     );