source: trunk/lists/SystemList.php

Last change on this file was 30, checked in by george, 16 years ago
  • Přidáno: Podpora pro určování v definicích krom tabulky také jméno databáze a jméno primárního identifikačního sloupce.
File size: 1.0 KB
Line 
1<?php
2
3class ListSystemList
4{
5 function OnAdd($Parameters)
6 {
7 global $Database;
8
9 $Database->query('CREATE TABLE IF NOT EXISTS `'.$Parameters['TableName'].'` (
10 `Id` int(11) NOT NULL auto_increment,
11 PRIMARY KEY (`Id`)
12 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci;');
13 //echo($Database->LastQuery);
14 }
15
16 function ListSystemListOnEdit($Parameters)
17 {
18 global $Database;
19
20 $DbResult = $Database->query('SELECT `TableName` FROM `'.$Parameters['ListTableName'].'` WHERE Id='.$Parameters['Id']);
21 $DbRow = $DbResult->fetch_assoc();
22 if($DbRow['TableName'] != $Parameters['TableName'])
23 $Database->query('RENAME TABLE `'.$DbRow['TableName'].'` TO `'.$Parameters['TableName'].'`');
24 }
25
26 function ApplySQLToItems($SQL)
27 {
28 global $Database;
29
30 $DbResult = $Database->query('SELECT `TableName` FROM `SystemList`');
31 while($DbRow = $DbResult->fetch_assoc())
32 {
33 $Database->query(str_replace('`TableName`', '`'.$DbRow['TableName'].'`', $SQL));
34 }
35 }
36}
37
38?>
Note: See TracBrowser for help on using the repository browser.