Changeset 572 for trunk/Modules/Export/Page.php
- Timestamp:
- Aug 26, 2013, 10:24:51 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/Page.php
r571 r572 2 2 3 3 include_once('ExportOutput.php'); 4 5 define('TAB_GENERAL', 0); 6 define('TAB_TRANSLATORS', 1); 7 define('TAB_GROUPS', 2); 8 define('TAB_LANGUAGES', 3); 9 define('TAB_OUTPUT_FORMAT', 4); 10 define('TAB_VERSION', 5); 11 define('TAB_STAT', 6); 12 define('TAB_OUTPUT', 7); 4 13 5 14 class PageExport extends Page … … 54 63 '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=7">Exportovat</a>'; 55 64 if($Export['User'] == $User->Id) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>'; 65 if($User->Id != null) $Action .= ' <a href="?Action=Clone&ExportId='.$Export['Id'].'" onclick="return confirmAction(\'Opravdu klonovat položku?\');">Klonovat</a>'; 56 66 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'. 57 67 '<td><a href="'.$this->System->Link('/user.php?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'. … … 678 688 $Output .= ShowTabs(array('Obecné', 'Překladatelé', 'Překlady', 'Jazyky', 'Formát', 'Verze', 'Statistika', 'Výstup')); 679 689 $Output .= '<div id="content">'; 680 if($_SESSION['Tab'] == 0) $Output .= $this->ExportViewGeneral();681 else if($_SESSION['Tab'] == 1) $Output .= $this->ExportViewTranslators();682 else if($_SESSION['Tab'] == 2) $Output .= $this->ExportViewGroups();683 else if($_SESSION['Tab'] == 3) $Output .= $this->ExportViewLanguages();684 else if($_SESSION['Tab'] == 4) $Output .= $this->ExportViewOutputFormat();685 else if($_SESSION['Tab'] == 5) $Output .= $this->ExportViewVersion();686 else if($_SESSION['Tab'] == 6) $Output .= $this->ExportViewStat();687 else if($_SESSION['Tab'] == 7) $Output .= $this->ExportViewOutput();690 if($_SESSION['Tab'] == TAB_GENERAL) $Output .= $this->ExportViewGeneral(); 691 else if($_SESSION['Tab'] == TAB_TRANSLATORS) $Output .= $this->ExportViewTranslators(); 692 else if($_SESSION['Tab'] == TAB_GROUPS) $Output .= $this->ExportViewGroups(); 693 else if($_SESSION['Tab'] == TAB_LANGUAGES) $Output .= $this->ExportViewLanguages(); 694 else if($_SESSION['Tab'] == TAB_OUTPUT_FORMAT) $Output .= $this->ExportViewOutputFormat(); 695 else if($_SESSION['Tab'] == TAB_VERSION) $Output .= $this->ExportViewVersion(); 696 else if($_SESSION['Tab'] == TAB_STAT) $Output .= $this->ExportViewStat(); 697 else if($_SESSION['Tab'] == TAB_OUTPUT) $Output .= $this->ExportViewOutput(); 688 698 else $Output .= $this->ExportViewGeneral(); 689 699 … … 694 704 } 695 705 696 function Show() 706 function ExportClone() 707 { 708 if($this->System->User->Licence(LICENCE_USER)) 709 { 710 if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId'])) 711 { 712 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 713 $DbRow = $DbResult->fetch_row(); 714 if($DbRow[0] < $this->System->Config['MaxExportPerUser']) 715 { 716 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 717 if($DbResult->num_rows > 0) 718 { 719 $DbRow = $DbResult->fetch_assoc(); 720 unset($DbRow['Id']); 721 $DbRow['UsedCount'] = '0'; 722 $DbRow['User'] = $this->System->User->Id; 723 $DbRow['TimeCreate'] = 'NOW()'; 724 $DbRow['Title'] .= ' - kopie'; 725 $this->System->Database->insert('Export', $DbRow); 726 $ExportId = $this->System->Database->insert_id; 727 $this->System->Database->query('INSERT INTO `ExportGroup` (SELECT NULL AS `Id`, '.$ExportId.' AS `Export`, `Group` FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId'].')'); 728 $this->System->Database->query('INSERT INTO `ExportLanguage` (SELECT NULL AS `Id`, '.$ExportId.' AS `Export`, `Language`, `Sequence` FROM `ExportLanguage` WHERE `Export`='.$_GET['ExportId'].')'); 729 $this->System->Database->query('INSERT INTO `ExportUser` (SELECT NULL AS `Id`, '.$ExportId.' AS `Export`, `User`, `Sequence` FROM `ExportUser` WHERE `Export`='.$_GET['ExportId'].')'); 730 $Output = ShowMessage('Kopie exportu vytvořena.<br/>Přímý odkaz na tento export: <a href="?Action=View&ExportId='.$ExportId.'">zde</a>'); 731 WriteLog('Vytvořena kopie exportu <a href="'.$this->System->Link('/export/?Action=View&ExportId='.$ExportId).'">'.$ExportId.'</a>.', LOG_TYPE_EXPORT); 732 $_GET['Filter'] = 'my'; 733 $this->ExportList(); 734 } else $Output = ShowMessage('Zdrojový export nenalezen', MESSAGE_CRITICAL); 735 } else $Output = ShowMessage('Nemůžete vytvářet další export. Max. počet na uživatele je '. 736 $this->System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL); 737 } else $Output = ShowMessage('Export nenalezen.', MESSAGE_CRITICAL); 738 } else $Output = ShowMessage('Nemáte oprávnění.', MESSAGE_CRITICAL); 739 return($Output); 740 } 741 742 function Show() 697 743 { 698 744 if(array_key_exists('Action', $_GET)) … … 702 748 else if($_GET['Action'] == 'View') $Output = $this->ExportView(); 703 749 else if($_GET['Action'] == 'Delete') $Output = $this->ExportDelete(); 750 else if($_GET['Action'] == 'Clone') $Output = $this->ExportClone(); 704 751 else $Output = $this->ExportList(); 705 752 } else $Output = $this->ExportList();
Note:
See TracChangeset
for help on using the changeset viewer.