| 1 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* TMssqlScaffoldInput class file.
|
|
|
4 |
*
|
|
|
5 |
* @link http://www.pradosoft.com/
|
|
|
6 |
* @copyright Copyright © 2005-2008 PradoSoft
|
|
|
7 |
* @license http://www.pradosoft.com/license/
|
|
|
8 |
* @package System.Data.ActiveReecord.Scaffold.InputBuilder
|
|
|
9 |
*/
|
|
|
10 |
Prado::using('System.Data.ActiveRecord.Scaffold.InputBuilder.TScaffoldInputCommon');
|
|
|
11 |
|
|
|
12 |
class TMssqlScaffoldInput extends TScaffoldInputCommon
|
|
|
13 |
{
|
|
|
14 |
protected function createControl($container, $column, $record)
|
|
|
15 |
{
|
|
|
16 |
switch(strtolower($column->getDbType()))
|
|
|
17 |
{
|
|
|
18 |
case 'bit':
|
|
|
19 |
return $this->createBooleanControl($container, $column, $record);
|
|
|
20 |
case 'text':
|
|
|
21 |
return $this->createMultiLineControl($container, $column, $record);
|
|
|
22 |
case 'smallint': case 'int': case 'bigint': case 'tinyint':
|
|
|
23 |
return $this->createIntegerControl($container, $column, $record);
|
|
|
24 |
case 'decimal': case 'float': case 'money': case 'numeric': case 'real': case 'smallmoney':
|
|
|
25 |
return $this->createFloatControl($container, $column, $record);
|
|
|
26 |
case 'datetime': case 'smalldatetime':
|
|
|
27 |
return $this->createDateTimeControl($container, $column, $record);
|
|
|
28 |
default:
|
|
|
29 |
$control = $this->createDefaultControl($container,$column, $record);
|
|
|
30 |
if($column->getIsExcluded())
|
|
|
31 |
$control->setEnabled(false);
|
|
|
32 |
return $control;
|
|
|
33 |
}
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
protected function getControlValue($container, $column, $record)
|
|
|
37 |
{
|
|
|
38 |
switch(strtolower($column->getDbType()))
|
|
|
39 |
{
|
|
|
40 |
case 'boolean':
|
|
|
41 |
return $container->findControl(self::DEFAULT_ID)->getChecked();
|
|
|
42 |
case 'datetime': case 'smalldatetime':
|
|
|
43 |
return $this->getDateTimeValue($container,$column, $record);
|
|
|
44 |
default:
|
|
|
45 |
$value = $this->getDefaultControlValue($container,$column, $record);
|
|
|
46 |
if(trim($value)==='' && $column->getAllowNull())
|
|
|
47 |
return null;
|
|
|
48 |
else
|
|
|
49 |
return $value;
|
|
|
50 |
}
|
|
|
51 |
}
|
|
|
52 |
}
|
|
|
53 |
|