| 1 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* TIbmScaffoldInput class file.
|
|
|
4 |
*
|
|
|
5 |
* @author Cesar Ramos <cramos[at]gmail[dot]com>
|
|
|
6 |
* @link http://www.pradosoft.com/
|
|
|
7 |
* @copyright Copyright © 2005-2008 PradoSoft
|
|
|
8 |
* @license http://www.pradosoft.com/license/
|
|
|
9 |
* @package System.Data.ActiveReecord.Scaffold.InputBuilder
|
|
|
10 |
*/
|
|
|
11 |
Prado::using('System.Data.ActiveRecord.Scaffold.InputBuilder.TScaffoldInputCommon');
|
|
|
12 |
|
|
|
13 |
class TIbmScaffoldInput extends TScaffoldInputCommon
|
|
|
14 |
{
|
|
|
15 |
protected function createControl($container, $column, $record)
|
|
|
16 |
{
|
|
|
17 |
switch(strtolower($column->getDbType()))
|
|
|
18 |
{
|
|
|
19 |
case 'date':
|
|
|
20 |
return $this->createDateControl($container, $column, $record);
|
|
|
21 |
case 'time':
|
|
|
22 |
return $this->createTimeControl($container, $column, $record);
|
|
|
23 |
case 'timestamp':
|
|
|
24 |
return $this->createDateTimeControl($container, $column, $record);
|
|
|
25 |
case 'smallint': case 'integer': case 'bigint':
|
|
|
26 |
return $this->createIntegerControl($container, $column, $record);
|
|
|
27 |
case 'decimal': case 'numeric': case 'real': case 'float': case 'double':
|
|
|
28 |
return $this->createFloatControl($container, $column, $record);
|
|
|
29 |
case 'char': case 'varchar':
|
|
|
30 |
return $this->createMultiLineControl($container, $column, $record);
|
|
|
31 |
default:
|
|
|
32 |
return $this->createDefaultControl($container,$column, $record);
|
|
|
33 |
}
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
protected function getControlValue($container, $column, $record)
|
|
|
37 |
{
|
|
|
38 |
switch(strtolower($column->getDbType()))
|
|
|
39 |
{
|
|
|
40 |
case 'date':
|
|
|
41 |
return $container->findControl(self::DEFAULT_ID)->getDate();
|
|
|
42 |
case 'time':
|
|
|
43 |
return $this->getTimeValue($container, $column, $record);
|
|
|
44 |
case 'timestamp':
|
|
|
45 |
return $this->getDateTimeValue($container, $column, $record);
|
|
|
46 |
default:
|
|
|
47 |
return $this->getDefaultControlValue($container,$column, $record);
|
|
|
48 |
}
|
|
|
49 |
}
|
|
|
50 |
}
|
|
|
51 |
|