Revision 296 (by ahitrov, 2013/03/26 17:59:01) |
Promosite (anthill) project source
|
package promosuite::Voice;
use strict;
use Contenido::Globals;
use base 'Contenido::Document';
sub extra_properties
{
return (
)
}
sub class_name
{
return 'Голос пользователя в опросе';
}
sub class_description
{
return 'Голос пользователя в опросе';
}
sub class_table
{
return 'promosuite::SQL::Enquesta';
}
sub pre_store
{
my $self = shift;
my $default_section = $project->s_alias->{votes} if ref $project->s_alias eq 'HASH';
my $sections = $self->{sections};
if ( $default_section ) {
if ( ref $sections eq 'ARRAY' && scalar @$sections ) {
my @new_sects = grep { $_ != $default_section } @$sections;
push @new_sects, $default_section;
$self->sections(@new_sects);
} elsif ( $sections && !ref $sections && $sections != $default_section ) {
my @new_sects = ($default_section, $sections);
$self->sections(@new_sects);
} else {
$self->sections($default_section);
}
}
return 1;
}
1;