|
|
|
@ -5595,11 +5595,22 @@ $server->wsdl->addComplexType( |
|
|
|
|
'', |
|
|
|
|
array( |
|
|
|
|
'id' => array('name' => 'id', 'type' => 'xsd:int'), |
|
|
|
|
'id_coach' => array('name' => 'id_coach', 'type' => 'xsd:int'), |
|
|
|
|
'name' => array('name' => 'name', 'type' => 'xsd:string'), |
|
|
|
|
'nbr_courses' => array('name' => 'nbr_courses', 'type' => 'xsd:int'), |
|
|
|
|
'nbr_users' => array('name' => 'nbr_users', 'type' => 'xsd:int'), |
|
|
|
|
'nbr_classes' => array('name' => 'nbr_classes', 'type' => 'xsd:int'), |
|
|
|
|
'date_start' => array('name' => 'date_start', 'type' => 'xsd:string'), |
|
|
|
|
'date_end' => array('name' => 'date_end', 'type' => 'xsd:string'), |
|
|
|
|
'duration' => array('name' => 'duration', 'type' => 'xsd:string'), |
|
|
|
|
'nb_days_access_before_beginning' => array('name' => 'nb_days_access_before_beginning', 'type' => 'xsd:int'), |
|
|
|
|
'nb_days_access_after_end' => array('nb_days_access_after_end' => 'duration', 'type' => 'xsd:int'), |
|
|
|
|
'session_admin_id' => array('session_admin_id' => 'duration', 'type' => 'xsd:int'), |
|
|
|
|
'visibility' => array('visibility' => 'duration', 'type' => 'xsd:int'), |
|
|
|
|
'session_category_id' => array('session_category_id' => 'duration', 'type' => 'xsd:int'), |
|
|
|
|
'promotion_id' => array('promotion_id' => 'duration', 'type' => 'xsd:int'), |
|
|
|
|
'description' => array('name' => 'description', 'type' => 'xsd:string'), |
|
|
|
|
'show_description' => array('name' => 'description', 'type' => 'xsd:int'), |
|
|
|
|
'duration' => array('name' => 'duration', 'type' => 'xsd:string'), |
|
|
|
|
'extra' => array('name' => 'extra', 'type' => 'tns:searchedSessionExtras'), |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
@ -5632,7 +5643,7 @@ $server->register( |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Web service to get a session list filtered by name, description or short description extra field |
|
|
|
|
* @param string Secret key |
|
|
|
|
* @param string $term Search term |
|
|
|
|
* @param string $extraFields Extrafields to include in request result |
|
|
|
|
* @return array The list |
|
|
|
|
*/ |
|
|
|
@ -5653,6 +5664,66 @@ function WSSearchSession($term, $extraFields) |
|
|
|
|
|
|
|
|
|
/* Search session Web Service end */ |
|
|
|
|
|
|
|
|
|
/* Fetch session Web Service start */ |
|
|
|
|
|
|
|
|
|
// Input params for WSSearchSession |
|
|
|
|
$server->wsdl->addComplexType( |
|
|
|
|
'FetchSession', |
|
|
|
|
'complexType', |
|
|
|
|
'struct', |
|
|
|
|
'all', |
|
|
|
|
'', |
|
|
|
|
array( |
|
|
|
|
'id' => array('name' => 'term', 'type' => 'xsd:int'), |
|
|
|
|
'extrafields' => array('name' => 'extrafields', 'type' => 'xsd:string') |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
//Reister WSFetchSession |
|
|
|
|
$server->register( |
|
|
|
|
'WSFetchSession', |
|
|
|
|
array('SearchSession' => 'tns:FetchSession'), // input parameters |
|
|
|
|
array('return' => 'tns:searchedSessionList'), // output parameters |
|
|
|
|
'urn:WSRegistration', // namespace |
|
|
|
|
'urn:WSRegistration#WSFetchSession', // soapaction |
|
|
|
|
'rpc', // style |
|
|
|
|
'encoded', // use |
|
|
|
|
'This service get a session by its id. Optionally can get its extra fields values' // documentation |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Web service to get a session by its id. Optionally can get its extra fields values |
|
|
|
|
* @param int $id The session id |
|
|
|
|
* @param string $extraFields Extrafields to include in request result |
|
|
|
|
* @return array The session data |
|
|
|
|
*/ |
|
|
|
|
function WSFetchSession($id, $extraFields) |
|
|
|
|
{ |
|
|
|
|
$fieldsToInclude = explode(',', $extraFields); |
|
|
|
|
|
|
|
|
|
foreach ($fieldsToInclude as &$field) { |
|
|
|
|
if (empty($field)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$field = trim($field); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$sessionData = SessionManager::fetch($id); |
|
|
|
|
|
|
|
|
|
if ($sessionData === false) { |
|
|
|
|
return return_error(WS_ERROR_INVALID_INPUT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($extraFields)) { |
|
|
|
|
$sessionData['extra'] = SessionManager::getFilteredExtraFields($id, $fieldsToInclude); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return array($sessionData); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Fetch session Web Service end */ |
|
|
|
|
|
|
|
|
|
// Add more webservices by Hooks |
|
|
|
|
if (!empty($hook)) { |
|
|
|
|
$hook->setEventData(array('server' => $server)); |
|
|
|
|