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
|
<?php
Class Soap_model extends CI_Model {
function getRemoteAccess($option = NULL, $limit = NULL, $offset = NULL)
{
switch ($option)
{
case 'active':
$this->db->where('status', 'true');
return $this->db->get('plugin_remote_access');
break;
case 'paginate':
return $this->db->get('plugin_remote_access', $limit, $offset);
break;
case 'count':
$this->db->select('count(*) as count');
return $this->db->get('plugin_remote_access')->row('count');
break;
}
}
function addRemoteAccess()
{
$data = array (
'access_name' => $this->input->post('access_name'),
'ip_address' => $this->input->post('ip_address'),
'token' => bin2hex(random_bytes(32)),
);
$this->db->insert('plugin_remote_access', $data);
}
function updateRemoteAccess()
{
$status = ($this->input->post('editstatus') === 'on') ? 'true' : 'false';
$data = array (
'access_name' => $this->input->post('editaccess_name'),
'ip_address' => $this->input->post('editip_address'),
'status' => $status
);
$this->db->where('id_remote_access', $this->input->post('editid_remote_access'));
$this->db->update('plugin_remote_access', $data);
}
function delRemoteAccess($id)
{
$this->db->delete('plugin_remote_access', array('id_remote_access' => $id));
}
function addNotification()
{
$nr = ($this->input->post('notifynumber'));
$value = ($this->input->post('notifyvalue'));
//TODO - save notify
}
}
|