Last change
on this file was 47, checked in by chronos, 10 years ago |
- Odstraněno: Zbytečná PHP ukončovací značka "?>" z konce všech souborů.
|
File size:
1.5 KB
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | include_once(dirname(__FILE__).'/Base.php');
|
---|
4 |
|
---|
5 | class TypePointerOneToOne extends TypeBase
|
---|
6 | {
|
---|
7 | function OnView($Item)
|
---|
8 | {
|
---|
9 | $Type = $this->System->Type->TypeDefinitionList[$Item['Type']];
|
---|
10 | $DbResult = $this->System->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name FROM `'.$Type['Parameters']['Table'].'` WHERE `'.$Type['Parameters']['Id'].'`='.$Item['Value']);
|
---|
11 | $DbRow = $DbResult->fetch_assoc();
|
---|
12 | if($this->System->Modules['Permission']->Check('Corporation', 'Show'))
|
---|
13 | $Output = $this->System->HTML->MakeLink($DbRow['Name'], $this->System->MakeLink($Type['Parameters']['Table'], 'Show', array('Id' => $Item['Value'])));
|
---|
14 | else $Output = $DbRow['Name'];
|
---|
15 | return($Output);
|
---|
16 | }
|
---|
17 |
|
---|
18 | function OnEdit($Item)
|
---|
19 | {
|
---|
20 | $Output = '<select name="'.$Item['Name'].'">';
|
---|
21 | $Type = $this->System->Type->TypeDefinitionList[$Item['Type']];
|
---|
22 | if(array_key_exists('Condition', $Type['Parameters'])) $Where = ' WHERE '.$Type['Parameters']['Condition'];
|
---|
23 | else $Where = '';
|
---|
24 | $DbResult = $this->System->Database->query('SELECT '.$Type['Parameters']['Name'].' AS Name,'.$Type['Parameters']['Id'].' AS Id FROM `'.$Type['Parameters']['Table'].'`'.$Where.' ORDER BY Name DESC');
|
---|
25 | while($DbRow = $DbResult->fetch_assoc())
|
---|
26 | {
|
---|
27 | if($Item['Value'] == $DbRow['Id']) $Selected = ' selected="1"'; else $Selected = '';
|
---|
28 | $Output .= '<option value="'.$DbRow['Id'].'"'.$Selected.'>'.$DbRow['Name'].'</option>';
|
---|
29 | }
|
---|
30 | $Output .= '</select>';
|
---|
31 | return($Output);
|
---|
32 | }
|
---|
33 |
|
---|
34 | function OnLoad($Item)
|
---|
35 | {
|
---|
36 | return($_POST[$Item['Name']]);
|
---|
37 | }
|
---|
38 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.