$arSelect = array("ID", "IBLOCK_ID", "*"); $property_enums = CIBlockPropertyEnum::GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => 2, "XML_ID" => "FOR_USERS")); while ($enum_fields = $property_enums->GetNext()) { $enums_id[] = $enum_fields["ID"]; } if (empty($_GET["filter"])) { if (date("U", strtotime($start_date)) < date("U", strtotime(date("j.n.Y", time())))) { $start_date = date("j.n.Y", strtotime(date("j.n.Y", time()) . " Monday")); } $arFilter = array("IBLOCK_ID" => 2, array("LOGIC" => "OR", array("IBLOCK_ID" => 2, "PROPERTY_ANC_ID" => $myID)), array("LOGIC" => "AND", array(">=PROPERTY_START_DATE" => trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($start_date), 'FULL')), "\\'")), array("<=PROPERTY_START_DATE" => trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($end_date), 'FULL')), "\\'")))); } elseif (substr($_GET["filter"], 0, 4) == "next") { $arFilter = array("IBLOCK_ID" => 2, ">=PROPERTY_START_DATE" => trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($start_date), 'FULL')), "\\'"), "<=PROPERTY_START_DATE" => trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($end_date), 'FULL')), "\\'")); } elseif (substr($_GET["filter"], 0, 4) == "prev") { $arFilter = array("IBLOCK_ID" => 2, "<=PROPERTY_START_DATE" => trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($end_date), 'FULL')), "\\'")); if (!empty($_GET["s"])) { $arFilter[">=PROPERTY_START_DATE"] = trim(CDatabase::CharToDateFunction(ConvertTimeStamp(strtotime($start_date), 'FULL')), "\\'"); } } if (!empty($_GET["place"]) && empty($_GET["s"])) { $arFilter = array(); $arFilter["IBLOCK_ID"] = 2; $arFilter["PROPERTY_CITY"] = $_GET["place"]; if (empty($_GET["filter"])) { $arFilter["PROPERTY_ANC_ID"] = $myID; } } if ($_GET["q"]) { $arFilter["%NAME"] = $_GET["q"]; } $res = CIBlockElement::GetList(array("PROPERTY_START_DATE" => "DESC"), $arFilter, false, false, $arSelect); $numPeriod = 0;
public function PrepareUpdateBind($strTableName, $arFields, $strFileDir, $lang, &$arBinds, $strTableAlias = "") { $arBinds = array(); if ($strTableAlias != "") { $strTableAlias .= "."; } $strUpdate = ""; $arColumns = $this->GetTableFields($strTableName); foreach ($arColumns as $strColumnName => $arColumnInfo) { $type = $arColumnInfo["TYPE"]; if (isset($arFields[$strColumnName])) { $value = $arFields[$strColumnName]; if ($value === false) { $strUpdate .= ", {$strTableAlias}`" . $strColumnName . "` = NULL"; } else { switch ($type) { case "int": $value = intval($value); break; case "real": $value = doubleval($value); break; case "datetime": case "timestamp": if (strlen($value) <= 0) { $value = "NULL"; } else { $value = CDatabase::CharToDateFunction($value, "FULL", $lang); } break; case "date": if (strlen($value) <= 0) { $value = "NULL"; } else { $value = CDatabase::CharToDateFunction($value, "SHORT", $lang); } break; default: $value = "'" . $this->ForSql($value) . "'"; } $strUpdate .= ", {$strTableAlias}`" . $strColumnName . "` = " . $value; } } elseif (is_set($arFields, "~" . $strColumnName)) { $strUpdate .= ", {$strTableAlias}`" . $strColumnName . "` = " . $arFields["~" . $strColumnName]; } } if ($strUpdate != "") { $strUpdate = substr($strUpdate, 2); } return $strUpdate; }
CModule::IncludeModule("iblock"); $group_id = isset($arGroup["id"]) ? $arGroup["id"] : $_GET["GROUP_ID"]; $iblock_id = 2; $arPosts = array(); // Постраничная пагинация / Сессия прописывается в init.php if (($nPageSize = $_GET["page"]) && !$_GET["PAGEN_1"]) { $nPageSizePhoto = $nPageSize * 9; } else { $nPageSizePhoto = 9; } $arFilter = array("IBLOCK_ID" => $iblock_id, "ACTIVE_DATE" => "Y", "PROPERTY_SOCIAL_GROUP_ID" => $group_id, "PROPERTY_ANC_TYPE" => 26, "PROPERTY_CREATED_USER_ID" => false); if ($_GET["filter"] == "next" || empty($_GET["filter"])) { $arFilter[">=PROPERTY_START_DATE"] = trim(CDatabase::CharToDateFunction(ConvertTimeStamp(time(), 'FULL')), "\\'"); } if ($_GET["filter"] == "prev") { $arFilter["<PROPERTY_END_DATE"] = trim(CDatabase::CharToDateFunction(ConvertTimeStamp(time(), 'FULL')), "\\'"); } if ($_GET["filter"] == "my") { $arFilter["PROPERTY_ANC_ID"] = $USER->GetID(); } if ($_GET["q"]) { $arFilter["%NAME"] = $_GET["q"]; } $res = CIBlockElement::GetList(array("ACTIVE_FROM" => "DESC"), $arFilter, false, array("nPageSize" => $nPageSizePhoto)); while ($arItemObj = $res->GetNextElement()) { $arItem = $arItemObj->GetFields(); $arItem["PROPERTIES"] = $arItemObj->GetProperties(); $arPosts[$arItem["ID"]] = $arItem; /*if($USER->GetID() == 2) { echo '<pre>'; print_r($arItem["PROPERTIES"]["START_DATE"]["VALUE"].' '.trim(CDatabase::CharToDateFunction(ConvertTimeStamp(time(),'FULL')),"\'")); echo '<pre>'; }*/