コード例 #1
0
ファイル: Browse.php プロジェクト: rameshrr99/civicrm-core
 /**
  * Heart of the viewing process. The runner gets all the meta data for
  * the contact and calls the appropriate type of page to view.
  */
 public function preProcess()
 {
     $this->_unscheduled = $this->_archived = $archiveLinks = FALSE;
     $this->_mailingId = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
     $this->_sms = CRM_Utils_Request::retrieve('sms', 'Positive', $this);
     $this->assign('sms', $this->_sms);
     // check that the user has permission to access mailing id
     CRM_Mailing_BAO_Mailing::checkPermission($this->_mailingId);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
     $this->assign('action', $this->_action);
     $showLinks = TRUE;
     if (CRM_Mailing_Info::workflowEnabled()) {
         if (CRM_Core_Permission::check('create mailings')) {
             $archiveLinks = TRUE;
         }
         if (!CRM_Core_Permission::check('access CiviMail') && !CRM_Core_Permission::check('create mailings')) {
             $showLinks = FALSE;
         }
     }
     $this->assign('showLinks', $showLinks);
     if (CRM_Core_Permission::check('access CiviMail')) {
         $archiveLinks = TRUE;
     }
     if ($archiveLinks == TRUE) {
         $this->assign('archiveLinks', $archiveLinks);
     }
 }
コード例 #2
0
/**
 * Send a email to ?? with the mailing report of one mailing
 * 
 * @param type $mailing_id
 */
function civicrm_api3_job_rapportagenamailings_mail($mailing_id)
{
    global $base_root;
    // create a new Cor Page
    $page = new CRM_Core_Page();
    $page->_mailing_id = $mailing_id;
    // create a new template
    $template = CRM_Core_Smarty::singleton();
    // from CRM/Mailing/Page/Report.php
    // check that the user has permission to access mailing id
    CRM_Mailing_BAO_Mailing::checkPermission($mailing_id);
    $report = CRM_Mailing_BAO_Mailing::report($mailing_id);
    //get contents of mailing
    CRM_Mailing_BAO_Mailing::getMailingContent($report, $page);
    $subject = ts('Mailing Gereed: %1', array(1 => $report['mailing']['name']));
    $template->assign('report', $report);
    // inlcude $base_root
    $template->assign('base_root', $base_root);
    $template->assign('subject', $subject);
    // from CRM/Core/page.php
    // only print
    $template->assign('tplFile', 'CRM/Rapportagenamailings/Page/RapportMailing.tpl');
    $content = $template->fetch('CRM/common/print.tpl');
    CRM_Utils_System::appendTPLFile('CRM/Rapportagenamailings/Page/RapportMailing.tpl', $content, $page->overrideExtraTemplateFileName());
    //its time to call the hook.
    CRM_Utils_Hook::alterContent($content, 'page', 'CRM/Rapportagenamailings/Page/RapportMailing.tpl', $page);
    //echo $content;
    // send mail
    $params = array('from' => '*****@*****.**', 'toName' => 'Front Office VnV', 'toEmail' => '*****@*****.**', 'subject' => $subject, 'text' => $subject, 'html' => $content, 'replyTo' => '*****@*****.**');
    CRM_Utils_Mail::send($params);
}
コード例 #3
0
ファイル: Report.php プロジェクト: hguru/224Civi
 function run()
 {
     $this->_mailing_id = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
     // check that the user has permission to access mailing id
     CRM_Mailing_BAO_Mailing::checkPermission($this->_mailing_id);
     $report = CRM_Mailing_BAO_Mailing::report($this->_mailing_id);
     //get contents of mailing
     CRM_Mailing_BAO_Mailing::getMailingContent($report, $this);
     //assign backurl
     $context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     if ($context == 'activitySelector') {
         $backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
         $backUrlTitle = ts('Back to Activities');
     } elseif ($context == 'activity') {
         $atype = CRM_Utils_Request::retrieve('atype', 'Positive', $this);
         $aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this);
         $backUrl = CRM_Utils_System::url('civicrm/activity/view', "atype={$atype}&action=view&reset=1&id={$aid}&cid={$cid}&context=activity");
         $backUrlTitle = ts('Back to Activity');
     } elseif ($context == 'mailing') {
         $backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=mailing");
         $backUrlTitle = ts('Back to Mailing');
     } else {
         $backUrl = CRM_Utils_System::url('civicrm/mailing', 'reset=1');
         $backUrlTitle = ts('Back to CiviMail');
     }
     $this->assign('backUrl', $backUrl);
     $this->assign('backUrlTitle', $backUrlTitle);
     $this->assign('report', $report);
     CRM_Utils_System::setTitle(ts('CiviMail Report: %1', array(1 => $report['mailing']['name'])));
     return CRM_Core_Page::run();
 }
コード例 #4
0
 /**
  * This function sets the default values for the form.
  * the default values are retrieved from the database
  *
  * @access public
  *
  * @return None
  */
 function setDefaultValues()
 {
     $mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
     $continue = CRM_Utils_Request::retrieve('continue', 'String', $this, FALSE, NULL);
     // check that the user has permission to access mailing id
     CRM_Mailing_BAO_Mailing::checkPermission($mailingID);
     $defaults = array();
     if ($mailingID) {
         $mailing = new CRM_Mailing_DAO_Mailing();
         $mailing->id = $mailingID;
         $mailing->addSelect('name', 'campaign_id');
         $mailing->find(TRUE);
         $defaults['name'] = $mailing->name;
         if (!$continue) {
             $defaults['name'] = ts('Copy of %1', array(1 => $mailing->name));
         } else {
             // CRM-7590, reuse same mailing ID if we are continuing
             $this->set('mailing_id', $mailingID);
         }
         $defaults['campaign_id'] = $mailing->campaign_id;
         $defaults['dedupe_email'] = $mailing->dedupe_email;
         $dao = new CRM_Mailing_DAO_Group();
         $mailingGroups = array();
         $dao->mailing_id = $mailingID;
         $dao->find();
         while ($dao->fetch()) {
             $mailingGroups[$dao->entity_table][$dao->group_type][] = $dao->entity_id;
         }
         $defaults['includeGroups'] = $mailingGroups['civicrm_group']['Include'];
         $defaults['excludeGroups'] = CRM_Utils_Array::value('Exclude', $mailingGroups['civicrm_group']);
         $defaults['includeMailings'] = CRM_Utils_Array::value('Include', $mailingGroups['civicrm_mailing']);
         $defaults['excludeMailings'] = $mailingGroups['civicrm_mailing']['Exclude'];
     }
     //when the context is search hide the mailing recipients.
     $showHide = new CRM_Core_ShowHideBlocks();
     $showGroupSelector = TRUE;
     if ($this->_searchBasedMailing) {
         $showGroupSelector = FALSE;
         $formElements = array('includeGroups', 'excludeGroups', 'includeMailings', 'excludeMailings');
         $formValues = $this->controller->exportValues($this->_name);
         foreach ($formElements as $element) {
             if (!empty($formValues[$element])) {
                 $showGroupSelector = TRUE;
                 break;
             }
         }
     }
     if ($showGroupSelector) {
         $showHide->addShow("id-additional");
         $showHide->addHide("id-additional-show");
     } else {
         $showHide->addShow("id-additional-show");
         $showHide->addHide("id-additional");
     }
     $showHide->addToTemplate();
     return $defaults;
 }
コード例 #5
0
ファイル: Group.php プロジェクト: ksecor/civicrm
 /**
  * This function sets the default values for the form.
  * the default values are retrieved from the database
  * 
  * @access public
  * @return None
  */
 function setDefaultValues()
 {
     $mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, false, null);
     $continue = CRM_Utils_Request::retrieve('continue', 'String', $this, false, null);
     // check that the user has permission to access mailing id
     require_once 'CRM/Mailing/BAO/Mailing.php';
     CRM_Mailing_BAO_Mailing::checkPermission($mailingID);
     $defaults = array();
     if ($mailingID && $continue) {
         $defaults["name"] = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $mailingID, 'name', 'id');
         $this->set('mailing_id', $mailingID);
     } elseif ($mailingID && !$continue) {
         $defaults["name"] = ts('Copy of %1', array(1 => CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $mailingID, 'name', 'id')));
     }
     if ($mailingID) {
         require_once "CRM/Mailing/DAO/Group.php";
         $dao =& new CRM_Mailing_DAO_Group();
         $mailingGroups = array();
         $dao->mailing_id = $mailingID;
         $dao->find();
         while ($dao->fetch()) {
             $mailingGroups[$dao->entity_table][$dao->group_type][] = $dao->entity_id;
         }
         $defaults['includeGroups'] = $mailingGroups['civicrm_group']['Include'];
         $defaults['excludeGroups'] = CRM_Utils_Array::value('Exclude', $mailingGroups['civicrm_group']);
         $defaults['includeMailings'] = CRM_Utils_Array::value('Include', $mailingGroups['civicrm_mailing']);
         $defaults['excludeMailings'] = $mailingGroups['civicrm_mailing']['Exclude'];
     }
     //when the context is search hide the mailing recipients.
     require_once 'CRM/Core/ShowHideBlocks.php';
     $showHide =& new CRM_Core_ShowHideBlocks();
     $context = $this->get('context');
     $showGroupSelector = true;
     if ($context == 'search') {
         $showGroupSelector = false;
         $formElements = array('includeGroups', 'excludeGroups', 'includeMailings', 'excludeMailings');
         $formValues = $this->controller->exportValues($this->_name);
         foreach ($formElements as $element) {
             if (!empty($formValues[$element])) {
                 $showGroupSelector = true;
                 break;
             }
         }
     }
     if ($showGroupSelector) {
         $showHide->addShow("id-additional");
         $showHide->addHide("id-additional-show");
     } else {
         $showHide->addShow("id-additional-show");
         $showHide->addHide("id-additional");
     }
     $showHide->addToTemplate();
     return $defaults;
 }
コード例 #6
0
ファイル: Report.php プロジェクト: hampelm/Ginsberg-CiviDemo
 function run()
 {
     $this->_mailing_id = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
     // check that the user has permission to access mailing id
     require_once 'CRM/Mailing/BAO/Mailing.php';
     CRM_Mailing_BAO_Mailing::checkPermission($this->_mailing_id);
     require_once 'CRM/Mailing/BAO/Mailing.php';
     $report =& CRM_Mailing_BAO_Mailing::report($this->_mailing_id);
     // #6835 Email Mutithreading
     //if ( count($report['jobs']) > 1 ) {
     //    CRM_Core_Error::statusBounce(ts('Selected Mailing has more than one live job.'));
     //}
     //get contents of mailing
     CRM_Mailing_BAO_Mailing::getMailingContent($report, $this);
     //assign backurl
     $context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     if ($context == 'activitySelector') {
         $backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
         $backUrlTitle = ts('Back to Activities');
     } else {
         if ($context == 'activity') {
             $atype = CRM_Utils_Request::retrieve('atype', 'Positive', $this);
             $aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this);
             $backUrl = CRM_Utils_System::url('civicrm/activity/view', "atype={$atype}&action=view&reset=1&id={$aid}&cid={$cid}&context=activity");
             $backUrlTitle = ts('Back to Activity');
         } else {
             $backUrl = CRM_Utils_System::url('civicrm/mailing', 'reset=1');
             $backUrlTitle = ts('Back to CiviMail');
         }
     }
     $this->assign('backUrl', $backUrl);
     $this->assign('backUrlTitle', $backUrlTitle);
     $this->assign('report', $report);
     CRM_Utils_System::setTitle(ts('CiviMail Report: %1', array(1 => $report['mailing']['name'])));
     parent::run();
 }
コード例 #7
0
ファイル: Browse.php プロジェクト: hampelm/Ginsberg-CiviDemo
 /**
  * Heart of the viewing process. The runner gets all the meta data for
  * the contact and calls the appropriate type of page to view.
  *
  * @return void
  * @access public
  *
  */
 function preProcess()
 {
     $this->_unscheduled = $this->_archived = $archiveLinks = false;
     $this->_mailingId = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
     // check that the user has permission to access mailing id
     require_once 'CRM/Mailing/BAO/Mailing.php';
     CRM_Mailing_BAO_Mailing::checkPermission($this->_mailingId);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
     $this->assign('action', $this->_action);
     $showLinks = true;
     require_once 'CRM/Mailing/Info.php';
     if (CRM_Mailing_Info::workflowEnabled()) {
         if (CRM_Core_Permission::check('create mailings')) {
             $archiveLinks = true;
         }
         if (!CRM_Core_Permission::check('access CiviMail') && !CRM_Core_Permission::check('create mailings')) {
             $showLinks = false;
         }
     }
     $this->assign('showLinks', $showLinks);
     if (CRM_Core_Permission::check('access CiviMail')) {
         $archiveLinks = true;
     }
     if ($archiveLinks == true) {
         $this->assign('archiveLinks', $archiveLinks);
     }
 }
コード例 #8
0
 /**
  * This function sets the default values for the form.
  * the default values are retrieved from the database
  *
  * @access public
  *
  * @return None
  */
 function setDefaultValues()
 {
     // to continue the unscheduled or draft mailing
     $continue = $this->_continue = CRM_Utils_Request::retrieve('continue', 'String', $this, FALSE, NULL);
     $mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
     $defaults = array();
     if ($this->_mailingID) {
         // check that the user has permission to access mailing id
         CRM_Mailing_BAO_Mailing::checkPermission($this->_mailingID);
         $mailing = new CRM_Mailing_DAO_Mailing();
         $mailing->id = $this->_mailingID;
         $mailing->addSelect('name', 'campaign_id');
         $mailing->find(TRUE);
         $defaults['name'] = $mailing->name;
         if (!$continue) {
             $defaults['name'] = ts('Copy of %1', array(1 => $mailing->name));
         } else {
             // CRM-7590, reuse same mailing ID if we are continuing
             $this->set('mailing_id', $this->_mailingID);
         }
         $defaults['campaign_id'] = $mailing->campaign_id;
         $defaults['dedupe_email'] = $mailing->dedupe_email;
         $dao = new CRM_Mailing_DAO_MailingGroup();
         $mailingGroups = array('civicrm_group' => array(), 'civicrm_mailing' => array());
         $dao->mailing_id = $this->_mailingID;
         $dao->find();
         while ($dao->fetch()) {
             // account for multi-lingual
             // CRM-11431
             $entityTable = 'civicrm_group';
             if (substr($dao->entity_table, 0, 15) == 'civicrm_mailing') {
                 $entityTable = 'civicrm_mailing';
             }
             $mailingGroups[$entityTable][$dao->group_type][] = $dao->entity_id;
         }
         $defaults['includeGroups'] = $mailingGroups['civicrm_group']['include'];
         $defaults['excludeGroups'] = CRM_Utils_Array::value('exclude', $mailingGroups['civicrm_group']);
         if (!empty($mailingGroups['civicrm_mailing'])) {
             $defaults['includeMailings'] = CRM_Utils_Array::value('include', $mailingGroups['civicrm_mailing']);
             $defaults['excludeMailings'] = CRM_Utils_Array::value('exclude', $mailingGroups['civicrm_mailing']);
         }
     } else {
         $defaults['url_tracking'] = TRUE;
         $defaults['open_tracking'] = TRUE;
     }
     //set default message body
     $reuseMailing = FALSE;
     if ($mailingID) {
         $reuseMailing = TRUE;
     } else {
         $mailingID = $this->_mailingID;
     }
     $count = $this->get('count');
     $this->assign('count', $count);
     $this->set('skipTextFile', FALSE);
     $this->set('skipHtmlFile', FALSE);
     $htmlMessage = NULL;
     if ($mailingID) {
         $dao = new CRM_Mailing_DAO_Mailing();
         $dao->id = $mailingID;
         $dao->find(TRUE);
         $dao->storeValues($dao, $defaults);
         //we don't want to retrieve template details once it is
         //set in session
         $templateId = $this->get('template');
         $this->assign('templateSelected', $templateId ? $templateId : 0);
         if (isset($defaults['msg_template_id']) && !$templateId) {
             $defaults['template'] = $defaults['msg_template_id'];
             $messageTemplate = new CRM_Core_DAO_MessageTemplate();
             $messageTemplate->id = $defaults['msg_template_id'];
             $messageTemplate->selectAdd();
             $messageTemplate->selectAdd('msg_text, msg_html');
             $messageTemplate->find(TRUE);
             $defaults['text_message'] = $messageTemplate->msg_text;
             $htmlMessage = $messageTemplate->msg_html;
         }
         if (isset($defaults['body_text'])) {
             $defaults['text_message'] = $defaults['body_text'];
             $this->set('textFile', $defaults['body_text']);
             $this->set('skipTextFile', TRUE);
         }
         if (isset($defaults['body_html'])) {
             $htmlMessage = $defaults['body_html'];
             $this->set('htmlFile', $defaults['body_html']);
             $this->set('skipHtmlFile', TRUE);
         }
         //set default from email address.
         if (CRM_Utils_Array::value('from_name', $defaults) && CRM_Utils_Array::value('from_email', $defaults)) {
             $defaults['from_email_address'] = array_search('"' . $defaults['from_name'] . '" <' . $defaults['from_email'] . '>', CRM_Core_OptionGroup::values('from_email_address'));
         } else {
             //get the default from email address.
             $defaultAddress = CRM_Core_OptionGroup::values('from_email_address', NULL, NULL, NULL, ' AND is_default = 1');
             foreach ($defaultAddress as $id => $value) {
                 $defaults['from_email_address'] = $id;
             }
         }
         if (CRM_Utils_Array::value('replyto_email', $defaults)) {
             $replyToEmail = CRM_Core_OptionGroup::values('from_email_address');
             foreach ($replyToEmail as $value) {
                 if (strstr($value, $defaults['replyto_email'])) {
                     $replyToEmailAddress = $value;
                     break;
                 }
             }
             $replyToEmailAddress = explode('<', $replyToEmailAddress);
             $replyToEmailAddress = $replyToEmailAddress[0] . '<' . $replyToEmailAddress[1];
             $this->replytoAddress = $defaults['reply_to_address'] = array_search($replyToEmailAddress, $replyToEmail);
         }
     }
     /*
     //set default from email address.
     if (CRM_Utils_Array::value('from_name', $defaults) && CRM_Utils_Array::value('from_email', $defaults)) {
       $defaults['from_email_address'] = array_search('"' . $defaults['from_name'] . '" <' . $defaults['from_email'] . '>',
         CRM_Core_OptionGroup::values('from_email_address')
       );
     }
     else {
       //get the default from email address.
       $defaultAddress = CRM_Core_OptionGroup::values('from_email_address', NULL, NULL, NULL, ' AND is_default = 1');
       foreach ($defaultAddress as $id => $value) {
         $defaults['from_email_address'] = $id;
       }
     }
     
     if (CRM_Utils_Array::value('replyto_email', $defaults)) {
       $replyToEmail = CRM_Core_OptionGroup::values('from_email_address');
       foreach ($replyToEmail as $value) {
         if (strstr($value, $defaults['replyto_email'])) {
           $replyToEmailAddress = $value;
           break;
         }
       }
       $replyToEmailAddress = explode('<', $replyToEmailAddress);
       $replyToEmailAddress = $replyToEmailAddress[0] . '<' . $replyToEmailAddress[1];
       $this->replytoAddress = $defaults['reply_to_address'] = array_search($replyToEmailAddress, $replyToEmail);
     }
     */
     //fix for CRM-2873
     if (!$reuseMailing) {
         $textFilePath = $this->get('textFilePath');
         if ($textFilePath && file_exists($textFilePath)) {
             $defaults['text_message'] = file_get_contents($textFilePath);
             if (strlen($defaults['text_message']) > 0) {
                 $this->set('skipTextFile', TRUE);
             }
         }
         $htmlFilePath = $this->get('htmlFilePath');
         if ($htmlFilePath && file_exists($htmlFilePath)) {
             $defaults['html_message'] = file_get_contents($htmlFilePath);
             if (strlen($defaults['html_message']) > 0) {
                 $htmlMessage = $defaults['html_message'];
                 $this->set('skipHtmlFile', TRUE);
             }
         }
     }
     if ($this->get('html_message')) {
         $htmlMessage = $this->get('html_message');
     }
     $htmlMessage = str_replace(array("\n", "\r"), ' ', $htmlMessage);
     $htmlMessage = str_replace("'", "\\'", $htmlMessage);
     $this->assign('message_html', $htmlMessage);
     $defaults['upload_type'] = 1;
     if (isset($defaults['body_html'])) {
         $defaults['html_message'] = $defaults['body_html'];
     }
     if (!empty($defaults['html_message'])) {
         $this->assign('reuse_message_template', $defaults['html_message']);
     }
     //CRM-4678 setdefault to default component when composing new mailing.
     if (!$reuseMailing) {
         $componentFields = array('header_id' => 'Header', 'footer_id' => 'Footer');
         foreach ($componentFields as $componentVar => $componentType) {
             $defaults[$componentVar] = CRM_Mailing_PseudoConstant::defaultComponent($componentType, '');
         }
     }
     //end
     return $defaults;
 }
コード例 #9
0
 /**
  * Set default values for the form.
  * the default values are retrieved from the database
  *
  *
  * @return void
  */
 public function setDefaultValues()
 {
     $continue = CRM_Utils_Request::retrieve('continue', 'String', $this, FALSE, NULL);
     $defaults = array();
     $defaults['dedupe_email'] = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'dedupe_email_default', NULL, FALSE);
     if ($this->_mailingID) {
         // check that the user has permission to access mailing id
         CRM_Mailing_BAO_Mailing::checkPermission($this->_mailingID);
         $mailing = new CRM_Mailing_DAO_Mailing();
         $mailing->id = $this->_mailingID;
         $mailing->addSelect('name', 'campaign_id');
         $mailing->find(TRUE);
         $defaults['name'] = $mailing->name;
         if (!$continue) {
             $defaults['name'] = ts('Copy of %1', array(1 => $mailing->name));
         } else {
             // CRM-7590, reuse same mailing ID if we are continuing
             $this->set('mailing_id', $this->_mailingID);
         }
         $defaults['campaign_id'] = $mailing->campaign_id;
         $defaults['dedupe_email'] = $mailing->dedupe_email;
         $defaults['location_type_id'] = $mailing->location_type_id;
         $defaults['email_selection_method'] = $mailing->email_selection_method;
         $dao = new CRM_Mailing_DAO_MailingGroup();
         $mailingGroups = array('civicrm_group' => array(), 'civicrm_mailing' => array());
         $dao->mailing_id = $this->_mailingID;
         $dao->find();
         while ($dao->fetch()) {
             // account for multi-lingual
             // CRM-11431
             $entityTable = 'civicrm_group';
             if (substr($dao->entity_table, 0, 15) == 'civicrm_mailing') {
                 $entityTable = 'civicrm_mailing';
             }
             $mailingGroups[$entityTable][$dao->group_type][] = $dao->entity_id;
         }
         $defaults['includeGroups'] = CRM_Utils_Array::value('Include', $mailingGroups['civicrm_group']);
         $defaults['excludeGroups'] = CRM_Utils_Array::value('Exclude', $mailingGroups['civicrm_group']);
         if (!empty($mailingGroups['civicrm_mailing'])) {
             $defaults['includeMailings'] = CRM_Utils_Array::value('Include', $mailingGroups['civicrm_mailing']);
             $defaults['excludeMailings'] = CRM_Utils_Array::value('Exclude', $mailingGroups['civicrm_mailing']);
         }
     }
     //when the context is search hide the mailing recipients.
     $showHide = new CRM_Core_ShowHideBlocks();
     $showGroupSelector = TRUE;
     if ($this->_searchBasedMailing) {
         $showGroupSelector = FALSE;
         $formElements = array('includeGroups', 'excludeGroups', 'includeMailings', 'excludeMailings');
         $formValues = $this->controller->exportValues($this->_name);
         foreach ($formElements as $element) {
             if (!empty($formValues[$element])) {
                 $showGroupSelector = TRUE;
                 break;
             }
         }
     }
     if ($showGroupSelector) {
         $showHide->addShow("id-additional");
         $showHide->addHide("id-additional-show");
     } else {
         $showHide->addShow("id-additional-show");
         $showHide->addHide("id-additional");
     }
     $showHide->addToTemplate();
     return $defaults;
 }
コード例 #10
0
ファイル: Browse.php プロジェクト: bhirsch/voipdev
 /**
  * Heart of the viewing process. The runner gets all the meta data for
  * the contact and calls the appropriate type of page to view.
  *
  * @return void
  * @access public
  *
  */
 function preProcess()
 {
     $this->_unscheduled = $this->_archived = false;
     $this->_mailingId = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
     // check that the user has permission to access mailing id
     require_once 'CRM/Mailing/BAO/Mailing.php';
     CRM_Mailing_BAO_Mailing::checkPermission($this->_mailingId);
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
     $this->assign('action', $this->_action);
 }
コード例 #11
0
ファイル: Report.php プロジェクト: kcristiano/civicrm-core
 /**
  * @return string
  */
 public function run()
 {
     $this->_mailing_id = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
     //CRM-15979 - check if abtest exist for mailing then redirect accordingly
     $abtest = CRM_Mailing_BAO_MailingAB::getABTest($this->_mailing_id);
     if (!empty($abtest) && !empty($abtest->id)) {
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/abtest/' . $abtest->id));
     }
     // check that the user has permission to access mailing id
     CRM_Mailing_BAO_Mailing::checkPermission($this->_mailing_id);
     $report = CRM_Mailing_BAO_Mailing::report($this->_mailing_id);
     // get contents of mailing
     CRM_Mailing_BAO_Mailing::getMailingContent($report, $this);
     // assign backurl
     $context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     if ($context == 'activitySelector') {
         $backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=activity");
         $backUrlTitle = ts('Back to Activities');
     } elseif ($context == 'activity') {
         $atype = CRM_Utils_Request::retrieve('atype', 'Positive', $this);
         $aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this);
         $backUrl = CRM_Utils_System::url('civicrm/activity/view', "atype={$atype}&action=view&reset=1&id={$aid}&cid={$cid}&context=activity");
         $backUrlTitle = ts('Back to Activity');
     } elseif ($context == 'mailing') {
         $backUrl = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$cid}&selectedChild=mailing");
         $backUrlTitle = ts('Back to Mailing');
     } else {
         $backUrl = CRM_Utils_System::url('civicrm/mailing', 'reset=1');
         $backUrlTitle = ts('Back to CiviMail');
     }
     $this->assign('backUrl', $backUrl);
     $this->assign('backUrlTitle', $backUrlTitle);
     $this->assign('report', $report);
     CRM_Utils_System::setTitle(ts('CiviMail Report: %1', array(1 => $report['mailing']['name'])));
     $this->assign('public_url', CRM_Mailing_BAO_Mailing::getPublicViewUrl($this->_mailing_id));
     return CRM_Core_Page::run();
 }