Встроенный календарь в страницу сайта

#
Встроенный календарь в страницу сайта
Мне необходим встроенный календарь, в котором были бы активные ссылки на новости на эту дату. Я пересмотрела, все посты, где только упоминался календарь. Но создать свой у меня не получилось.
1. Не понятно ставить в макет сайта, и где мне это взять.
2. Что исправить в js
3. И вообще бы хотелось получить подробную инструкцию как это можно сделать??? как например здесь http://www.hostcms.ru/forums/22/2029/page-2/ по пунктам
#
Re: Встроенный календарь в страницу сайта
дошел до такого варианта
http://swingtown.ru/
минусы - нельзя посмотреть прошедшие месяцы, чистый php и измененная тип. дин. страница новостей

могу описать, если подойдет
#
Re: Встроенный календарь в страницу сайта
Было бы замечательно. думаю это интересно не только мне
#
Re: Встроенный календарь в страницу сайта
Код календаря:


<?php
//Месяц, стрелки
echo('<div class="navigator"><div class="l_arr">');
//Год (проверяем переменную y, переменную year, если они пусты - подставляем текущий год)
   if (isset($_GET['y'])) {
      $cy = to_int($_GET['y']);
   }
   elseif (isset($GLOBALS['year'])) {
      $cy = $GLOBALS['year'];
   }
   else {
      $cy = date('Y');
   }
//Месяц (переменные m, mont)
   if (isset($_GET['m'])) {
      $cm = $_GET['m'];
   }
   elseif (isset($GLOBALS['mont'])) {
      $cm = $GLOBALS['mont'];
   }
   else {
      $cm = date('m');
   }
//Если январь - стрелка назад переводит в декабрь предыдущего года
   if ($cm == 1) {
      $backyear = $cy-1;
   }
   else {
      $backyear = $cy;
   }
   if ($cm == 1) {
      $backmonth = 12;
   }
   else {
      $backmonth = $cm-1;
   }
   if ($backmonth < 10) {
      $backmonth = "0".$backmonth;
   }
//Доработать! если месяц и год равен текущему, стрелка назад неактивна
   if ($cm == date('m') && $cy == date('Y')) {
      echo('<img src="/f/i/l_arr_unact.png" alt="Назад" width="11" height="16" class="png">');
   }
//если нет составляем ссылку
   else {
      $Structure = & singleton('Structure');
//проверка на путь, если мы собственно в событиях, к пути добавляется "events"
      $pathhh =  substr($Structure->GetStructurePath(CURRENT_STRUCTURE_ID, 0), 0, 6);
         if ($pathhh == 'events') {
            echo('<a href="/events/');
            print_r($backyear);
            echo('/');
            print_r($backmonth);
            echo('/"><img src="/f/i/l_arr.png" alt="Назад" width="11" height="16" class="png"></a>');
         }
         else {
            echo('<a href="?y=');
            print_r($backyear);
            echo('&m=');
            print_r($backmonth);
            echo('"><img src="/f/i/l_arr.png" alt="Назад" width="11" height="16" class="png"></a>');
         }

   }

echo('</div><p>');
//название месяца
$them = $cm;

   if ($them == 1) echo ('Январь');
   if ($them == 2) echo ('Февраль');
   if ($them == 3) echo ('Март');
   if ($them == 4) echo ('Апрель');
   if ($them == 5) echo ('Май');
   if ($them == 6) echo ('Июнь');
   if ($them == 7) echo ('Июль');
   if ($them == 8) echo ('Август');
   if ($them == 9) echo ('Сентябрь');
   if ($them == 10) echo ('Октябрь');
   if ($them == 11) echo ('Ноябрь');
   if ($them == 12) echo ('Декабрь');

echo('</p><div class="r_arr">');
//правая стрелка
if ($cm == 12) {
$foryear = $cy+1;
}
else {
$foryear = $cy;
}

if ($cm == 12) {
$formonth = 1;
}
else {
$formonth = $cm+1;
}
if ($formonth < 10) {
$formonth = "0".$formonth;
}
//проверяем, есть ли события в след. месяце
//если есть - стрелка активна
$querr="SELECT count(*)  FROM `information_items_table` WHERE `information_systems_id` = 1 AND `information_items_date` >= '".$foryear."-".$formonth."-01 00:00:01' AND `information_items_date` <= '".$foryear."-".$formonth."-31 23:59:59'";
$res = mysql_query($querr);
$curdatecount = mysql_fetch_row($res);

if ($curdatecount[0] > 0) {

   $Structure = & singleton('Structure');
   $pathhh =  substr($Structure->GetStructurePath(CURRENT_STRUCTURE_ID, 0), 0, 6);
      if ($pathhh == 'events') {
         echo('<a href="/events/');
         print_r($foryear);
         echo('/');
         print_r($formonth);
         echo('/"><img src="/f/i/r_arr.png" alt="Вперед" width="11" height="16" class="png"></a>');
      }
      else {
         echo('<a href="?y=');
         print_r($foryear);
         echo('&m=');
         print_r($formonth);
         echo('"><img src="/f/i/r_arr.png" alt="Вперед" width="11" height="16" class="png"></a>');
      }
}
else {
   echo('<img src="/f/i/r_arr_unact.png" alt="Вперед" width="11" height="16" class="png"></div></div>');
}

//Календарная сетка
$yearnow = $cy;
$monthnow = $cm;

$daynow = date('d');
$num = cal_days_in_month(CAL_GREGORIAN, $monthnow, $yearnow);

  $dayofmonth = $num;
  $day_count = 1;
  $num = 0;
  for($i = 0; $i < 7; $i++)
  {
    $dayofweek = date('w',
    mktime(0, 0, 0, $monthnow, $day_count, $yearnow));
    $dayofweek = $dayofweek - 1;
    if($dayofweek == -1) $dayofweek = 6;
    if($dayofweek == $i)

    {
      $week[$num][$i] = $day_count;
      $day_count++;
    }
    else
    {
      $week[$num][$i] = "";
    }
  }
  while(true)
  {
    $num++;
    for($i = 0; $i < 7; $i++)
    {
      $week[$num][$i] = $day_count;
      $day_count++;
      if($day_count > $dayofmonth) break;
    }
    if($day_count > $dayofmonth) break;
  }

  echo "<table><tr><td>Пн</td><td>Вт</td><td>Ср</td><td>Чт</td><td>Пт</td><td>Сб</td><td>Вс</td></tr>";
  for($i = 0; $i < count($week); $i++)
  {
    echo "<tr>";
    for($j = 0; $j < 7; $j++)
    {
      if(!empty($week[$i][$j]))
      {
//есть события в эту дату - ставим ссылку
$querr="SELECT count(*)  FROM `information_items_table` WHERE `information_systems_id` = 1 AND `information_items_date` >= '".$yearnow."-".$monthnow."-".$week[$i][$j]." 00:00:01' AND `information_items_date` <= '".$yearnow."-".$monthnow."-".$week[$i][$j]." 23:59:59'";
$res = mysql_query($querr);
$curdatecount = mysql_fetch_row($res);

if ($curdatecount[0] > 0) {
   echo ('<td');
//сегодняшний день выделяем жирным
if ($yearnow == date('Y') && $monthnow == date('m') && $week[$i][$j] == date('d')) {
echo (' style="font-style:italic; font-weight:bold;"');
}
echo('><a href="/events/');
print_r($yearnow);
echo('/');
print_r($monthnow);
echo('/');
print_r($week[$i][$j]);
echo('/">');
print_r($week[$i][$j]);
echo('</a></td>');    
}
else {
echo ('<td');
if ($yearnow == date('Y') && $monthnow == date('m') && $week[$i][$j] == date('d')) {
echo (' style="font-style:italic; font-weight:bold;"');
}
echo('>');
print_r($week[$i][$j]);
echo('</td>');
}
      }
      else echo "<td>&nbsp;</td>";
    }
    echo "</tr>";
  }
  echo "</table>";
?>
#
Re: Встроенный календарь в страницу сайта
Код типовой динамической:
<?php

$InformationSystem_id = to_int($GLOBALS['LA']['InformationSystemID']);

// Получаем информацию о текущем пользователе
if (class_exists('SiteUsers'))
{
   $SiteUsers = & singleton('SiteUsers');
   $site_user_id = $SiteUsers->GetCurrentSiteUser();
}
else
{
   $site_user_id = 0;
}

/* Массив внешних параметров, передаваемых в XML */
$external_propertys = array();


/* XSL шаблон для отображения списка элементов информационной системы */
$xsl_list = to_str($GLOBALS['LA']['xsl_information_system_list']);

/* XSL шаблон для отображения элемента информационной системы */
$xsl_item = to_str($GLOBALS['LA']['xsl_information_item']);

$InformationResult = $GLOBALS['InformationResult'];


/* Массив дополнительных параметров */
$property = array();

/* Число элементов на страницу */
if (isset($InformationResult['items_on_page']))
{

   if ($InformationResult['items_on_page'] !== true)
   {
      $InformationResult['items_on_page'] = to_int($InformationResult['items_on_page']);
   }
}
else
{
   $InformationResult['items_on_page'] = 10;
}

/* Номер, с которого начинается показ */
if (isset($InformationResult['items_begin']))
{
   $InformationResult['items_begin'] = to_int($InformationResult['items_begin']);
}
else
{
   $InformationResult['items_begin'] = 0;
}

// Метод определения идентификатора информационной группы и идентификатора
// информационного элемента по значению URI
$result = $GLOBALS['LA_InformationSystem']->GetInformationFromPath($InformationSystem_id);

if ($result != false)
{
   /* Вывод списка */
   if ($result['item'] == false)
   {
      $external_propertys = array();
      
      $external_propertys['ТекущийГод'] = date('Y');
      $external_propertys['Год'] = $GLOBALS['year'];//date('Y');
      
      $external_propertys['ТекущийМесяц'] = date('m');
      $external_propertys['Месяц'] = $GLOBALS['mont'];//;
      
      $external_propertys['ТекущийДень'] = date('d');
if (isset($GLOBALS['theday'])) {
      $external_propertys['День'] = $GLOBALS['theday'];
}
else {
      $external_propertys['День'] = 0;
}
      // Отображаем рейтинг новостей
      $property = array();
            
      $element['type'] = 0;
      $element['prefix'] = ' and ';
      $element['name'] = 'information_items_table.information_items_status';
      $element['if'] = '=';
      $element['value'] = '1';
      $element['sufix'] = '';
      $property['select'][] = $element;

if (!isset($GLOBALS['theday'])) {

      $element['type'] = 0;
      $element['prefix'] = ' and ';
      $element['name'] = 'information_items_table.information_items_date';
      $element['if'] = '>=';
      $element['value'] = $GLOBALS['year'] . '-' . $GLOBALS['mont'] . '-01 00:00:00' ;
      $element['sufix'] = '';
      $property['select'][] = $element;      
            
      $element['type'] = 0;
      $element['prefix'] = ' and ';
      $element['name'] = 'information_items_table.information_items_date';
      $element['if'] = '<=';
      $element['value'] = $GLOBALS['year'] . '-' . $GLOBALS['mont'] . '-31 23:59:59' ;
      $element['sufix'] = '';
      $property['select'][] = $element;  
}
else {
      $element['type'] = 0;
      $element['prefix'] = ' and ';
      $element['name'] = 'information_items_table.information_items_date';
      $element['if'] = '>=';
      $element['value'] = $GLOBALS['year'] . '-' . $GLOBALS['mont'] . '-' . $GLOBALS['theday'] . ' 00:00:00' ;
      $element['sufix'] = '';
      $property['select'][] = $element;      
            
      $element['type'] = 0;
      $element['prefix'] = ' and ';
      $element['name'] = 'information_items_table.information_items_date';
      $element['if'] = '<=';
      $element['value'] = $GLOBALS['year'] . '-' . $GLOBALS['mont'] . '-' . $GLOBALS['theday'] . ' 23:59:59' ;
      $element['sufix'] = '';
      $property['select'][] = $element;  
}

echo('<ul class="submenu clear">');

//если год текущий
if ($GLOBALS['year'] == date('Y')) {
   //начинаем с текущего месяца
   $startm = date('m');
}
else {
   //если нет - с января
   $startm = 1;
}
//первый месяц - с nomarker
if ($startm<10) {
$ibigg = "0".$startm;
}
else {
$ibigg = $startm;
}

$querr="SELECT count(*)  FROM `information_items_table` WHERE `information_systems_id` = 1 AND `information_items_date` >= '".$GLOBALS['year']."-".$ibigg."-01 00:00:01' AND `information_items_date` <= '".$GLOBALS['year']."-".$ibigg."-31 23:59:59'";
$res = mysql_query($querr);
$curdatecount = mysql_fetch_row($res);

if ($curdatecount[0] > 0) {

echo ('<li class="nomarker">');
//если он выбран
   if ($GLOBALS['mont'] == $startm) {
      echo('<strong>');
      //месяц
      if ($startm == 1) echo ('Январь');
      if ($startm == 2) echo ('Февраль');
      if ($startm == 3) echo ('Март');
      if ($startm == 4) echo ('Апрель');
      if ($startm == 5) echo ('Май');
      if ($startm == 6) echo ('Июнь');
      if ($startm == 7) echo ('Июль');
      if ($startm == 8) echo ('Август');
      if ($startm == 9) echo ('Сентябрь');
      if ($startm == 10) echo ('Октябрь');
      if ($startm == 11) echo ('Ноябрь');
      if ($startm == 12) echo ('Декабрь');
      echo('</strong>');
   }
   else {
      echo ('<a href="/events/');
      print_r($GLOBALS['year']);
      echo('/');
if ($startm == 1) {
echo ('01');

}
else {
      print_r($startm);
}
      echo('/">');
      if ($startm == 1) echo ('Январь');
      if ($startm == 2) echo ('Февраль');
      if ($startm == 3) echo ('Март');
      if ($startm == 4) echo ('Апрель');
      if ($startm == 5) echo ('Май');
      if ($startm == 6) echo ('Июнь');
      if ($startm == 7) echo ('Июль');
      if ($startm == 8) echo ('Август');
      if ($startm == 9) echo ('Сентябрь');
      if ($startm == 10) echo ('Октябрь');
      if ($startm == 11) echo ('Ноябрь');
      if ($startm == 12) echo ('Декабрь');
      echo('</a>');
   }
echo('</li>');
}

for($i = $startm+1; $i <= 12; $i++)
{
if ($i<10) {
$ibig = "0".$i;
}
else {
$ibig = $i;
}
$querr="SELECT count(*)  FROM `information_items_table` WHERE `information_systems_id` = 1 AND `information_items_date` >= '".$GLOBALS['year']."-".$ibig."-01 00:00:01' AND `information_items_date` <= '".$GLOBALS['year']."-".$ibig."-31 23:59:59'";
$res = mysql_query($querr);
$curdatecount = mysql_fetch_row($res);

if ($curdatecount[0] > 0) {

   if ($GLOBALS['mont'] == $i) {
      echo('<li><strong>');
      //месяц
      if ($i == 1) echo ('Январь');
      if ($i == 2) echo ('Февраль');
      if ($i == 3) echo ('Март');
      if ($i == 4) echo ('Апрель');
      if ($i == 5) echo ('Май');
      if ($i == 6) echo ('Июнь');
      if ($i == 7) echo ('Июль');
      if ($i == 8) echo ('Август');
      if ($i == 9) echo ('Сентябрь');
      if ($i == 10) echo ('Октябрь');
      if ($i == 11) echo ('Ноябрь');
      if ($i == 12) echo ('Декабрь');
      echo('</strong></li>');
}
else {
echo('<li><a href="/events/');
print_r($GLOBALS['year']);
echo('/');
if ($i<10) {
echo('0');
print_r($i);
}
else {
print_r($i);
}
echo('/">');
if ($i == 1) echo ('Январь');
if ($i == 2) echo ('Февраль');
if ($i == 3) echo ('Март');
if ($i == 4) echo ('Апрель');
if ($i == 5) echo ('Май');
if ($i == 6) echo ('Июнь');
if ($i == 7) echo ('Июль');
if ($i == 8) echo ('Август');
if ($i == 9) echo ('Сентябрь');
if ($i == 10) echo ('Октябрь');
if ($i == 11) echo ('Ноябрь');
if ($i == 12) echo ('Декабрь');
echo('</a></li>');
}
}
}
echo('</ul>');
        
      /* Отображаем архив статей */        
      $GLOBALS['LA_InformationSystem']->ShowInformationSystem($InformationSystem_id, $result['group'], $xsl_list, $InformationResult['items_on_page'], $InformationResult['items_begin'], $external_propertys, $property);  
   }
   else
   {
      /* Определяем идентификатор информационного элемента */
      $item_id = $GLOBALS['LA_InformationSystem']->GetIdInformationItem($result['item'], $result['group'], $InformationSystem_id);

      /* Выводим статью */
      $GLOBALS['LA_InformationSystem']->ShowInformationSystemItem($item_id, $xsl_item, $external_propertys);
   }
}

?>
#
Re: Встроенный календарь в страницу сайта
Настройки типовой динамической:
<?php

$kernel = & singleton('kernel');

/* ID Информационной системы */
$InformationSystem_id = to_int($GLOBALS['LA']['InformationSystemID']);

/* Количество записей на страницу */
$items_on_page = to_int($GLOBALS['LA']['ItemsOnPage']);

$GLOBALS['LA_InformationSystem'] = & singleton('InformationSystem');

if ($items_on_page !== true)
{
   $items_on_page = to_int($items_on_page);
}

$property = to_array($property);

/* Текстовая информация для указания номера страницы, например "страница" */
if (isset($GLOBALS['LA']['page']))
{
   $property['page'] = to_str($GLOBALS['LA']['page']);
}
else
{
   $property['page'] = 'страница';
}


/* Разделитель в заголовке страницы */
if (isset($GLOBALS['LA']['separator']))
{
   $property['separator'] = to_str($GLOBALS['LA']['separator']);
}
else
{
   $property['separator'] = ' / ';
}

$GLOBALS['InformationResult'] = array();

// Если указание на страницу - не прерываем определение
if (ereg ("^part-([0-9]*)$", end($GLOBALS['URL_ARRAY']), $regs) && to_int($regs[1]) > 0)
{
   /* Страница умножается на кол-во элементов, выводимых на страницу */
   $break_if_path_not_found = false;
   $GLOBALS['part_ii'] = $regs[1];

}
else
{

   $break_if_path_not_found = false;
   $GLOBALS['part_ii'] = 1;
}

$count_url_array = count($GLOBALS['URL_ARRAY']);

if ($count_url_array == 4) {
if (!isset($GLOBALS['URL_ARRAY'][1]))
{
   $GLOBALS['year'] = date('Y');
}
else
{
   $GLOBALS['year'] = to_str($GLOBALS['URL_ARRAY'][1]);
}

if (!isset($GLOBALS['URL_ARRAY'][2]))
{
   $GLOBALS['mont'] = date('m');
}
else
{
   $GLOBALS['mont'] = to_str($GLOBALS['URL_ARRAY'][2]);
}

if (!isset($GLOBALS['URL_ARRAY'][3]))
{
   $GLOBALS['theday'] = date('d');
}
else
{
   $GLOBALS['theday'] = to_str($GLOBALS['URL_ARRAY'][3]);
}

if ($count_url_array >= 4)
{
   unset($GLOBALS['URL_ARRAY'][1]);
   unset($GLOBALS['URL_ARRAY'][2]);
   unset($GLOBALS['URL_ARRAY'][3]);
}
}
else {
if (!isset($GLOBALS['URL_ARRAY'][1]))
{
   $GLOBALS['year'] = date('Y');
}
else
{
   $GLOBALS['year'] = to_str($GLOBALS['URL_ARRAY'][1]);
}

if (!isset($GLOBALS['URL_ARRAY'][2]))
{
   $GLOBALS['mont'] = date('m');
}
else
{
   $GLOBALS['mont'] = to_str($GLOBALS['URL_ARRAY'][2]);
}

if ($count_url_array >= 3)
{
   unset($GLOBALS['URL_ARRAY'][1]);
   unset($GLOBALS['URL_ARRAY'][2]);
}
}

/* получаем для пути ассоциативный массив с id группы и id/url элемента для данной инфосистемы */
$GLOBALS['INFSYS_result'] = $GLOBALS['LA_InformationSystem']->GetInformationFromPath($InformationSystem_id, '', $break_if_path_not_found);

/* Если путь существует */
if ($GLOBALS['INFSYS_result'])
{
   /* получаем массив с деревом от текущей группы до корня */
   $GLOBALS['LA_InformationSystem']->GetInformationGroupsForXml($GLOBALS['INFSYS_result']['group'], $InformationSystem_id);

   $group_path='';

   $mas_information_groups_for_xml=$GLOBALS['LA_InformationSystem']->get_mas_information_groups_for_xml();

   /* получаем данные о группе */
   $group_result=$GLOBALS['LA_InformationSystem']->SelectInformationGroups($GLOBALS['INFSYS_result']['group'], $InformationSystem_id);

   $row_group=mysql_fetch_assoc($group_result);

   /* получаем данные из seo - полей для групп */
   $seo_title = trim($row_group['information_groups_seo_title']);
   $seo_description = trim($row_group['information_groups_seo_description']);
   $seo_keywords = trim($row_group['information_groups_seo_keywords']);

   /* цикл по массиву с деревом для формирования пути по группам */
   for($i = count($mas_information_groups_for_xml)-1; $i >= 0; $i--)
   {
      /* seo_title для группы пустое, то в заголовок подставляем название */

      if (trim($mas_information_groups_for_xml[$i]['information_groups_seo_title'])=='')
      {
         $group_path.=$property['separator'].$mas_information_groups_for_xml[$i]['information_groups_name'];
      }
      else
      {
         $group_path.=$property['separator'].$mas_information_groups_for_xml[$i]['information_groups_seo_title'];
      }
   }

   /* определяем название информационной системы */
   $row = $GLOBALS['LA_InformationSystem']->GetInformationSystem($InformationSystem_id);

   /* имя информационной системы */
   $InformationSystem_name = $row['information_systems_name'];

   /* Если вывод информационного элемента */

   if ($GLOBALS['INFSYS_result']['item'])
   {
      /* определяем id информационного элемента */
      $item_id = $GLOBALS['LA_InformationSystem']->GetIdInformationItem($GLOBALS['INFSYS_result']['item'], $GLOBALS['INFSYS_result']['group'], $InformationSystem_id);

      $GLOBALS['InformationResult']['item_id'] = $item_id;

      /* получаем данные об элементе */
      $row_item = $GLOBALS['LA_InformationSystem']->GetInformationSystemItem($item_id);
$GLOBALS['year'] = substr($row_item['information_items_date'],0,4);
$GLOBALS['mont'] = substr($row_item['information_items_date'],5,2);
      /* проверяем если seo_title непустой, то в заголовок страницы подставляем его */

      if (trim($row_item['information_items_seo_title']) != '')
      {
         $item_name = $property['separator'].trim($row_item['information_items_seo_title']);
      }
      else
      {
         /* имя элемента */
         $item_name=$property['separator'].$row_item['information_items_name'];
      }
   }
   else
   {
      /* Вывод информационной группы */

      /* Определяем номер страницы для показа */
      $end_array_item = end($GLOBALS['URL_ARRAY']);

      $page = to_str($end_array_item);

      if (ereg ("^page-([0-9]*)$", $page, $regs) && to_int($regs[1]) > 0)
      {

         /* Страница умножается на кол-во элементов, выводимых на страницу */
         $items_begin = ($regs[1] - 1) * $items_on_page;

         /* Если показываем группу, а не элемент, то указываем страницу (страница N), если она не первая */
         $page_number = "{$property['separator']}{$property['page']} {$regs[1]}";
      }
      else
      {
         $items_begin = 0;
      }

      /* Массив, возвращаемый методом */
      $GLOBALS['InformationResult']['items_begin'] = $items_begin;
   }

   if (isset($GLOBALS['INFSYS_result']['tag_name']))
   {
      $tag_name = "Метка: {$GLOBALS['INFSYS_result']['tag_name']} {$property['separator']}";
   }

   /* формируем заголовок страницы */
   $new_title = $InformationSystem_name . $group_path . to_str($item_name) . to_str($page_number);
}
else
{
   // Элемент/группа не найдены, возвращаем 404 ошибку.
   ShowHeader404();

   if (to_str($_SERVER['REQUEST_URI']) != '/')
   {
      header('Location: /');
   }

   // Прекращаем выполнение
   exit();
}

if (!empty($new_title))
{
   /* отображаем группу, если не существует данных об элементе и родительская группа не является корнем */
   if (!isset($row_item) && $GLOBALS['INFSYS_result']['group'] != 0 || isset($tag_name))
   {
      /* Заголовок для группы задан */
      if (!empty($seo_title))
      {
         $kernel->set_title($seo_title);
      }
      else
      {
         $kernel->set_title($new_title);
      }

      /* Описание для группы задано */
      if (!empty($seo_description))
      {
         $kernel->set_description($seo_description);
      }
      else
      {
         $kernel->set_description($new_title);
      }

      /* Ключевые слова для группы заданы */
      if (!empty($seo_keywords))
      {
         $kernel->set_keywords($seo_keywords);
      }
      else
      {
         $kernel->set_keywords($new_title);
      }
   }
   elseif (isset($row_item)) /* отображаем элемент */
   {
      if (!empty($row_item['information_items_seo_description']))
      {
         $kernel->set_title(trim($row_item['information_items_seo_title']));
      }
      else
      {
         $kernel->set_title($new_title);
      }

      /* Описание для элемента задано */
      if (!empty($row_item['information_items_seo_description']))
      {
         $kernel->set_description(trim($row_item['information_items_seo_description']));
      }
      else
      {
         $kernel->set_description($new_title);
      }

      /* Ключевые слова для элемента заданы */
      if (!empty($row_item['information_items_seo_keywords']))
      {
         $kernel->set_keywords(trim($row_item['information_items_seo_keywords']));
      }
      else
      {
         $kernel->set_keywords($new_title);
      }
   }
}

$GLOBALS['InformationResult']['items_on_page'] = $items_on_page;

?>
#
Re: Встроенный календарь в страницу сайта
XSL-шаблон списка событий:
<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="Windows-1251" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>

   <xsl:template match="/">
      <xsl:apply-templates select="/document"/>
   </xsl:template>

   <xsl:template match="/document">

      <!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
      <xsl:variable name="parent_group_id" select="blocks/parent_group_id"/>

      <!-- Если в находимся корне - выводим название информационной системы -->
      <xsl:if test="blocks/parent_group_id = 0">

         <!-- Описание выводится при отсутствии фильтрации по тэгам -->
         <xsl:if test="count(blocks/tags/tag) = 0">
            <xsl:value-of disable-output-escaping="yes" select="blocks/description"/>
         </xsl:if>
      </xsl:if>

      <!--<div class="archive_calendar">
         <ul>
            <xsl:call-template name="for_years">
               <xsl:with-param name="current_year" select="/document/Год"/>
               <xsl:with-param name="count_years" select="/document/ТекущийГод - 2000"/>
            </xsl:call-template>
         </ul>

         <table>
            <tbody>
               <tr>
                  <xsl:choose>
                     <xsl:when test="/document/Месяц = 01">
                        <td class="act">
                           <span>январь</span>
                        </td>
                     </xsl:when>
                     <xsl:otherwise>
                        <td>

                           <xsl:choose>

                              <xsl:when test="/document/Год = /document/ТекущийГод and 01 &gt; /document/ТекущийМесяц">январь</xsl:when>
                              <xsl:otherwise>
                                 <a href="{blocks/url}{/document/Год}/01/">январь</a>
                              </xsl:otherwise>
                           </xsl:choose>
                        </td>
                     </xsl:otherwise>
                  </xsl:choose>

                  <xsl:choose>
                     <xsl:when test="/document/Месяц = 02">
                        <td class="act">
                           <span>февраль</span>
                        </td>
                     </xsl:when>
                     <xsl:otherwise>
                        <td>
                           <xsl:choose>
                              <xsl:when test="/document/Год = /document/ТекущийГод and 02 &gt; /document/ТекущийМесяц">февраль</xsl:when>
                              <xsl:otherwise>
                                 <a href="{blocks/url}{/document/Год}/02/">февраль</a>
                              </xsl:otherwise>
                           </xsl:choose>
                        </td>
                     </xsl:otherwise>
                  </xsl:choose>

                  <xsl:choose>
                     <xsl:when test="/document/Месяц = 03">
                        <td class="act">
                           <span>март</span>
                        </td>
                     </xsl:when>
                     <xsl:otherwise>
                        <td>
                           <xsl:choose>
                              <xsl:when test="/document/Год = /document/Год and 03 &gt; /document/ТекущийМесяц">март</xsl:when>
                              <xsl:otherwise>
                                 <a href="{blocks/url}{/document/Год}/03/">март</a>
                              </xsl:otherwise>
                           </xsl:choose>
                        </td>
                     </xsl:otherwise>
                  </xsl:choose>

                  <xsl:choose>
                     <xsl:when test="/document/Месяц = 04">
                        <td class="act">
                           <span>апрель</span>
                        </td>
                     </xsl:when>
                     <xsl:otherwise>
                        <td>
                           <xsl:choose>
                              <xsl:when test="/document/Год = /document/ТекущийГод and 04 &gt; /document/ТекущийМесяц">апрель</xsl:when>
                              <xsl:otherwise>
                                 <a href="{blocks/url}{/document/Год}/04/">апрель</a>
                              </xsl:otherwise>
                           </xsl:choose>
                        </td>
                     </xsl:otherwise>
                  </xsl:choose>

                  <xsl:choose>
                     <xsl:when test="/document/Месяц = 05">
                        <td class="act">
                           <span>май</span>
                        </td>
                     </xsl:when>
                     <xsl:otherwise>
                        <td>
                           <xsl:choose>
                              <xsl:when test="/document/Год = /document/ТекущийГод and 05 &gt; /document/ТекущийМесяц">май</xsl:when>
                              <xsl:otherwise>
                                 <a href="{blocks/url}{/document/Год}/05/">май</a>
                              </xsl:otherwise>
                           </xsl:choose>
                        </td>
                     </xsl:otherwise>
                  </xsl:choose>

                  <xsl:choose>
                     <xsl:when test="/document/Месяц = 06">
                        <td class="act">
                           <span>июнь</span>
                        </td>
                     </xsl:when>
                     <xsl:otherwise>
                        <td>
                           <xsl:choose>
                              <xsl:when test="/document/Год = /document/ТекущийГод and 06 &gt; /document/ТекущийМесяц ">июнь</xsl:when>
                              <xsl:otherwise>
                                 <a href="{blocks/url}{/document/Год}/06/">июнь</a>
                              </xsl:otherwise>
                           </xsl:choose>
                        </td>
                     </xsl:otherwise>
                  </xsl:choose>
               </tr>
               <tr>

                  <xsl:choose>
                     <xsl:when test="/document/Месяц = 07">
                        <td class="act">
                           <span>июль</span>
                        </td>
                     </xsl:when>
                     <xsl:otherwise>
                        <td>
                           <xsl:choose>
                              <xsl:when test="/document/Год = /document/ТекущийГод and 07 &gt; /document/ТекущийМесяц">июль</xsl:when>
                              <xsl:otherwise>
                                 <a href="{blocks/url}{/document/Год}/07/">июль</a>
                              </xsl:otherwise>
                           </xsl:choose>
                        </td>
                     </xsl:otherwise>
                  </xsl:choose>


                  <xsl:choose>
                     <xsl:when test="/document/Месяц = 08">
                        <td class="act">
                           <span>август</span>
                        </td>
                     </xsl:when>
                     <xsl:otherwise>
                        <td>
                           <xsl:choose>
                              <xsl:when test="/document/Год = /document/ТекущийГод and 08 &gt; /document/ТекущийМесяц">август</xsl:when>
                              <xsl:otherwise>
                                 <a href="{blocks/url}{/document/Год}/08/">август</a>
                              </xsl:otherwise>
                           </xsl:choose>
                        </td>
                     </xsl:otherwise>
                  </xsl:choose>

                  <xsl:choose>
                     <xsl:when test="/document/Месяц = 09">
                        <td class="act">
                           <span>сентябрь</span>
                        </td>
                     </xsl:when>
                     <xsl:otherwise>
                        <td>
                           <xsl:choose>
                              <xsl:when test="/document/Год = /document/ТекущийГод and 09 &gt; /document/ТекущийМесяц">сентябрь</xsl:when>
                              <xsl:otherwise>
                                 <a href="{blocks/url}{/document/Год}/09/">сентябрь</a>
                              </xsl:otherwise>
                           </xsl:choose>
                        </td>
                     </xsl:otherwise>
                  </xsl:choose>


                  <xsl:choose>
                     <xsl:when test="/document/Месяц = 10">
                        <td class="act">
                           <span>октябрь</span>
                        </td>
                     </xsl:when>
                     <xsl:otherwise>
                        <td>
                           <xsl:choose>
                              <xsl:when test="/document/Год = /document/ТекущийГод and 10 &gt; /document/ТекущийМесяц">октябрь</xsl:when>
                              <xsl:otherwise>
                                 <a href="{blocks/url}{/document/Год}/10/">октябрь</a>
                              </xsl:otherwise>
                           </xsl:choose>
                        </td>
                     </xsl:otherwise>
                  </xsl:choose>


                  <xsl:choose>
                     <xsl:when test="/document/Месяц = 11">
                        <td class="act">
                           <span>ноябрь</span>
                        </td>
                     </xsl:when>
                     <xsl:otherwise>
                        <td>
                           <xsl:choose>
                              <xsl:when test="/document/Год = /document/ТекущийГод and 11 &gt; /document/ТекущийМесяц">ноябрь</xsl:when>
                              <xsl:otherwise>
                                 <a href="{blocks/url}{/document/Год}/11/">ноябрь</a>
                              </xsl:otherwise>
                           </xsl:choose>
                        </td>
                     </xsl:otherwise>
                  </xsl:choose>

                  <xsl:choose>
                     <xsl:when test="/document/Месяц = 12">
                        <td class="act">
                           <span>декабрь</span>
                        </td>
                     </xsl:when>
                     <xsl:otherwise>
                        <td>
                           <xsl:choose>
                              <xsl:when test="/document/Год = /document/ТекущийГод and 12 &gt; /document/ТекущийМесяц">декабрь</xsl:when>
                              <xsl:otherwise>
                                 <a href="{blocks/url}{/document/Год}/12/">декабрь</a>
                              </xsl:otherwise>
                           </xsl:choose>
                        </td>
                     </xsl:otherwise>
                  </xsl:choose>
               </tr>
            </tbody>
         </table>
      </div>-->

      <div class="item_list">
         <!-- Отображение записи информационной системы -->
         <xsl:apply-templates select="blocks/items/item[item_status=1]"/>
      </div>



      <xsl:if test="blocks/items/count_items &gt; blocks/items/items_on_page">
         <!-- Ссылка, для которой дописываются суффиксы page-XX/ -->
         <xsl:variable name="link">
            <xsl:value-of select="/document/blocks/url"/>
            <xsl:if test="$parent_group_id != 0">
               <xsl:value-of select="/document/blocks//group[@id = $parent_group_id]/fullpath"/>
            </xsl:if>
            <xsl:value-of select="Год"/>/<xsl:value-of select="Месяц"/>/</xsl:variable>
         <div class="pager">
            <h3>
               <strong>Страницы</strong>
            </h3>
            <p>

               <xsl:call-template name="for">
                  <xsl:with-param name="link" select="$link"/>
                  <xsl:with-param name="items_on_page" select="blocks/items/items_on_page"/>
                  <xsl:with-param name="current_page" select="blocks/items/current_page"/>
                  <xsl:with-param name="count_items" select="blocks/items/count_items"/>
                  <xsl:with-param name="visible_pages">5</xsl:with-param>
               </xsl:call-template>
            </p>
         </div>
      </xsl:if>
   </xsl:template>

   <!-- Данные о статьях -->

   <xsl:template match="blocks/items/item"><hr class="normal" />
<div class="article_one">
         <table width="100%"><tr><td style="padding-right:40px; width:80%;"><h3 class="yellow">
            <a href="{item_path}"><xsl:value-of disable-output-escaping="yes" select="item_name"/></a>
         </h3></td><td style="text-align:right;"><div style="background:url('/f/i/pointer.gif') left top no-repeat; height:26px; padding-left:10px; white-space:nowrap;"><div style="background:#706436; height:26px;"><div style="padding:3px 10px 0; color:#fff;"><xsl:value-of disable-output-escaping="yes" select="substring(item_date,1,2)"/>&#xa0;<xsl:if test="substring(item_date,4,2)='01'">января</xsl:if><xsl:if test="substring(item_date,4,2)='02'">февраля</xsl:if><xsl:if test="substring(item_date,4,2)='03'">марта</xsl:if><xsl:if test="substring(item_date,4,2)='04'">апреля</xsl:if><xsl:if test="substring(item_date,4,2)='05'">мая</xsl:if><xsl:if test="substring(item_date,4,2)='06'">июня</xsl:if><xsl:if test="substring(item_date,4,2)='07'">июля</xsl:if><xsl:if test="substring(item_date,4,2)='08'">августа</xsl:if><xsl:if test="substring(item_date,4,2)='09'">сентября</xsl:if><xsl:if test="substring(item_date,4,2)='10'">октября</xsl:if><xsl:if test="substring(item_date,4,2)='11'">ноября</xsl:if><xsl:if test="substring(item_date,4,2)='12'">декабря</xsl:if>&#xa0;<xsl:value-of disable-output-escaping="yes" select="substring(item_date,7,4)"/>
<xsl:if test="item_propertys/item_property[@xml_name='xsl_notime']/value!=1">, <xsl:value-of disable-output-escaping="yes" select="substring(item_datetime, 12, 5)"/></xsl:if></div></div>
</div>   </td></tr></table>
<xsl:value-of disable-output-escaping="yes" select="item_description"/>
         
      </div>
   </xsl:template>

   <!-- /// Метки для информационного элемента /// -->
   <xsl:template match="tags/tag">
      <a href="{/document/blocks/url}tag/{tag_path_name}/" class="tag">
         <xsl:value-of select="tag_name"/>
      </a>
      <xsl:if test="position() != last()">,</xsl:if>&#xA0;</xsl:template>

   <!-- Цикл для вывода строк ссылок -->
   <xsl:template name="for">
      <xsl:param name="i" select="0"/>
      <xsl:param name="prefix">page</xsl:param>
      <xsl:param name="link"/>
      <xsl:param name="items_on_page"/>
      <xsl:param name="current_page"/>
      <xsl:param name="count_items"/>
      <xsl:param name="visible_pages"/>

      <xsl:variable name="n" select="$count_items div $items_on_page"/>

      <!-- Заносим в переменную $parent_group_id идентификатор текущей группы -->
      <xsl:variable name="parent_group_id" select="/document/blocks/parent_group_id"/>


      <!-- Считаем количество выводимых ссылок перед текущим элементом -->
      <xsl:variable name="pre_count_page">
         <xsl:choose>
            <xsl:when test="$current_page &gt; ($n - (round($visible_pages div 2) - 1))">
               <xsl:value-of select="$visible_pages - ($n - $current_page)"/>
            </xsl:when>
            <xsl:otherwise>
               <xsl:value-of select="round($visible_pages div 2) - 1"/>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:variable>

      <!-- Считаем количество выводимых ссылок после текущего элемента -->
      <xsl:variable name="post_count_page">
         <xsl:choose>
            <xsl:when test="0 &gt; $current_page - (round($visible_pages div 2) - 1)">
               <xsl:value-of select="$visible_pages - $current_page - 1"/>
            </xsl:when>
            <xsl:otherwise>
               <xsl:choose>
                  <xsl:when test="round($visible_pages div 2) = ($visible_pages div 2)">
                     <xsl:value-of select="$visible_pages div 2"/>
                  </xsl:when>
                  <xsl:otherwise>
                     <xsl:value-of select="round($visible_pages div 2) - 1"/>
                  </xsl:otherwise>
               </xsl:choose>
            </xsl:otherwise>
         </xsl:choose>
      </xsl:variable>
      <!--
      <xsl:if test="$i = 0 and $current_page != 0">
            <xsl:choose>
               <xsl:when test="$current_page != 1">
                  <a href="{$link}page-{$current_page}/" style="color: #333;">&#x2190; предыдущая</a>&#xA0;&#xA0;&#xA0;</xsl:when>
               <xsl:otherwise>
                  <a href="{$link}" style="color: #333;">&#x2190; предыдущая</a>&#xA0;&#xA0;&#xA0;</xsl:otherwise>
            </xsl:choose>
         </xsl:if>
         -->
<!--
      <xsl:if test="$i = 0 and $current_page != 0">
         <span class="ctrl">&#x2190;
             Ctrl</span>
      </xsl:if>
      -->

<!--
      <xsl:if test="$i &gt;= $n and ($n - 1) &gt; $current_page">
         <span class="ctrl">Ctrl &#x2192;</span>
      </xsl:if>
      -->
      <!--
      <xsl:if test="$i &gt;= $n and ($n - 1) &gt; $current_page">
            <xsl:variable name="redo_link" select="$current_page + 2"/>
            <a href="{$link}page-{$redo_link}/" style="color: #333;">следующая&#x2192;</a>
         </xsl:if>
         -->

      <xsl:if test="$count_items &gt; $items_on_page and $n &gt; $i">

         <!-- Определяем адрес тэга -->
         <xsl:variable name="tag_link">
            <xsl:choose>
               <!-- Если не нулевой уровень -->
               <xsl:when test="count(/document/blocks/selected_tags/tag) != 0">tag/<xsl:value-of select="/document/blocks/selected_tags/tag/tag_path_name"/>/</xsl:when>
               <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
               <xsl:otherwise></xsl:otherwise>
            </xsl:choose>
         </xsl:variable>

         <!-- Определяем адрес ссылки -->
         <xsl:variable name="number_link">
            <xsl:choose>
               <!-- Если не нулевой уровень -->
               <xsl:when test="$i != 0">
                  <xsl:value-of select="$prefix"/>-<xsl:value-of select="$i + 1"/>/</xsl:when>
               <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
               <xsl:otherwise></xsl:otherwise>
            </xsl:choose>
         </xsl:variable>

         <!-- Ставим ссылку на страницу-->
         <xsl:if test="$i != $current_page">
            <!-- Выводим ссылку на первую страницу -->
            <xsl:if test="$current_page - $pre_count_page &gt; 0 and $i = 0">
               <a href="{$link}" class="page_link" style="text-decoration: none;">первая</a>&#xA0;
            </xsl:if>

            <xsl:choose>
               <xsl:when test="$i &gt;= ($current_page - $pre_count_page) and ($current_page + $post_count_page) &gt;= $i">
                  <!-- Выводим ссылки на видимые страницы -->
                  <a href="{$link}{$tag_link}{$number_link}" class="page_link">
                     <xsl:value-of select="$i + 1"/>
                  </a>&#xA0;
               </xsl:when>
               <xsl:otherwise></xsl:otherwise>
            </xsl:choose>

            <!-- Выводим ссылку на последнюю страницу -->
            <xsl:if test="$i+1 &gt;= $n and $n &gt; ($current_page + 1 + $post_count_page)">
               <xsl:choose>
                  <xsl:when test="$n &gt; round($n)">
                     <!-- Выводим ссылку на последнюю страницу -->
                     <a href="{$link}{$prefix}-{round($n+1)}/" class="page_link" style="text-decoration: none;">последняя</a>
                  </xsl:when>
                  <xsl:otherwise>
                     <a href="{$link}{$prefix}-{round($n)}/" class="page_link" style="text-decoration: none;">последняя</a>
                  </xsl:otherwise>
               </xsl:choose>
            </xsl:if>
         </xsl:if>

         <!-- Ссылка на предыдущую страницу для Ctrl + влево -->
         <xsl:if test="$current_page != 0 and $i = $current_page">
            <xsl:variable name="prev_number_link">
               <xsl:choose>
                  <!-- Если не нулевой уровень -->
                  <xsl:when test="($current_page - 1) != 0">page-<xsl:value-of select="$i"/>/</xsl:when>
                  <!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
                  <xsl:otherwise></xsl:otherwise>
               </xsl:choose>
            </xsl:variable>

            <a href="{$link}{$tag_link}{$prev_number_link}" id="id_prev"></a>
         </xsl:if>

         <!-- Ссылка на следующую страницу для Ctrl + вправо -->
         <xsl:if test="($n - 1) &gt; $current_page and $i = $current_page">
            <a href="{$link}{$tag_link}page-{$current_page+2}/" id="id_next"></a>
         </xsl:if>

         <!-- Не ставим ссылку на страницу-->
         <xsl:if test="$i = $current_page">
            <span class="current">
               <xsl:value-of select="$i+1"/>&#xA0;
            </span>
         </xsl:if>

         <!-- Рекурсивный вызов шаблона. НЕОБХОДИМО ПЕРЕДАВАТЬ ВСЕ НЕОБХОДИМЫЕ ПАРАМЕТРЫ! -->
         <xsl:call-template name="for">
            <xsl:with-param name="i" select="$i + 1"/>
            <xsl:with-param name="prefix" select="$prefix"/>
            <xsl:with-param name="link" select="$link"/>
            <xsl:with-param name="items_on_page" select="$items_on_page"/>
            <xsl:with-param name="current_page" select="$current_page"/>
            <xsl:with-param name="count_items" select="$count_items"/>
            <xsl:with-param name="visible_pages" select="$visible_pages"/>
         </xsl:call-template>
      </xsl:if>
   </xsl:template>

   <xsl:template name="for_years">
      <xsl:param name="i" select="0"/>
      <xsl:param name="current_year"/>
      <xsl:param name="count_years"/>

      <xsl:variable name="year" select="2000 + $count_years - $i"/>

      <xsl:if test="$count_years&gt;=$i  ">
         <li>
            <xsl:choose>
               <xsl:when test="/document/Год != $year">
                  <a href="{/document/blocks/url}{$year}/01/">
                     <xsl:value-of disable-output-escaping="yes" select="$year"/>
                  </a>
               </xsl:when>
               <xsl:otherwise>
                  <strong>
                     <xsl:value-of disable-output-escaping="yes" select="2000 + $count_years - $i"/>
                  </strong>
               </xsl:otherwise>
            </xsl:choose>&#xA0;</li>


         <!-- Рекурсивный вызов шаблона. НЕОБХОДИМО ПЕРЕДАВАТЬ ВСЕ НЕОБХОДИМЫЕ ПАРАМЕТРЫ! -->
         <xsl:call-template name="for_years">
            <xsl:with-param name="i" select="$i + 1"/>
            <xsl:with-param name="current_year" select="$current_year"/>
            <xsl:with-param name="count_years" select="$count_years"/>
         </xsl:call-template>
      </xsl:if>
   </xsl:template>

   <xsl:template name="for_monts">
      <xsl:param name="i" select="1"/>
      <xsl:param name="current_mont"/>

      <xsl:if test="12&gt;=$i">

         <xsl:variable name="td_class">
            <xsl:choose>
               <xsl:when test="/document/Месяц != $current_mont">class="act"</xsl:when>
               <xsl:otherwise></xsl:otherwise>
            </xsl:choose>
         </xsl:variable>




         <!-- Рекурсивный вызов шаблона. НЕОБХОДИМО ПЕРЕДАВАТЬ ВСЕ НЕОБХОДИМЫЕ ПАРАМЕТРЫ! -->
         <xsl:call-template name="for_years">
            <xsl:with-param name="i" select="$i + 1"/>
            <xsl:with-param name="current_mont" select="$current_mont"/>
         </xsl:call-template>
      </xsl:if>
   </xsl:template>
</xsl:stylesheet>
#
Re: Встроенный календарь в страницу сайта
будет работать если путь к новостям - "/events/", если нет нужно дорабатывать
и все новости лежат в корне инфосистемы

все сыро, но работает
#
Re: Встроенный календарь в страницу сайта
Версия вполне рабочая, благодарю за информацию, внедрила ее на сайте http://www.ladyu.ru/events/2009/07/

меня смущает только три незначительных момента
1. Календарь работает и в прошлые месяцы, если их задать в адресной строке, но не стрелки на месяц назад или вперед не работает в текущем месяце. Я убрала одно из условий и ссылка стала рабочей
2. Стрелка вперед не работает, если в следующем месяце нет новостей, но если это не будущий месяц, а какой то прошедший, то получается, что календарь не перелистывается через него (В моем случае это август), обойти это условия я не смогла. Если его убрать, то календарь можно листать в будущее и в этом ничего плохого нет.
3. Единственное, в поле самого списка не отображаться все месяцы (где выводятся новости), где есть новости, только октябрь и ноябрь. я здесь где-то ошиблась?
#
Re: Встроенный календарь в страницу сайта
по 3 - отображаются только месяцы, в которых есть новости

а по 1 и 2 - да, немного сыро, нужно дорабатывать
Авторизация