A
A
Alexander Ivanov2016-06-30 17:55:25
PHP
Alexander Ivanov, 2016-06-30 17:55:25

How to finish adding your own parameter to the Bitrix component?

All this is necessary in order to link news with the event calendar, I poke the date of the month and the news feed at the bottom.
The problem is that the default cannot be set. it is set by the infoblock itself.
https://dev.1c-bitrix.ru/learning/course/?COURSE_I...
was
fe34838ddc5d49d6b1a4514ddb2ff6cb.png
now
bd60e83ef97348c3834de6dcf08ed871.png
Event date(DATA_SOBYTIYA) this property I display the property
in the component

//вывожу дату
  $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");
  $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();
  $sDateEventsCustom = "12.09.2016";//$arFilterDate["PROPERTY_DATA_SOBYTIYA_VALUE"]

$sDateEventsCustom - here I somehow have to pass the DATA_SOBYTIYA property and display events based on it .
The filter that works on the page itself is $arFilterDate["PROPERTY_DATA_SOBYTIYA_VALUE"]
$arDay["events"][] = array(
            "time"=>$eTime,
            "url"=>$dayNews["DETAIL_PAGE_URL"],
            "title"=>$title,
            "preview"=>$sTitle,
            "DATA_SOBYTIYA"=>$sDateEventsCustom,//свойство должно что-то передавать 
            //"property"=>$sProperty,//свойство должно что-то передавать
            $arParams["DATE_FIELD"]=>$dayNews[$arParams["DATE_FIELD"]],
          );

Event in wardump
array(1) {
  [0]=&gt;
  array(5) {
    ["time"]=&gt;
    string(11) "19:17&nbsp;"
    ["url"]=&gt;
    string(56) "/dsaf/asfdfa/"
    ["title"]=&gt;
    string(92) "авывыфавы"
    ["DATA_SOBYTIYA"]=&gt;
    string(190) "выаыфва.."
    ["DATE_ACTIVE_FROM"]=&gt;
    string(19) "18.06.2016 19:17:00"
  }
}

.parameters.php
$arDATE_FIELD = Array(
  "DATE_ACTIVE_FROM" => "[DATE_ACTIVE_FROM] ".GetMessage("T_IBLOCK_DESC_CAL_DATE_ACTIVE_FROM"),
  "DATE_ACTIVE_TO" => "[DATE_ACTIVE_TO] ".GetMessage("T_IBLOCK_DESC_CAL_DATE_ACTIVE_TO"),
  "TIMESTAMP_X" => "[TIMESTAMP_X] ".GetMessage("T_IBLOCK_DESC_CAL_TIMESTAMP_X"),
  "DATE_CREATE" => "[DATE_CREATE] ".GetMessage("T_IBLOCK_DESC_CAL_DATE_CREATE"),
  "DATA_SOBYTIYA" => "[DATA_SOBYTIYA] ".GetMessage("T_IBLOCK_DESC_DATA_SOBYTIYA"),
  );

template.php of the calendar itself
<?
//здесь я пропарсил url на основе его выводится текущая дата 
?>

<?foreach($arResult["MONTH"] as $arWeek):?>
      <tr>
        <?foreach($arWeek as $arDay):?>
        <td class='calendar-date'>
        <? $fulldatecal = $arDay["day"].".".$currentMonth.".".$currentYear;//дата дней в календаре?>
            <?echo "<pre style='font-size:0'>"; var_dump($arDay["events"]);echo "</pre>";?>						
            <?echo "<p style='font-size:0'>".$arDay["events"][0]["DATA_SOBYTIYA"]."</p>";?>					
            <?echo "<p style='font-size:0'>".count($arDay["events"][0]["DATA_SOBYTIYA"])."</p>";?>
          <?if(count($arDay["events"])>0):?>
            <a title="<?=$arDay["events"][0]["title"]?>" 
              href="/calendar/<?=$arResult["currentYear"]?>/<?=$arResult["currentMonth"]?>/<?=$arDay["day"]?>/" 
              name="<?=$arDay["events"][0]["DATA_SOBYTIYA"]?>" 
              class="event-link"><?=$arDay["day"]?></a>
            <?//}?>	
          <?else:?>						
            <span name="<?=$arDay["events"][0]["DATA_SOBYTIYA"]?>" title="<?=$fulldatecal?>"><?=$arDay["day"]?></span>
          <?endif;?>
        </td>
        <?endforeach?>
      </tr >
    <?endforeach?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2016-07-07
@cimonlebedev

long to explain in general he decided

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question