Changeset 412 for trunk/export/index.php
- Timestamp:
- Apr 2, 2010, 7:08:00 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/export/index.php
r411 r412 106 106 if($User->Licence(LICENCE_USER)) 107 107 { 108 if(array_key_exists('ExportId', $_GET)) 109 { 110 $DbResult = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId'].' AND `User`='.$User->Id); 111 if(mysql_num_rows($DbResult) > 0) 112 { 113 $Database->SQLCommand('DELETE FROM `Export` WHERE `Id`='.$_GET['ExportId']); 114 DeleteDirectory('../tmp/Export/'.$_GET['ExportId'].'/'); 115 echo('Export smazán.<br/><br/>'); 116 $_GET['Filter'] = 'my'; 117 WriteLog('Smazán export '.$_GET['ExportId'], LOG_TYPE_EXPORT); 118 ExportList(); 119 } else echo('Export '.$_GET['ExportId'].' nelze smazat.<br/>'); 120 } else echo('Nebylo zadáno Id'); 108 $DbResult = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId'].' AND `User`='.$User->Id); 109 $Database->SQLCommand('DELETE FROM `Export` WHERE `Id`='.$_GET['ExportId']); 110 DeleteDirectory('../tmp/Export/'.$_GET['ExportId'].'/'); 111 echo('Export smazán.<br/><br/>'); 112 $_GET['Filter'] = 'my'; 113 WriteLog('Smazán export '.$_GET['ExportId'], LOG_TYPE_EXPORT); 114 ExportList(); 121 115 } else echo('Nemáte oprávnění'); 122 116 } … … 127 121 128 122 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 129 if(array_key_exists('ExportId', $_GET)) 130 { 131 $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 132 if(mysql_num_rows($DbRows) > 0) 133 { 134 $Export = mysql_fetch_assoc($DbRows); 135 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 136 else $Editable = false; 137 123 $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 124 $Export = mysql_fetch_assoc($DbRows); 125 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 126 else $Editable = false; 138 127 139 128 if(array_key_exists('Operation', $_GET)) … … 220 209 echo('</form>'); 221 210 echo($PageList['Output']); 222 } else echo('Položka nenalezena');223 } else echo('Nebylo zadáno Id');224 211 } 225 212 … … 231 218 $DisabledTextArea = array(false => ' readonly="yes"', true => ''); 232 219 echo('<h3>Obecná nastavení</h3>'); 233 if(array_key_exists('ExportId', $_GET)) 234 { 235 $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 236 if(mysql_num_rows($DbRows) > 0) 237 { 238 $Export = mysql_fetch_assoc($DbRows); 239 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 240 else $Editable = false; 241 if($Editable and array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST)) 242 { 243 if(array_key_exists('WithDiacritic', $_POST)) $WithDiacritic = 1; 244 else $WithDiacritic = 0; 245 $Database->SQLCommand('UPDATE `Export` SET `Title`="'.$_POST['Title'].'", `Description`="'.$_POST['Description'].'", `WithDiacritic`='.$WithDiacritic.' WHERE Id='.$Export['Id']); 246 $Export['Title'] = $_POST['Title']; 247 $Export['Description'] = $_POST['Description']; 248 $Export['WithDiacritic'] = $WithDiacritic; 249 } 220 $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 221 $Export = mysql_fetch_assoc($DbRows); 222 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 223 else $Editable = false; 224 if($Editable and array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST)) 225 { 226 if(array_key_exists('WithDiacritic', $_POST)) $WithDiacritic = 1; 227 else $WithDiacritic = 0; 228 $Database->SQLCommand('UPDATE `Export` SET `Title`="'.$_POST['Title'].'", `Description`="'.$_POST['Description'].'", `WithDiacritic`='.$WithDiacritic.' WHERE Id='.$Export['Id']); 229 $Export['Title'] = $_POST['Title']; 230 $Export['Description'] = $_POST['Description']; 231 $Export['WithDiacritic'] = $WithDiacritic; 232 } 250 233 251 252 253 254 255 256 257 258 234 if($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"'; else $WithDiacritic = ''; 235 echo('<form action="?Action=View&Tab=0&ExportId='.$Export['Id'].'" method="post">'. 236 '<table>'); 237 if($Editable) 238 { 239 echo('<tr><td colspan="2"><input type="submit" value="Uložit" '.$DisabledInput[$Editable].'/></td></tr>'); 240 } 241 echo('<tr><td>Označení:</td><td><input type="text" style="width: 400px" name="Title" value="'.$Export['Title'].'"'.$DisabledInput[$Editable].'/></td></tr>'. 259 242 '<tr><td>Popis:</td><td><textarea name="Description" cols="54" rows="10"'.$DisabledTextArea[$Editable].'>'.$Export['Description'].'</textarea></td></tr>'. 260 243 '<tr><td>Včetně háčků a čárek</td><td><input type="checkbox" name="WithDiacritic" '.$WithDiacritic.''.$DisabledInput[$Editable].'/></td></tr>'. 261 '</table></form>'); 262 } else echo('Položka nenalezena'); 263 } else echo('Nebylo zadáno Id'); 244 '</table></form>'); 264 245 } 265 246 … … 269 250 270 251 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 271 if(array_key_exists('ExportId', $_GET)) 272 { 273 $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 274 if(mysql_num_rows($DbRows) > 0) 275 { 276 $Export = mysql_fetch_assoc($DbRows); 277 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 278 else $Editable = false; 252 $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 253 $Export = mysql_fetch_assoc($DbRows); 254 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 255 else $Editable = false; 279 256 280 257 if(array_key_exists('Operation', $_GET)) … … 353 330 echo('</form>'); 354 331 echo($PageList['Output']); 355 } else echo('Položka nenalezena');356 } else echo('Nebylo zadáno Id');357 332 } 358 333 … … 362 337 363 338 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 364 if(array_key_exists('ExportId', $_GET)) 365 { 366 $DbRows = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']); 367 if(mysql_num_rows($DbRows) > 0) 368 { 369 $Export = mysql_fetch_assoc($DbRows); 370 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 371 else $Editable = false; 339 $DbRows = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']); 340 $Export = mysql_fetch_assoc($DbRows); 341 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 342 else $Editable = false; 372 343 373 344 if(array_key_exists('Operation', $_GET)) … … 442 413 echo('</form>'); 443 414 echo($PageList['Output']); 444 } else echo('Položka nenalezena');445 } else echo('Nebylo zadáno Id');446 415 } 447 416 … … 490 459 491 460 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 492 if(array_key_exists('ExportId', $_GET)) 493 { 494 $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 495 if(mysql_num_rows($DbRows) > 0) 496 { 497 $Export = mysql_fetch_assoc($DbRows); 498 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 499 else $Editable = false; 461 $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 462 $Export = mysql_fetch_assoc($DbRows); 463 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; 464 else $Editable = false; 500 465 501 466 if(array_key_exists('ClientVersion', $_POST)) … … 545 510 echo('</form>'); 546 511 echo($PageList['Output']); 547 } else echo('Položka nenalezena');548 } else echo('Nebylo zadáno Id');549 512 } 550 513 … … 571 534 global $Database, $System; 572 535 573 if(array_key_exists('ExportId', $_GET)) 574 { 575 $Export = new Export($System); 536 $Export = new Export($System); 576 537 $Export->Id = $_GET['ExportId']; 577 538 $Export->Init(); … … 625 586 echo('<tr><td><strong>Celkem</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, round($Translated / $Total * 100, 2)).'</strong></td></tr>'); 626 587 echo('</table>'); 588 } 589 590 function ExportView() 591 { 592 global $Database; 593 594 if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId'])) 595 { 596 $DbResult = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 597 if(mysql_num_rows($DbResult) > 0) 598 { 599 $Export = mysql_fetch_assoc($DbResult); 600 601 $DbResult = $Database->SQLCommand('SELECT * FROM `User` WHERE `ID`='.$Export['User']); 602 $UserLine = mysql_fetch_assoc($DbResult); 603 echo('Export <strong><a href="?Action=View&Tab=6&ExportId='.$Export['Id'].'">'.$_GET['ExportId'].'</a></strong> překladatele <strong>'.$UserLine['Name'].'</strong> s označením <strong>'.$Export['Title'].'</strong>'); 604 ShowTabs(array('Obecné', 'Překladatelé', 'Překlady', 'Jazyky', 'Formát', 'Verze', 'Statistika', 'Výstup')); 605 echo('<div id="content">'); 606 if($_SESSION['Tab'] == 0) ExportViewGeneral(); 607 else if($_SESSION['Tab'] == 1) ExportViewTranslators(); 608 else if($_SESSION['Tab'] == 2) ExportViewGroups(); 609 else if($_SESSION['Tab'] == 3) ExportViewLanguages(); 610 else if($_SESSION['Tab'] == 4) ExportViewOutputFormat(); 611 else if($_SESSION['Tab'] == 5) ExportViewVersion(); 612 else if($_SESSION['Tab'] == 6) ExportViewStat(); 613 else if($_SESSION['Tab'] == 7) ExportViewOutput(); 614 else ExportViewGeneral(); 615 616 echo('</div>'); 617 } else echo('Export nenalezen'); 627 618 } else echo('Nebylo zadáno Id'); 628 }629 630 function ExportView()631 {632 global $Database;633 634 $DbResult = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);635 $Export = mysql_fetch_assoc($DbResult);636 $DbResult = $Database->SQLCommand('SELECT * FROM `User` WHERE `ID`='.$Export['User']);637 $UserLine = mysql_fetch_assoc($DbResult);638 echo('Export <strong><a href="?Action=View&Tab=6&ExportId='.$Export['Id'].'">'.$_GET['ExportId'].'</a></strong> překladatele <strong>'.$UserLine['Name'].'</strong> s označením <strong>'.$Export['Title'].'</strong>');639 ShowTabs(array('Obecné', 'Překladatelé', 'Překlady', 'Jazyky', 'Formát', 'Verze', 'Statistika', 'Výstup'));640 echo('<div id="content">');641 if($_SESSION['Tab'] == 0) ExportViewGeneral();642 else if($_SESSION['Tab'] == 1) ExportViewTranslators();643 else if($_SESSION['Tab'] == 2) ExportViewGroups();644 else if($_SESSION['Tab'] == 3) ExportViewLanguages();645 else if($_SESSION['Tab'] == 4) ExportViewOutputFormat();646 else if($_SESSION['Tab'] == 5) ExportViewVersion();647 else if($_SESSION['Tab'] == 6) ExportViewStat();648 else if($_SESSION['Tab'] == 7) ExportViewOutput();649 650 echo('</div>');651 619 } 652 620
Note:
See TracChangeset
for help on using the changeset viewer.