This repository has been archived by the owner on Nov 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPartnerExample.php
78 lines (66 loc) · 2.2 KB
/
PartnerExample.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/***************************************************************************
* *
* (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev *
* *
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
namespace Tygh\Models;
use Tygh\Registry;
class PartnerExample extends AModel
{
public function getTableName()
{
return '?:partners';
}
public function getPrimaryField()
{
return 'partner_id';
}
public function getFields($params)
{
return array(
$this->getTableName() . '.*',
);
}
public function getSortFields()
{
return array(
'id' => 'partner_id',
'name' => 'name',
'status' => 'status',
);
}
public function getSearchFields()
{
return array(
'string' => array(
'status' => 'status',
'name' => 'name',
),
);
}
public function getExtraCondition($params)
{
$condition = [];
$table_name = $this->getTableName();
$company_id = 0;
if (fn_allowed_for('ULTIMATE') && $company_id = Registry::get('runtime.company_id')) {
$condition[] = db_quote("$table_name.company_id = ?i", $company_id);
}
return $condition;
}
public function getStatuses()
{
return array(
'A' => __('active', '', $this->_lang_code),
'D' => __('disabled', '', $this->_lang_code),
);
}
}