]> git.mjollnir.org Git - s9y.git/commitdiff
beginnings of breakfast support. main page to come !
authorPenny Leach <mjollnir@titania.local>
Sun, 18 Jun 2006 04:19:58 +0000 (16:19 +1200)
committerPenny Leach <mjollnir@titania.local>
Sun, 18 Jun 2006 04:19:58 +0000 (16:19 +1200)
13 files changed:
include/breakfast.inc.php [new file with mode: 0644]
include/functions_installer.inc.php
include/functions_permalinks.inc.php
include/genpage.inc.php
include/tpl/htaccess_rewrite.tpl
index.php
lang/UTF-8/serendipity_lang_en.inc.php
lang/serendipity_lang_en.inc.php
plugins/serendipity_plugin_breakfast/admin.inc.php [new file with mode: 0644]
plugins/serendipity_plugin_breakfast/lang_en.inc.php [new file with mode: 0644]
plugins/serendipity_plugin_breakfast/lib.php [new file with mode: 0644]
plugins/serendipity_plugin_breakfast/serendipity_plugin_breakfast.php [new file with mode: 0644]
serendipity_admin.php

diff --git a/include/breakfast.inc.php b/include/breakfast.inc.php
new file mode 100644 (file)
index 0000000..e09b4a5
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+$serendipity['smarty']->assign('content_message','
+<h3 class="serendipity_date">breakfast</h3>');
+
+
+
+
+?>
index 6402a7a5da0308c30202eb96fcbdb3d6e2af152d..2a4fe2ccf5bec0ed05c2552a28b1c3233623d6f9 100644 (file)
@@ -846,6 +846,7 @@ function serendipity_installFiles($serendipity_core = '') {
                    '{PAT_PERMALINK_CATEGORIES}',
                    '{PAT_PERMALINK_FEEDAUTHORS}',
                    '{PAT_ABOUT}', '{PATH_ABOUT}',
+                   '{PAT_BREAKFAST}', '{PATH_BREAKFAST}',
                    '{PAT_GALLERY}','{PATH_GALLERY}',
 
                  ),
@@ -870,6 +871,7 @@ function serendipity_installFiles($serendipity_core = '') {
                    trim($PAT['PERMALINK_CATEGORIES'], '@/i'),
                    trim($PAT['PERMALINK_FEEDAUTHORS'], '@/i'),
                    trim($PAT['ABOUT'], '@/i'),       $serendipity['permalinkAboutPath'], 
+                   trim($PAT['BREAKFAST'], '@/i'),       $serendipity['permalinkBreakfastPath'], 
                    trim($PAT['GALLERY'],'@/i'),      $serendipity['permalinkGalleryPath'],
                  ),
 
index 0ccd4195f533a73b06c053a6206af4c8cfe7f25b..cdb13704f47d327870d97ed2dfb0dfc199714ac4 100644 (file)
@@ -220,6 +220,10 @@ function serendipity_initPermalinks() {
         $serendipity['permalinkAboutPath'] = 'about';
     }
     
+    if (!isset($serendipity['permalinkBreakfastPath'])) {
+        $serendipity['permalinkBreakfastPath'] = 'breakfast';
+    }
+    
     if (!isset($serendipity['permalinkGallery{ath'])) {
         $serendipity['permalinkGalleryPath'] = 'gallery';
     }
@@ -229,6 +233,7 @@ function serendipity_initPermalinks() {
      * backwards URL compatibility
      */
     @define('PATH_ABOUT',       $serendipity['permalinkAboutPath']);
+    @define('PATH_BREAKFAST',       $serendipity['permalinkBreakfastPath']);
     @define('PATH_GALLERY',     $serendipity['permalinkGalleryPath']);
     @define('PATH_ARCHIVES',    $serendipity['permalinkArchivesPath']);
     @define('PATH_ARCHIVE',     $serendipity['permalinkArchivePath']);
@@ -248,6 +253,7 @@ function serendipity_initPermalinks() {
      * function serendipity_installFiles().
      */
     @define('PAT_ABOUT', '@/'.PATH_ABOUT.'/?@');
+    @define('PAT_BREAKFAST', '@/'.PATH_BREAKFAST.'/?@');
     @define('PAT_GALLERY','@/'.PATH_GALLERY.'/(.*)@');
     @define('PAT_FILENAME',   '0-9a-z\.\_!;,\+\-');
     @define('PAT_CSS',        '@/(serendipity\.css|serendipity_admin\.css)@');
@@ -270,6 +276,7 @@ function &serendipity_permalinkPatterns($return = false) {
     $PAT = array();
 
     $PAT['ABOUT']                    = '@/'  . $serendipity['permalinkAboutPath'];
+    $PAT['BREAKFAST']                    = '@/'  . $serendipity['permalinkBreakfastPath'];
     $PAT['GALLERY']                  = '@/'  . $serendipity['permalinkGalleryPath'];
     $PAT['UNSUBSCRIBE']              = '@/'  . $serendipity['permalinkUnsubscribePath'].'/(.*)/([0-9]+)@';
     $PAT['APPROVE']                  = '@/'  . $serendipity['permalinkApprovePath'].'/(.*)/(.*)/([0-9]+)@';
index 1539420f366d786ce355cf9d81a1be99e596a6ee..95306efa650cfdc0908622c05a2e101943a9db12 100644 (file)
@@ -94,6 +94,9 @@ if ($serendipity['smarty_raw_mode']) {
         case 'about':
             include_once(S9Y_INCLUDE_PATH.'include/about.inc.php');
             break;
+        case 'breakfast':
+            include_once(S9Y_INCLUDE_PATH.'include/breakfast.inc.php');
+            break;
         case 'gallery':
             include_once(S9Y_INCLUDE_PATH.'include/gallery.inc.php');
             break;
index 827fc733efbb5d9cf49e803def26f4692f5e4cf7..9962b31ae5afa12e4e03510564ef29e96f1e3a69 100644 (file)
@@ -28,6 +28,7 @@ RewriteRule ^{PAT_CSS} {indexFile}?url=/$1 [L,QSA]
 RewriteRule ^index\.(html?|php.+) {indexFile}?url=index.html [L,QSA]
 RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]
 RewriteRule ^{PAT_ABOUT} {indexFile}?url=/{PAT_ABOUT}/ [L,QSA]
+RewriteRule ^{PAT_BREAKFAST} {indexFile}?url=/{PAT_BREAKFAST}/ [L,QSA]
 RewriteRule (.*\.html?) {indexFile}?url=/$1 [L,QSA]
 
 <Files *.tpl.php>
index a456d6f4b937a7b489654f64de73463e4df428a6..1bff7766a0009da2ea333563fba8614ce0ab4e26 100644 (file)
--- a/index.php
+++ b/index.php
@@ -175,7 +175,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
                 $tm = jalali_mktime(0, 0, 0, $i, $day, $year);
                 $ts = jalali_mktime(0, 0, 0, jalali_date_utf('m', $tm), jalali_date_utf('j', $tm), $year);
                 $te = jalali_mktime(23, 59, 59, jalali_date_utf('m', $tm), jalali_date_utf('j', $tm)+7, $year);
-                $date = serendipity_formatTime(WEEK .' '. $week .'، %Y', $ts, false);
+                $date = serendipity_formatTime(WEEK .' '. $week .'\81، %Y', $ts, false);
             } else {
                 if ($day) {
                     $ts = jalali_mktime(0, 0, 0, $month, $day, $year);
@@ -457,6 +457,9 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
 } else if (preg_match(PAT_ABOUT, $uri, $matches)) {
     $serendipity['GET']['action'] = 'about';
     include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
+} else if (preg_match(PAT_BREAKFAST, $uri, $matches)) {
+    $serendipity['GET']['action'] = 'breakfast';
+    include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
 } else if (preg_match(PAT_GALLERY, $uri, $matches)) {
     $serendipity['GET']['action'] = 'gallery';
     include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
index 5ea86216e434c4f8153e2b322d49cee23c4035d5..3f64af507a11ad43894eac87a24818fb2a784d76 100644 (file)
@@ -53,6 +53,7 @@
 @define('NEW_ENTRY', 'New Entry');
 @define('EDIT_ENTRIES', 'Edit Entries');
 @define('CATEGORIES', 'Categories');
+@define('BREAKFAST', 'Breakfast');
 @define('WARNING_THIS_BLAHBLAH', "WARNING:\\nThis may take a long time if there are many images without thumbnails.");
 @define('CREATE_THUMBS', 'Rebuild Thumbs');
 @define('MANAGE_IMAGES', 'Manage Images');
index 12c3befcbb7a5d666e9f235d125bfa0ce5e20d7a..ff97737abd7e6ab652c7f0488a9b533f98bd9357 100644 (file)
@@ -53,6 +53,7 @@
 @define('NEW_ENTRY', 'New Entry');
 @define('EDIT_ENTRIES', 'Edit Entries');
 @define('CATEGORIES', 'Categories');
+@define('BREAKFAST', 'Breakfast');
 @define('WARNING_THIS_BLAHBLAH', "WARNING:\\nThis may take a long time if there are many images without thumbnails.");
 @define('CREATE_THUMBS', 'Rebuild Thumbs');
 @define('MANAGE_IMAGES', 'Manage Images');
diff --git a/plugins/serendipity_plugin_breakfast/admin.inc.php b/plugins/serendipity_plugin_breakfast/admin.inc.php
new file mode 100644 (file)
index 0000000..15ec874
--- /dev/null
@@ -0,0 +1,122 @@
+<?
+if (IN_serendipity !== true) {
+    die ("Don't hack!");
+}
+
+require_once(dirname(__FILE__).'/lib.php');
+
+switch ($serendipity['GET']['adminAction']) {
+
+ case 'new':
+     echo '
+    <form action="?" method="get">
+        <input type="hidden" name="serendipity[action]"      value="admin"      />
+        <input type="hidden" name="serendipity[adminModule]" value="breakfast"    />
+        <input type="hidden" name="serendipity[adminAction]" value="save" />
+        <table>
+          <tr>
+              <td><input type="text" name="date" value="'.date('Y-m-d') .'" />
+                  '.breakfast_cafe_dropdown() .' or <input type="text" name="cafe_free"  /></td>
+          </tr>
+          <tr>
+              <td><textarea name="comment" rows="4" cols="70"></textarea></td>
+          </tr>
+';
+     for ($i = 0; $i < 10; $i++) {
+     echo '
+          <tr>
+              <td><hr /></td>
+          </tr>
+          <tr>
+              <td>'.breakfast_person_dropdown($i) .' or <input type="text" name="person_free'.$i.'" />
+                  had '. breakfast_menu_dropdown($i) .' or <input type="text" name="meal_free'.$i.'" /></td>
+          </tr>
+          <tr>
+              <td>'. breakfast_scoring_dropdowns($i).'</td>
+          </tr>
+          <tr>
+              <td><input type="text" name="comment'.$i.'" size="70" /></td>
+          </tr>
+';
+     }
+
+
+echo '
+          <tr>
+              <td><input type="submit" value="Save" />
+          </tr>
+     </table>
+     </form>
+';
+ break; 
+ case 'save':
+     // get the categories, we need these
+     $categories = serendipity_db_query('SELECT * FROM mbg_category');
+     // cafe first..
+     if (!empty($_GET['cafe_free'])) {
+         $sql = 'INSERT INTO mbg_cafe (name) values (\''.$_GET['cafe_free'].'\')';
+         serendipity_db_query($sql);
+         $cafeid = serendipity_db_insert_id();
+     } else {
+         $cafeid = $_GET['cafe'];
+     }
+
+     $date = strtotime($_GET['date']);
+
+     // make an event.
+     serendipity_db_query('INSERT INTO mbg_event (date,cafe'.((!empty($_GET['comment'])) ? ',comment' : '').')
+             VALUES ('.$date.','.$cafeid.((!empty($_GET['comment'])) ? ',\''.$_GET['comment'].'\'' : '').')');
+     $eventid = serendipity_db_insert_id();
+
+     for ($i = 0; $i < 10; $i++) {
+         // person, meal, then scores.
+         if (empty($_GET['person'.$i]) && empty($_GET['person_free'.$i])) {
+             continue;
+         }
+         // new people first
+         if (!empty($_GET['person_free'.$i])) {
+             // look for an alias
+             $sql = 'INSERT INTO mbg_person (name';
+             $values = ' VALUES (\'';
+             if (preg_match('/([a-zA-Z0-9]*)\s\(([^\)]*)\)/',$_GET['person_free'.$i],$matches)) {
+                 $sql .= ',alias';
+                 $values .= $matches[1].'\',\''.$matches[2];
+             } else {
+                 $values .= $_GET['person_free'.$i];
+             } 
+             $sql .= ') '.$values.'\') ';
+             serendipity_db_query($sql);
+             $personid = serendipity_db_insert_id();
+         } else {
+             $personid = $_GET['person'.$i];
+         }
+         if (!empty($_GET['meal_free'.$i])) {
+             $sql = 'INSERT INTO mbg_meal (cafe, name) VALUES ('.$cafeid.',\''.$_GET['meal_free'.$i].'\');';
+             serendipity_db_query($sql);
+             $mealid = serendipity_db_insert_id();
+         } else {
+             $mealid = $_GET['meal'.$i];
+         }
+         // now we can make an attendee... then just score to go
+         $sql = "INSERT INTO mbg_attendee (event,person,ate,comment) VALUES ($eventid,$personid,$mealid,".
+             ((!empty($_GET['comment'.$i])) ? "'".$_GET['comment'.$i]."'" : 'null')
+             .')';
+         serendipity_db_query($sql);
+         $attendee = serendipity_db_insert_id();
+         foreach ($categories as $cat) {
+             //score-catid-$i
+             if (!empty($_GET['score-'.$cat['id'].'-'.$i])) {
+                 $score = $_GET['score-'.$cat['id'].'-'.$i];
+                 $sql = "INSERT INTO mbg_score (attendee, category, score) VALUES ($attendee,".$cat['id'].",$score)";
+                 serendipity_db_query($sql);
+             }
+         }
+         echo 'Saved!';
+     }
+     
+     break;
+}
+
+
+
+?>
\ No newline at end of file
diff --git a/plugins/serendipity_plugin_breakfast/lang_en.inc.php b/plugins/serendipity_plugin_breakfast/lang_en.inc.php
new file mode 100644 (file)
index 0000000..1f4e885
--- /dev/null
@@ -0,0 +1,4 @@
+<?php
+define('PLUGIN_BREAKFAST_TITLE','mbg');
+define('PLUGIN_BREAKFAST_DESC','mbg breakfast');
+?>
\ No newline at end of file
diff --git a/plugins/serendipity_plugin_breakfast/lib.php b/plugins/serendipity_plugin_breakfast/lib.php
new file mode 100644 (file)
index 0000000..bca5978
--- /dev/null
@@ -0,0 +1,106 @@
+<?
+if (IN_serendipity !== true) {
+    die ("Don't hack!");
+}
+
+
+function breaKfast_cafe_dropdown() {
+    $output = '
+    <select name="cafe">
+        <option value="0">-- Cafe --</option>';
+    $results = serendipity_db_query('SELECT * FROM mbg_cafe');
+    foreach ($results as $r) {
+        $output .='<option value="'.$r['id'].'">'.$r['name'].'</option>';
+    }                              
+    $output .= '</select>';
+    return $output;
+}
+function breakfast_person_dropdown($count) {
+    static $people;
+    if (empty($people)) {
+        $people = serendipity_db_query('SELECT * FROM mbg_person');        
+    }
+    $output = '
+    <select name="person'.$count.'">
+        <option value="0">-- Person --</option>';
+    foreach ($people as $person) {
+        $output .= '<option value="'.$person['id'].'">'.$person['name'].((!empty($person['alias'])) ? '('.$person['alias'].')' : '').'</option>';
+    }                              
+    $output .= '</select>';
+    return $output;
+}
+function breakfast_menu_dropdown($count) {
+    static $menu;
+    if (empty($menu)) {
+        $menu = serendipity_db_query('SELECT m.id,m.name,c.name as cafe FROM mbg_meal m LEFT JOIN mbg_cafe c ON m.cafe = c.id'); 
+    }
+    $output = '
+    <select name="meal'.$count.'">
+        <option value="0">-- Meal --</option>';
+    foreach ($menu as $item) {
+        $output .= '<option value="'.$item['id'].'">'.((!empty($item['cafe'])) ? '('.$item['cafe'].')' : '').$item['name'].'</option>';
+    }                              
+    $output .= '</select>';
+    return $output;
+}
+function breakfast_scoring_dropdowns($count) {
+    static $categories;
+    if (empty($categories)) {
+        $categories = serendipity_db_query('SELECT * FROM mbg_category');
+    }
+    $output = '';
+    foreach ($categories as $i => $c) {
+        $output .= $c['category'].' ('.$c['weight'].') : <input size="2" maxlength="2" type="text" name="score-'.$c['id'].'-'.$count.'" /> ';
+        if ($i == 3) {
+            $output .= '<br />';
+        }
+    }
+    return $output;
+    
+}
+
+function breakfast_get_latest() {
+    $sql = 'SELECT c.name, e.date, e.id as event, count(a.id) as num FROM mbg_cafe c 
+            JOIN mbg_event e ON e.cafe = c.id 
+            JOIN mbg_attendee a ON a.event = e.id GROUP BY a.event';
+    if (!$latest = serendipity_db_query($sql,true)) {
+        return false;
+    }
+    $sql = 'SELECT p.name,p.alias,m.name as meal, a.id FROM mbg_attendee a JOIN mbg_person p ON a.person = p.id JOIN mbg_meal m ON a.ate = m.id 
+            WHERE a.event = '.$latest['event'].' ORDER BY rand() LIMIT 1';
+    $latest['random'] = serendipity_db_query($sql,true);
+    $sql = 'SELECT s.score,c.weight,c.category FROM mbg_score s JOIN mbg_category c ON s.category = c.id WHERE s.attendee = '.$latest['random']['id'];
+    $latest['random']['scores'] = serendipity_db_query($sql);
+    $sql = 'SELECT sum(s.score) as score, sum(c.weight) as weight FROM mbg_score s 
+            JOIN mbg_category c ON s.category = c.id 
+            JOIN mbg_attendee a ON s.attendee = a.id WHERE a.event = '.$latest['event'].' GROUP BY s.attendee';
+    $totals = serendipity_db_query($sql);
+    $num = 0;
+    $grandtotal = 0;
+    $min = 100;
+    $max = 0;
+    $thistotal = 0;
+    foreach ($totals as $total) {
+        if ($total['weight'] != 100) {
+            $thistotal = (($total['score']/$total['weight']) * 100);
+            $grandtotal += $thistotal;
+        }
+        else {
+            $grandtotal += $total['score'];
+            $thistotal = $total['score'];
+        }
+        $num++;
+        if ($thistotal < $min) {
+            $min = $thistotal;
+        }
+        if ($thistotal > $max) {
+            $max = $thistotal;
+        }
+    }
+    $latest['total'] = $grandtotal/$num;
+    $latest['min'] = $min;
+    $latest['max'] = $max;
+    return $latest;
+}
+
+?>
\ 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
new file mode 100644 (file)
index 0000000..ea93883
--- /dev/null
@@ -0,0 +1,169 @@
+<?php
+
+require_once(dirname(__FILE__) . '/lang_en.inc.php');
+require_once(dirname(__FILE__) . '/lib.php');
+
+class serendipity_plugin_breakfast extends serendipity_plugin
+{
+    var $tags  = array();
+    var $title = PLUGIN_BREAKFAST_TITLE;
+
+    function introspect(&$propbag)
+    {
+        global $serendipity;
+
+        $propbag->add('name',          PLUGIN_BREAKFAST_TITLE);
+        $propbag->add('description',   PLUGIN_BREAKFAST_DESC);
+        $propbag->add('stackable',     false);
+        $propbag->add('author',        'Penny Leach');
+        $propbag->add('requirements',  array(
+            'serendipity' => '0.8',
+            'smarty'      => '2.6.7',
+            'php'         => '4.1.0'
+        ));
+        $propbag->add('version',       '1.0');
+        $propbag->add('plugin_hooks',    array());
+    }
+
+    function introspect_config_item($name, &$propbag)
+    {     
+        return true;
+    }
+
+    function generate_content(&$title) {
+        if (!$latest = breakfast_get_latest()) {
+            return false;
+        }
+        $title = $this->title;
+        echo '
+<table>
+  <tr>
+    <td colspan="2" nowrap="nowrap"><b>Most recent breakfast:</b></td>
+  </tr>
+  <tr>
+    <td colspan="2">'.$latest['name'].' on '.date('j F Y',$latest['date']).' with '.$latest['num'].' people</td>
+  </tr>
+  <tr>
+    <td colspan="2"><b>'.((!empty($latest['random']['alias'])) ? $latest['random']['alias'] : $latest['random']['name'])
+            .' had \''.$latest['random']['meal'].'\':</b></td>
+  </tr>';
+        $total = 0;
+        $totalweight = 0;
+        foreach ($latest['random']['scores'] as $score) {
+            echo '  <tr>
+    <td>'.$score['category'].':</td><td>'.$score['score'].'/'.$score['weight'].'</td>
+  </tr>';
+            $total += $score['score'];
+            $totalweight += $score['weight'];
+        }
+        if ($totalweight != 100) {
+            $total = ($total/$totalweight) * 100;
+        }
+        echo '  <tr>
+    <td>Total</td><td>'.$total.'%</td>
+  </tr>
+  <tr>
+    <td colspan="2"><b>The group gave:</td>
+  </tr>
+  <tr>
+    <td>Min:</td><td>'.$latest['min'].'%</td>
+  </tr>
+  <tr>
+    <td>Max:</td><td>'.$latest['max'].'%</td>
+  </tr>
+  <tr>
+    <td>Avergage:</td><td>'.$latest['total'].'%</td>
+  </tr>
+  <tr>
+      <td nowrap="nowrap" colspan="2"><a href="/breakfast/">What the hell is this?</a></td>
+  </tr>
+</table>';
+        return;
+    }
+
+    function tableCreated()  {
+        global $serendipity;
+
+        $q = "select count(id) from mbg_category";
+        $row = serendipity_db_query($q, true, 'num');
+
+        if (!is_numeric($row[0])) {        // if the response we got back was an SQL error.. :P
+            return false;
+        } else {
+            return true;
+        }
+    }
+
+    function install() {
+        global $serendipity;
+
+        if (!serendipity_plugin_breakfast::tableCreated()) {
+            $qs = $this->getcreatesql();
+            foreach ($qs as $q) {
+                $result =  serendipity_db_schema_import($q);
+            }
+            serendipity_db_query('INSERT INTO mbg_category (category, weight) VALUES (\'Eggs\',10);');
+            serendipity_db_query('INSERT INTO mbg_category (category, weight) VALUES (\'Meat\',10);');
+            serendipity_db_query('INSERT INTO mbg_category (category, weight) VALUES (\'Hygiene\',10);');
+            serendipity_db_query('INSERT INTO mbg_category (category, weight) VALUES (\'Atmosphere\',10);');
+            serendipity_db_query('INSERT INTO mbg_category (category, weight) VALUES (\'Food overall\',20);');
+            serendipity_db_query('INSERT INTO mbg_category (category, weight) VALUES (\'Coffee\',20);');
+            serendipity_db_query('INSERT INTO mbg_category (category, weight) VALUES (\'Service\',20);');    
+        }
+        return true;
+    }
+
+    function getcreatesql() {
+        return array(
+                   'CREATE TABLE mbg_cafe (
+       id int(10) not null auto_increment,
+       name varchar(50) not null,
+       address varchar(100),
+       url varchar(100),
+       PRIMARY KEY (id)
+);',
+                   'CREATE TABLE mbg_meal (
+       id int(10) not null auto_increment,
+       cafe int(10),
+       name varchar(50),
+       PRIMARY KEY (id)
+);',
+                   'CREATE TABLE mbg_person (
+       id int(10) not null auto_increment,
+       name varchar(50) not null,
+       alias varchar(100),
+       PRIMARY KEY (id)
+);',
+                   'CREATE TABLE mbg_event (
+       id int(10) not null auto_increment,
+       date int(10) not null,
+       cafe int(10) not null,
+       comment text,
+       PRIMARY KEY (id)
+);',
+                   'CREATE TABLE mbg_attendee (
+       id int(10) not null auto_increment,
+       event int(10) not null,
+       person int(10) not null,
+       ate int(10) not null,
+       comment text,
+       PRIMARY KEY (id)
+);',
+                   'CREATE TABLE mbg_category (
+       id int(10) not null auto_increment,
+       category varchar(20) not null,
+       weight int(2),
+       PRIMARY KEY (id)
+);',
+                   'CREATE TABLE mbg_score (
+       id int(10) not null auto_increment,
+       attendee int(10) not null,
+       category int (10) not null,
+       score int(2) not null,
+       PRIMARY KEY (id)
+);',
+                   );                   
+    }
+}
+
+/* vim: set sts=4 ts=4 expandtab : */
index 71297351c0a706864f2d24e6a29aa9e080725e5e..87357e65ee35c4845334f5eb263f78e5a8d12e36 100644 (file)
@@ -176,6 +176,7 @@ if (!isset($serendipity['serendipityPath']) || IS_installed === false || IS_up2d
 <?php if (serendipity_checkPermission('adminCategories')) { ?>
                         <li><a href="serendipity_admin.php?serendipity[adminModule]=category&amp;serendipity[adminAction]=view"><?php echo CATEGORIES; ?></a></li>
 <?php } ?>
+                        <li><a href="serendipity_admin.php?serendipity[adminModule]=breakfast&amp;serendipity[adminAction]=new"><?php echo BREAKFAST; ?></a></li>
                         <?php if ($serendipity['no_create'] !== true) serendipity_plugin_api::hook_event('backend_sidebar_entries', $serendipity); ?>
                     </ul>
 <?php } ?>
@@ -356,7 +357,10 @@ if (!isset($serendipity['serendipityPath']) || IS_installed === false || IS_up2d
         case 'logout':
             echo LOGGEDOUT;
             break;
-
+        case 'breakfast':
+            include S9Y_INCLUDE_PATH . 'plugins/serendipity_plugin_breakfast/admin.inc.php';
+            break;
+               
         default:
             include S9Y_INCLUDE_PATH . 'include/admin/overview.inc.php';
             break;