forked from extern/egroupware
Add in function io map function, listmethods() and rework so class to create
the contacts object in the constructor
This commit is contained in:
parent
eac74fee75
commit
ca0ed1f136
@ -112,20 +112,49 @@
|
|||||||
if(isset($order)) { $this->order = $order; }
|
if(isset($order)) { $this->order = $order; }
|
||||||
if(isset($filter)) { $this->filter = $filter; }
|
if(isset($filter)) { $this->filter = $filter; }
|
||||||
if(isset($fcat_id)) { $this->cat_id = $fcat_id; }
|
if(isset($fcat_id)) { $this->cat_id = $fcat_id; }
|
||||||
|
}
|
||||||
|
|
||||||
/* Preliminary xml function exposure */
|
function list_methods($_type='xmlrpc')
|
||||||
$this->xml_functions = array(
|
{
|
||||||
'read_entry' => array(
|
switch($_type)
|
||||||
'function' => 'read_entry',
|
{
|
||||||
'signature' => array(array($xmlrpcStruct)),
|
case 'xmlrpc':
|
||||||
'docstring' => lang('Read a single entry by passing the id and fieldlist.')
|
$xml_functions = array(
|
||||||
),
|
'read_entry' => array(
|
||||||
'read_entries' => array(
|
'function' => 'read_entry',
|
||||||
'function' => 'read_entries',
|
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
||||||
'signature' => array(array($xmlrpcStruct)),
|
'docstring' => lang('Read a single entry by passing the id and fieldlist.')
|
||||||
'docstring' => lang('Read a list of entries.')
|
),
|
||||||
)
|
'add_entry' => array(
|
||||||
);
|
'function' => 'add_entry',
|
||||||
|
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
||||||
|
'docstring' => lang('Add a single entry by passing the fields.')
|
||||||
|
),
|
||||||
|
'update_entry' => array(
|
||||||
|
'function' => 'update_entry',
|
||||||
|
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
||||||
|
'docstring' => lang('Update a single entry by passing the fields.')
|
||||||
|
),
|
||||||
|
'delete_entry' => array(
|
||||||
|
'function' => 'delete_entry',
|
||||||
|
'signature' => array(array(xmlrpcInt,xmlrpcInt)),
|
||||||
|
'docstring' => lang('Delete a single entry by passing the id.')
|
||||||
|
),
|
||||||
|
'read_entries' => array(
|
||||||
|
'function' => 'read_entries',
|
||||||
|
'signature' => array(array(xmlrpcStruct,xmlrpcStruct)),
|
||||||
|
'docstring' => lang('Read a list of entries.')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return $xml_functions;
|
||||||
|
break;
|
||||||
|
case 'soap':
|
||||||
|
return $this->soap_functions;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return array();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_sessiondata($data)
|
function save_sessiondata($data)
|
||||||
|
@ -43,30 +43,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->rights = $rights;
|
$this->rights = $rights;
|
||||||
$this->grants = $grants;
|
$this->grants = $grants;
|
||||||
$this->owner = $owner;
|
$this->owner = $owner;
|
||||||
}
|
$this->contacts = CreateObject('phpgwapi.contacts');
|
||||||
|
|
||||||
function makeobj()
|
|
||||||
{
|
|
||||||
if (!is_object($this->contacts))
|
|
||||||
{
|
|
||||||
$this->contacts = CreateObject('phpgwapi.contacts');
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function read_entries($start,$offset,$qcols,$query,$qfilter,$sort,$order)
|
function read_entries($start,$offset,$qcols,$query,$qfilter,$sort,$order)
|
||||||
{
|
{
|
||||||
$this->makeobj();
|
|
||||||
$readrights = $this->rights & PHPGW_ACL_READ;
|
$readrights = $this->rights & PHPGW_ACL_READ;
|
||||||
return $this->contacts->read($start,$offset,$qcols,$query,$qfilter,$sort,$order,$readrights);
|
return $this->contacts->read($start,$offset,$qcols,$query,$qfilter,$sort,$order,$readrights);
|
||||||
}
|
}
|
||||||
|
|
||||||
function read_entry($id,$fields)
|
function read_entry($id,$fields)
|
||||||
{
|
{
|
||||||
$this->makeobj();
|
|
||||||
if ($this->rights & PHPGW_ACL_READ)
|
if ($this->rights & PHPGW_ACL_READ)
|
||||||
{
|
{
|
||||||
return $this->contacts->read_single_entry($id,$fields);
|
return $this->contacts->read_single_entry($id,$fields);
|
||||||
@ -80,21 +70,19 @@
|
|||||||
|
|
||||||
function read_last_entry($fields)
|
function read_last_entry($fields)
|
||||||
{
|
{
|
||||||
$this->makeobj();
|
|
||||||
if ($this->rights & PHPGW_ACL_READ)
|
if ($this->rights & PHPGW_ACL_READ)
|
||||||
{
|
{
|
||||||
return $this->contacts->read_last_entry($fields);
|
return $this->contacts->read_last_entry($fields);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$rtrn = array('No access' => 'No access');
|
$rtrn = array(0 => array('No access' => 'No access'));
|
||||||
return $rtrn;
|
return $rtrn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_entry($fields)
|
function add_entry($fields)
|
||||||
{
|
{
|
||||||
$this->makeobj();
|
|
||||||
$fields['tid'] = trim($fields['tid']);
|
$fields['tid'] = trim($fields['tid']);
|
||||||
if(empty($fields['tid']))
|
if(empty($fields['tid']))
|
||||||
{
|
{
|
||||||
@ -109,15 +97,13 @@
|
|||||||
|
|
||||||
function get_lastid()
|
function get_lastid()
|
||||||
{
|
{
|
||||||
$this->makeobj();
|
|
||||||
$entry = $this->contacts->read_last_entry();
|
$entry = $this->contacts->read_last_entry();
|
||||||
$ab_id = $entry[0]['id'];
|
$id = $entry[0]['id'];
|
||||||
return $ab_id;
|
return $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_entry($fields)
|
function update_entry($fields)
|
||||||
{
|
{
|
||||||
$this->makeobj();
|
|
||||||
if ($this->rights & PHPGW_ACL_EDIT)
|
if ($this->rights & PHPGW_ACL_EDIT)
|
||||||
{
|
{
|
||||||
$this->contacts->update($fields['ab_id'],$fields['owner'],$fields,$fields['access'],$fields['cat_id']);
|
$this->contacts->update($fields['ab_id'],$fields['owner'],$fields,$fields['access'],$fields['cat_id']);
|
||||||
@ -127,7 +113,6 @@
|
|||||||
|
|
||||||
function delete_entry($data)
|
function delete_entry($data)
|
||||||
{
|
{
|
||||||
$this->makeobj();
|
|
||||||
if ($this->rights & PHPGW_ACL_DELETE)
|
if ($this->rights & PHPGW_ACL_DELETE)
|
||||||
{
|
{
|
||||||
$this->contacts->delete($data['id']);
|
$this->contacts->delete($data['id']);
|
||||||
|
Loading…
Reference in New Issue
Block a user