A
A
Alexander Ivanov2016-06-29 13:12:17
PHP
Alexander Ivanov, 2016-06-29 13:12:17

How to adjust the filter by property in the Bitrix event calendar?

working example

$arFilter = Array("IBLOCK_ID"=>$IBLOCK_ID,"ACTIVE" => "Y", ">=DATE_ACTIVE_FROM" => $curdate, "PROPERTY" => array('ADD_TO_EVENTS' => array('VALUE' => 'Y')), "<=DATE_ACTIVE_FROM" => $curdatelast);

not working
$arFilterDate = Array(
    "IBLOCK_ID" => $IBLOCK_ID,
    "ACTIVE" => "Y", 
    ">=DATE_ACTIVE_FROM" => $curdate, 
    "PROPERTY" => array('DATA_SOBYTIYA' => array('VALUE' => true)), 
    "<=DATE_ACTIVE_FROM" => $curdatelast
  );

How to correctly write the "not working" filter so that it displays DATA_SOBYTIYA when it is filled
, there are many examples here, but none with "empty" - "not empty"
dev.1c-bitrix.ru/learning/course/?COURSE_ID=43&LES ...
apparently I need more information
-------------------------------
I take the properties from the component and display them in the calendar
$IBLOCK_ID = intval($arParams['IBLOCK_ID']);
  //print $IBLOCK_ID;
  if(!CModule::IncludeModule("iblock"))
    die('iblock module is not included!');
  $arSort = Array("SORT"=>"ASC", "NAME"=>"ASC");
  $arSelect = Array("ID","NAME","PROPERTY_DATA_SOBYTIYA");
  $arFilter = Array("IBLOCK_ID"=>$IBLOCK_ID,"ACTIVE" => "Y", ">=DATE_ACTIVE_FROM" => $curdate, "PROPERTY" => array('ADD_TO_EVENTS' => array('VALUE' => 'Y')), "<=DATE_ACTIVE_FROM" => $curdatelast);
  $arFilterDate = Array(
    "IBLOCK_ID" => $IBLOCK_ID,
    "ACTIVE" => "Y", 
    ">=DATE_ACTIVE_FROM" => $curdate, 
    "!PROPERTY" => array('DATA_SOBYTIYA' => array('VALUE' => false)), 
    "<=DATE_ACTIVE_FROM" => $curdatelast
  );
  $obIBlockResult = CIBlockElement::GetList($arSort, $arFilter, false, false, $arSelect);
  $arFilter = $obIBlockResult->GetNext();
  $sProperty = $arFilterDate;//["PROPERTY_DATA_SOBYTIYA_VALUE"];
...
  $arDay["events"][] = array(
            "time"=>$eTime,
            "url"=>$dayNews["DETAIL_PAGE_URL"],
            "title"=>$title,
            "preview"=>$sTitle,
            "property"=>$sProperty,//свойство должно что-то передавать 
            $arParams["DATE_FIELD"]=>$dayNews[$arParams["DATE_FIELD"]],
          );

wardump
array(4) {
        ["day"]=&gt;
        int(18)
        ["td_class"]=&gt;
        string(14) "NewsCalWeekend"
        ["tday_class"]=&gt;
        string(10) "NewsCalDay"
        ["events"]=&gt;
        array(1) {
          [0]=&gt;
          array(6) {
            ["time"]=&gt;
            string(11) "19:17&nbsp;"
            ["url"]=&gt;
            string(56) "/adress/"
            ["title"]=&gt;
            string(92) "sadfsadfsadfds"
            ["preview"]=&gt;
            string(190) "выавфыаывфавыаываывфаывавыаывфавыа.."
            ["property"]=&gt;
            array(5) {
              ["IBLOCK_ID"]=&gt;
              int(31)
              ["ACTIVE"]=&gt;
              string(1) "Y"
              ["&gt;=DATE_ACTIVE_FROM"]=&gt;
              NULL
              ["PROPERTY"]=&gt;
              array(1) {
                ["DATA_SOBYTIYA"]=&gt;
                array(1) {
                  ["VALUE"]=&gt;
                  bool(true)
                }
              }
              ["&lt;=DATE_ACTIVE_FROM"]=&gt;
              NULL
            }
            ["DATE_ACTIVE_FROM"]=&gt;
            string(19) "18.06.2016 19:17:00"
          }
        }
      }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Zakharov, 2016-06-29
@cimonlebedev

$arrFilter['!PROPERTY_<property code>'] = false;
check for completed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question