} } } if ($newBean->save()) { $msgs[] = 'LBL_TEMPLATE_SAVED'; } //$formBase = new EmailTemplateFormBase(); //$newBean = $formBase->handleAttachmentsProcessImages($newBean, false, true); $data['id'] = $newBean->id; $data['name'] = $newBean->name; break; case 'uploadAttachments': $formBase = new EmailTemplateFormBase(); $focus = BeanFactory::getBean('EmailTemplates', $_REQUEST['attach_to_template_id']); //$data = $formBase->handleAttachments($focus, false, null); $data = $formBase->handleAttachmentsProcessImages($focus, false, true, 'download', true); $redirectUrl = 'index.php?module=Campaigns&action=WizardMarketing&campaign_id=' . $_REQUEST['campaign_id'] . "&jump=2&template_id=" . $_REQUEST['attach_to_template_id']; // . '&marketing_id=' . $_REQUEST['attach_to_marketing_id'] . '&record=' . $_REQUEST['attach_to_marketing_id']; header('Location: ' . $redirectUrl); die; break; default: case 'get': if ($bean = BeanFactory::getBean('EmailTemplates', $emailTemplateId)) { $fields = array('id', 'name', 'body', 'body_html', 'subject'); foreach ($bean as $key => $value) { if (in_array($key, $fields)) { $data[$key] = $bean->{$key}; } } $data['body_from_html'] = from_html($bean->body_html);