source: branches/mvc/Base/Types/Enumeration.php

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: 877 bytes
Line 
1<?php
2
3include_once(dirname(__FILE__).'/Base.php');
4
5class TypeEnumeration extends TypeBase
6{
7 function OnView($Item)
8 {
9 $Type = $this->System->Type->GetTypeDefinition($Item['Type']);
10 if(array_key_exists($Item['Value'], $Type['Parameters']))
11 $Output = $Type['Parameters'][$Item['Value']];
12 else $Output = $Item['Value'];
13 return($Output);
14 }
15
16 function OnEdit($Item)
17 {
18 $Type = $this->System->Type->GetTypeDefinition($Item['Type']);
19 $Output = '<select name="'.$Item['Name'].'">';
20 foreach($Type['Parameters'] as $Index => $StateName)
21 {
22 if($Item['Value'] == $Index) $Selected = ' selected="1"'; else $Selected = '';
23 $Output .= '<option value="'.$Index.'"'.$Selected.'>'.$StateName.'</option>';
24 }
25 $Output .= '</select>';
26 return($Output);
27 }
28
29 function OnLoad($Item)
30 {
31 return($_POST[$Item['Name']]);
32 }
33}
Note: See TracBrowser for help on using the repository browser.