Changeset 149
- Timestamp:
- Feb 15, 2009, 8:07:45 PM (16 years ago)
- Location:
- www
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
www/jidelna/index.php
r4 r149 1 1 <?php 2 include_once('../style.php');3 2 include_once('../global.php'); 4 ShowHeader('Jídleníček jídelny Na kopečku','Jídelníček');5 3 6 $Dny = array('Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'); 7 $Status = array('Nezveřejněno', 'Otevřeno', 'Zavřeno - svátek', 'Zavřeno - dovolená'); 4 class EatingPlace extends Page 5 { 6 var $FullTitle = 'Jídleníček jídelny Na kopečku'; 7 var $ShortTitle = 'Jídelníček'; 8 8 9 //echo('Dnes je '.HumanDate(date('Y-m-d')).'<br>'); 10 echo('<table align="center" border="1" cellspacing="0" cellpadding="5"><tr><th>Den</th><th>Datum</th><th>Polévka</th><th>Hlavní jídlo</th></tr>'); 11 $DbResult = $Database->select('meals','*,UNIX_TIMESTAMP(date)','date>=NOW() ORDER BY date'); 12 while($Row = $DbResult->fetch_array()) 13 { 14 if($Row['status']==1) echo('<tr><td>'.$Dny[date('w',$Row['UNIX_TIMESTAMP(date)'])].'</td><td align="right">'.HumanDate($Row['date']).'</td><td>'.$Row['soap'].'</td><td>'.$Row['meal'].'</td></tr>'); 15 else if(($Row['status']==2) or ($Row['status']==3)) 9 function Show() 16 10 { 17 echo('<tr><td>'.$Dny[date('w',$Row['UNIX_TIMESTAMP(date)'])].'</td><td align="right">'.HumanDate($Row['date']).'</td><td colspan="2" align="center">'.$Status[$Row['status']].'</td></tr>'); 18 } 11 $Dny = array('Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'); 12 $Status = array('Nezveřejněno', 'Otevřeno', 'Zavřeno - svátek', 'Zavřeno - dovolená'); 13 14 //echo('Dnes je '.HumanDate(date('Y-m-d')).'<br>'); 15 $Output = '<table align="center" border="1" cellspacing="0" cellpadding="5"><tr><th>Den</th><th>Datum</th><th>Polévka</th><th>Hlavní jídlo</th></tr>'; 16 $DbResult = $this->Database->select('Meals', '*, UNIX_TIMESTAMP(Date)','Date >= NOW() ORDER BY Date'); 17 while($Row = $DbResult->fetch_array()) 18 { 19 if($Row['Status'] == 1) $Output .= '<tr><td>'.$Dny[date('w', $Row['UNIX_TIMESTAMP(Date)'])].'</td><td align="right">'.HumanDate($Row['Date']).'</td><td>'.$Row['Soup'].'</td><td>'.$Row['Meal'].'</td></tr>'; 20 else if(($Row['status' ] == 2) or ($Row['status'] == 3)) 21 { 22 $Output .= '<tr><td>'.$Dny[date('w',$Row['UNIX_TIMESTAMP(Date)'])].'</td><td align="right">'.HumanDate($Row['Date']).'</td><td colspan="2" align="center">'.$Status[$Row['Status']].'</td></tr>'; 23 } 24 } 25 $Output .= '</table><br />'; 26 27 $DbResult = $this->Database->select('MealsInfo', '*'); 28 $Row = $DbResult->fetch_array(); 29 $Output .= 'Cena jednoho menu: '.$Row['Price'].' Kč<br />'; 30 $Output .= $Row['Info']; 31 return($Output); 32 } 19 33 } 20 echo('</table><br>');21 34 22 $DbResult = $Database->select('meals_info','*'); 23 $Row = $DbResult->fetch_array(); 24 echo('Cena jednoho menu: '.$Row['price'].' Kč<br>'); 25 echo($Row['info']); 26 /* 27 echo('Pracovní doba: 7:00 - 14:00<br> 28 Výdej obědů: 11:00 - 12:00<br> 29 Přihlašování nebo odhlášení nejpozději den předem.<br> 30 <br> 31 <strong>Kontakt:</strong><br> 32 Baroňová, Šťastná<br> 33 Telefon: 571449274<br> 34 <br> 35 Ceny smluvní<br> 36 Cena jednoho menu 50 Kč<br> 37 <br>'); 38 echo('<strong>Provozovatel:</strong><br> 39 Jídelna Na kopečku<br> 40 Josef Polách<br> 41 Králova 1051, 75601, Valašské Meziříčí<br> 42 tel. 0657/649274 (není staré?)<br> 43 IČO: 1363036 (zkontrolovat)<br> 44 DIČ: 405-440920471(zkontrolovat)<br>'); 45 */ 35 $System->AddModule(new EatingPlace()); 36 $System->Modules['EatingPlace']->GetOutput(); 46 37 47 ShowFooter();48 38 ?> 49 39 -
www/jidelna/menuedit.php
r29 r149 1 1 <?php 2 include_once('../style.php'); 3 Header('Cache-Control: no-cache'); 4 ShowHeader('Jídleníček jídelny Na kopečku','Editace jídelníčku'); 2 include_once('../global.php'); 5 3 6 $Dny = array('Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'); 7 $Status = array('Nezveřejněno', 'Otevřeno', 'Zavřeno - svátek', 'Zavřeno - dovolená'); 8 $Count = 20; // počet dopředu zobrazených dnů 4 class EatingPlaceEdit extends Page 5 { 6 var $Dependencies = array('Log'); 7 var $FullTitle = 'Jídleníček jídelny Na kopečku'; 8 var $ShortTitle = 'Editace jídelníčku'; 9 var $DayNames = array('Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'); 10 var $Status = array('Nezveřejněno', 'Otevřeno', 'Zavřeno - svátek', 'Zavřeno - dovolená'); 11 var $DayCount = 20; // počet dopředu zobrazených dnů 9 12 10 function PrintTableRow($Row)11 {12 global $Dny, $Status,$LastWeekOfYear;13 function PrintTableRow($Row) 14 { 15 global $LastWeekOfYear; 13 16 14 $Selected = array('','','',''); 15 $Selected[$Row['status']] = 'selected '; 16 $Date = explode('-',$Row['date']); 17 $Week = date('w',mktime(0,0,0,$Date[1],$Date[2],$Date[0])); 18 //$Week = ; 19 $WeekOfYear = date('W',mktime(0,0,0,$Date[1],$Date[2],$Date[0])); 20 if($WeekOfYear != $LastWeekOfYear) 21 $WeekRowSpan = '<td align="center" rowspan="'.(7-(($Week+7-1) % 7)).'">'.$WeekOfYear.'<br><a href="tisk.php?date='.date('Y-m-d',mktime(0,0,0,$Date[1],$Date[2],$Date[0])-($Week-1)*86400).'">Tisk</a></td>'; 22 else $WeekRowSpan = ''; 23 if($Week == 0) $Color = ' style="color: #ff0000;" '; else $Color = ''; 24 echo('<tr><td'.$Color.'>'.$Dny[$Week].'</td><td>'.HumanDate($Row['date']).'</td> 25 '.$WeekRowSpan.' 26 <td><input name="soap_'.$Row['date'].'" size="30" value="'.$Row['soap'].'"></td> 27 <td><input name="meal_'.$Row['date'].'" size="30" value="'.$Row['meal'].'"></td> 28 <td><select name="status_'.$Row['date'].'">'); 29 for($I=0; $I<4; $I++) echo(' <option '.$Selected[$I].'value="'.$I.'">'.$Status[$I].'</option>'); 30 echo('</select></td></tr>'); 31 $LastWeekOfYear = $WeekOfYear; 17 $Selected = array('', '', '', ''); 18 $Selected[$Row['Status']] = 'selected '; 19 $Date = explode('-', $Row['Date']); 20 $Week = date('w', mktime(0, 0, 0, $Date[1], $Date[2], $Date[0])); 21 $WeekOfYear = date('W', mktime(0, 0, 0, $Date[1], $Date[2], $Date[0])); 22 if($WeekOfYear != $LastWeekOfYear) 23 $WeekRowSpan = '<td align="center" rowspan="'.(7 - (($Week + 7 - 1) % 7)).'">'.$WeekOfYear.'<br /><a href="tisk.php?date='.date('Y-m-d', mktime(0, 0, 0, $Date[1], $Date[2], $Date[0]) - ($Week - 1) * 86400).'">Tisk</a></td>'; 24 else $WeekRowSpan = ''; 25 if($Week == 0) $Color = ' style="color: #ff0000;" '; else $Color = ''; 26 $Output = '<tr><td'.$Color.'>'.$this->DayNames[$Week].'</td><td>'.HumanDate($Row['Date']).'</td>'.$WeekRowSpan.' 27 <td><input name="soup_'.$Row['Date'].'" size="30" value="'.$Row['Soup'].'"></td> 28 <td><input name="meal_'.$Row['Date'].'" size="30" value="'.$Row['Meal'].'"></td> 29 <td><select name="status_'.$Row['Date'].'">'; 30 for($I = 0; $I < 4; $I++) $Output .= ' <option '.$Selected[$I].'value="'.$I.'">'.$this->Status[$I].'</option>'; 31 $Output .= '</select></td></tr>'; 32 $LastWeekOfYear = $WeekOfYear; 33 return($Output); 34 } 35 36 function Show() 37 { 38 Header('Cache-Control: no-cache'); 39 40 $Output = ''; 41 if(array_key_exists('action', $_GET)) 42 { 43 if($_GET['action'] == 'savemenu') 44 { 45 for($I = 0; $I < $this->DayCount; $I++) 46 { 47 $Time = time() + $I * 86400; 48 $Date = date('Y-m-d', $Time); 49 $this->Database->replace('Meals', array('Date' => $Date, 'Meal' => $_POST['meal_'.$Date], 'Soup' => $_POST['soup_'.$Date], 'Status' => $_POST['status_'.$Date])); 50 } 51 $Output .= '<div style="color: red; font-size: larger;">Menu uloženo!</div>'; 52 $this->System->Modules['Log']->NewRecord('EatingPlace', 'MenuSave'); 53 } 54 if($_GET['action'] == 'saveinfo') 55 { 56 $this->Database->delete('MealsInfo', '1'); 57 $this->Database->insert('MealsInfo', array('Info' => $_POST['info'], 'Price' => $_POST['price'])); 58 $Output .= '<div style="color: red; font-size: larger;">Informační údaje uloženy!</div>'; 59 $this->System->Modules['Log']->NewRecord('EatingPlace', 'InfoSave'); 60 } 61 } 62 $Output = '<form action="menuedit.php?action=savemenu" method="post"> 63 <fieldset><legend>Jídlo pro jednotlivé dny</legend> 64 <table align="center" border="1" cellspacing="0" cellpadding="5"><tr><th>Den</th><th>Datum</th><th>Týden</th><th>Polévka</th><th>Hlavní jídlo</th><th>Stav</th></tr>'; 65 for($I = 0; $I < $this->DayCount; $I++) 66 { 67 $Time = time() + $I * 86400; 68 $DbResult = $this->Database->select('Meals', '*', 'Date = "'.date('Y-m-d', $Time).'"'); 69 if($Row = $DbResult->fetch_array()) 70 $Output .= $this->PrintTableRow($Row); 71 else 72 { 73 $Row = array('Status' => 0, 'Meal' => '', 'Soup' => '', 'Date' => date('Y-m-d', $Time)); 74 $Output .= $this->PrintTableRow($Row); 75 } 76 } 77 $Output .= '</table><br /> 78 <div align="center"><input type="submit" value="Uložit menu"></div> 79 </fieldset></form>'; 80 $Output .= '<form action="menuedit.php?action=saveinfo" method="post"> 81 <fieldset><legend>Informační údaje</legend>'; 82 83 $DbResult = $this->Database->select('MealsInfo', '*'); 84 $Row = $DbResult->fetch_array(); 85 $Output .= '<textarea name="info" rows="20" cols="80" >'.$Row['Info'].'</textarea><br />'. 86 'Cena: <input type="text" name="price" size="5" value="'.$Row['Price'].'"> Kč<br />'. 87 '<div align="center"><input type="submit" value="Uložit údaje"></div> 88 </fieldset></form>'; 89 return($Output); 90 } 32 91 } 33 92 34 if(array_key_exists('action',$_GET)) 35 { 36 if($_GET['action'] == 'savemenu') 37 { 38 for($I=0; $I<$Count; $I++) 39 { 40 $Time = time() + $I * 86400; 41 $Date = date('Y-m-d', $Time); 42 $Database->replace('meals', array('date' => $Date, 'meal' => $_POST['meal_'.$Date], 'soap' => $_POST['soap_'.$Date], 'status' => $_POST['status_'.$Date])); 43 //echo($Database->error.'<br>'); 44 } 45 echo('<div style="color: red; font-size: larger;">Menu uloženo!</div>'); 46 } 47 if($_GET['action'] == 'saveinfo') 48 { 49 $Database->delete('meals_info','1'); 50 $Database->insert('meals_info',array('info' => $_POST['info'], 'price' => $_POST['price'])); 51 echo('<div style="color: red; font-size: larger;">Informační údaje uloženy!</div>'); 52 } 53 } 54 echo(' 55 <form action="menuedit.php?action=savemenu" method="post"> 56 <fieldset><legend>Jídlo pro jednotlivé dny</legend> 93 $System->AddModule(new EatingPlaceEdit()); 94 $System->Modules['EatingPlaceEdit']->GetOutput(); 57 95 58 <table align="center" border="1" cellspacing="0" cellpadding="5"><tr><th>Den</th><th>Datum</th><th>Týden</th><th>Polévka</th><th>Hlavní jídlo</th><th>Stav</th></tr>');59 for($I=0; $I<$Count; $I++)60 {61 $Time = time()+$I*86400;62 $DbResult = $Database->select('meals','*','date = "'.date('Y-m-d',$Time).'"');63 if($Row = $DbResult->fetch_array())64 PrintTableRow($Row);65 else {66 $Row = array('status' => 0, 'meal' => '', 'soap' => '', 'date' => date('Y-m-d',$Time));67 PrintTableRow($Row);68 }69 }70 echo('</table><br>71 <div align="center"><input type="submit" value="Uložit menu"></div>72 </fieldset></form>');73 echo('<form action="menuedit.php?action=saveinfo" method="post">74 <fieldset><legend>Informační údaje</legend>');75 76 $DbResult = $Database->select('meals_info','*');77 $Row = $DbResult->fetch_array();78 echo('<textarea name="info" rows="20" cols="80" >'.$Row['info'].'</textarea><br>'.79 'Cena: <input type="text" name="price" size="5" value="'.$Row['price'].'"> Kč<br>'.80 '<div align="center"><input type="submit" value="Uložit údaje"></div>81 </fieldset></form>');82 83 ShowFooter();84 96 ?> 85 97 -
www/jidelna/tisk.php
r4 r149 1 1 <?php 2 include_once('../style.php');3 2 include_once('../global.php'); 4 3 echo('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> … … 16 15 //echo('Dnes je '.HumanDate(date('Y-m-d')).'<br>'); 17 16 echo('<table height="99%" width="100%" align="center" border="1" cellspacing="0" cellpadding="3">'); 18 $Date = explode('-', $_GET['date']);17 $Date = explode('-', $_GET['date']); 19 18 echo('<tr><td style="border-bottom-style: solid; border-bottom-color: black; border-bottom-width: 2;" colspan="2"> 20 <table cellspacing="0" cellpadding="0" width="100%"><tr><td width="50%"><strong>DATUM:</strong> '.HumanDate($_GET['date']).' - '.HumanDate(date('Y-m-d',mktime(0, 0,0,$Date[1],$Date[2],$Date[0])+4*86400)).'</td>19 <table cellspacing="0" cellpadding="0" width="100%"><tr><td width="50%"><strong>DATUM:</strong> '.HumanDate($_GET['date']).' - '.HumanDate(date('Y-m-d',mktime(0, 0, 0, $Date[1], $Date[2], $Date[0]) + 4 * 86400)).'</td> 21 20 <td align="right">CENY SMLUVNÍ</td></tr></table> 22 21 <div align="center" style="font-size: xx-large;">„JÍDELNA NA KOPEČKU”</div> 23 22 <div align="center" style="font-size: x-large;">JÍDELNÍČEK</div> 24 23 </td></tr>'); 25 $Date = explode('-', $_GET['date']);26 $Time2 = mktime(0, 0,0,$Date[1],$Date[2],$Date[0]);27 for($I =0; $I< 5; $I++)24 $Date = explode('-', $_GET['date']); 25 $Time2 = mktime(0, 0, 0, $Date[1], $Date[2], $Date[0]); 26 for($I = 0; $I < 5; $I++) 28 27 { 29 $Time = $Time2 + $I *86400;30 $Date = date('Y-m-d', $Time);31 $DayOfWeek = date('w', $Time);32 $DbResult = $Database->select(' meals','*','date="'.$Date.'"');28 $Time = $Time2 + $I * 86400; 29 $Date = date('Y-m-d', $Time); 30 $DayOfWeek = date('w', $Time); 31 $DbResult = $Database->select('Meals', '*', 'Date="'.$Date.'"'); 33 32 $Row = $DbResult->fetch_array(); 34 33 echo('<tr><td style="border-style: solid; border-color: black; border-width: 2; font-size: xx-large;" width="10%">'.$DnyZkratky[$DayOfWeek].'</td><td style="font-size: x-large; border-style: solid; border-color: black; border-width: 2;" width="90%">'); 35 if($Row[' status']==0) echo(' <br><br> ');36 if($Row[' status']==1) echo('Polévka: '.$Row['soap'].'<br><br>'.$Row['meal']);37 else if(($Row['status'] ==2) or ($Row['status']==3))34 if($Row['Status'] == 0) echo(' <br><br> '); 35 if($Row['Status'] == 1) echo('Polévka: '.$Row['Soup'].'<br><br>'.$Row['Meal']); 36 else if(($Row['status'] == 2) or ($Row['status'] == 3)) 38 37 { 39 echo('<br>'.$Status[$Row[' status']].'<br> ');38 echo('<br>'.$Status[$Row['Status']].'<br> '); 40 39 } 41 40 echo('</td></tr>'); 42 41 } 43 $DbResult = $Database->select(' meals_info','*');42 $DbResult = $Database->select('MealsInfo','*'); 44 43 $Row = $DbResult->fetch_array(); 45 44 echo('<tr><td style="border-top-style: solid; border-top-color: black; border-top-width: 2;" colspan="2"><table cellspacing="0" cellpadding="0" width="100%"><tr><td width="50%"><strong>JÍDLA PŘIPRAVIL: BAROŇOVÁ L.</strong></td> 46 45 <td align="right"><strong>PROVOZOVATEL:</strong></td></tr></table> 47 46 <br> 48 <strong>CENA JEDNOHO MENU JE '.$Row[' price'].' Kč</strong></td></tr>');47 <strong>CENA JEDNOHO MENU JE '.$Row['Price'].' Kč</strong></td></tr>'); 49 48 //echo('<tr><td colspan="2">dd</td></tr>'); 50 49 echo('</table>');
Note:
See TracChangeset
for help on using the changeset viewer.