<?php /** * User: Олег * Data: 11.06.12 22:56 * Site: http://sForge.ru **/ require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php"; CModule::IncludeModule("iblock"); CModule::IncludeModule("mytb"); die; $res = Club::getList(array(), array(), false, false, array("ID", "PROPERTY_ADDRESS", "PROPERTY_PHONE")); $i = 0; while ($row = $res->Fetch()) { foreach ($row["PROPERTY_ADDRESS_VALUE"] as $var) { $obj = json_decode(file_get_contents("http://geocode-maps.yandex.ru/1.x/?geocode=" . urlencode(trim($var)) . "&format=json")); list($LAT, $LON) = explode(" ", $obj->response->GeoObjectCollection->featureMember[0]->GeoObject->Point->pos); MyTbCore::Add(array("CLUB_ID" => $row["ID"], "SITY_ID" => 1, "LON" => $LON, "LAT" => $LAT, "ADDRESS" => $var, "PHONE" => serialize((array) $row["PROPERTY_PHONE_VALUE"])), "address"); } $i++; } echo $i;
$obCache = new CPHPCache; if ($obCache->InitCache($arParams['CACHE_TIME'], $cache_id, '/')) { $vars = $obCache->GetVars(); $arResult = $vars['arResult']; } elseif ($obCache->StartDataCache()) { $arFilter["ID"] = Club::getListHaveStocks(); $res = Club::getList(Array("SORT" => "DESC"), $arFilter, FALSE, $arNavStartParams, Array( "NAME", "ID", "PREVIEW_TEXT", "PREVIEW_PICTURE", 'PROPERTY_RATING', 'PROPERTY_METRO', 'PROPERTY_TIME_WORKING', 'PROPERTY_PRICE_COCKTAIL', 'PROPERTY_CARDS', 'PROPERTY_TYPE_FACILITY' )); $clubsID = array(); while ($arField = $res->Fetch()) { $arFile = CFile::GetFileArray($arField["PREVIEW_PICTURE"]); $result[] = array( "ID" => $arField["ID"], "NAME" => $arField["NAME"], "PREVIEW_TEXT" => $arField["~PREVIEW_TEXT"], "PREVIEW_PICTURE" => imgurl($arFile["SRC"], array("w" => 100)),
if ($arParams["AJAX"] == "Y" && intval($_POST['clubID']) != 0) { $clubID = intval($_POST['clubID']); if (in_array($clubID, $rs['PROPERTY_LINK_STOK_VALUE'])) { $arListClubSubs = array(intval($_POST['clubID'])); } } else { //иначе достаем спиисок всех клубов $arListClubSubs = array_merge($rs['PROPERTY_LINK_STOK_VALUE'], $rs['PROPERTY_LINK_EVENT_VALUE']); } if (count($arListClubSubs) > 0) { $ob = CIBlockElement::GetList(array("SORT" => "ASC"), array("PROPERTY_CLUB_ID" => $arListClubSubs, "IBLOCK_ID" => array(IB_SUB_STOCK_ID, IB_SUB_EVENT_ID), ">=DATE_ACTIVE_TO" => date("d.m.Y")), FALSE, FALSE, array("ID", "NAME", "DATE_ACTIVE_FROM", "DATE_ACTIVE_TO", "PREVIEW_TEXT", "DETAIL_PICTURE", "PROPERTY_CLUB_ID", "DATE_ACTIVE_TO")); } if ($ob) { while ($ar = $ob->Fetch()) { $clubListID[] = intval($ar['PROPERTY_CLUB_ID_VALUE']); $arStockList[date("d.m.Y", strtotime($ar['DATE_ACTIVE_FROM']))][] = $ar; } } if (count($arListClubSubs) > 0) { $rsClub = Club::getList(array(), array("ID" => $arListClubSubs), FALSE, FALSE, array("NAME", "ID", "PREVIEW_PICTURE")); while ($arClub = $rsClub->Fetch()) { if (intval($arClub["PREVIEW_PICTURE"]) > 0) { $arFile = CFile::GetFileArray($arClub["PREVIEW_PICTURE"]); $arClub["PREVIEW_PICTURE"] = imgurl($arFile["SRC"], array("w" => 350, "h" => "100")); } $arClubList[$arClub['ID']] = array("NAME" => $arClub['NAME'], "ID" => $arClub['ID'], "PREVIEW_PICTURE" => $arClub["PREVIEW_PICTURE"]); } } $arResult['stockList'] = $arStockList; $arResult['club'] = $arClubList; $this->IncludeComponentTemplate();
$user = new User($arParams['USER_ID']); //достаем информуци. у пользователя $rs = $user->getProps(array("ID", "PROPERTY_USER", "PROPERTY_LINK_STOK", "PROPERTY_LINK_EVENT")); //Если Ajax о показываем информацию только по одному клубу if ($arParams["AJAX"] == "Y" && intval($_POST['clubID']) != 0) { $clubID = intval($_POST['clubID']); if (in_array($clubID, $rs['PROPERTY_LINK_STOK_VALUE'])) { $arListClubSubs = array(intval($_POST['clubID'])); } } else { //иначе достаем спиисок всех клубов $arListClubSubs = array_merge($rs['PROPERTY_LINK_STOK_VALUE'], $rs['PROPERTY_LINK_EVENT_VALUE']); } if (count($arListClubSubs) > 0) { $ob = CIBlockElement::GetList(array("SORT" => "ASC"), array("PROPERTY_CLUB_ID" => $arListClubSubs, "IBLOCK_ID" => array(IB_SUB_STOCK_ID, IB_SUB_EVENT_ID), ">=DATE_ACTIVE_TO" => date("d.m.Y")), FALSE, FALSE, array("ID", "NAME", "IBLOCK_ID", "DATE_ACTIVE_FROM", "DATE_ACTIVE_TO", "PREVIEW_TEXT", "DETAIL_PICTURE", "PROPERTY_CLUB_ID", "DATE_ACTIVE_TO")); } if ($ob) { while ($ar = $ob->Fetch()) { $clubListID[] = intval($ar['PROPERTY_CLUB_ID_VALUE']); $arStockList[] = $ar; } } if (count($arListClubSubs) > 0) { $rsClub = Club::getList(array(), array("ID" => $arListClubSubs), FALSE, FALSE, array("NAME", "ID")); while ($arClub = $rsClub->Fetch()) { $arClubList[$arClub['ID']] = array("NAME" => $arClub['NAME'], "ID" => $arClub['ID']); } } $arResult['stockList'] = $arStockList; $arResult['club'] = $arClubList; $this->IncludeComponentTemplate();
$clubSave['metod'][] = "email"; } } } if (isset($_POST['day'])) { foreach ($_POST['day'] as $var) { $var = intval($var); if ($var > 0 & $var < 8) { $clubSave['day'][] = $var; } } } $user->setSubscribeData($clubSave); } $rs = $user->getProps(array("ID", "PROPERTY_USER", "PROPERTY_LINK_STOK", "PROPERTY_LINK_EVENT", "PROPERTY_NOTICE")); $arListClubSubsEVENT = $rs['PROPERTY_LINK_EVENT_VALUE']; $arListClubSubsSTOK = $rs['PROPERTY_LINK_STOK_VALUE']; $NOTICE = unserialize($rs['PROPERTY_NOTICE_VALUE']); $clubAll = array_merge((array) $arListClubSubsEVENT, (array) $arListClubSubsSTOK); if (count($clubAll) > 0) { $rsClub = Club::getList(array(), array("ID" => $clubAll, "ACTIVE" => "Y"), FALSE, FALSE, array("NAME", "ID", "PREVIEW_PICTURE")); while ($arClub = $rsClub->Fetch()) { $arFile = CFile::GetFileArray($arClub["PREVIEW_PICTURE"]); $arClubList[$arClub['ID']] = array("NAME" => $arClub['NAME'], "ID" => $arClub['ID'], "SRC" => $arFile["SRC"]); } } $arResult['club'] = $arClubList; $arResult['SUBS']["EVENT"] = $arListClubSubsEVENT; $arResult['SUBS']["STOK"] = $arListClubSubsSTOK; $arResult['NOTICE'] = $NOTICE; $this->IncludeComponentTemplate();