Changeset 40 for trunk


Ignore:
Timestamp:
May 5, 2019, 11:48:18 PM (6 years ago)
Author:
chronos
Message:
  • Added: New table DanceFigure to represent various dancing figures.
Location:
trunk
Files:
2 edited

Legend:

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

    r37 r40  
    1818  {
    1919    $this->System->RegisterPage('tance', 'PageDanceList');
     20    $this->System->RegisterPage('tanec', 'PageDance');
     21    $this->System->RegisterPage('figura', 'PageDanceFigure');
     22    $this->System->RegisterPage('figury', 'PageDanceFigureList');
    2023    $this->System->RegisterMenuItem('/tance', 'Tance');
     24    $this->System->RegisterMenuItem('/figury', 'Figury');
    2125  } 
    2226}
    2327
    24 class PageDanceList extends Page
    25 {
    26   function __construct($System)
    27   {
    28     parent::__construct($System);
    29     $this->FullTitle = 'Tance';
    30     $this->ShortTitle = 'Tance';
    31   }
    32 
    33   function Show()
    34   {
    35     $this->Title = 'Tance - '.$this->Title;
    36     $Output = '<div class="title">Tance</div>';
    37     $Output .= '<table class="WideTable">';
    38     $Output .= '<tr><th>Název</th><th>Skupina</th>';
    39     $DbResult2 = $this->Database->select('ResourceGroup', '*');
     28class PageDance extends Page
     29{
     30  function __construct($System)
     31  {
     32    parent::__construct($System);
     33    $this->FullTitle = 'Tanec';
     34    $this->ShortTitle = 'Tanec';
     35  }
     36
     37  function Show()
     38  {
     39    $this->Title = 'Tanec - Tance - '.$this->Title;
     40    $Output = '';
     41    if(count($this->System->PathItems) > 1)
     42    {
     43      $id = $this->System->PathItems[1] * 1;
     44    } else return 'Položka nenalezena';
     45    $Output .= '<div class="title">Tanec</div>';
     46    $DbResult = $this->Database->select('Dance', '*, (SELECT DanceGroup.Name FROM DanceGroup WHERE DanceGroup.Id=Dance.Group) AS DanceGroupName', 'Id='.$id);
     47    if ($DbResult->num_rows > 0)
     48    {
     49      $MeetItem = $DbResult->fetch_assoc();
     50      if ($MeetItem['Link'] != '') $Link = '<a href="'.$MeetItem['Link'].'">Odkaz</a>';
     51        else $Link = '';
     52      $Output .= '<table class="ItemTable">'.
     53        '<tr><th>Jméno</th><td>'.$MeetItem['Name'].'</td></tr>'.
     54        '<tr><th>Skupina</th><td>'.$MeetItem['DanceGroupName'].'</td></tr>';
     55      $Output .= '</table>';
     56    } else $Output .= 'Položka nenalezena';
     57
     58    $Output .= '<br/><div class="title">Taneční figury</div>';
     59    $Output .= '<table class="WideTable">';
     60    $Output .= '<tr><th>Český název</th><th>Anglický název</th><th>Detail</th></tr>';
     61    $DbResult = $this->Database->select('DanceFigure', '*', '(`Dance`='.$id.')');
     62    while($DanceFigure = $DbResult->fetch_assoc())
     63    {
     64      $Output .= '<tr>'.
     65        '<td>'.$DanceFigure['NameCz'].'</td>'.
     66        '<td>'.$DanceFigure['NameEn'].'</td>'.
     67        '<td><a href="'.$this->System->Link('/figura/'.$DanceFigure['Id'].'/').'">Ukázat</a></td>';
     68        '</tr>';
     69    }
     70    $Output .= '</table>';
     71
     72    $Output .= '<br/><div class="title">Výuková videa</div>';
     73    $Output .= '<table class="WideTable">';
     74    $Output .= '<tr><th>Název</th><th>Skupina</th><th>Odkaz</th></tr>';
     75    $DbResult = $this->Database->select('Resource', '*, (SELECT Name FROM ResourceGroup WHERE ResourceGroup.Id=Resource.Group) AS GroupName', '(`Dance`='.$id.')');
     76    while($DbRow = $DbResult->fetch_assoc())
     77    {
     78      $Output .= '<tr>'.
     79        '<td>'.$DbRow['Name'].'</td>'.
     80        '<td>'.$DbRow['GroupName'].'</td>'.
     81        '<td><a href="'.$DbRow['URL'].'">'.$DbRow['URL'].'</a></td>'.
     82        '</tr>';
     83    }
     84    $Output .= '</table>';
     85
     86      /*
     87          $DbResult2 = $this->Database->select('ResourceGroup', '*');
    4088    while($ResourceGroup = $DbResult2->fetch_assoc())
    4189    {
    4290      $Output .= '<th>'.$ResourceGroup['Name'].'</th>';
    4391    }
    44     $Output .= '</tr>';
    45     $DbResult = $this->Database->select('Dance', '*, (SELECT Name FROM DanceGroup WHERE DanceGroup.Id=Dance.Group) AS GroupName', '1 ORDER BY `Name`');
    46     while($Dance = $DbResult->fetch_assoc())
    47     {
    48       $Output .= '<tr><td>'.$Dance['Name'].'</td><td>'.$Dance['GroupName'].'</td>';
     92
    4993      $DbResult2 = $this->Database->select('ResourceGroup', '*');
    5094      while($ResourceGroup = $DbResult2->fetch_assoc())
    5195      {
    5296        $Output .= '<td>';
    53         $DbResult3 = $this->Database->select('Resource', '*', '(`Dance`='.$Dance['Id'].') AND (`Group`='.$ResourceGroup['Id'].')');
    5497        while($Resource = $DbResult3->fetch_assoc())
    5598        {
     
    57100        }
    58101        $Output .= '</td>';
    59       }
     102      }*/
     103 
     104    return $Output;
     105  }
     106}
     107
     108class PageDanceList extends Page
     109{
     110  function __construct($System)
     111  {
     112    parent::__construct($System);
     113    $this->FullTitle = 'Tance';
     114    $this->ShortTitle = 'Tance';
     115  }
     116
     117  function Show()
     118  {
     119    $this->Title = 'Tance - '.$this->Title;
     120    $Output = '<div class="title">Tance</div>';
     121    $Output .= '<table class="WideTable">';
     122    $Output .= '<tr><th>Název</th><th>Skupina</th><th>Detail</th></tr>';
     123    $DbResult = $this->Database->select('Dance', '*, (SELECT Name FROM DanceGroup WHERE DanceGroup.Id=Dance.Group) AS GroupName', '1 ORDER BY `Name`');
     124    while($Dance = $DbResult->fetch_assoc())
     125    {
     126      $Output .= '<tr>'.
     127        '<td>'.$Dance['Name'].'</td>'.
     128        '<td>'.$Dance['GroupName'].'</td>'.
     129        '<td><a href="'.$this->System->Link('/tanec/'.$Dance['Id'].'/').'">Ukázat</a></td>';
    60130      $Output .= '</tr>';
    61131    }
     
    66136}
    67137
     138class PageDanceFigure extends Page
     139{
     140  function __construct($System)
     141  {
     142    parent::__construct($System);
     143    $this->FullTitle = 'Taneční figura';
     144    $this->ShortTitle = 'Figura';
     145  }
     146
     147  function Show()
     148  {
     149    $this->Title = 'Taneční figura - Tance - '.$this->Title;
     150    $Output = '';
     151    if(count($this->System->PathItems) > 1)
     152    {
     153      $id = $this->System->PathItems[1] * 1;
     154    } else return 'Položka nenalezena';
     155    $Output .= '<div class="title">Taneční figura</div>';
     156    $DbResult = $this->Database->select('DanceFigure', '*, (SELECT Dance.Name FROM Dance WHERE Dance.Id=DanceFigure.Dance) AS DanceName', 'Id='.$id);
     157    if ($DbResult->num_rows > 0)
     158    {
     159      $DbRow = $DbResult->fetch_assoc();
     160      $Output .= '<table class="ItemTable">'.
     161        '<tr><th>České jméno</th><td>'.$DbRow['NameCz'].'</td></tr>'.
     162        '<tr><th>Anglické jméno</th><td>'.$DbRow['NameEn'].'</td></tr>'.
     163        '<tr><th>Tanec</th><td>'.$DbRow['DanceName'].'</td></tr>';
     164      $Output .= '</table>';
     165    } else $Output .= 'Položka nenalezena';
     166
     167    /*$Output .= '<br/><div class="title">Videa</div>';
     168    $Output .= '<table class="WideTable">';
     169    $Output .= '<tr><th>Skupina videí</th><th></th><th>Detail</th></tr>';
     170    $DbResult = $this->Database->select('DanceFigure', '*', '(`Dance`='.$id.')');
     171    while($DanceFigure = $DbResult->fetch_assoc())
     172    {
     173      $Output .= '<tr>'.
     174        '<td>'.$DanceFigure['NameCz'].'</td>'.
     175        '<td>'.$DanceFigure['NameEn'].'</td>'.
     176        '<td><a href="'.$this->System->Link('/tance/figura/'.$DanceFigure['Id'].'/').'">Ukázat</a></td>';
     177        '</tr>';
     178    }
     179    $Output .= '</table>';
     180    */
     181      /*
     182          $DbResult2 = $this->Database->select('ResourceGroup', '*');
     183    while($ResourceGroup = $DbResult2->fetch_assoc())
     184    {
     185      $Output .= '<th>'.$ResourceGroup['Name'].'</th>';
     186    }
     187
     188      $DbResult2 = $this->Database->select('ResourceGroup', '*');
     189      while($ResourceGroup = $DbResult2->fetch_assoc())
     190      {
     191        $Output .= '<td>';
     192        while($Resource = $DbResult3->fetch_assoc())
     193        {
     194          $Output .= '<a href="'.$Resource['URL'].'">'.$Resource['Name'].'</a> ';
     195        }
     196        $Output .= '</td>';
     197      }*/
     198 
     199    return $Output;
     200  }
     201}
     202
     203class PageDanceFigureList extends Page
     204{
     205  function __construct($System)
     206  {
     207    parent::__construct($System);
     208    $this->FullTitle = 'Tance';
     209    $this->ShortTitle = 'Tance';
     210  }
     211
     212  function Show()
     213  {
     214    $this->Title = 'Tance - '.$this->Title;
     215    $Output = '<div class="title">Taneční figury</div>';
     216    $Output .= '<table class="WideTable">';
     217    $Output .= '<tr><th>Název</th><th>Skupina</th><th>Tanec</th><th>Detail</th></tr>';
     218    $DbResult = $this->Database->select('DanceFigure', '*, (SELECT Dance.Name FROM Dance WHERE Dance.Id=DanceFigure.Dance) AS DanceName', '1 ORDER BY `NameCz`');
     219    while($DbRow = $DbResult->fetch_assoc())
     220    {
     221      $Output .= '<tr>'.
     222        '<td>'.$DbRow['NameCz'].'</td>'.
     223        '<td>'.$DbRow['NameEn'].'</td>'.
     224        '<td>'.$DbRow['DanceName'].'</td>'.
     225        '<td><a href="'.$this->System->Link('/figura/'.$DbRow['Id'].'/').'">Ukázat</a></td>';
     226      $Output .= '</tr>';
     227    }
     228    $Output .= '</table>';
     229
     230    return($Output);
     231  }
     232}
  • trunk/SQL/Update.php

    r37 r40  
    3131ALTER TABLE `Movie`
    3232  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
     33
     34CREATE TABLE `DanceFigure` (
     35  `Id` int(11) NOT NULL,
     36  `NameCz` varchar(255) NOT NULL,
     37  `NameEn` varchar(255) NOT NULL,
     38  `Dance` int(11) NOT NULL
     39) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
     40
     41ALTER TABLE `DanceFigure`
     42  ADD PRIMARY KEY (`Id`),
     43  ADD UNIQUE KEY `Id` (`Id`),
     44  ADD KEY `Dance` (`Dance`);
     45
     46ALTER TABLE `DanceFigure`
     47  MODIFY `Id` int(11) NOT NULL AUTO_INCREMENT;
     48
     49ALTER TABLE `DanceFigure`
     50  ADD CONSTRAINT `DanceFigure_ibfk_1` FOREIGN KEY (`Dance`) REFERENCES `Dance` (`Id`);
Note: See TracChangeset for help on using the changeset viewer.