<?php 
$form = $_MTP['form'];
?>
<link rel="stylesheet" href="tpl/css/meet.css" type="text/css" />

<div class="foot">
  <img src="/style/icons/str2.gif" /> <a href="/">Главная</a> / <b><?php echo $title; ?></b>
</div>

<form class="meets" method="get">
  <input type="hidden" name="order" value="<?php echo $form['order']; ?>">
  <input type="hidden" name="options" value="<?php echo $form['options']; ?>">
  <input type="hidden" name="city" value="<?php echo $form['city']; ?>">
  
  <?php if ($form['options']) { ?>
    <div>
      Поиск: <input type="text" name="q" value="<?php echo $form['q']; ?>" />
    </div>
  <?php } ?>
  
  <div class="meets-age">
    Возраст: 
    от <input type="tel" name="age_from" value="<?php echo $form['age_from']; ?>" maxlength="3" />
    до <input type="tel" name="age_to" value="<?php echo $form['age_to']; ?>" maxlength="3" />
  </div>
  
  <div>
    Пол: 
    <label><input type="radio" name="sex" value="" <?php echo ($form['sex'] == '' ? 'checked' : ''); ?> />Любой</label> 
    <label><input type="radio" name="sex" value="1" <?php echo ($form['sex'] ? 'checked' : ''); ?> />Мужской</label> 
    <label><input type="radio" name="sex" value="0" <?php echo ($form['sex'] == '0' ? 'checked' : ''); ?> />Женский</label>     
  </div>
  
  <div>
    Город: <a href="/user/settings/?func=location&amp;r=meets"><?= $city['name']?></a> 
    <?php if ($form['city']) { ?>
    <button class="o-delete" type="submit" name="city" value=""><img src="/style/icons/delete.gif" /></button> 
    <?php } ?>
  </div>
  
  <?php if ($form['options']) { ?>
    <div>
      Ориентация: 
      <select name="orien">
        <option value="0" <?php echo ($form['orien'] == 0 ? 'selected' : ''); ?>>Любая</option>
        <option value="1" <?php echo ($form['orien'] == 1 ? 'selected' : ''); ?>>Гетеро</option>
        <option value="2" <?php echo ($form['orien'] == 2 ? 'selected' : ''); ?>>Би</option>
        <option value="3" <?php echo ($form['orien'] == 3 ? 'selected' : ''); ?>>Гей/Лесби</option>
      </select>
    </div>
    
    <div>
      Цель знакомства: 
      <select name="target">
        <option value="0" <?php echo ($form['target'] == 0 ? 'selected' : ''); ?>>Любая</option>
        <?php foreach($_ARR_TARGET AS $key => $target) { ?>
          <option value="<?php echo $key; ?>" <?php echo ($form['target'] == $key ? 'selected' : ''); ?>><?php echo $target; ?></option>
        <?php } ?>
      </select>
    </div>
    
    <div>
      <label><input type="checkbox" name="online" value="1" <?php echo ($form['online'] ? 'checked' : ''); ?> /> В cети</label> 
      <label><input type="checkbox" name="has_photo" value="1" <?php echo ($form['has_photo'] ? 'checked' : ''); ?> /> Только с фото</label>
    </div>
  <? } ?>
  
  <div>
    <input type="submit" value="Искать" /> 
    <?php if (!$form['options']) { ?>
      <button class="options" type="submit" name="options" value="1">Расширенный</button>
    <?php } ?>
  </div>
  
  <?php if ($_MTP['item']) { ?>
    <div class="ordering">
      <?php if (isset($user)) { ?>
        <div class="<?php echo ($form['order'] == 'priority' ? 'o-active' : ''); ?>">
          <button type="submit" name="order" value="priority">Совместимость</button>
        </div>
      <?php } ?>
      <div class="<?php echo ($form['order'] == 'rating' ? 'o-active' : ''); ?>"><button type="submit" name="order" value="rating">Популярные</button></div>
      <div class="<?php echo ($form['order'] == 'new' ? 'o-active' : ''); ?>"><button type="submit" name="order" value="new">Новые</button></div>
    </div>
  <?php } ?>
</form>

<?php
if ($_MTP['item']) {
    $i = 0;
    foreach($_MTP['item'] AS $post) {
        $i++;
        ?>
        <div class="<?php echo ($i % 2 ? 'nav1' : 'nav2'); ?>">
          <?php echo $post['avatar']; ?> 
          <a href="/info.php?id=<?php echo $post['id']; ?>">
            <?php if ($form['q']) { ?>
              <?php echo $post['first_name']; ?> <?php echo $post['last_name']; ?> <?php echo online($post['id']); ?>
            <?php } else { ?>
              <?php echo $post['nickname']; ?>
            <?php } ?>
          </a>
          <?php echo ($post['age'] ? ', ' . des2num($post['age'], array('год', 'года', 'лет')) : ''); ?>
          <?php echo ($post['city'] ? ', <a href="?city=' . $post['city'] . '">' . $post['city'] . '</a>' : ''); ?>
          
          <?php if (isset($post['compatibility'])) { ?>
            <div>Совпадение: <b style="color: #09ae00;"><?php echo $post['compatibility'];?></b></div>
          <?php } ?>
        </div>
        <?
    }
    
    if ($_MTP['pages'] > 1) {
        str('index.php?' . $_MTP['http_build'] . '&', $k_page, $page);
    }
} else {
  ?>
  <div class="mess">Нет результатов по этому запросу</div>
  <?
}
?>
<div class="foot">
  <img src="/style/icons/str2.gif" /> <a href="/">Главная</a> / <b><?php echo $title; ?></b>
</div>