From 76b2028a5757b95821c02ddb3fef132169c64438 Mon Sep 17 00:00:00 2001 From: Penny Leach Date: Sun, 18 Jun 2006 21:25:54 +1200 Subject: [PATCH] small changes & avoiding notices to breakfast stuff --- include/breakfast.inc.php | 4 +- .../lang_en.inc.php | 2 +- plugins/serendipity_plugin_breakfast/lib.php | 82 +++++++++++-------- .../serendipity_plugin_breakfast.php | 20 +++-- 4 files changed, 66 insertions(+), 42 deletions(-) diff --git a/include/breakfast.inc.php b/include/breakfast.inc.php index bdcab45..cbbb472 100644 --- a/include/breakfast.inc.php +++ b/include/breakfast.inc.php @@ -21,7 +21,7 @@ if (!empty($_REQUEST['date'])) { $output = '

breakfast

For some time, I have been going out for weekly Sunday breakfast with a group of people that ranges somewhere between 5 and 10 in number. After awhile, we decided we needed some sort of rating system. Since I already sometimes write about breakfast here already, I thought I would make it more official and write a s9y plugin for it.

So here it is:

-

So far, you can check out the most recent breakfast only

'; +

(So far, you can check out the most recent breakfast only)

'; /*

Filter by: '.breakfast_cafe_dropdown($cafe).', '.breakfast_people_dropdown($person).', '.breakfast_meal_dropdown($meal).', '.breakfast_date_dropdown($date).'

Or, just the most recent breakfast

'; @@ -62,5 +62,7 @@ foreach ($categories as $cat => $weight) { } $output .= 'Total'.$tabledata.''; +$output .= '

Minimum: '.$latest['totals']['min'].'%, Maximum: '.$latest['totals']['max'].'%, Average: ' +.ceil($latest['totals']['scores']/$latest['totals']['num']).'%

'; $serendipity['smarty']->assign('content_message',$output); ?> diff --git a/plugins/serendipity_plugin_breakfast/lang_en.inc.php b/plugins/serendipity_plugin_breakfast/lang_en.inc.php index 1f4e885..d081b9b 100644 --- a/plugins/serendipity_plugin_breakfast/lang_en.inc.php +++ b/plugins/serendipity_plugin_breakfast/lang_en.inc.php @@ -1,4 +1,4 @@ \ No newline at end of file diff --git a/plugins/serendipity_plugin_breakfast/lib.php b/plugins/serendipity_plugin_breakfast/lib.php index 98caaee..e2cc0c4 100644 --- a/plugins/serendipity_plugin_breakfast/lib.php +++ b/plugins/serendipity_plugin_breakfast/lib.php @@ -9,13 +9,15 @@ function breaKfast_cafe_dropdown($selected=0) { '; return $output; } @@ -27,9 +29,11 @@ function breakfast_person_dropdown($count) { $output = ' '; return $output; } @@ -42,13 +46,15 @@ function breakfast_people_dropdown($selected=0) { $output = ' '; return $output; } @@ -61,9 +67,11 @@ function breakfast_menu_dropdown($count) { $output = ' '; return $output; } @@ -75,12 +83,14 @@ function breakfast_meal_dropdown($selected=0) { $output = ' '; return $output; @@ -91,10 +101,12 @@ function breakfast_scoring_dropdowns($count) { $categories = serendipity_db_query('SELECT * FROM mbg_category'); } $output = ''; - foreach ($categories as $i => $c) { - $output .= $c['category'].' ('.$c['weight'].') : '; - if ($i == 3) { - $output .= '
'; + if (is_array($categories)) { + foreach ($categories as $i => $c) { + $output .= $c['category'].' ('.$c['weight'].') : '; + if ($i == 3) { + $output .= '
'; + } } } return $output; @@ -104,12 +116,14 @@ function breakfast_date_dropdown($selected=0) { $output = ' '; return $output; diff --git a/plugins/serendipity_plugin_breakfast/serendipity_plugin_breakfast.php b/plugins/serendipity_plugin_breakfast/serendipity_plugin_breakfast.php index c9f7b64..e3d245d 100644 --- a/plugins/serendipity_plugin_breakfast/serendipity_plugin_breakfast.php +++ b/plugins/serendipity_plugin_breakfast/serendipity_plugin_breakfast.php @@ -51,27 +51,30 @@ class serendipity_plugin_breakfast extends serendipity_plugin .' had \''.$attendee['meal'].'\': '; foreach ($attendee['scores'] as $category => $score) { + if (empty($score)) { + continue; + } echo ' - '.$category.':'.$score['score'].'/'.$score['weight'].' + '.$category.':'.$score['score'].'/'.$score['weight'].' '; } echo ' - Total'.$attendee['totals']['scores'].'% + Total'.$attendee['totals']['scores'].'% The group gave: - Min:'.$latest['totals']['min'].'% + Min:'.$latest['totals']['min'].'% - Max:'.$latest['totals']['max'].'% + Max:'.$latest['totals']['max'].'% - Avergage:'.ceil($latest['totals']['scores']/$latest['totals']['num']).'% + Avergage:'.ceil($latest['totals']['scores']/$latest['totals']['num']).'% - What the hell is this? +

What the hell is this? '; return; @@ -162,3 +165,8 @@ class serendipity_plugin_breakfast extends serendipity_plugin } /* vim: set sts=4 ts=4 expandtab : */ +/** +TODO! +finish query builder page +make sure there is no collision of saving same name of new breakfasts in admin page +**/ -- 2.39.5