Revision 296 (by ahitrov, 2013/03/26 17:59:01) Promosite (anthill) project source
% if ($total > $size) {
<p>
<strong>Страницы:</strong>&nbsp;
<& /inc/pages_.msn, p => $p, n => $size, total => $total, delimiter => ' ' &>
</p>
% }

<table width="100%" border="0" cellspacing="0" cellpadding="10">
% my $i=1;
% foreach my $doc (@docs) {
%	my ($rate1, $rate2, $rate3);
%	if ($doc->rating) {
%		$rate3 = 10 % $doc->rating;
%		$rate2 = (10 - $rate3) % 2;
%		$rate1 = int ((10 - $rate2 - $rate3) / 2);
%		$rate3 = int ($rate3 / 2);
%	}
%	my $date = $3.'.'.$2.'.'.$1	if ($doc->dtime =~ /(\d+)-(\d+)-(\d+)/);
%	if ($i % 2) {
<tr valign="top">
%	}
<td width="50%">\
%	##### Картинко
%	my $img = $doc->get_image('icon');
%	if (ref $img && exists $img->{filename}) {
<a href="./?id=<% $doc->id %>"><img src="<% $img->{filename} %>" border="0" align="left" class="imageBorder1" width="<% $img->{width} %>" height="<% $img->{height} %>" alt="<% $doc->name %>" title="<% $doc->name %>" align="left"></a>
%	}
<a href="./?id=<% $doc->id %>" style="font-weight: bold; font-size: 11pt;"><% $doc->name %></a><br>
%	if ( $doc->abstr ) {
<% $doc->abstr %><br>
%	}
%	if ( $doc->country ) {
<b>Страна:</b> <% $doc->country %><br>
%	}
%	if ($doc->rating) {
	<table cellspacing="0" cellpadding="0" border="0">
	<tr><td style="padding: 0px;"><b>Рейтинг:&nbsp;</b></td>
	<td width="100%" style="padding: 0px;">
	<div style="white-space: nowrap;">\
%		foreach (1 .. $rate1) {
<img src="/i/<% $prj %>/star-on.gif" width="16" height="15">\
%		}
%		foreach (1 .. $rate2) {
<img src="/i/<% $prj %>/star-half.gif" width="16" height="15">\
%		}
%		foreach (1 .. $rate3) {
<img src="/i/<% $prj %>/star-off.gif" width="16" height="15">\
%		}
</div>
	</td></tr>
	</table>
%	} ###/ Рейтинг
%       if ( $doc->url && $doc->url_label ) {
<a href="<% $doc->url %>" target="_blank"><% $doc->url_label %></a><br>
%       }
<a href="./?id=<% $doc->id %>" style="text-decoration:none;">подробнее &gt;&gt;</a><br>
</td>
%	unless ($i++ % 2) {
</tr>
%	}
% }
% unless ( $i % 2 ) {
<td></td></tr>
% }
</table>


% if ( $total > $size ) {
<p>
<strong>Страницы:</strong>&nbsp;
<& /inc/pages_.msn, p => $p, n => $size, total => $total, delimiter => ' ' &>
</p>
% }
<%args>

	$p	=> 1
	$size	=> 4
	$section	=> undef

</%args>
<%init>

  my $prj = $request->{project};
  my $profile = $request->{project_profile};
  my $root = $request->{project_section};

  ($section) = $keeper->get_sections (
                s       => $root->id,
                class   => 'promosuite::AnnoSection',
                limit   => 1,
                status  => 1,
	)				unless ref $section;
  my $total = $keeper->get_documents (
		s	=> $section->id,
		class	=> 'promosuite::Anons',
		count	=> 1,
	);
  my @docs;
  if ($p <= (int($total/$size) + ($total % $size ? 1 : 0)) ) {
	if ( $section->_sorted ) {
		@docs = $keeper->get_sorted_documents (
			s	=> $section->id,
			class	=> 'promosuite::Anons',
			limit	=> $size,
			offset	=> ($p-1)*$size,
		);
	}else{
		@docs = $keeper->get_documents (
			s	=> $section->id,
			class	=> 'promosuite::Anons',
			limit	=> $size,
			offset	=> ($p-1)*$size,
		);
	}
  }

</%init>