Ignore:
Timestamp:
Apr 7, 2020, 10:15:48 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Export/Page.php

    r864 r880  
    1717  {
    1818    $Output = '<a href="?Action=ViewList">'.T('All').'</a>';
    19     if($this->System->User->Licence(LICENCE_USER))
     19    if ($this->System->User->Licence(LICENCE_USER))
    2020    {
    2121      $Output .= ' <a href="?Action=ViewList&amp;Filter=Others">'.T('Others').'</a>'.
     
    2323    }
    2424
    25     if($this->System->User->Licence(LICENCE_USER))
     25    if ($this->System->User->Licence(LICENCE_USER))
    2626      $Output .= '<br/><div style="text-align: center;"><a href="?Action=Create">'.T('Create new export').'</a></div><br/>';
    2727
    2828    $Filter = '';
    29     if(array_key_exists('Filter', $_GET))
    30     {
    31       if($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$this->System->User->Id;
    32       if($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$this->System->User->Id;
     29    if (array_key_exists('Filter', $_GET))
     30    {
     31      if ($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$this->System->User->Id;
     32      if ($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$this->System->User->Id;
    3333    }
    3434
     
    6262      '(SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` '.
    6363      'LEFT JOIN `User` ON `User`.`ID`=`Export`.`User` '.$Filter.$Order['SQL'].$PageList['SQLLimit']);
    64     while($Export = $DbResult->fetch_assoc())
     64    while ($Export = $DbResult->fetch_assoc())
    6565    {
    6666      $Action = '<a href="?Action=View&amp;ExportId='.$Export['Id'].'&amp;Tab=0">'.T('View').'</a> '.
    6767        '<a href="?Action=View&amp;ExportId='.$Export['Id'].'&amp;Tab=7">'.T('Make export').'</a>';
    68       if($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy delete item?').'\');">'.T('Delete').'</a>';
    69       if($this->System->User->Id != null) $Action .= ' <a href="?Action=Clone&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a>';
     68      if ($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy delete item?').'\');">'.T('Delete').'</a>';
     69      if ($this->System->User->Id != null) $Action .= ' <a href="?Action=Clone&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a>';
    7070      $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'.
    7171          '<td><a href="'.$this->System->Link('/user/?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'.
     
    7979        $PageList['Output'];
    8080
    81     return($Output);
     81    return $Output;
    8282  }
    8383
    8484  function ExportCreate()
    8585  {
    86     if($this->System->User->Licence(LICENCE_USER))
     86    if ($this->System->User->Licence(LICENCE_USER))
    8787    {
    8888      $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id);
    8989      $DbRow = $DbResult->fetch_row();
    90       if($DbRow[0] < $this->System->Config['MaxExportPerUser'])
     90      if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])
    9191      {
    9292        $Output = '<form action="?Action=CreateFinish" method="post">'.
     
    9898      } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), $this->System->Config['MaxExportPerUser']), MESSAGE_CRITICAL);
    9999    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    100     return($Output);
     100    return $Output;
    101101  }
    102102
    103103  function ExportCreateFinish()
    104104  {
    105     if($this->System->User->Licence(LICENCE_USER))
    106     {
    107       if(array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
     105    if ($this->System->User->Licence(LICENCE_USER))
     106    {
     107      if (array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
    108108      {
    109109        $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id);
    110110        $DbRow = $DbResult->fetch_row();
    111         if($DbRow[0] < $this->System->Config['MaxExportPerUser'])
     111        if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])
    112112        {
    113113          $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$this->System->User->Id.', NOW(), 1, "'.$_POST['Description'].'")');
     
    120120      } else $Output = ShowMessage(T('Missing data in form.'), MESSAGE_CRITICAL);
    121121    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    122     return($Output);
     122    return $Output;
    123123  }
    124124
    125125  function ExportDelete()
    126126  {
    127     if($this->System->User->Licence(LICENCE_USER))
     127    if ($this->System->User->Licence(LICENCE_USER))
    128128    {
    129129      $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE (`Id`='.($_GET['ExportId'] * 1).') AND (`User`='.$this->System->User->Id.')');
    130       if($DbResult->num_rows > 0)
     130      if ($DbResult->num_rows > 0)
    131131      {
    132132        $this->System->Database->query('DELETE FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId']);
     
    143143      } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL);
    144144    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    145     return($Output);
     145    return $Output;
    146146  }
    147147
     
    163163    $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    164164    $Export = $DbResult->fetch_assoc();
    165     if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     165    if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    166166    else $Editable = false;
    167167
    168     if(array_key_exists('Operation', $_POST))
    169     {
    170       if($_POST['Operation'] == 'Save')
     168    if (array_key_exists('Operation', $_POST))
     169    {
     170      if ($_POST['Operation'] == 'Save')
    171171      {
    172172        //print_r($_POST);
    173173        // Update user selection page
    174         foreach($_POST as $Index => $Value)
     174        foreach ($_POST as $Index => $Value)
    175175        {
    176           if(substr($Index, 0, 3) == 'seq')
     176          if (substr($Index, 0, 3) == 'seq')
    177177          {
    178178            $UserId = substr($Index, 3) * 1;
    179             if(array_key_exists('sel'.$UserId, $_POST)) $Selected = true;
     179            if (array_key_exists('sel'.$UserId, $_POST)) $Selected = true;
    180180            else $Selected = false;
    181181            $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `User`='.$UserId;
    182182            $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition);
    183             if($DbResult->num_rows > 0)
     183            if ($DbResult->num_rows > 0)
    184184            {
    185               if(!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition);
     185              if (!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition);
    186186              else $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition);
    187187            } else
    188188            {
    189               if($Selected) $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')');
     189              if ($Selected) $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')');
    190190            }
    191191          }
     
    221221    );
    222222    $Order = GetOrderTableHeader($TableColumns, 'TranslatedCount', 1);
    223     if($Order['Column'] != 'Sequence2') $InitialOrder = ', '.substr($Order['SQL'], 10);
     223    if ($Order['Column'] != 'Sequence2') $InitialOrder = ', '.substr($Order['SQL'], 10);
    224224    else $InitialOrder = '';
    225225
     
    234234    $Output .= '<form name="Translators" action="?Action=View&amp;ExportId='.$_GET['ExportId'].'" method="post">'.
    235235        '<h3>'.T('Translators').'</h3>';
    236     if($Editable)
     236    if ($Editable)
    237237    {
    238238      $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'.
     
    252252    $this->System->Database->query('SET @I = 0');
    253253    $DbResult = $this->System->Database->query($Query);
    254     while($UserLine = $DbResult->fetch_assoc())
     254    while ($UserLine = $DbResult->fetch_assoc())
    255255    {
    256256      $XP = GetLevelMinMax($UserLine['XP']);
     
    268268        '</form>'.
    269269        $PageList['Output'];
    270     return($Output);
     270    return $Output;
    271271  }
    272272
     
    278278    $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    279279    $Export = $DbRows->fetch_assoc();
    280     if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     280    if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    281281    else $Editable = false;
    282282
    283     if(array_key_exists('Operation', $_POST))
    284       if($_POST['Operation'] == 'Save')  if($Editable and array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
    285       {
    286         if(array_key_exists('WithDiacritic', $_POST)) $WithDiacritic = 1;
     283    if (array_key_exists('Operation', $_POST))
     284      if ($_POST['Operation'] == 'Save')  if ($Editable and array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
     285      {
     286        if (array_key_exists('WithDiacritic', $_POST)) $WithDiacritic = 1;
    287287        else $WithDiacritic = 0;
    288288        if (array_key_exists('Featured', $_POST)) $Export['Featured'] = 1;
     
    296296      }
    297297
    298       if($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"';
     298      if ($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"';
    299299      else $WithDiacritic = '';
    300300      $Output .= '<form action="?Action=View&amp;Tab=0&amp;ExportId='.$Export['Id'].'" method="post">'.
    301301          '<table>';
    302       if($this->System->User->Id != null)
     302      if ($this->System->User->Id != null)
    303303      {
    304304        $Output .= '<input type="hidden" name="Operation" value="Save"/>'.
    305305            '<tr><td colspan="2">';
    306         if($Editable) $Output .= ' <input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>';
     306        if ($Editable) $Output .= ' <input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>';
    307307        $Output .= ' <a href="?Action=Clone&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a> ';
    308         if($this->System->User->Licence(LICENCE_ADMIN))
     308        if ($this->System->User->Licence(LICENCE_ADMIN))
    309309          $Output .= CheckBox('Featured', $Export['Featured'], '', 'CheckBox', !$Editable). ' '.T('Recommended').' ';
    310310        $Output .= '</td></tr>';
     
    314314          '<tr><td>'.T('With diacritics').'</td><td><input type="checkbox" name="WithDiacritic" '.$WithDiacritic.''.$DisabledInput[$Editable].'/></td></tr>'.
    315315          '</table></form>';
    316       return($Output);
     316      return $Output;
    317317  }
    318318
     
    325325    $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    326326    $Export = $DbRows->fetch_assoc();
    327     if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     327    if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    328328    else $Editable = false;
    329329
    330     if(array_key_exists('Operation', $_POST))
    331     {
    332       if($_POST['Operation'] == 'Save')
     330    if (array_key_exists('Operation', $_POST))
     331    {
     332      if ($_POST['Operation'] == 'Save')
    333333      {
    334334        //print_r($_POST);
    335335        // Update user selection page
    336         foreach($_POST as $Index => $Value)
     336        foreach ($_POST as $Index => $Value)
    337337        {
    338           if(substr($Index, 0, 3) == 'seq')
     338          if (substr($Index, 0, 3) == 'seq')
    339339          {
    340340            $LanguageId = substr($Index, 3) * 1;
    341             if(array_key_exists('sel'.$LanguageId, $_POST)) $Selected = true;
     341            if (array_key_exists('sel'.$LanguageId, $_POST)) $Selected = true;
    342342            else $Selected = false;
    343343            $Condition = ' WHERE Export='.$_GET['ExportId'].' AND `Language`='.$LanguageId;
    344344            $DbResult = $this->System->Database->query('SELECT * FROM `ExportLanguage` '.$Condition);
    345             if($DbResult->num_rows > 0)
     345            if ($DbResult->num_rows > 0)
    346346            {
    347               if(!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition);
     347              if (!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition);
    348348              else $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition);
    349349            } else
    350350            {
    351               if($Selected) $this->System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');
     351              if ($Selected) $this->System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');
    352352            }
    353353          }
     
    377377    $Output .= '<form action="?Action=View&amp;ExportId='.$_GET['ExportId'].'" method="post">'.
    378378        '<h3>'.T('Languages').'</h3>';
    379     if($Editable)
     379    if ($Editable)
    380380    {
    381381      $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'.
     
    393393    $this->System->Database->query('SET @I = 0');
    394394    $DbResult = $this->System->Database->query($Query);
    395     while($Langugage = $DbResult->fetch_assoc())
     395    while ($Langugage = $DbResult->fetch_assoc())
    396396    {
    397397      $Checked = $Langugage['Sequence'] != '';
     
    405405        '</form>'.
    406406        $PageList['Output'];
    407     return($Output);
     407    return $Output;
    408408  }
    409409
     
    416416    $DbRows = $this->System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
    417417    $Export = $DbRows->fetch_assoc();
    418     if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     418    if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    419419    else $Editable = false;
    420420
    421     if(array_key_exists('Operation', $_POST))
    422     {
    423       if($_POST['Operation'] == 'Save')
     421    if (array_key_exists('Operation', $_POST))
     422    {
     423      if ($_POST['Operation'] == 'Save')
    424424      {
    425425        //print_r($_POST);
    426426        // Update user selection page
    427         foreach($_POST as $Index => $Value)
     427        foreach ($_POST as $Index => $Value)
    428428        {
    429           if(substr($Index, 0, 3) == 'seq')
     429          if (substr($Index, 0, 3) == 'seq')
    430430          {
    431431            $GroupId = substr($Index, 3) * 1;
    432             if(array_key_exists('sel'.$GroupId, $_POST)) $Selected = true;
     432            if (array_key_exists('sel'.$GroupId, $_POST)) $Selected = true;
    433433            else $Selected = false;
    434434            $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `Group`='.$GroupId;
    435435            $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroup` '.$Condition);
    436             if($DbResult->num_rows > 0)
     436            if ($DbResult->num_rows > 0)
    437437            {
    438               if(!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition);
     438              if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition);
    439439            } else
    440440            {
    441               if($Selected) $this->System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')');
     441              if ($Selected) $this->System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')');
    442442            }
    443443          }
     
    446446      }
    447447      //items
    448       foreach($TranslationTree as $Group)
    449       {
    450         foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
    451           if(array_key_exists('item'.$Column['Id'], $_POST)) $Selected = true;
     448      foreach ($TranslationTree as $Group)
     449      {
     450        foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {
     451          if (array_key_exists('item'.$Column['Id'], $_POST)) $Selected = true;
    452452          else $Selected = false;
    453453          //we will save only forbitten collums and need to be visible
     
    457457            $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `GroupItem`='.$Column['Id'];
    458458            $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroupItem` '.$Condition);
    459             if($DbResult->num_rows > 0)
     459            if ($DbResult->num_rows > 0)
    460460            {
    461               if(!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition);
     461              if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition);
    462462            } else
    463463            {
    464               if($Selected) $this->System->Database->query('INSERT INTO `ExportGroupItem` (`Export`, `GroupItem`) VALUES ('.$_GET['ExportId'].', '.$Column['Id'].')');
     464              if ($Selected) $this->System->Database->query('INSERT INTO `ExportGroupItem` (`Export`, `GroupItem`) VALUES ('.$_GET['ExportId'].', '.$Column['Id'].')');
    465465            }
    466466
     
    486486    $Output .= '<form action="?Action=View&amp;ExportId='.$_GET['ExportId'].'" method="post">'.
    487487        '<h3>'.T('Translation groups').'</h3>';
    488     if($Editable)
     488    if ($Editable)
    489489    {
    490490      $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'.
     
    500500
    501501    $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$_GET['ExportId']);
    502     while($GroupItem = $DbResultItem->fetch_assoc())
     502    while ($GroupItem = $DbResultItem->fetch_assoc())
    503503    {
    504504      $GroupItems[$GroupItem['GroupItem']] = 1;
     
    507507    $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit'];
    508508    $DbResult = $this->System->Database->query($Query);
    509     while($Group = $DbResult->fetch_assoc())
     509    while ($Group = $DbResult->fetch_assoc())
    510510    {
    511511      $Columns = '';
    512       foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
     512      foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {
    513513        if ($Column['Visible']) $Columns .= CheckBox('item'.$Column['Id'],
    514514          !isset($GroupItems[$Column['Id']]), '', 'CheckBox', !$Editable).' '.T($Column['Name']).' <br/>';
     
    533533      '</form>'.
    534534      $PageList['Output'];
    535     return($Output);
     535    return $Output;
    536536  }
    537537
     
    540540    $Output = '';
    541541    $DisabledInput = array(false => ' disabled="disabled"', true => '');
    542     if(array_key_exists('ExportId', $_GET))
     542    if (array_key_exists('ExportId', $_GET))
    543543    {
    544544      $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    545       if($DbRows->num_rows > 0)
     545      if ($DbRows->num_rows > 0)
    546546      {
    547547        $Export = $DbRows->fetch_assoc();
    548         if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     548        if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    549549        else $Editable = false;
    550550
    551         if(array_key_exists('Operation', $_POST))
    552           if($_POST['Operation'] == 'Save')
     551        if (array_key_exists('Operation', $_POST))
     552          if ($_POST['Operation'] == 'Save')
    553553          {
    554             if(array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0))
     554            if (array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0))
    555555            {
    556556              $this->System->Database->query('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']);
     
    564564          $Output .= '<h3>'.T('Format the generated output').'</h3>'.
    565565              '<form action="?Action=View&amp;ExportId='.$_GET['ExportId'].'" method="post">';
    566           if($Editable)
     566          if ($Editable)
    567567          {
    568568            $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'.
     
    571571          }
    572572          $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` ORDER BY `Name`');
    573           while($ExportFormat = $DbResult->fetch_assoc())
     573          while ($ExportFormat = $DbResult->fetch_assoc())
    574574          {
    575575            $Output .= RadioButton('OutputType', $ExportFormat['Id'], $Export['OutputType'] == $ExportFormat['Id'], '', !$Editable).' '.$ExportFormat['Name'].'<br/>';
     
    578578      } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
    579579    } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL);
    580     return($Output);
     580    return $Output;
    581581  }
    582582
     
    587587    $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    588588    $Export = $DbRows->fetch_assoc();
    589     if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     589    if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    590590    else $Editable = false;
    591591
    592     if(array_key_exists('Operation', $_POST))
    593       if(($_POST['Operation'] == 'Save') and (array_key_exists('ClientVersion', $_POST)))
     592    if (array_key_exists('Operation', $_POST))
     593      if (($_POST['Operation'] == 'Save') and (array_key_exists('ClientVersion', $_POST)))
    594594      {
    595595        $this->System->Database->query('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']);
     
    600600      $Export = $DbResult->fetch_assoc();
    601601
    602       if($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);
     602      if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);
    603603      else {
    604604        $Query = 'SELECT `ClientVersion`.* FROM `ExportVersion` '.
     
    620620            '<h3>'.T('Client version').'</h3>';
    621621
    622         if($Editable)
     622        if ($Editable)
    623623        {
    624624          $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'.
     
    633633        $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit'];
    634634        $DbResult = $this->System->Database->query($Query);
    635         while($Version = $DbResult->fetch_assoc())
     635        while ($Version = $DbResult->fetch_assoc())
    636636        {
    637637          $Output .= '<tr><td><a href="'.$this->System->Link('/client-version/?action=item&amp;id='.$Version['Id']).'">'.
     
    646646            $PageList['Output'];
    647647      }
    648       return($Output);
     648      return $Output;
    649649  }
    650650
     
    654654    $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    655655    $Export = $DbResult->fetch_assoc();
    656     if($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);
    657     else if($Export['ClientVersion'] == '') $Output .= ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL);
     656    if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);
     657    else if ($Export['ClientVersion'] == '') $Output .= ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL);
    658658    else {
    659659      $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']);
    660       if($DbResult->num_rows > 0)
     660      if ($DbResult->num_rows > 0)
    661661      {
    662662        $DbResult = $this->System->Database->query('SELECT * FROM `ExportVersion` WHERE (`ExportType`='.$Export['OutputType'].') AND (`ClientVersion`='.$Export['ClientVersion'].')');
    663         if($DbResult->num_rows > 0)
     663        if ($DbResult->num_rows > 0)
    664664        {
    665665          if (array_key_exists('Auto', $_GET) == false)
     
    669669      } else $Output = ShowMessage(T('Format output isn\'t select').'.', MESSAGE_CRITICAL);
    670670    }
    671     return($Output);
     671    return $Output;
    672672  }
    673673
     
    679679    $Export->LoadFilters();
    680680
    681     if(($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == ''))
     681    if (($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == ''))
    682682      $Output = ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL);
    683683    else {
     
    687687      $UnionItems = array();
    688688      $DbResult = $this->System->Database->query($GroupListQuery.$Where);
    689       while($DbRow = $DbResult->fetch_assoc())
     689      while ($DbRow = $DbResult->fetch_assoc())
    690690      {
    691691        $UnionItems[] = 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
     
    721721      $Translated = 0;
    722722      $Total = 0;
    723       if(count($UnionItems) > 0)
     723      if (count($UnionItems) > 0)
    724724      {
    725725        $ID = $this->System->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.implode(' UNION ALL ', $UnionItems).') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
    726         while($Group = $ID->fetch_assoc())
     726        while ($Group = $ID->fetch_assoc())
    727727        {
    728728          $Output .= '<tr><td>'.T($Group['Name']).'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>';
     
    731731        }
    732732      }
    733       if($Total > 0) $Percent = $Translated / $Total * 100;
     733      if ($Total > 0) $Percent = $Translated / $Total * 100;
    734734      else $Percent = 100;
    735735
     
    737737      $Output .= '</table>';
    738738    }
    739     return($Output);
     739    return $Output;
    740740  }
    741741
     
    743743  {
    744744    $Output = '';
    745     if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
     745    if (array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
    746746    {
    747747      $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    748       if($DbResult->num_rows > 0)
     748      if ($DbResult->num_rows > 0)
    749749      {
    750750        $Export = $DbResult->fetch_assoc();
     
    759759          T('Statistic'), T('Output')));
    760760        $Output .= '<div id="content">';
    761         if($_SESSION['Tab'] == TAB_GENERAL) $Output .= $this->ExportViewGeneral();
    762         else if($_SESSION['Tab'] == TAB_TRANSLATORS) $Output .= $this->ExportViewTranslators();
    763         else if($_SESSION['Tab'] == TAB_GROUPS) $Output .= $this->ExportViewGroups();
    764         else if($_SESSION['Tab'] == TAB_LANGUAGES) $Output .= $this->ExportViewLanguages();
    765         else if($_SESSION['Tab'] == TAB_OUTPUT_FORMAT) $Output .= $this->ExportViewOutputFormat();
    766         else if($_SESSION['Tab'] == TAB_VERSION) $Output .= $this->ExportViewVersion();
    767         else if($_SESSION['Tab'] == TAB_STAT) $Output .= $this->ExportViewStat();
    768         else if($_SESSION['Tab'] == TAB_OUTPUT) $Output .= $this->ExportViewOutput();
     761        if ($_SESSION['Tab'] == TAB_GENERAL) $Output .= $this->ExportViewGeneral();
     762        else if ($_SESSION['Tab'] == TAB_TRANSLATORS) $Output .= $this->ExportViewTranslators();
     763        else if ($_SESSION['Tab'] == TAB_GROUPS) $Output .= $this->ExportViewGroups();
     764        else if ($_SESSION['Tab'] == TAB_LANGUAGES) $Output .= $this->ExportViewLanguages();
     765        else if ($_SESSION['Tab'] == TAB_OUTPUT_FORMAT) $Output .= $this->ExportViewOutputFormat();
     766        else if ($_SESSION['Tab'] == TAB_VERSION) $Output .= $this->ExportViewVersion();
     767        else if ($_SESSION['Tab'] == TAB_STAT) $Output .= $this->ExportViewStat();
     768        else if ($_SESSION['Tab'] == TAB_OUTPUT) $Output .= $this->ExportViewOutput();
    769769        else $Output .= $this->ExportViewGeneral();
    770770
     
    772772      } else $Output .= ShowMessage(T('Export not found.'), MESSAGE_CRITICAL);
    773773    } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL);
    774     return($Output);
     774    return $Output;
    775775  }
    776776
    777777  function ExportClone()
    778778  {
    779     if($this->System->User->Licence(LICENCE_USER))
    780     {
    781       if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
     779    if ($this->System->User->Licence(LICENCE_USER))
     780    {
     781      if (array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
    782782      {
    783783        $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id);
    784784        $DbRow = $DbResult->fetch_row();
    785         if($DbRow[0] < $this->System->Config['MaxExportPerUser'])
     785        if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])
    786786        {
    787787          $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    788           if($DbResult->num_rows > 0)
     788          if ($DbResult->num_rows > 0)
    789789          {
    790790            $DbRow = $DbResult->fetch_assoc();
     
    810810      } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL);
    811811    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    812     return($Output);
     812    return $Output;
    813813  }
    814814
     
    816816  {
    817817    $this->Title = T('Export');
    818     if(array_key_exists('Action', $_GET))
    819     {
    820       if($_GET['Action'] == 'Create') $Output = $this->ExportCreate();
    821       else if($_GET['Action'] == 'CreateFinish') $Output = $this->ExportCreateFinish();
    822       else if($_GET['Action'] == 'View') $Output = $this->ExportView();
    823       else if($_GET['Action'] == 'Delete') $Output = $this->ExportDelete();
    824       else if($_GET['Action'] == 'Clone') $Output = $this->ExportClone();
     818    if (array_key_exists('Action', $_GET))
     819    {
     820      if ($_GET['Action'] == 'Create') $Output = $this->ExportCreate();
     821      else if ($_GET['Action'] == 'CreateFinish') $Output = $this->ExportCreateFinish();
     822      else if ($_GET['Action'] == 'View') $Output = $this->ExportView();
     823      else if ($_GET['Action'] == 'Delete') $Output = $this->ExportDelete();
     824      else if ($_GET['Action'] == 'Clone') $Output = $this->ExportClone();
    825825      else $Output = $this->ExportList();
    826826    } else $Output = $this->ExportList();
    827     return($Output);
     827    return $Output;
    828828  }
    829829}
     
    839839  function Show()
    840840  {
    841     if(array_key_exists('i', $_GET))
     841    if (array_key_exists('i', $_GET))
    842842      $Output = $this->System->ModuleManager->Modules['Export']->GetTaskProgress($_GET['i'] * 1);
    843843      else $Output = 'Missing task id';
    844     return($Output);
     844    return $Output;
    845845  }
    846846}
Note: See TracChangeset for help on using the changeset viewer.