3namespace Bitrix\Report\VisualConstructor\Controller;
5use Bitrix\Main\ArgumentException;
6use Bitrix\Main\UI\Filter\Options;
7use Bitrix\Report\VisualConstructor\Internal\Engine\Response\Component;
8use Bitrix\Report\VisualConstructor\Entity\Dashboard;
9use Bitrix\Report\VisualConstructor\Helper\Dashboard as DashboardHelper;
10use Bitrix\Report\VisualConstructor\Helper\Row;
11use Bitrix\Report\VisualConstructor\Helper\Util;
12use Bitrix\Report\VisualConstructor\Internal\Error\Error;
13use Bitrix\Report\VisualConstructor\RuntimeProvider\AnalyticBoardProvider;
32 $dashboardForUser = Dashboard::loadByBoardKeyAndUserId($boardKey,
$userId);
33 if ($dashboardForUser)
35 $dashboardForUser->delete();
39 $analyticBoardProvider->
addFilter(
'boardKey', $boardKey);
40 $analyticBoard = $analyticBoardProvider->execute()->getFirstResult();
45 $filter = $analyticBoard->getFilter();
50 $filterId =
$filter->getFilterParameters()[
'FILTER_ID'];
52 $options->setFilterSettingsArray($filter::getPresetsList());
62 $oldMode = DashboardHelper::getBoardModeIsDemo($boardKey);
63 DashboardHelper::setBoardModeIsDemo($boardKey, !$oldMode);
64 return array(
'demoMode' => !$oldMode);
77 $templateName =
'addform';
79 'BOARD_ID' => $boardId,
80 'REPORTS_CATEGORIES' =>
array(),
93 if ($formParams[
'boardId'])
95 if ($formParams[
'patternWidgetId'])
97 $widgetGId = $this->createWidgetFromExisting($formParams);
101 $this->addError(
new Error(
'Should select view type or select from widget pattern'));
106 return array(
'widgetId' => $widgetGId);
110 $this->addError(
new Error(
'Board id might be not blank'));
120 private function createWidgetFromExisting($formParams)
122 $dashboardForUser = DashboardHelper::getDashboardByKeyForCurrentUser($formParams[
'boardId']);
123 if (!$dashboardForUser)
125 $this->addError(
new Error(
'Can\'t create widget because current user has not board to edit'));
131 $copy = $widget->getCopyForCurrentUser();
135 $row = Row::getRowDefaultEntity(
array(
136 'cellIds' =>
array($cellId)
141 $this->errorCollection[] =
new Error($e->getMessage());
145 $row->setBoardId($formParams[
'boardId']);
146 $copy->setWeight($cellId);
147 $copy->setGId(Util::generateUserUniqueId());
148 $copy->setIsPattern(
false);
149 $copy->setBoardId($formParams[
'boardId']);
150 $row->addWidgets($copy);
152 $dashboardForUser->addRows($row);
153 $dashboardForUser->save();
154 return $copy->getGId();
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
submitAddFormAction($formParams=array())
toggleModeAction($boardKey)
toggleToDefaultAction($boardKey)
showAddFormAction($categories, $boardId)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
randString($pass_len=10, $pass_chars=false)
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']