source: trunk/lists/SystemListItem.php

Last change on this file was 29, checked in by george, 16 years ago
  • Upraveno: Hledání položek v seznamu dle zadaného filtru.
File size: 1.1 KB
Line 
1<?php
2
3class ListSystemListItem
4{
5 function RebuildOrder($List)
6 {
7 global $Database;
8
9 $Database->query('SET @I = 0;');
10 $Database->query('UPDATE `SystemListItem` SET `Sequence` = (@I := @I + 1) WHERE `List`='.$List.' ORDER BY `Sequence`;');
11 }
12
13 function OnAdd($Parameters)
14 {
15 global $Database;
16
17 //print_r($Parameters);
18 $DbResult = $Database->query('SELECT `DbDataType` FROM `SystemType` WHERE Id='.$Parameters['Type']);
19 //echo($Database->LastQuery);
20 $DbRow = $DbResult->fetch_assoc();
21 $DbResult = $Database->query('SELECT `TableName` FROM `SystemList` WHERE Id='.$Parameters[$Parameters['Column']]);
22 //echo($Database->LastQuery);
23 $DbRow2 = $DbResult->fetch_assoc();
24 $Database->query('ALTER TABLE `'.$DbRow2['TableName'].'` ADD `'.$Parameters['Name'].'` '.$DbRow['DbDataType'].' NOT NULL ;');
25 //echo($Database->LastQuery);
26
27 $this->RebuildOrder($Parameters['List']);
28 }
29
30 function OnEdit($Parameters)
31 {
32 $this->RebuildOrder($Parameters['List']);
33 }
34
35 function OnDelete($Parameters)
36 {
37 $this->RebuildOrder($Parameters['List']);
38 }
39}
40
41?>
Note: See TracBrowser for help on using the repository browser.