mirror of
https://github.com/YunoHost-Apps/movim_ynh.git
synced 2024-09-03 19:46:19 +02:00
117 lines
2.6 KiB
PHP
Executable file
117 lines
2.6 KiB
PHP
Executable file
<?php
|
|
|
|
namespace modl;
|
|
|
|
class CapsDAO extends SQL {
|
|
function get($node) {
|
|
$this->_sql = '
|
|
select * from caps
|
|
where
|
|
node = :node';
|
|
|
|
$this->prepare(
|
|
'Caps',
|
|
array(
|
|
'node' => $node
|
|
)
|
|
);
|
|
|
|
return $this->run('Caps', 'item');
|
|
}
|
|
|
|
function getClients() {
|
|
$this->_sql = '
|
|
select * from caps
|
|
where category = :category';
|
|
|
|
$this->prepare(
|
|
'Caps',
|
|
array(
|
|
'category' => 'client'
|
|
)
|
|
);
|
|
|
|
return $this->run('Caps');
|
|
}
|
|
|
|
function getServers() {
|
|
$this->_sql = '
|
|
select * from caps
|
|
where category = :category';
|
|
|
|
$this->prepare(
|
|
'Caps',
|
|
array(
|
|
'category' => 'server'
|
|
)
|
|
);
|
|
|
|
return $this->run('Caps');
|
|
}
|
|
|
|
function getAll() {
|
|
$this->_sql = '
|
|
select * from caps';
|
|
|
|
$this->prepare(
|
|
'Caps'
|
|
);
|
|
|
|
return $this->run('Caps');
|
|
}
|
|
|
|
function set(Caps $caps) {
|
|
$this->_sql = '
|
|
update caps
|
|
set category = :category,
|
|
type = :type,
|
|
name = :name,
|
|
features = :features
|
|
where node = :node';
|
|
|
|
$this->prepare(
|
|
'Caps',
|
|
array(
|
|
'node' => $caps->node,
|
|
'category' => $caps->category,
|
|
'type' => $caps->type,
|
|
'name' => $caps->name,
|
|
'features' => $caps->features,
|
|
)
|
|
);
|
|
|
|
$this->run('Caps');
|
|
|
|
if(!$this->_effective) {
|
|
$this->_sql = '
|
|
insert into caps
|
|
(
|
|
node,
|
|
category,
|
|
type,
|
|
name,
|
|
features
|
|
)
|
|
values(
|
|
:node,
|
|
:category,
|
|
:type,
|
|
:name,
|
|
:features
|
|
)';
|
|
|
|
$this->prepare(
|
|
'Caps',
|
|
array(
|
|
'node' => $caps->node,
|
|
'category' => $caps->category,
|
|
'type' => $caps->type,
|
|
'name' => $caps->name,
|
|
'features' => $caps->features,
|
|
)
|
|
);
|
|
|
|
return $this->run('Caps');
|
|
}
|
|
}
|
|
}
|