art-web r541 - in branches/art-hub: controllers models views



Author: thos
Date: Tue Jun 17 20:50:48 2008
New Revision: 541
URL: http://svn.gnome.org/viewvc/art-web?rev=541&view=rev

Log:
* Implement background resolution links


Modified:
   branches/art-hub/controllers/backgrounds.php
   branches/art-hub/models/backgrounds.php
   branches/art-hub/views/backgrounds.php

Modified: branches/art-hub/controllers/backgrounds.php
==============================================================================
--- branches/art-hub/controllers/backgrounds.php	(original)
+++ branches/art-hub/controllers/backgrounds.php	Tue Jun 17 20:50:48 2008
@@ -25,6 +25,12 @@
 else
   $view_data = null;
 
+$bg_res = array ();
+foreach ($view_data as $b)
+{
+  $bg_res[$b['backgroundID']] = $bg->get_resolutions ($b['backgroundID']);
+}
+
 $total_backgrounds = $bg->get_total ($category);
 
 /* load view */

Modified: branches/art-hub/models/backgrounds.php
==============================================================================
--- branches/art-hub/models/backgrounds.php	(original)
+++ branches/art-hub/models/backgrounds.php	Tue Jun 17 20:50:48 2008
@@ -35,6 +35,23 @@
 
     return $total[0];
   }
+
+  function get_resolutions ($backgroundID)
+  {
+    if (!is_numeric ($backgroundID))
+      return;
+
+    $sql = "SELECT * FROM background_resolution
+            WHERE backgroundID = $backgroundID";
+
+    $r = mysql_query ($sql);
+    $res = array ();
+
+    while ($rr = mysql_fetch_assoc ($r))
+      $res[] = $rr;
+
+    return $res;
+  }
 }
 
 ?>

Modified: branches/art-hub/views/backgrounds.php
==============================================================================
--- branches/art-hub/views/backgrounds.php	(original)
+++ branches/art-hub/views/backgrounds.php	Tue Jun 17 20:50:48 2008
@@ -57,14 +57,19 @@
     <td rowspan="3">
       <img width="96" alt="Preview" src='/images/thumbnails/backgrounds/<?php echo $row['backgroundID']?>.jpg'>
     </td>
-    <td colspan="5" style="width:100%"><?php echo $row['description']?></td>
+    <td colspan="4" style="width:100%"><?php echo $row['description']?></td>
+    <td rowspan="2">
+     <?php foreach ($bg_res[$row['backgroundID']] as $res):?>
+       <a href="/download/backgrounds/<?php printf ("%s/%s/%s", $row['category'], $res['background_resolutionID'], $res['filename'])?>">
+       <?php echo $res['resolution']?></a><br>
+     <?php endforeach ?>
+    </td>
   </tr>
   <tr>
     <td class="label">Date:</td>
     <td><?php $tm = strtotime ($row['release_date']); echo date ("d M Y", $tm); ?></td>
     <td class="label">License:</td>
     <td><?php echo $license_config_array[$row['license']]?></td>
-    <td><a href="#">Download</a></td>
   </tr>
 </table>
 </div>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]