Changeset 602 for trunk/Modules/Translation
- Timestamp:
- Nov 25, 2013, 11:01:32 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Translation/TranslationList.php
r595 r602 278 278 array('Name' => '', 'Title' => 'Zdroje'), 279 279 array('Name' => 'LastImport', 'Title' => 'Datum posledního importu'), 280 array('Name' => 'LastVersion', 'Title' => 'Verze posledního importu'), 280 array('Name' => 'LastVersion', 'Title' => 'Verze posledního importu'), 281 281 ); 282 if($this->System->User->Licence(LICENCE_ADMIN)) 283 $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); 282 284 283 285 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); … … 292 294 if($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua '; 293 295 $Output .= '</td><td><a title="Změny po posledním importu u vybrané překladové skupiny" href="log.php?group='. 294 $Group['Id'].'&type=11">'.HumanDate($Group['LastImport']).'</a></td><td>'.GetVersionWOW($Group['LastVersion']).'</td></tr>'; 296 $Group['Id'].'&type=11">'.HumanDate($Group['LastImport']).'</a></td><td>'.GetVersionWOW($Group['LastVersion']).'</td>'; 297 if($this->System->User->Licence(LICENCE_ADMIN)) 298 $Output .= '<td><a href="?action=groupdelete&id='.$Group['Id'].'">Smazat</a></td>'; 299 $Output .= '</tr>'; 300 295 301 } 296 302 $Output .= '</table>'. … … 353 359 '<table>'. 354 360 '<tr><td>Název:</td><td><input type="text" name="Name"/></td></tr>'. 355 '<tr><td>Název tabulky v databázi:</td><td><input type="text" name="TablePrefix"/></td></tr>'. 356 '<tr><td>Typ zdroje:</td><td><input type="text" name="SourceType"/></td></tr>'. 357 '<tr><td>Mangos databáze:</td><td><input type="text" name="MangosDatabase"/></td></tr>'. 358 '<tr><td>Mangos tabulka:</td><td><input type="text" name="MangosTable"/></td></tr>'. 361 '<tr><td>Název tabulky v databázi:</td><td>Text<input type="text" name="TablePrefix"/></td></tr>'. 359 362 '<tr><td colspan="2"><input type="submit" name="add" value="Přidat"/></td></tr>'. 360 363 '</table></form>'; … … 367 370 if($this->System->User->Licence(LICENCE_ADMIN)) 368 371 { 369 // TODO: Add group items manipulation oprations 370 } 371 } 372 372 $TableName = 'Text'.$_POST['TablePrefix']; 373 $DbResult = $this->System->Database->select('Group', 'Id', 'TablePrefix="'.$TableName.'"'); 374 if($DbResult->num_rows == 0) 375 { 376 377 $this->System->Database->query('CREATE TABLE IF NOT EXISTS `'.$TableName.'` ( 378 `ID` int(11) NOT NULL AUTO_INCREMENT, 379 `Entry` int(11) NOT NULL, 380 `Name` varchar(255) NOT NULL, 381 `Language` int(11) NOT NULL DEFAULT "0", 382 `User` int(11) DEFAULT NULL, 383 `Complete` int(11) NOT NULL, 384 `CompleteParts` int(11) NOT NULL, 385 `Take` int(11) DEFAULT NULL, 386 `VersionStart` int(11) NOT NULL, 387 `VersionEnd` int(11) NOT NULL, 388 `ModifyTime` datetime NOT NULL, 389 PRIMARY KEY (`ID`), 390 KEY `Entry` (`Entry`), 391 KEY `User` (`User`), 392 KEY `Take` (`Take`), 393 KEY `Language` (`Language`), 394 KEY `Complete` (`Complete`), 395 KEY `VersionStart` (`VersionStart`), 396 KEY `VersionEnd` (`VersionEnd`), 397 KEY `ModifyTime` (`ModifyTime`) 398 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;'); 399 400 $this->System->Database->query('ALTER TABLE `'.$TableName.'` 401 ADD CONSTRAINT `'.$TableName.'_ibfk_1` FOREIGN KEY (`Language`) REFERENCES `Language` (`Id`), 402 ADD CONSTRAINT `'.$TableName.'_ibfk_2` FOREIGN KEY (`User`) REFERENCES `User` (`ID`), 403 ADD CONSTRAINT `'.$TableName.'_ibfk_3` FOREIGN KEY (`Take`) REFERENCES `'.$TableName.'` (`ID`);'); 404 $DbResult = $this->System->Database->insert('Group', array('Name' => $_POST['Name'], 405 'TablePrefix' => $TableName, 'PrimaryKeyItem' => 'Entry')); 406 $Group = $this->System->Database->insert_id; 407 $this->System->Database->insert('GroupItem', array('Group' => $Group, 408 'Name' => 'Jméno', 'Column' => 'Name', 'Visible' => 1)); 409 $Output = ShowMessage('Překladová skupina vytvořena', MESSAGE_INFORMATION); 410 } else $Output = ShowMessage('Překladová skupina '.$TableName.' již existuje', MESSAGE_CRITICAL); 411 $Output .= $this->ShowGroupTypeList(); 412 } else $Output = ShowMessage('Nemáte oprávnění.', MESSAGE_CRITICAL); 413 return($Output); 414 } 415 416 function ShowGroupDelete() 417 { 418 if($this->System->User->Licence(LICENCE_ADMIN)) 419 { 420 $DbResult = $this->System->Database->select('Group', '*', 'Id='.$_GET['id']); 421 if($DbResult->num_rows == 1) 422 { 423 $Group = $DbResult->fetch_assoc(); 424 $this->Database->query('DROP TABLE `'.$Group['TablePrefix'].'`'); 425 $this->Database->query('DELETE FROM `GroupItem` WHERE `Group`='.$Group['Id']); 426 $this->Database->query('DELETE FROM `Group` WHERE `Id`='.$Group['Id']); 427 $Output = ShowMessage('Překladová skupina '.$Group['Name'].' smazána', MESSAGE_INFORMATION); 428 } else $Output = ShowMessage('Překladová skupina nenalezena', MESSAGE_CRITICAL); 429 } else $Output = ShowMessage('Nemáte oprávnění.', MESSAGE_CRITICAL); 430 $Output .= $this->ShowGroupTypeList(); 431 return($Output); 432 } 433 373 434 function Show() 374 435 { … … 377 438 else if($Action == 'grouplist') $Output = $this->ShowGroupTypeList(); 378 439 else if($Action == 'groupadd') $Output = $this->ShowGroupAdd(); 440 else if($Action == 'groupdelete') $Output = $this->ShowGroupDelete(); 379 441 else if($Action == 'groupaddfinish') $Output = $this->ShowGroupAddFinish(); 380 442 else
Note:
See TracChangeset
for help on using the changeset viewer.