'css' => array('css/angular-crmMailingAB.css'),
);
- $compMails = civicrm_api3('Mailing', 'get', array());
+
+ $civiMails = civicrm_api3('Mailing', 'get', array());
$campNames = civicrm_api3('Campaign', 'get', array());
- $vargroups = civicrm_api3('Group', 'get', array());
+ $mailStatus = civicrm_api3('MailingJob', 'get', array());
+ $groupNames = civicrm_api3('Group', 'get', array());
+ $headerfooterList = civicrm_api3('MailingComponent', 'get', array());
+ $emailAdd = civicrm_api3('Email', 'get', array(
+ 'sequential' => 1,
+ 'return' => "email",
+ 'contact_id' => 202,
+ ));
+ $mesTemplate = civicrm_api3('MessageTemplate', 'get', array( 'sequential' => 1,
+ 'return' => array("msg_html", "id", "msg_title"),
+ 'id' => array('>' => 58),
+ ));
CRM_Core_Resources::singleton()->addSetting(array(
'crmMailing' => array(
- 'compMails' => array_values($compMails['values']),
+ 'civiMails' => array_values($civiMails['values']),
'campNames' => array_values($campNames['values']),
- 'vargroups' => array_values($vargroups['values']),
+ 'mailStatus' => array_values($mailStatus['values']),
+ 'groupNames' => array_values($groupNames['values']),
+ 'headerfooterList' => array_values($headerfooterList['values']),
+ 'mesTemplate' => array_values($mesTemplate['values']),
+ 'emailAdd' => array_values($emailAdd['values']),
),
));
templateUrl: partialUrl('main.html'),
controller: 'TabsDemoCtrl',
resolve: {
- metaData: function($route, crmApi) {
- return crmApi('Group', 'get', {});
- },
+
mailingList: function($route, crmApi) {
return crmApi('Mailing', 'get', {});
}
// Add a new record by name.
// Ex: <crmAddName crm-options="['Alpha','Beta','Gamma']" crm-var="newItem" crm-on-add="callMyCreateFunction(newItem)" />
- crmMailingAB.controller('TabsDemoCtrl', function($scope, crmApi, metaData, mailingList) {
+ crmMailingAB.controller('TabsDemoCtrl', function($scope, crmApi) {
+
+ $scope.groups= CRM.crmMailing.groupNames;
+ $scope.mailList = CRM.crmMailing.civiMails;
- $scope.groups = metaData.values;
- $scope.mailings = mailingList.values;
$scope.tab_val=0;
$scope.max_tab=0;
$scope.campaign_clicked= function(){
return {
restrict : 'AE',
link: function(scope,element, attrs){
- $(element).select2({width:"400px",placeholder: "Select the groups you wish to include"});
- $(element).select2("data",groups)
function format(item) {
if(!item.id) {
// return `text` for optgroup
<select multiple groupselect ng-model="incGroup">
<option id= "1" ng-repeat="grp in groups" value="{{grp.id}} group include" > {{grp.title}} </option>
<option ng-repeat="grp in groups" value="{{grp.id}} group exclude" > {{grp.title}} </option>
- <option ng-repeat="ml in mailList| filter:isCompMail" value="{{ml.id}} mail include" > {{ml.name}} </option>
- <option ng-repeat="ml in mailList| filter:isCompMail" value="{{ml.id}} mail exclude" > {{ml.name}} </option>
+ <option ng-repeat="ml in mailList" value="{{ml.id}} mail include" > {{ml.name}} </option>
+ <option ng-repeat="ml in mailList" value="{{ml.id}} mail exclude" > {{ml.name}} </option>
</select>
<br> <br><br><br>