Revision 296 (by ahitrov, 2013/03/26 17:59:01) Promosite (anthill) project source
<%args>

        $name => undef
        $SETS => undef

</%args>
<%init>

        return unless ref $SETS;
        return unless $name;

	my $schedule = [];
	foreach my $key (keys %$SETS) {
		if ($key =~ /^${name}_(name|alias|image|amage|url|delete)_(\d+)$/) {
			my $field = $1;
			my $i = $2;
			$schedule->[$i-1]->{$field} = $SETS->{$key}   if $SETS->{$key};
		}
	}
	@$schedule = grep { !$_->{delete} } @$schedule;
	local $Data::Dumper::Indent = 0;
	return Data::Dumper::Dumper($schedule);

</%init>