1 |
3 |
ahitrov@rambler.ru |
package SQL::SectionTable; |
2 |
|
|
|
3 |
|
|
use strict; |
4 |
|
|
use base 'SQL::ProtoTable'; |
5 |
|
|
|
6 |
|
|
sub db_table |
7 |
|
|
{ |
8 |
|
|
return 'sections'; |
9 |
|
|
} |
10 |
|
|
|
11 |
|
|
sub available_filters { |
12 |
|
|
my @available_filters = qw( |
13 |
|
|
_class_filter |
14 |
|
|
_status_filter |
15 |
|
|
_in_id_filter |
16 |
|
|
_id_filter |
17 |
|
|
_name_filter |
18 |
|
|
_class_excludes_filter |
19 |
|
|
_excludes_filter |
20 |
|
|
_datetime_filter |
21 |
|
|
_date_equal_filter |
22 |
|
|
_date_filter |
23 |
|
|
_previous_days_filter |
24 |
|
|
|
25 |
|
|
_s_filter |
26 |
|
|
_alias_filter |
27 |
|
|
); |
28 |
|
|
return \@available_filters; |
29 |
|
|
} |
30 |
|
|
|
31 |
|
|
# ---------------------------------------------------------------------------- |
32 |
|
|
# �������� ������ � ��������, ������ ��� ������� �����! |
33 |
|
|
# ��� ����� �������� - ���������� ��� ���� ����������. |
34 |
|
|
# |
35 |
|
|
# attr - ������������ ��������, �������� ��������; |
36 |
|
|
# type - ��� ���������, ��������� ��� ������������; |
37 |
|
|
# rusname - ������� ��������, ����� �� ��������� ��� �����������; |
38 |
|
|
# hidden - ����� 1, ����� |
39 |
|
|
# readonly - ������������� ��� ������ ������ ��� ��������� � ���������� |
40 |
|
|
# db_field - ���� � ������� |
41 |
|
|
# default - �������� �� ��������� (���� ������ ����� ��� ��������) |
42 |
|
|
# ---------------------------------------------------------------------------- |
43 |
|
|
sub required_properties |
44 |
|
|
{ |
45 |
|
|
return ( |
46 |
|
|
{ # ������������� ���������, �������� �� ���� �����... |
47 |
|
|
'attr' => 'id', |
48 |
|
|
'type' => 'integer', |
49 |
|
|
'rusname' => '������������� ���������', |
50 |
|
|
'hidden' => 1, |
51 |
|
|
'auto' => 1, |
52 |
|
|
'readonly' => 1, |
53 |
|
|
'db_field' => 'id', |
54 |
|
|
'db_type' => 'integer', |
55 |
|
|
}, |
56 |
|
|
{ # ������������� ������������ ������ |
57 |
|
|
'attr' => 'pid', |
58 |
|
|
'type' => 'parent', |
59 |
|
|
'rusname' => '������������� ��������', |
60 |
|
|
'db_field' => 'pid', |
61 |
|
|
'db_type' => 'integer', |
62 |
|
|
}, |
63 |
|
|
{ # ������� ���������� |
64 |
|
|
'attr' => 'sorder', |
65 |
|
|
'type' => 'sorder', |
66 |
|
|
'rusname' => '������� ����������', |
67 |
|
|
'hidden' => 1, |
68 |
|
|
'db_field' => 'sorder', |
69 |
|
|
'db_type' => 'integer', |
70 |
|
|
}, |
71 |
|
|
{ # ����� ���������... |
72 |
|
|
'attr' => 'class', |
73 |
|
|
'type' => 'string', |
74 |
|
|
'rusname' => '����� ���������', |
75 |
|
|
'hidden' => 1, |
76 |
|
|
'readonly' => 1, |
77 |
|
|
'db_field' => 'class', |
78 |
|
|
'db_type' => 'varchar(48)', |
79 |
|
|
}, |
80 |
|
|
{ # ��� ���������... |
81 |
|
|
'attr' => 'name', |
82 |
|
|
'type' => 'string', |
83 |
|
|
'rusname' => '��������', |
84 |
|
|
'db_field' => 'name', |
85 |
|
|
'db_type' => 'varchar(255)', |
86 |
|
|
}, |
87 |
|
|
{ # ��� ���������... |
88 |
|
|
'attr' => 'alias', |
89 |
|
|
'type' => 'string', |
90 |
|
|
'rusname' => 'web-alias', |
91 |
|
|
'db_field' => 'alias', |
92 |
|
|
'db_type' => 'text', |
93 |
|
|
}, |
94 |
|
|
{ # ����� �������� ���������, ��������� ����... |
95 |
|
|
'attr' => 'ctime', |
96 |
|
|
'type' => 'datetime', |
97 |
|
|
'rusname' => '����� ��������', |
98 |
|
|
'hidden' => 1, |
99 |
|
|
'readonly' => 1, |
100 |
|
|
'auto' => 1, |
101 |
|
|
'db_field' => 'ctime', |
102 |
|
|
'db_type' => 'timestamp', |
103 |
|
|
'default' => 'CURRENT_TIMESTAMP', |
104 |
|
|
}, |
105 |
|
|
{ # ����� ����������� ���������, ��������� ����... |
106 |
|
|
'attr' => 'mtime', |
107 |
|
|
'type' => 'datetime', |
108 |
|
|
'rusname' => '����� �����������', |
109 |
|
|
'hidden' => 1, |
110 |
|
|
'auto' => 1, |
111 |
|
|
'db_field' => 'mtime', |
112 |
|
|
'db_type' => 'timestamp', |
113 |
|
|
'default' => 'CURRENT_TIMESTAMP', |
114 |
|
|
}, |
115 |
|
|
{ # ���� ���� ������� �������� ����������... |
116 |
|
|
'attr' => 'status', |
117 |
|
|
'type' => 'status', |
118 |
|
|
'rusname' => '������', |
119 |
|
|
'db_field' => 'status', |
120 |
|
|
'db_type' => 'integer', |
121 |
|
|
}, |
122 |
|
|
); |
123 |
|
|
} |
124 |
|
|
|
125 |
|
|
|
126 |
|
|
########### FILTERS DESCRIPTION #################################################################################### |
127 |
|
|
sub _s_filter { |
128 |
|
|
my ($self,%opts)=@_; |
129 |
|
|
return undef unless ( exists($opts{s}) ); |
130 |
|
|
if ($opts{dive}) { |
131 |
|
|
return &SQL::Common::_generic_int_filter('d.pid', $opts{all_childs}); |
132 |
|
|
} else { |
133 |
|
|
return &SQL::Common::_generic_int_filter('d.pid', $opts{s}); |
134 |
|
|
} |
135 |
|
|
} |
136 |
|
|
|
137 |
|
|
sub _alias_filter { |
138 |
|
|
my ($self,%opts)=@_; |
139 |
|
|
return undef unless ( exists($opts{alias}) ); |
140 |
|
|
return &SQL::Common::_generic_text_filter('d.alias', $opts{alias}); |
141 |
|
|
} |
142 |
|
|
|
143 |
|
|
1; |
144 |
|
|
|