...
,{
xtype: 'modx-combo'
,emptyText: _('goodnews.subscribers_user_group')+'...'
,width: 200
,displayField: 'name'
,valueField: 'id'
,store: new Ext.data.JsonStore({
url: GoodNews.config.connectorUrl
,baseParams: {
action : 'mgr/settings/getMemberGroupList'
}
,fields: ['id','name']
,root: 'results'
// debug
,listeners: {
'load': {
fn: function(obj, options, response, e){
console.info(arguments);
}
}
}
})
,listeners: {
'select': {fn:this.filterByUserGroup,scope:this}
}
}
...
{"total":"4","results":[{"groupA":"groupA"},{"groupB":"groupB"},{"groupC":"groupC"},{"groupD":"groupD"}]}
<?php
// read defined mailing member group names from system setting (comma separated list of values)
$groups = $modx->getOption('goodnews.mailing_member_groups');
$grouplist = explode(",", $groups);
$list = array();
foreach ($grouplist as $group) {
$list[] = array($group => $group);
}
$modx->log(xPDO::LOG_LEVEL_INFO, 'Groups sent back to JS: '. $this->outputArray($list));
return $this->outputArray($list);
This question has been answered by gadgetto. See the first response.
{"total":"4","results":[{"id":"groupA","name":"groupA"},{"id":"groupB","name":"groupB"},{"id":"groupC","name":"groupC"},{"id":"groupD","name":"groupD"}]}
<?php
// read defined mailing member group names from system setting
$groups = $modx->getOption('goodnews.mailing_member_groups');
$grouplist = explode(",", $groups);
$modx->log(modX::LOG_LEVEL_INFO, 'Groups from settings: ' . $modx->toJson($grouplist));
$list = array();
foreach ($grouplist as $group) {
$list[] = array('id' => $group, 'name' => $group);
}
$modx->log(xPDO::LOG_LEVEL_INFO, 'Sent back to JS: '. $this->outputArray($list));
return $this->outputArray($list);