]> git.mjollnir.org Git - s9y.git/commitdiff
added support for gallery linkage to the breakfast plugin
authorPenny Leach <mjollnir@titania.local>
Fri, 30 Jun 2006 23:42:41 +0000 (11:42 +1200)
committerPenny Leach <penny@catalyst.net.nz>
Tue, 8 Apr 2008 00:04:19 +0000 (12:04 +1200)
include/breakfast.inc.php
plugins/serendipity_plugin_breakfast/lib.php
plugins/serendipity_plugin_breakfast/serendipity_plugin_breakfast.php

index aae0650ed93298fbf5143babab48cb6e34adea17..18afd3f8b6c217c142c4aed587ed11b2d73a4759 100644 (file)
@@ -37,8 +37,14 @@ if (empty($cafe) && empty($person) && empty($meal) && empty($date)) { // just th
 }
 */
 $dates = array_keys($latest);
-$latest = $latest[$dates[0]];
-$output .= '<p><b>Most recent breakfast</b>: '.$latest['cafe'].' on '.$latest['nicedate'].' with '.$latest['num'].' people</p>
+$eventdate = $dates[0];
+$latest = $latest[$eventdate];
+$output .= '<p><b>Most recent breakfast</b>: '.$latest['cafe'].' on '.$latest['nicedate'].' with '.$latest['num'].' people';
+if ($path = breakfast_has_photos($eventdate)) {
+    $output .= ' (<a href="'.$path.'">photos</a>) ';
+}
+
+$output .='</p>
     '.((!empty($latest['overallcomment'])) ? '<p>'.$latest['overallcomment'].'</p>' : '').'
     <table cellpadding="2" cellspacing="1" bgcolor="black" class="data">';
 $categories = array();
index 13349a8edca6dcbb04f7fee71802d15111a2a487..c77e8c86eba222f764fd47882f27c5a1551334e7 100644 (file)
@@ -2,7 +2,7 @@
 if (IN_serendipity !== true) {
     die ("Don't hack!");
 }
-
+require_once(S9Y_INCLUDE_PATH.'/plugins/serendipity_plugin_gallery/lib.php');
 
 function breaKfast_cafe_dropdown($selected=0) {
     $output = '
@@ -234,4 +234,15 @@ function breakfast_generate_sql($latest=true,$date=0,$cafe=0,$person=0,$meal=0)
     return $sql .' ORDER BY e.date DESC, p.name';
 }
 
+function breakfast_has_photos($date) {
+    global $serendipity;
+    $checkpath = SGN_DIR_ROOT.'/mbg/breakfast/'.date('Ymd',$date);
+    error_log("checking $checkpath");
+    $returnpath = $serendipity['baseURL'].'gallery/show/mbg/breakfast/'.date('Ymd',$date);
+    if (!file_exists($checkpath) || !is_dir($checkpath))  {
+        return false;
+    } 
+    return $returnpath;
+}
+
 ?>
\ No newline at end of file
index 4ae1f0f6805e9328940337c3938188571a534c7f..6ccfbf8a652d29ab3daaaebbadeda6d456e72642 100644 (file)
@@ -35,7 +35,8 @@ class serendipity_plugin_breakfast extends serendipity_plugin
             return false;
         }
         $dates = array_keys($latest);
-        $latest = $latest[$dates[0]];
+        $eventdate = $dates[0];
+        $latest = $latest[$eventdate];
         $attendee = $latest['attendees'][array_rand($latest['attendees'])];
         $title = $this->title;
         echo '
@@ -44,7 +45,11 @@ class serendipity_plugin_breakfast extends serendipity_plugin
     <td colspan="2" nowrap="nowrap"><b>Most recent breakfast:</b></td>
   </tr>
   <tr>
-    <td colspan="2">'.$latest['cafe'].' on '.$latest['nicedate'].' with '.$latest['num'].' people</td>
+    <td colspan="2">'.$latest['cafe'].' on '.$latest['nicedate'].' with '.$latest['num'].' people';
+        if ($path = breakfast_has_photos($eventdate)) {
+            echo ' (<a href="'.$path.'">photos</a>) ';
+        }
+echo '</td>
   </tr>
   <tr>
     <td colspan="2"><b>'.((!empty($attendee['alias'])) ? $attendee['alias'] : $attendee['name'])