script type="text/javascript" src="<?php print $mosConfig_live_site;?>/includes/js/jquery.pack.js"></script>
<script type="text/javascript">
<!--
function toggle_check(id)
{
var disabled = $('input:text', '#'+id).attr('disabled');
$('input:text', '#'+id).attr({disabled: !disabled});
}
//-->
</script>
<?php
# Don't allow direct linking
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
// конфигурационный файл
require_once($mosConfig_absolute_path . '/administrator/components/com_mau/config.mau.php');
// общий класс
require_once($mosConfig_absolute_path . '/administrator/components/com_mau/mau.class.php');
// обрабатываем присланные параметры в запросе GET
$data = array();
foreach($_GET as $key=>&$get)
{
$get = mysql_escape_string(strip_tags($get));
$data[$key] = htmlspecialchars($get, ENT_QUOTES, 'windows-1251');
}
// дата начала периода
$start = strtotime(MAu::date_format($data['start']));
if($start != -1 && !empty($data['start']))
{
$data['start'] = date('d.m.Y', $start);
}
else
{
$data['start'] = date('d.m.Y', strtotime('-6 day'));
}
// дата конца периода
$finish = strtotime(MAu::date_format($data['finish']));
if($finish != -1 && !empty($data['finish']))
{
$data['finish'] = date('d.m.Y', $finish);
}
else
{
$data['finish'] = date('d.m.Y');
}
// сортировка
if(!in_array($data['sort'], array('about', 'title', 'date')))
{
$data['sort'] = 'about';
}
if(!in_array($data['order'], array('asc', 'desc')))
{
$data['order'] = 'asc';
}
if(!empty($data['id']))
{
$params = array
(
'table' => 'auctions',
'where' => '`id` = '.$data['id'],
);
$mau = new MAu();
$item = $mau->get($params);
$item = array_shift($item['rows']);
$params = array
(
'table' => 'auction_files',
'where' => '`id_auction` = '.$data['id'],
);
$mau = new MAu();
$files = $mau->get($params);
if(!empty($item)):
?>
<b>Предмет контракта:<br><?php print $item['title']?></b>
<table border="0" cellspacing="2" cellpadding="3">
<tr>
<td>Дата проведения:</td>
<td><?php print date('d.m.Y', strtotime($item['start']));?> - <?php print date('d.m.Y', strtotime($item['finish']));?></td>
</tr>
<tr>
<tr>
<td>Статус:</td>
<td><?php print $statuses[$item['status']]['title'];?></td>
</tr>
</tr>
<tr>
<td>Форма торгов:</td>
<td><?php print $methods[$item['method']]['title'];?></td>
</tr>
<tr>
<td>Номер извещения:</td>
<td><?php print $item['about'];?></td>
</tr>
</table><br>
<?php if(!empty($files['rows'])):?>
<b>Документация</b><br>
<table width="50%" border="0" cellspacing="2" cellpadding="3">
<?php foreach($files['rows'] as $file):?>
<tr>
<td><a href="<?php print MAU_FILES_HREF.$file['file'];?>"><?php print $file['title'];?></a></td>
<td><?php print date('d.m.Y', strtotime($file['date']));?></td>
<td><?php print number_format($file['size'] / 1024, 0, '.', ' ');?> Кб</td>
</tr>
<?php endforeach;?>
</table>
<?php endif;?>
<?php
else:
?>
Извините, указанная Вами страница не найдена. Вернитесь на <a href="<?php print $mosConfig_live_site;?>">главную страницу</a> сайта либо воспользуйтесь поиском.
<?php
endif;
}
// общий список закупок
else
{
// формируем фильтр для запроса к БД
$where = '';
if(!empty($data['status'])) $where[] = '`status` = '.$data['status'];
if(!empty($data['method'])) $where[] = '`method` = '.$data['method'];
if(!empty($start) && !empty($data['use_date'])) $where[] = '`start` >= "'.date('Y-m-d', $start).'"';
if(!empty($finish) && !empty($data['use_date'])) $where[] = '`finish` <= "'.date('Y-m-d', $finish).'"';
if(!empty($data['title'])) $where[] = '`title` LIKE "%'.$data['title'].'%"';
if(!empty($data['about'])) $where[] = '`about` LIKE "%'.$data['about'].'%"';
$page = max(0, intval($data['page']));
$params = array
(
'table' => 'auctions',
'order' => ( $data['sort']=='date' ? '`start` '.$data['order'].', `finish` '.$data['order'] : '`'.$data['sort'].'` '.$data['order']),
'limit' => array('offset'=>($page * $parameters['items_on_page']), 'limit'=>$parameters['items_on_page']),
'count' => true,
);
if(!empty($where))
{
$params['where'] = implode(' AND ', $where);
}
$mau = new MAu();
$items = $mau->get($params);
// общий вид строки с GET - запросом
$link = 'index.php?option='.$option.'&Itemid='.$Itemid;
foreach(array('method', 'status', 'title', 'about', 'use_date') as $el)
{
if(!empty($data[$el]))
{
$link .= '&'.$el.'='.$data[$el];
}
}
!empty($data['use_date']) ? $link .= '&start='.$data['start'].'&finish='.$data['finish'] : null;
// получаем листер
$lister = MAu::get_lister($items['count'], $parameters['items_on_page'], $page);
//var_dump($lister);
?>
<h1><?php print $parameters['pageTitle'];?></h1>
<div class="contentpane">
<form name="filters" action="<?php print sefRelToAbs('index.php?option='.$option.'&Itemid='.$Itemid);?>" method="get">
<input type="hidden" name="option" value="<?php print $option;?>" />
<input type="hidden" name="Itemid" value="<?php print $Itemid;?>" />
<div align="center">
<table width="50%" border="0" cellspacing="2" cellpadding="3">
<tr>
<td>Способ размещения:</td>
<td align="left">
<select name="method">
<option value="0">все</option>
<?php foreach($methods as $id=>$val):?>
<option value="<?php print $id;?>" <?php print ($data['method']==$id?'selected="selected"':'');?>><?php print $val['title'];?></option>
<?php endforeach;?>
</select>
</td>
<td> </td>
</tr>
<tr>
<td>Статус:</td>
<td align="left">
<select name="status">
<option value="0">все</option>
<?php foreach($statuses as $id=>$val):?>
<option value="<?php print $id;?>" <?php print ($data['status']==$id?'selected="selected"':'');?>><?php print $val['title'];?></option>
<?php endforeach;?>
</select>
</td>
<td> </td>
</tr>
<tr>
<td>Дата проведения:</td>
<td align="left" id="date">
<input type="checkbox" name="use_date" value="1" <?php print (!empty($data['use_date'])?'checked="checked"':'');?> onclick="javascript: toggle_check('date');" />
с <input type="text" name="start" value="<?php print $data['start'];?>" <?php print (!empty($data['use_date'])?'':'disabled="disabled"');?> size="9"/>
по <input type="text" name="finish" value="<?php print $data['finish'];?>" <?php print (!empty($data['use_date'])?'':'disabled="disabled"');?> size="9"/>
</td>
<td> </td>
</tr>
<tr>
<td>Предмет контракта:</td>
<td align="left"><input type="text" name="title" value="<?php print $_GET['title'];?>" style="width:100%;" /></td>
<td> </td>
</tr>
<tr>
<td>Номер извещения:</td>
<td align="left"><input type="text" name="about" value="<?php print $_GET['about'];?>" style="width:100%;" /></td>
<td><input type="submit" value="Найти"/></td>
</tr>
</table>
</div>
</form>
<div>Всего найдено закупок: <span><?php print $items['count'];?></span>.</div><br>
<?php
ob_start();
?>
<div class="pager">
Страницы (<?php print ceil($items['count'] / $parameters['items_on_page']);?>):
<?php
foreach($lister['text'] as $el):
if(!empty($el['link'])):
?>
<a href="<?php print $link.'&sort='.$data['sort'].'&order='.$data['order'].'&'.$el['link'];?>"><?php print $el['title'];?></a>
<?php else:?>
<span><?php print $el['title'];?></span>
<?php
endif;
endforeach;?>
<div class="pages">
<?php
foreach($lister['digit'] as $el):
if(!empty($el['link'])):
?>
<a href="<?php print $link.'&sort='.$data['sort'].'&order='.$data['order'].'&'.$el['link'];?>"><?php print $el['title'];?></a>
<?php else:?>
<span><?php print $el['title'];?></span>
<?php
endif;
endforeach;?>
</div>
</div><br>
<?php
$pager = ob_get_clean();
print $pager;
?>
<table class="orders" width="100%">
<tr>
<th><nobr> </nobr></th>
<th><nobr><a href="<?php print $link.'&sort=about&order='.($data['order']=='asc'?'desc':'asc');?>"><br>Номер<br>извещения</a><?php ($data['sort']=='about') ? print ($data['order']=='asc' ? '↑' : '↓') : null;?></nobr></th>
<th><nobr><a href="<?php print $link.'&sort=title&order='.($data['order']=='asc'?'desc':'asc');?>">Предмет контракта,начальная (максимальная) цена</a> <?php ($data['sort']=='title') ? print ($data['order']=='asc' ? '↑' : '↓') : null;?></nobr></th>
<th><nobr><a href="<?php print $link.'&sort=date&order='.($data['order']=='asc'?'desc':'asc');?>"><br>Дата начала<br> подачи заявок </a> <?php ($data['sort']=='date') ? print ($data['order']=='asc' ? '↑' : '↓') : null;?></nobr></th>
<th><nobr><a href="<?php print $link.'&sort=date&order='.($data['order']=='asc'?'desc':'asc');?>"><br>Дата окончания<br> приема заявок</a> <?php ($data['sort']=='date') ? print ($data['order']=='asc' ? '↑' : '↓') : null;?></nobr></th>
<th><br>Форма<br>торгов</th>
</tr>
<?php foreach(array_values($items['rows']) as $key=>$item):
if ($key%2==0) {?>
<tr style=background-color:#7cd5ff>
<td><center></center></td>
<td><center><?php print $item['about'];?></center></td>
<td><center><a href="<?php print sefRelToAbs('index.php?option='.$option.'&Itemid='.$Itemid.'&id=' . $item['id']);?>"><?php print $item['title'];?></a><center></td>
<td><center><?php print date('d.m.Y', strtotime($item['start']));?></center></td>
<td><center><?php print date('d.m.Y', strtotime($item['finish']));?></center></td>
<td><center><?php print $methods[$item['method']]['title'];?></center></td>
</tr>
<?php
}
else {?>
<tr>
<td><center></center></td>
<td><center><?php print $item['about'];?></center></td>
<td><center><a href="<?php print sefRelToAbs('index.php?option='.$option.'&Itemid='.$Itemid.'&id=' . $item['id']);?>"><?php print $item['title'];?></a><center></td>
<td><center><?php print date('d.m.Y', strtotime($item['start']));?></center></td>
<td><center><?php print date('d.m.Y', strtotime($item['finish']));?></center></td>
<td><center><?php print $methods[$item['method']]['title'];?></center></td>
</tr>
<?php
}
endforeach;?>
</table><br>
</div>
<?php
print $pager;
}
?>