Newer
Older
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/**
* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
* This file is part of Maarch software.
*
*/
/**
* @brief Docserver Model
* @author dev@maarch.org
* @ingroup core
*/
namespace Core\Models;
require_once 'apps/maarch_entreprise/services/Table.php';
class DocserverModelAbstract extends \Apps_Table_Service
{
public static function getList()
{
$aReturn = static::select([
'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
'table' => ['docservers'],
]);
return $aReturn;
}
public static function getById(array $aArgs = [])
{
static::checkRequired($aArgs, ['id']);
static::checkString($aArgs, ['id']);
$aReturn = static::select([
'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
'table' => ['docservers'],
'where' => ['docserver_id = ?'],
'data' => [$aArgs['id']]
]);
return $aReturn;
}
public static function create(array $aArgs = [])
{
static::checkRequired($aArgs, ['docserver_id']);
static::checkString($aArgs, ['docserver_id']);
$aReturn = static::insertInto($aArgs, 'docservers');
return $aReturn;
}
public static function update(array $aArgs = [])
{
static::checkRequired($aArgs, ['docserver_id']);
static::checkString($aArgs, ['docserver_id']);
$where['docserver_id'] = $aArgs['docserver_id'];
$aReturn = static::updateTable(
$aArgs,
'docservers',
$where
);
return $aReturn;
}
public static function delete(array $aArgs = [])
{
static::checkRequired($aArgs, ['id']);
static::checkString($aArgs, ['id']);
$aReturn = static::deleteFrom([
'table' => 'docservers',
'where' => ['id = ?'],
'data' => [$aArgs['id']]
]);
return $aReturn;
}
public static function getDocserverToInsert(array $aArgs = [])
{
static::checkRequired($aArgs, ['collId']);
static::checkString($aArgs, ['collId']);
$aReturn = static::select([
'select' => ['*'],
'table' => ['docservers'],
'where' => ["is_readonly = 'N' and enabled = 'Y' and coll_id = ?"],
'data' => [$aArgs['collId']],
'order_by' => ['priority_number'],
'limit' => 1,
]);
return $aReturn;
}
public static function setSize(array $aArgs = [])
{
static::checkRequired($aArgs, ['id']);
static::checkString($aArgs, ['id']);
$where['id'] = $aArgs['id'];
$aReturn = static::updateTable(
$aArgs,
'docservers',
$where
);
return $aReturn;
}
}