Ignore:
Timestamp:
Apr 6, 2020, 11:17:40 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code format.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Meals/Meals.php

    r790 r873  
    1313  function Show()
    1414  {
    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());
    2121  }
    2222
     
    2626    $Output = '<table align="center" class="WideTable"><tr><th>Den</th><th>Datum</th><th>Polévka</th><th>Hlavní jídlo</th></tr>';
    2727    $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))
    3232      {
    3333        $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>';
     
    4040    $Output .= 'Cena jednoho menu: '.$Row['Price'].' Kč<br />';
    4141    $Output .= $Row['Info'];
    42     return($Output);
     42    return ($Output);
    4343  }
    4444
     
    6666    $Date = explode('-', $_GET['date']);
    6767    $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++)
    6969    {
    7070      $Time = $Time2 + $I * 86400;
     
    7474      $Row = $DbResult->fetch_array();
    7575      $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 .= '&nbsp;<br><br>&nbsp;';
    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 .= '&nbsp;<br><br>&nbsp;';
     77      if ($Row['Status'] == 1) $Output .= 'Polévka: '.$Row['Soup'].'<br><br>'.$Row['Meal'];
     78      else if (($Row['Status'] == 2) or ($Row['Status'] == 3))
    7979      {
    8080        $Output .= '<br>'.$this->Status[$Row['Status']].'<br>&nbsp;';
     
    9191
    9292    $Output .= '</body></html>';
    93     return($Output);
     93    return ($Output);
    9494  }
    9595
     
    103103    $Week = date('w', mktime(0, 0, 0, $Date[1], $Date[2], $Date[0]));
    104104    $WeekOfYear = date('W', mktime(0, 0, 0, $Date[1], $Date[2], $Date[0]));
    105     if($WeekOfYear != $LastWeekOfYear)
     105    if ($WeekOfYear != $LastWeekOfYear)
    106106      $WeekRowSpan = '<td align="center" rowspan="'.(7 - (($Week + 7 - 1) % 7)).'">'.
    107107        $WeekOfYear.'<br /><a href="tisk/?date='.
     
    109109        '">Tisk</a></td>';
    110110      else $WeekRowSpan = '';
    111     if($Week == 0) $Color = ' style="color: #ff0000;" '; else $Color = '';
     111    if ($Week == 0) $Color = ' style="color: #ff0000;" '; else $Color = '';
    112112    $Output = '<tr><td'.$Color.'>'.$this->DayNames[$Week].'</td><td>'.HumanDate($Row['Date']).'</td>'.$WeekRowSpan.'
    113113    <td><input name="soup_'.$Row['Date'].'" size="30" value="'.$Row['Soup'].'"></td>
    114114    <td><input name="meal_'.$Row['Date'].'" size="30" value="'.$Row['Meal'].'"></td>
    115115    <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>';
    117117    $Output .= '</select></td></tr>';
    118118    $LastWeekOfYear = $WeekOfYear;
    119     return($Output);
     119    return ($Output);
    120120  }
    121121
     
    125125
    126126    $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++)
    132132        {
    133133          $Time = time() + $I * 86400;
     
    138138        $this->System->ModuleManager->Modules['Log']->NewRecord('EatingPlace', 'MenuSave');
    139139      }
    140       if($_GET['action'] == 'saveinfo')
     140      if ($_GET['action'] == 'saveinfo')
    141141      {
    142142        $this->Database->delete('MealsInfo', '1');
     
    149149<fieldset><legend>Jídlo pro jednotlivé dny</legend>
    150150<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++)
    152152    {
    153153      $Time = time() + $I * 86400;
    154154      $DbResult = $this->Database->select('Meals', '*', 'Date = "'.date('Y-m-d', $Time).'"');
    155       if($Row = $DbResult->fetch_array())
     155      if ($Row = $DbResult->fetch_array())
    156156        $Output .= $this->PrintTableRow($Row);
    157157      else
     
    173173'<div align="center"><input type="submit" value="Uložit údaje"></div>
    174174</fieldset></form>';
    175     return($Output);
     175    return ($Output);
    176176  }
    177177}
Note: See TracChangeset for help on using the changeset viewer.