Manage subscriptions

- make use of the SubscriberSegment::status column to keep track of unsubscriptions
- unsubscribed segments now appear grayed out in the Subscribers listing
- added unsubscribed_at after segment names when editing a subscriber
- added date() method for Twig (uses WP's date format / date_offset)
- fixed typo in Form iframe export
- fixed unit test for Newsletters
- updated selection component (JSX) to allow more customization
This commit is contained in:
Jonathan Labreuille
2016-02-22 11:35:34 +01:00
parent acf300160d
commit 07d533a810
19 changed files with 313 additions and 138 deletions

View File

@ -13,11 +13,10 @@ class Forms {
function get($id = false) {
$form = Form::findOne($id);
if($form === false) {
return false;
} else {
return $form->asArray();
if($form !== false) {
$form = $form->asArray();
}
return $form;
}
function listing($data = array()) {
@ -29,19 +28,14 @@ class Forms {
$listing_data = $listing->get();
// fetch segments relations for each returned item
foreach($listing_data['items'] as &$item) {
// form's segments
$form_settings = (
(is_serialized($item['settings']))
? unserialize($item['settings'])
: array()
);
$item['segments'] = (
!empty($form_settings['segments'])
? $form_settings['segments']
foreach($listing_data['items'] as $key => $form) {
$form = $form->asArray();
$form['segments'] = (
!empty($form['settings']['segments'])
? $form['settings']['segments']
: array()
);
$listing_data['items'][$key] = $form;
}
return $listing_data;