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/Map/Map.php

    r865 r873  
    1313  function Show()
    1414  {
    15     if(!$this->System->User->CheckPermission('Map', 'Show'))
    16       return('Nemáte oprávnění');
    17 
    18     if(count($this->System->PathItems) > 1)
    19     {
    20       if($this->System->PathItems[1] == 'show-position') return($this->ShowPosition());
    21       else return(PAGE_NOT_FOUND);
    22     } else return($this->ShowMain());
     15    if (!$this->System->User->CheckPermission('Map', 'Show'))
     16      return ('Nemáte oprávnění');
     17
     18    if (count($this->System->PathItems) > 1)
     19    {
     20      if ($this->System->PathItems[1] == 'show-position') return ($this->ShowPosition());
     21      else return (PAGE_NOT_FOUND);
     22    } else return ($this->ShowMain());
    2323  }
    2424
     
    2626  {
    2727    $DbResult = $this->Database->select('MapPosition', '*', '`Id`='.$_GET['i']);
    28     if($DbResult->num_rows > 0)
     28    if ($DbResult->num_rows > 0)
    2929    {
    3030      $DbRow = $DbResult->fetch_assoc();
     
    4040      $MapApi->Markers[] = $Marker;
    4141      $Output = $MapApi->ShowPage($this);
    42       return($Output);
    43     } else return('Položka nenalezena');
     42      return ($Output);
     43    } else return ('Položka nenalezena');
    4444  }
    4545
     
    5959    'WHERE (`NetworkDevice`.`Used`=1) AND (`NetworkDevice`.`MapPosition` IS NOT NULL) '.
    6060    'GROUP BY `NetworkDevice`.`MapPosition`');
    61     while($Device = $DbResult->fetch_assoc())
     61    while ($Device = $DbResult->fetch_assoc())
    6262    {
    6363      $Pos = explode(';', $Device['Pos']);
     
    6969
    7070    $DbResult = $this->Database->query('SELECT * FROM `NetworkLink` WHERE (`Interface1` <> 0) AND (`Interface2` <> 0)');
    71     while($Link = $DbResult->fetch_assoc())
     71    while ($Link = $DbResult->fetch_assoc())
    7272    {
    7373      $DbResult2 = $this->Database->query('SELECT `NetworkDevice`.`Used`, `MapPosition`.`Pos` FROM `NetworkDevice` '.
     
    7777        'JOIN `MapPosition` ON `MapPosition`.`Id` = `NetworkDevice`.`MapPosition` '.
    7878        'WHERE `NetworkDevice`.`Id` = (SELECT `NetworkInterface`.`Device` FROM `NetworkInterface` WHERE `NetworkInterface`.`Id` = '.$Link['Interface2'].')');
    79       if(($DbResult2->num_rows > 0) and ($DbResult3->num_rows > 0))
     79      if (($DbResult2->num_rows > 0) and ($DbResult3->num_rows > 0))
    8080      {
    8181        $Device1 = $DbResult2->fetch_assoc();
     
    8383        $Device2 = $DbResult3->fetch_assoc();
    8484        $Pos2 = explode(';', $Device2['Pos']);
    85         if(($Device1['Used'] == 1) and ($Device2['Used'] == 1))
     85        if (($Device1['Used'] == 1) and ($Device2['Used'] == 1))
    8686        {
    8787          $PolyLine = new MapPolyLine();
     
    146146        NetworkLinks = [';
    147147    $DbResult = $this->Database->query('SELECT * FROM `NetworkLink` WHERE (`Interface1` <> 0) AND (`Interface2` <> 0)');
    148     while($Link = $DbResult->fetch_assoc())
     148    while ($Link = $DbResult->fetch_assoc())
    149149    {
    150150      $DbResult2 = $this->Database->query('SELECT `NetworkDevice`.`Used`, `MapPosition`.`Pos` FROM `NetworkDevice` '.
     
    154154        'JOIN `MapPosition` ON `MapPosition`.`Id` = `NetworkDevice`.`MapPosition` '.
    155155        'WHERE `NetworkDevice`.`Id` = (SELECT `NetworkInterface`.`Device` FROM `NetworkInterface` WHERE `NetworkInterface`.`Id` = '.$Link['Interface2'].')');
    156       if(($DbResult2->num_rows > 0) and ($DbResult3->num_rows > 0))
     156      if (($DbResult2->num_rows > 0) and ($DbResult3->num_rows > 0))
    157157      {
    158158        $Device1 = $DbResult2->fetch_assoc();
     
    160160        $Device2 = $DbResult3->fetch_assoc();
    161161        $Pos2 = explode(';', $Device2['Pos']);
    162         if(($Device1['Used'] == 1) and ($Device2['Used'] == 1))
     162        if (($Device1['Used'] == 1) and ($Device2['Used'] == 1))
    163163          $Output .= 'new google.maps.Polyline([new google.maps.LatLng('.$Pos1[0].', '.
    164164        $Pos1[1].'),new google.maps.LatLng('.$Pos2[0].', '.$Pos2[1].')], "#4F4FBF", 3, 0.8), ';
     
    198198      'WHERE (`NetworkDevice`.`Used`=1) AND (`NetworkDevice`.`MapPosition` IS NOT NULL) '.
    199199      'GROUP BY `NetworkDevice`.`MapPosition`');
    200     while($Device = $DbResult->fetch_assoc())
     200    while ($Device = $DbResult->fetch_assoc())
    201201    {
    202202      $Pos = explode(';', $Device['Pos']);
     
    236236                </table>';
    237237    */
    238     return($Output);
     238    return ($Output);
    239239  }
    240240}
     
    245245  {
    246246    $Output = parent::OnEdit($Item);
    247     if($this->FormManager->ShowRelation)
     247    if ($this->FormManager->ShowRelation)
    248248      $Output .=  '<img src="'.$this->FormManager->Root.'/images/select.png" alf="Vybrat" language="javascript" '.
    249249        'onclick="return popupwindow(&quot;'.$this->FormManager->Root.'/is/?a=mapselect&amp;r='.
    250250        $Item['Name'].'&quot;,&quot;test&quot;);" style="cursor:hand;cursor:pointer"/>';
    251     return($Output);
     251    return ($Output);
    252252  }
    253253}
Note: See TracChangeset for help on using the changeset viewer.