%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 3.128.202.230
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64
User : www-root ( 1010)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/report/lib/visualconstructor/views/jscomponent/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/report/lib/visualconstructor/views/jscomponent/activity.php
<?php

namespace Bitrix\Report\VisualConstructor\Views\JsComponent;

use Bitrix\Main\Localization\Loc;
use Bitrix\Report\VisualConstructor\Config\Common;
use Bitrix\Report\VisualConstructor\Fields\Valuable\DropDown;
use Bitrix\Report\VisualConstructor\Handler\BaseReport;
use Bitrix\Report\VisualConstructor\IReportMultipleGroupedData;

/**
 * Class Activity
 * @package Bitrix\Report\VisualConstructor\Views\JsComponent
 */
class Activity extends Base
{
	const VIEW_KEY                = 'activity';
	const MAX_RENDER_REPORT_COUNT = 1;

	/**
	 * Activity constructor.
	 */
	public function __construct()
	{
		$this->setLabel(Loc::getMessage('REPORT_ACTIVITY_VIEW_LABEL'));
		$this->setLogoUri('/bitrix/images/report/visualconstructor/view-activity.jpg');
		$this->setJsClassName('BX.Report.VisualConstructor.Widget.Content.Activity');
		$this->setCompatibleDataType(Common::MULTIPLE_BI_GROUPED_REPORT_TYPE);
		$this->setHeight(380);
	}


	/**
	 * Method to modify widget form elements.
	 *
	 * @param BaseReport $reportHandler Widget handler.
	 * @return void
	 */
	public function collectReportHandlerFormElements($reportHandler)
	{
		parent::collectReportHandlerFormElements($reportHandler);

		/** @var DropDown $whatWillCalculateField */
		$whatWillCalculateField = $reportHandler->getFormElement('calculate');
		if ($whatWillCalculateField)
		{
			$labelField = $reportHandler->getWidgetHandler()->getFormElement('label');
			$labelField->addJsEventListener($whatWillCalculateField, $whatWillCalculateField::JS_EVENT_ON_CHANGE, array(
				'class' => 'BX.Report.VisualConstructor.FieldEventHandlers.Title',
				'action' => 'whatWillCalculateChange',
			));
			$whatWillCalculateField->addAssets(array(
				'js' => array('/bitrix/js/report/js/visualconstructor/fields/reporttitle.js')
			));
		}

		$removeFormElement = $reportHandler->getFormElementByDataAttribute('role', 'report-remove-button');
		if ($removeFormElement)
		{
			$removeFormElement->setDisplay(false);
		}

		$colorField = $reportHandler->getFormElement('color');
		$reportHandler->getFormElement('label_color_container_start')->setDisplay(false);
		$reportHandler->getFormElement('label_color_container_end')->setDisplay(false);
		$reportHandler->getFormElement('head_container_start')->setDisplay(false);
		$reportHandler->getFormElement('head_container_end')->setDisplay(false);
		if ($colorField)
		{
			$colorField->setDisplay(false);
		}


		$labelField = $reportHandler->getFormElement('label');
		if ($labelField)
		{
			$labelField->setDisplay(false);
		}
	}

	/**
	 * Handle all data prepared for this view.
	 *
	 * @see IReportMultipleGroupedData::getMultipleGroupedData().
	 * @param array $dataFromReport Calculated data from report handler.
	 * @return array
	 */
	public function handlerFinallyBeforePassToView($dataFromReport)
	{
		if ($dataFromReport['items'])
		{
			$items = array();
			foreach ($dataFromReport['items'] as $item)
			{

				if (!empty($items[$item['firstGroupId']][$item['secondGroupId']]))
				{
					$items[$item['firstGroupId']][$item['secondGroupId']]['active'] += (int)$item['value'];
				}
				else
				{
					$items[$item['firstGroupId']][$item['secondGroupId']] = array(
						'labelXid' => (int)$item['firstGroupId'] + 1,
						'labelYid' => (int)$item['secondGroupId'],
						'active' => (int)$item['value'],
					);
				}

			}

			foreach ($items as $firstGroupId => $secondGroup)
			{
				foreach ($secondGroup as $secondGroupId => $newItem)
				{
					$result['items'][] = $newItem;
				}
			}
		}


		$result['config']['labelY'] = $this->getWeekDaysMap();
		$result['config']['labelX'] = $this->getHourList();
		return $result;
	}

	/**
	 * Week days labels map.
	 *
	 * @return array
	 */
	protected function getWeekDaysMap()
	{
		return array(
			array(
				'id' => 1,
				'name' => Loc::getMessage('MONDAY'),
			),
			array(
				'id' => 2,
				'name' => Loc::getMessage('TUESDAY'),
			),
			array(
				'id' => 3,
				'name' => Loc::getMessage('WEDNESDAY'),
			),
			array(
				'id' => 4,
				'name' => Loc::getMessage('THURSDAY'),
			),
			array(
				'id' => 5,
				'name' => Loc::getMessage('FRIDAY'),
			),
			array(
				'id' => 6,
				'name' => Loc::getMessage('SATURDAY'),
				'light' => true
			),
			array(
				'id' => 0,
				'name' => Loc::getMessage('SUNDAY'),
				'light' => true
			),
		);
	}


	/**
	 * Get Hour list for grouping data by hour.
	 *
	 * @return array
	 */
	protected function getHourList()
	{
		$result = array();
		for ($i = 1; $i <= 24; $i++)
		{
			$hour = array(
				'id' => $i,
				'name' => $i
			);
			if ($i === 0 || $i === 24 || ($i) % 6 == 0)
			{
				$hour['show'] = true;
			}

			if ($i >= 9 && $i <= 18)
			{
				$hour['active'] = true;
			}
			$result[] = $hour;
		}
		return $result;
	}

	/**
	 * Always in activity widget report color should be white.
	 *
	 * @param int $num Number of color which need.
	 * @return string
	 */
	public function getReportDefaultColor($num)
	{
		return '#ffffff';
	}

}

Youez - 2016 - github.com/yon3zu
LinuXploit