Changeset 880 for trunk/Modules/Export/Page.php
- Timestamp:
- Apr 7, 2020, 10:15:48 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/Page.php
r864 r880 17 17 { 18 18 $Output = '<a href="?Action=ViewList">'.T('All').'</a>'; 19 if ($this->System->User->Licence(LICENCE_USER))19 if ($this->System->User->Licence(LICENCE_USER)) 20 20 { 21 21 $Output .= ' <a href="?Action=ViewList&Filter=Others">'.T('Others').'</a>'. … … 23 23 } 24 24 25 if ($this->System->User->Licence(LICENCE_USER))25 if ($this->System->User->Licence(LICENCE_USER)) 26 26 $Output .= '<br/><div style="text-align: center;"><a href="?Action=Create">'.T('Create new export').'</a></div><br/>'; 27 27 28 28 $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; 33 33 } 34 34 … … 62 62 '(SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` '. 63 63 '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()) 65 65 { 66 66 $Action = '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=0">'.T('View').'</a> '. 67 67 '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=7">'.T('Make export').'</a>'; 68 if ($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&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&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&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&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a>'; 70 70 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'. 71 71 '<td><a href="'.$this->System->Link('/user/?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'. … … 79 79 $PageList['Output']; 80 80 81 return ($Output);81 return $Output; 82 82 } 83 83 84 84 function ExportCreate() 85 85 { 86 if ($this->System->User->Licence(LICENCE_USER))86 if ($this->System->User->Licence(LICENCE_USER)) 87 87 { 88 88 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 89 89 $DbRow = $DbResult->fetch_row(); 90 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])90 if ($DbRow[0] < $this->System->Config['MaxExportPerUser']) 91 91 { 92 92 $Output = '<form action="?Action=CreateFinish" method="post">'. … … 98 98 } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), $this->System->Config['MaxExportPerUser']), MESSAGE_CRITICAL); 99 99 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 100 return ($Output);100 return $Output; 101 101 } 102 102 103 103 function ExportCreateFinish() 104 104 { 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)) 108 108 { 109 109 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 110 110 $DbRow = $DbResult->fetch_row(); 111 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])111 if ($DbRow[0] < $this->System->Config['MaxExportPerUser']) 112 112 { 113 113 $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$this->System->User->Id.', NOW(), 1, "'.$_POST['Description'].'")'); … … 120 120 } else $Output = ShowMessage(T('Missing data in form.'), MESSAGE_CRITICAL); 121 121 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 122 return ($Output);122 return $Output; 123 123 } 124 124 125 125 function ExportDelete() 126 126 { 127 if ($this->System->User->Licence(LICENCE_USER))127 if ($this->System->User->Licence(LICENCE_USER)) 128 128 { 129 129 $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) 131 131 { 132 132 $this->System->Database->query('DELETE FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId']); … … 143 143 } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 144 144 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 145 return ($Output);145 return $Output; 146 146 } 147 147 … … 163 163 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 164 164 $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; 166 166 else $Editable = false; 167 167 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') 171 171 { 172 172 //print_r($_POST); 173 173 // Update user selection page 174 foreach ($_POST as $Index => $Value)174 foreach ($_POST as $Index => $Value) 175 175 { 176 if (substr($Index, 0, 3) == 'seq')176 if (substr($Index, 0, 3) == 'seq') 177 177 { 178 178 $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; 180 180 else $Selected = false; 181 181 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `User`='.$UserId; 182 182 $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition); 183 if ($DbResult->num_rows > 0)183 if ($DbResult->num_rows > 0) 184 184 { 185 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition);185 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition); 186 186 else $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition); 187 187 } else 188 188 { 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.')'); 190 190 } 191 191 } … … 221 221 ); 222 222 $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); 224 224 else $InitialOrder = ''; 225 225 … … 234 234 $Output .= '<form name="Translators" action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 235 235 '<h3>'.T('Translators').'</h3>'; 236 if ($Editable)236 if ($Editable) 237 237 { 238 238 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 252 252 $this->System->Database->query('SET @I = 0'); 253 253 $DbResult = $this->System->Database->query($Query); 254 while ($UserLine = $DbResult->fetch_assoc())254 while ($UserLine = $DbResult->fetch_assoc()) 255 255 { 256 256 $XP = GetLevelMinMax($UserLine['XP']); … … 268 268 '</form>'. 269 269 $PageList['Output']; 270 return ($Output);270 return $Output; 271 271 } 272 272 … … 278 278 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 279 279 $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; 281 281 else $Editable = false; 282 282 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; 287 287 else $WithDiacritic = 0; 288 288 if (array_key_exists('Featured', $_POST)) $Export['Featured'] = 1; … … 296 296 } 297 297 298 if ($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"';298 if ($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"'; 299 299 else $WithDiacritic = ''; 300 300 $Output .= '<form action="?Action=View&Tab=0&ExportId='.$Export['Id'].'" method="post">'. 301 301 '<table>'; 302 if ($this->System->User->Id != null)302 if ($this->System->User->Id != null) 303 303 { 304 304 $Output .= '<input type="hidden" name="Operation" value="Save"/>'. 305 305 '<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].'/>'; 307 307 $Output .= ' <a href="?Action=Clone&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)) 309 309 $Output .= CheckBox('Featured', $Export['Featured'], '', 'CheckBox', !$Editable). ' '.T('Recommended').' '; 310 310 $Output .= '</td></tr>'; … … 314 314 '<tr><td>'.T('With diacritics').'</td><td><input type="checkbox" name="WithDiacritic" '.$WithDiacritic.''.$DisabledInput[$Editable].'/></td></tr>'. 315 315 '</table></form>'; 316 return ($Output);316 return $Output; 317 317 } 318 318 … … 325 325 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 326 326 $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; 328 328 else $Editable = false; 329 329 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') 333 333 { 334 334 //print_r($_POST); 335 335 // Update user selection page 336 foreach ($_POST as $Index => $Value)336 foreach ($_POST as $Index => $Value) 337 337 { 338 if (substr($Index, 0, 3) == 'seq')338 if (substr($Index, 0, 3) == 'seq') 339 339 { 340 340 $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; 342 342 else $Selected = false; 343 343 $Condition = ' WHERE Export='.$_GET['ExportId'].' AND `Language`='.$LanguageId; 344 344 $DbResult = $this->System->Database->query('SELECT * FROM `ExportLanguage` '.$Condition); 345 if ($DbResult->num_rows > 0)345 if ($DbResult->num_rows > 0) 346 346 { 347 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition);347 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition); 348 348 else $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition); 349 349 } else 350 350 { 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.')'); 352 352 } 353 353 } … … 377 377 $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 378 378 '<h3>'.T('Languages').'</h3>'; 379 if ($Editable)379 if ($Editable) 380 380 { 381 381 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 393 393 $this->System->Database->query('SET @I = 0'); 394 394 $DbResult = $this->System->Database->query($Query); 395 while ($Langugage = $DbResult->fetch_assoc())395 while ($Langugage = $DbResult->fetch_assoc()) 396 396 { 397 397 $Checked = $Langugage['Sequence'] != ''; … … 405 405 '</form>'. 406 406 $PageList['Output']; 407 return ($Output);407 return $Output; 408 408 } 409 409 … … 416 416 $DbRows = $this->System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']); 417 417 $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; 419 419 else $Editable = false; 420 420 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') 424 424 { 425 425 //print_r($_POST); 426 426 // Update user selection page 427 foreach ($_POST as $Index => $Value)427 foreach ($_POST as $Index => $Value) 428 428 { 429 if (substr($Index, 0, 3) == 'seq')429 if (substr($Index, 0, 3) == 'seq') 430 430 { 431 431 $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; 433 433 else $Selected = false; 434 434 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `Group`='.$GroupId; 435 435 $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroup` '.$Condition); 436 if ($DbResult->num_rows > 0)436 if ($DbResult->num_rows > 0) 437 437 { 438 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition);438 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition); 439 439 } else 440 440 { 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.')'); 442 442 } 443 443 } … … 446 446 } 447 447 //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; 452 452 else $Selected = false; 453 453 //we will save only forbitten collums and need to be visible … … 457 457 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `GroupItem`='.$Column['Id']; 458 458 $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroupItem` '.$Condition); 459 if ($DbResult->num_rows > 0)459 if ($DbResult->num_rows > 0) 460 460 { 461 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition);461 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition); 462 462 } else 463 463 { 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'].')'); 465 465 } 466 466 … … 486 486 $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 487 487 '<h3>'.T('Translation groups').'</h3>'; 488 if ($Editable)488 if ($Editable) 489 489 { 490 490 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 500 500 501 501 $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$_GET['ExportId']); 502 while ($GroupItem = $DbResultItem->fetch_assoc())502 while ($GroupItem = $DbResultItem->fetch_assoc()) 503 503 { 504 504 $GroupItems[$GroupItem['GroupItem']] = 1; … … 507 507 $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit']; 508 508 $DbResult = $this->System->Database->query($Query); 509 while ($Group = $DbResult->fetch_assoc())509 while ($Group = $DbResult->fetch_assoc()) 510 510 { 511 511 $Columns = ''; 512 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {512 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 513 513 if ($Column['Visible']) $Columns .= CheckBox('item'.$Column['Id'], 514 514 !isset($GroupItems[$Column['Id']]), '', 'CheckBox', !$Editable).' '.T($Column['Name']).' <br/>'; … … 533 533 '</form>'. 534 534 $PageList['Output']; 535 return ($Output);535 return $Output; 536 536 } 537 537 … … 540 540 $Output = ''; 541 541 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 542 if (array_key_exists('ExportId', $_GET))542 if (array_key_exists('ExportId', $_GET)) 543 543 { 544 544 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 545 if ($DbRows->num_rows > 0)545 if ($DbRows->num_rows > 0) 546 546 { 547 547 $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; 549 549 else $Editable = false; 550 550 551 if (array_key_exists('Operation', $_POST))552 if ($_POST['Operation'] == 'Save')551 if (array_key_exists('Operation', $_POST)) 552 if ($_POST['Operation'] == 'Save') 553 553 { 554 if (array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0))554 if (array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0)) 555 555 { 556 556 $this->System->Database->query('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']); … … 564 564 $Output .= '<h3>'.T('Format the generated output').'</h3>'. 565 565 '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'; 566 if ($Editable)566 if ($Editable) 567 567 { 568 568 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 571 571 } 572 572 $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` ORDER BY `Name`'); 573 while ($ExportFormat = $DbResult->fetch_assoc())573 while ($ExportFormat = $DbResult->fetch_assoc()) 574 574 { 575 575 $Output .= RadioButton('OutputType', $ExportFormat['Id'], $Export['OutputType'] == $ExportFormat['Id'], '', !$Editable).' '.$ExportFormat['Name'].'<br/>'; … … 578 578 } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 579 579 } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL); 580 return ($Output);580 return $Output; 581 581 } 582 582 … … 587 587 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 588 588 $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; 590 590 else $Editable = false; 591 591 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))) 594 594 { 595 595 $this->System->Database->query('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']); … … 600 600 $Export = $DbResult->fetch_assoc(); 601 601 602 if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);602 if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL); 603 603 else { 604 604 $Query = 'SELECT `ClientVersion`.* FROM `ExportVersion` '. … … 620 620 '<h3>'.T('Client version').'</h3>'; 621 621 622 if ($Editable)622 if ($Editable) 623 623 { 624 624 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 633 633 $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit']; 634 634 $DbResult = $this->System->Database->query($Query); 635 while ($Version = $DbResult->fetch_assoc())635 while ($Version = $DbResult->fetch_assoc()) 636 636 { 637 637 $Output .= '<tr><td><a href="'.$this->System->Link('/client-version/?action=item&id='.$Version['Id']).'">'. … … 646 646 $PageList['Output']; 647 647 } 648 return ($Output);648 return $Output; 649 649 } 650 650 … … 654 654 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 655 655 $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); 658 658 else { 659 659 $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']); 660 if ($DbResult->num_rows > 0)660 if ($DbResult->num_rows > 0) 661 661 { 662 662 $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) 664 664 { 665 665 if (array_key_exists('Auto', $_GET) == false) … … 669 669 } else $Output = ShowMessage(T('Format output isn\'t select').'.', MESSAGE_CRITICAL); 670 670 } 671 return ($Output);671 return $Output; 672 672 } 673 673 … … 679 679 $Export->LoadFilters(); 680 680 681 if (($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == ''))681 if (($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == '')) 682 682 $Output = ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL); 683 683 else { … … 687 687 $UnionItems = array(); 688 688 $DbResult = $this->System->Database->query($GroupListQuery.$Where); 689 while ($DbRow = $DbResult->fetch_assoc())689 while ($DbRow = $DbResult->fetch_assoc()) 690 690 { 691 691 $UnionItems[] = 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. … … 721 721 $Translated = 0; 722 722 $Total = 0; 723 if (count($UnionItems) > 0)723 if (count($UnionItems) > 0) 724 724 { 725 725 $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()) 727 727 { 728 728 $Output .= '<tr><td>'.T($Group['Name']).'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>'; … … 731 731 } 732 732 } 733 if ($Total > 0) $Percent = $Translated / $Total * 100;733 if ($Total > 0) $Percent = $Translated / $Total * 100; 734 734 else $Percent = 100; 735 735 … … 737 737 $Output .= '</table>'; 738 738 } 739 return ($Output);739 return $Output; 740 740 } 741 741 … … 743 743 { 744 744 $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'])) 746 746 { 747 747 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 748 if ($DbResult->num_rows > 0)748 if ($DbResult->num_rows > 0) 749 749 { 750 750 $Export = $DbResult->fetch_assoc(); … … 759 759 T('Statistic'), T('Output'))); 760 760 $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(); 769 769 else $Output .= $this->ExportViewGeneral(); 770 770 … … 772 772 } else $Output .= ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 773 773 } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL); 774 return ($Output);774 return $Output; 775 775 } 776 776 777 777 function ExportClone() 778 778 { 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'])) 782 782 { 783 783 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 784 784 $DbRow = $DbResult->fetch_row(); 785 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])785 if ($DbRow[0] < $this->System->Config['MaxExportPerUser']) 786 786 { 787 787 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 788 if ($DbResult->num_rows > 0)788 if ($DbResult->num_rows > 0) 789 789 { 790 790 $DbRow = $DbResult->fetch_assoc(); … … 810 810 } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 811 811 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 812 return ($Output);812 return $Output; 813 813 } 814 814 … … 816 816 { 817 817 $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(); 825 825 else $Output = $this->ExportList(); 826 826 } else $Output = $this->ExportList(); 827 return ($Output);827 return $Output; 828 828 } 829 829 } … … 839 839 function Show() 840 840 { 841 if (array_key_exists('i', $_GET))841 if (array_key_exists('i', $_GET)) 842 842 $Output = $this->System->ModuleManager->Modules['Export']->GetTaskProgress($_GET['i'] * 1); 843 843 else $Output = 'Missing task id'; 844 return ($Output);844 return $Output; 845 845 } 846 846 }
Note:
See TracChangeset
for help on using the changeset viewer.