Last change
on this file was 38, checked in by george, 16 years ago |
- Přidáno: Typy Color pro výběr barvy a Text pro psaní obsáhlejších textů.
- Opraveno: Ukládání položek do jiných databází než v které je systém.
|
File size:
1.2 KB
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | class DatabaseList extends Module
|
---|
4 | {
|
---|
5 | var $Dependencies = array('Log', 'User');
|
---|
6 |
|
---|
7 | function AddItem($TableId, $Values)
|
---|
8 | {
|
---|
9 | $DbResult = $this->Database->query('SELECT `TableName`, `Database` FROM `SystemList` WHERE `Id`='.$TableId);
|
---|
10 | $DbRow = $DbResult->fetch_assoc();
|
---|
11 |
|
---|
12 | $this->Database->insert(array('Table' => $DbRow['TableName'], 'Database' => $DbRow['Database']), $Values);
|
---|
13 | return($this->Database->insert_id);
|
---|
14 | }
|
---|
15 |
|
---|
16 | function DeleteItem($TableId, $ItemId)
|
---|
17 | {
|
---|
18 | $DbResult = $this->Database->query('SELECT `TableName`, `Database` FROM `SystemList` WHERE `Id`='.$TableId);
|
---|
19 | $DbRow = $DbResult->fetch_assoc();
|
---|
20 | $this->Database->delete(array('Table' => $DbRow['TableName'], 'Database' => $DbRow['Database'], 'Condition' => 'Id='.$ItemId), array('DeletionTime' => 'NOW()'));
|
---|
21 | }
|
---|
22 |
|
---|
23 | function EditItem($TableId, $Values, $ItemId)
|
---|
24 | {
|
---|
25 | $DbResult = $this->Database->query('SELECT `TableName`, `Database` FROM `SystemList` WHERE `Id`='.$TableId);
|
---|
26 | $DbRow = $DbResult->fetch_assoc();
|
---|
27 | $this->DeleteItem($TableId, $ItemId);
|
---|
28 | $Values['Id'] = $ItemId;
|
---|
29 | $this->Database->replace(array('Table' => $DbRow['TableName'], 'Database' => $DbRow['Database']), $Values);
|
---|
30 | }
|
---|
31 | }
|
---|
32 |
|
---|
33 | ?>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.