Changeset 873 for trunk/Modules/Meals
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Meals/Meals.php
r790 r873 13 13 function Show() 14 14 { 15 if (count($this->System->PathItems) > 1)16 { 17 if ($this->System->PathItems[1] == 'tisk') return($this->ShowPrint());18 else if ($this->System->PathItems[1] == 'menuedit.php') return($this->ShowEdit());19 else return (PAGE_NOT_FOUND);20 } else return ($this->ShowMenu());15 if (count($this->System->PathItems) > 1) 16 { 17 if ($this->System->PathItems[1] == 'tisk') return ($this->ShowPrint()); 18 else if ($this->System->PathItems[1] == 'menuedit.php') return ($this->ShowEdit()); 19 else return (PAGE_NOT_FOUND); 20 } else return ($this->ShowMenu()); 21 21 } 22 22 … … 26 26 $Output = '<table align="center" class="WideTable"><tr><th>Den</th><th>Datum</th><th>Polévka</th><th>Hlavní jídlo</th></tr>'; 27 27 $DbResult = $this->Database->select('Meals', '*, UNIX_TIMESTAMP(Date)','Date >= NOW() ORDER BY Date'); 28 while ($Row = $DbResult->fetch_array())29 { 30 if ($Row['Status'] == 1) $Output .= '<tr><td>'.$this->DayNames[date('w', $Row['UNIX_TIMESTAMP(Date)'])].'</td><td align="right">'.HumanDate($Row['Date']).'</td><td>'.$Row['Soup'].'</td><td>'.$Row['Meal'].'</td></tr>';31 else if (($Row['Status' ] == 2) or ($Row['Status'] == 3))28 while ($Row = $DbResult->fetch_array()) 29 { 30 if ($Row['Status'] == 1) $Output .= '<tr><td>'.$this->DayNames[date('w', $Row['UNIX_TIMESTAMP(Date)'])].'</td><td align="right">'.HumanDate($Row['Date']).'</td><td>'.$Row['Soup'].'</td><td>'.$Row['Meal'].'</td></tr>'; 31 else if (($Row['Status' ] == 2) or ($Row['Status'] == 3)) 32 32 { 33 33 $Output .= '<tr><td>'.$this->DayNames[date('w', $Row['UNIX_TIMESTAMP(Date)'])].'</td><td align="right">'.HumanDate($Row['Date']).'</td><td colspan="2" align="center">'.$this->Status[$Row['Status']].'</td></tr>'; … … 40 40 $Output .= 'Cena jednoho menu: '.$Row['Price'].' Kč<br />'; 41 41 $Output .= $Row['Info']; 42 return ($Output);42 return ($Output); 43 43 } 44 44 … … 66 66 $Date = explode('-', $_GET['date']); 67 67 $Time2 = mktime(0, 0, 0, $Date[1], $Date[2], $Date[0]); 68 for ($I = 0; $I < 5; $I++)68 for ($I = 0; $I < 5; $I++) 69 69 { 70 70 $Time = $Time2 + $I * 86400; … … 74 74 $Row = $DbResult->fetch_array(); 75 75 $Output .= '<tr><td style="border-style: solid; border-color: black; border-width: 2; font-size: xx-large;" width="10%">'.$this->DayNamesShort[$DayOfWeek].'</td><td style="font-size: x-large; border-style: solid; border-color: black; border-width: 2;" width="90%">'; 76 if ($Row['Status'] == 0) $Output .= ' <br><br> ';77 if ($Row['Status'] == 1) $Output .= 'Polévka: '.$Row['Soup'].'<br><br>'.$Row['Meal'];78 else if (($Row['Status'] == 2) or ($Row['Status'] == 3))76 if ($Row['Status'] == 0) $Output .= ' <br><br> '; 77 if ($Row['Status'] == 1) $Output .= 'Polévka: '.$Row['Soup'].'<br><br>'.$Row['Meal']; 78 else if (($Row['Status'] == 2) or ($Row['Status'] == 3)) 79 79 { 80 80 $Output .= '<br>'.$this->Status[$Row['Status']].'<br> '; … … 91 91 92 92 $Output .= '</body></html>'; 93 return ($Output);93 return ($Output); 94 94 } 95 95 … … 103 103 $Week = date('w', mktime(0, 0, 0, $Date[1], $Date[2], $Date[0])); 104 104 $WeekOfYear = date('W', mktime(0, 0, 0, $Date[1], $Date[2], $Date[0])); 105 if ($WeekOfYear != $LastWeekOfYear)105 if ($WeekOfYear != $LastWeekOfYear) 106 106 $WeekRowSpan = '<td align="center" rowspan="'.(7 - (($Week + 7 - 1) % 7)).'">'. 107 107 $WeekOfYear.'<br /><a href="tisk/?date='. … … 109 109 '">Tisk</a></td>'; 110 110 else $WeekRowSpan = ''; 111 if ($Week == 0) $Color = ' style="color: #ff0000;" '; else $Color = '';111 if ($Week == 0) $Color = ' style="color: #ff0000;" '; else $Color = ''; 112 112 $Output = '<tr><td'.$Color.'>'.$this->DayNames[$Week].'</td><td>'.HumanDate($Row['Date']).'</td>'.$WeekRowSpan.' 113 113 <td><input name="soup_'.$Row['Date'].'" size="30" value="'.$Row['Soup'].'"></td> 114 114 <td><input name="meal_'.$Row['Date'].'" size="30" value="'.$Row['Meal'].'"></td> 115 115 <td><select name="status_'.$Row['Date'].'">'; 116 for ($I = 0; $I < 4; $I++) $Output .= ' <option '.$Selected[$I].'value="'.$I.'">'.$this->Status[$I].'</option>';116 for ($I = 0; $I < 4; $I++) $Output .= ' <option '.$Selected[$I].'value="'.$I.'">'.$this->Status[$I].'</option>'; 117 117 $Output .= '</select></td></tr>'; 118 118 $LastWeekOfYear = $WeekOfYear; 119 return ($Output);119 return ($Output); 120 120 } 121 121 … … 125 125 126 126 $Output = ''; 127 if (array_key_exists('action', $_GET))128 { 129 if ($_GET['action'] == 'savemenu')130 { 131 for ($I = 0; $I < $this->DayCount; $I++)127 if (array_key_exists('action', $_GET)) 128 { 129 if ($_GET['action'] == 'savemenu') 130 { 131 for ($I = 0; $I < $this->DayCount; $I++) 132 132 { 133 133 $Time = time() + $I * 86400; … … 138 138 $this->System->ModuleManager->Modules['Log']->NewRecord('EatingPlace', 'MenuSave'); 139 139 } 140 if ($_GET['action'] == 'saveinfo')140 if ($_GET['action'] == 'saveinfo') 141 141 { 142 142 $this->Database->delete('MealsInfo', '1'); … … 149 149 <fieldset><legend>Jídlo pro jednotlivé dny</legend> 150 150 <table align="center" class="WideTable"><tr><th>Den</th><th>Datum</th><th>Týden</th><th>Polévka</th><th>Hlavní jídlo</th><th>Stav</th></tr>'; 151 for ($I = 0; $I < $this->DayCount; $I++)151 for ($I = 0; $I < $this->DayCount; $I++) 152 152 { 153 153 $Time = time() + $I * 86400; 154 154 $DbResult = $this->Database->select('Meals', '*', 'Date = "'.date('Y-m-d', $Time).'"'); 155 if ($Row = $DbResult->fetch_array())155 if ($Row = $DbResult->fetch_array()) 156 156 $Output .= $this->PrintTableRow($Row); 157 157 else … … 173 173 '<div align="center"><input type="submit" value="Uložit údaje"></div> 174 174 </fieldset></form>'; 175 return ($Output);175 return ($Output); 176 176 } 177 177 }
Note:
See TracChangeset
for help on using the changeset viewer.