Changeset 99
- Timestamp:
- Aug 1, 2008, 9:23:03 AM (16 years ago)
- Location:
- devel/www/jidelna
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/www/jidelna/index.php
r89 r99 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 -
devel/www/jidelna/menuedit.php
r89 r99 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 $FullTitle = 'Jídleníček jídelny Na kopečku'; 7 var $ShortTitle = 'Editace jídelníčku'; 8 var $DayNames = array('Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'); 9 var $Status = array('Nezveřejněno', 'Otevřeno', 'Zavřeno - svátek', 'Zavřeno - dovolená'); 10 var $DayCount = 20; // počet dopředu zobrazených dnů 9 11 10 function PrintTableRow($Row)11 {12 global $Dny, $Status,$LastWeekOfYear;12 function PrintTableRow($Row) 13 { 14 global $LastWeekOfYear; 13 15 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; 16 $Selected = array('', '', '', ''); 17 $Selected[$Row['Status']] = 'selected '; 18 $Date = explode('-', $Row['Date']); 19 $Week = date('w', mktime(0, 0, 0, $Date[1], $Date[2], $Date[0])); 20 $WeekOfYear = date('W', mktime(0, 0, 0, $Date[1], $Date[2], $Date[0])); 21 if($WeekOfYear != $LastWeekOfYear) 22 $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>'; 23 else $WeekRowSpan = ''; 24 if($Week == 0) $Color = ' style="color: #ff0000;" '; else $Color = ''; 25 $Output = '<tr><td'.$Color.'>'.$this->DayNames[$Week].'</td><td>'.HumanDate($Row['Date']).'</td>'.$WeekRowSpan.' 26 <td><input name="soup_'.$Row['Date'].'" size="30" value="'.$Row['Soup'].'"></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++) $Output .= ' <option '.$Selected[$I].'value="'.$I.'">'.$this->Status[$I].'</option>'; 30 $Output .= '</select></td></tr>'; 31 $LastWeekOfYear = $WeekOfYear; 32 return($Output); 33 } 34 35 function Show() 36 { 37 Header('Cache-Control: no-cache'); 38 39 $Output = ''; 40 if(array_key_exists('action', $_GET)) 41 { 42 if($_GET['action'] == 'savemenu') 43 { 44 for($I = 0; $I < $this->DayCount; $I++) 45 { 46 $Time = time() + $I * 86400; 47 $Date = date('Y-m-d', $Time); 48 $this->Database->replace('Meals', array('Date' => $Date, 'Meal' => $_POST['meal_'.$Date], 'Soup' => $_POST['soup_'.$Date], 'Status' => $_POST['status_'.$Date])); 49 } 50 $Output .= '<div style="color: red; font-size: larger;">Menu uloženo!</div>'; 51 } 52 if($_GET['action'] == 'saveinfo') 53 { 54 $this->Database->delete('MealsInfo', '1'); 55 $this->Database->insert('MealsInfo', array('Info' => $_POST['info'], 'Price' => $_POST['price'])); 56 $Output .= '<div style="color: red; font-size: larger;">Informační údaje uloženy!</div>'; 57 } 58 } 59 $Output = '<form action="menuedit.php?action=savemenu" method="post"> 60 <fieldset><legend>Jídlo pro jednotlivé dny</legend> 61 <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>'; 62 for($I = 0; $I < $this->DayCount; $I++) 63 { 64 $Time = time() + $I * 86400; 65 $DbResult = $this->Database->select('Meals', '*', 'Date = "'.date('Y-m-d', $Time).'"'); 66 if($Row = $DbResult->fetch_array()) 67 $Output .= $this->PrintTableRow($Row); 68 else 69 { 70 $Row = array('Status' => 0, 'Meal' => '', 'Soup' => '', 'Date' => date('Y-m-d', $Time)); 71 $Output .= $this->PrintTableRow($Row); 72 } 73 } 74 $Output .= '</table><br /> 75 <div align="center"><input type="submit" value="Uložit menu"></div> 76 </fieldset></form>'; 77 $Output .= '<form action="menuedit.php?action=saveinfo" method="post"> 78 <fieldset><legend>Informační údaje</legend>'; 79 80 $DbResult = $this->Database->select('MealsInfo', '*'); 81 $Row = $DbResult->fetch_array(); 82 $Output .= '<textarea name="info" rows="20" cols="80" >'.$Row['Info'].'</textarea><br />'. 83 'Cena: <input type="text" name="price" size="5" value="'.$Row['Price'].'"> Kč<br />'. 84 '<div align="center"><input type="submit" value="Uložit údaje"></div> 85 </fieldset></form>'; 86 return($Output); 87 } 32 88 } 33 89 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> 90 $System->AddModule(new EatingPlaceEdit()); 91 $System->Modules['EatingPlaceEdit']->GetOutput(); 57 92 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 93 ?> 85 94 -
devel/www/jidelna/tisk.php
r89 r99 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.