use inheritance for campaign classes
This commit is contained in:
parent
24d224cc38
commit
6b434e455f
10 changed files with 932 additions and 475 deletions
|
@ -55,7 +55,7 @@ function civicrm_api3_twingle_sync_Post($params) {
|
|||
: $params['twingle_api_key'];
|
||||
$twingleApi = new TwingleApiCall($apiKey);
|
||||
|
||||
// Get all projects from Twingle and store them in $projects
|
||||
// Get all projects from Twingle
|
||||
$projects = $twingleApi->getProject();
|
||||
|
||||
// Create projects as campaigns if they do not exist and store results in
|
||||
|
@ -68,5 +68,22 @@ function civicrm_api3_twingle_sync_Post($params) {
|
|||
}
|
||||
}
|
||||
|
||||
// Get all events from projects of event type
|
||||
foreach ($result_values['sync']['projects'] as $project) {
|
||||
if ($project['project_type'] == 'event') {
|
||||
$events = $twingleApi->getEvent($project['project_id']);
|
||||
}
|
||||
}
|
||||
|
||||
// Create events them as campaigns if they do not exist and store results in
|
||||
// $result_values
|
||||
$j = 0;
|
||||
if ($events) {
|
||||
foreach ($events as $event) {
|
||||
$result_values['sync']['events'][$j++] = $twingleApi
|
||||
->syncEvent($event, $is_test);
|
||||
}
|
||||
}
|
||||
|
||||
return civicrm_api3_create_success($result_values);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue