summaryrefslogtreecommitdiff
path: root/framework/Data/ActiveRecord/Scaffold/InputBuilder/TPgsqlScaffoldInput.php
blob: 4e02f1683da17f22ab6359830138fece3966ae3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
 * TPgsqlScaffoldInput class file.
 *
 * @link https://github.com/pradosoft/prado
 * @copyright Copyright &copy; 2005-2016 The PRADO Group
 * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
 * @package System.Data.ActiveRecord.Scaffold.InputBuilder
 */
Prado::using('System.Data.ActiveRecord.Scaffold.InputBuilder.TScaffoldInputCommon');

class TPgsqlScaffoldInput extends TScaffoldInputCommon
{
	protected function createControl($container, $column, $record)
	{
		switch(strtolower($column->getDbType()))
		{
			case 'boolean':
				return $this->createBooleanControl($container, $column, $record);
			case 'date':
				return $this->createDateControl($container, $column, $record);
			case 'text':
				return $this->createMultiLineControl($container, $column, $record);
			case 'smallint': case 'integer': case 'bigint':
				return $this->createIntegerControl($container, $column, $record);
			case 'decimal': case 'numeric': case 'real': case 'double precision':
				return $this->createFloatControl($container, $column, $record);
			case 'time without time zone' :
				return $this->createTimeControl($container, $column, $record);
			case 'timestamp without time zone':
				return $this->createDateTimeControl($container, $column, $record);
			default:
				return $this->createDefaultControl($container,$column, $record);
		}
	}

	protected function getControlValue($container, $column, $record)
	{
		switch(strtolower($column->getDbType()))
		{
			case 'boolean':
				return $container->findControl(self::DEFAULT_ID)->getChecked();
			case 'date':
				return $container->findControl(self::DEFAULT_ID)->getDate();
			case 'time without time zone':
				return $this->getTimeValue($container, $column, $record);
			case 'timestamp without time zone':
				return $this->getDateTimeValue($container,$column, $record);
			default:
				return $this->getDefaultControlValue($container,$column, $record);
		}
	}
}