From: Penny Leach Date: Fri, 30 Jun 2006 23:42:41 +0000 (+1200) Subject: added support for gallery linkage to the breakfast plugin X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8d61714ec8035a63fd60e0475fc3a2d6c8a47d9d;p=s9y.git added support for gallery linkage to the breakfast plugin --- diff --git a/include/breakfast.inc.php b/include/breakfast.inc.php index aae0650..18afd3f 100644 --- a/include/breakfast.inc.php +++ b/include/breakfast.inc.php @@ -37,8 +37,14 @@ if (empty($cafe) && empty($person) && empty($meal) && empty($date)) { // just th } */ $dates = array_keys($latest); -$latest = $latest[$dates[0]]; -$output .= '

Most recent breakfast: '.$latest['cafe'].' on '.$latest['nicedate'].' with '.$latest['num'].' people

+$eventdate = $dates[0]; +$latest = $latest[$eventdate]; +$output .= '

Most recent breakfast: '.$latest['cafe'].' on '.$latest['nicedate'].' with '.$latest['num'].' people'; +if ($path = breakfast_has_photos($eventdate)) { + $output .= ' (photos) '; +} + +$output .='

'.((!empty($latest['overallcomment'])) ? '

'.$latest['overallcomment'].'

' : '').' '; $categories = array(); diff --git a/plugins/serendipity_plugin_breakfast/lib.php b/plugins/serendipity_plugin_breakfast/lib.php index 13349a8..c77e8c8 100644 --- a/plugins/serendipity_plugin_breakfast/lib.php +++ b/plugins/serendipity_plugin_breakfast/lib.php @@ -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 diff --git a/plugins/serendipity_plugin_breakfast/serendipity_plugin_breakfast.php b/plugins/serendipity_plugin_breakfast/serendipity_plugin_breakfast.php index 4ae1f0f..6ccfbf8 100644 --- a/plugins/serendipity_plugin_breakfast/serendipity_plugin_breakfast.php +++ b/plugins/serendipity_plugin_breakfast/serendipity_plugin_breakfast.php @@ -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 - +
Most recent breakfast:
'.$latest['cafe'].' on '.$latest['nicedate'].' with '.$latest['num'].' people'.$latest['cafe'].' on '.$latest['nicedate'].' with '.$latest['num'].' people'; + if ($path = breakfast_has_photos($eventdate)) { + echo ' (photos) '; + } +echo '
'.((!empty($attendee['alias'])) ? $attendee['alias'] : $attendee['name'])