8namespace Bitrix\Sender\UI;
10use Bitrix\Main\Localization\Loc;
11use Bitrix\Main\Type\DateTime;
13Loc::loadMessages(__FILE__);
88 'bgcolor' => $bgColor,
124 $name =
$name ?: Loc::getMessage(
'SENDER_UI_TILEVIEW_SECTION_'.mb_strtoupper($id));
127 $this->sections[$id] = [
152 $this->sections = [];
161 public function get()
166 if (in_array(self::SECTION_ALL,
$sections))
171 foreach ($this->tiles as $tile)
175 if ($section === self::SECTION_ALL)
180 if (empty($tile[
'data'][$section]))
186 $list[$section][
'items'][] = $tile;
191 return array_values($list);
196 if ($section === self::SECTION_LAST)
198 $last = $tile[
'data'][self::SECTION_LAST];
201 $tile[
'data'][self::SECTION_LAST] = $last->getTimestamp();
208 foreach ([self::SECTION_LAST, self::SECTION_FREQ] as $section)
210 if (!isset($list[$section]))
217 $list[$section][
'items'],
218 function (
$a, $b) use ($section)
220 return (
$a[
'data'][$section] > $b[
'data'][$section]) ? -1 : 1;
223 $list[$section][
'items'] = array_slice($list[$section][
'items'], 0, self::MAX_COUNT);
addTile($id, $name, $data=[], $bgColor=null, $color=null)
static prepareTileForSorting(&$tile, $section)
getTile($id, $name, $data=[], $bgColor=null, $color=null)
addSection($id, $name=null)