Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
category.php
1
<?php
8
namespace
Bitrix\Sender\Templates
;
9
10
use
Bitrix\Main\Localization\Loc
;
11
use
Bitrix\Sender\Internals\ClassConstant
;
12
13
Loc::loadMessages
(__FILE__);
14
19
class
Category
extends
ClassConstant
20
{
21
const
RECENT
= 100;
22
const
BASE
= 1;
23
const
USER
= 2;
24
const
ADDITIONAL
= 3;
25
const
CASES
= 4;
26
33
public
static
function
getName
($id)
34
{
35
$name =
Loc::getMessage
(
'SENDER_TEMPLATES_CATEGORY_'
. self::getCode($id));
36
return
$name ?: parent::getName($id);
37
}
38
46
public
static
function
sortByCode
($codeA, $codeB)
47
{
48
$order = array(
49
self::RECENT => 1,
50
self::BASE => 200,
51
self::USER => 210,
52
self::ADDITIONAL => 220,
53
);
54
55
$orderA = isset($order[self::getId($codeA)]) ? $order[
self::getId
($codeA)] : 100;
56
$orderB = isset($order[self::getId($codeB)]) ? $order[
self::getId
($codeB)] : 100;
57
58
if
($orderA < $orderB)
59
{
60
return
-1;
61
}
62
elseif ($orderA > $orderB)
63
{
64
return
1;
65
}
66
67
return
0;
68
}
69
}
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Sender\Internals\ClassConstant
Definition
classconstant.php:20
Bitrix\Sender\Internals\ClassConstant\getId
static getId($code)
Definition
classconstant.php:145
Bitrix\Sender\Templates\Category
Definition
category.php:20
Bitrix\Sender\Templates\Category\sortByCode
static sortByCode($codeA, $codeB)
Definition
category.php:46
Bitrix\Sender\Templates\Category\RECENT
const RECENT
Definition
category.php:21
Bitrix\Sender\Templates\Category\USER
const USER
Definition
category.php:23
Bitrix\Sender\Templates\Category\ADDITIONAL
const ADDITIONAL
Definition
category.php:24
Bitrix\Sender\Templates\Category\CASES
const CASES
Definition
category.php:25
Bitrix\Sender\Templates\Category\getName
static getName($id)
Definition
category.php:33
Bitrix\Sender\Templates\Category\BASE
const BASE
Definition
category.php:22
Bitrix\Sender\Templates
Definition
category.php:8
modules
sender
lib
templates
category.php
Создано системой
1.10.0