403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/php_interface/wbs24.lib/lib/Extrasection/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/php_interface/wbs24.lib/lib/Extrasection/Helper.php
<?php
namespace Wbs24\Lib\Extrasection;

use Bitrix\Main\Loader;

class Helper
{
    public $sectionId = 125;
    public $iblockId = 18;

    public function getSection()
    {
        Loader::includeModule('iblock');

        // получить все разделы из раздела "Букет по поводу"
        $result = \CIBlockSection::GetList([], [
            'SECTION_ID' => $this->sectionId,
            'IBLOCK_ID' => $this->iblockId,
        ], false, [
            'ID',
            'IBLOCK_ID',
            'NAME',
            'SECTION_PAGE_URL',
            'UF_DATE_START',
            'UF_DATE_END',
            'PICTURE'
        ]);
        $sections = [];
        while($fields = $result->GetNext()) {
            $sections[] = $fields;
        }

        $needExtraSections = [];
        $currentDate = date("d.m.Y");
        $currentTimeStamp = strtotime($currentDate);

        foreach ($sections as $section) {
            if (
                !empty($section['UF_DATE_START'])
                && !empty($section['UF_DATE_END'])
            ) {
                $dateStart = $this->changeYearToCurrent($section['UF_DATE_START']);
                $dateEnd = $this->changeYearToCurrent($section['UF_DATE_END']);

                $dateStartTimeStamp = strtotime($dateStart);
                $dateEndTimeStamp = strtotime($dateEnd);

                if (
                    $currentTimeStamp >= $dateStartTimeStamp
                    && $currentTimeStamp <= $dateEndTimeStamp
                ) {
                    $needExtraSections[] = $section;
                }
            }
        }

        return $needExtraSections;
    }


    protected function changeYearToCurrent($date)
    {
        $arrDate = explode(".", $date);
        $needDate = $arrDate[0] . '.' . $arrDate[1] . '.' . date("Y");

        return $needDate;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit