Exemplo n.º 1
0
 /**
  * Outputs legacy mass mailer display
  *
  * @deprecated 2.0
  *
  * @param UserTable[]  $rows
  * @param string       $emailSubject
  * @param string       $emailBody
  * @param string       $emailAttach
  * @param string       $emailFromName
  * @param string       $emailFromAddr
  * @param string       $emailReplyName
  * @param string       $emailReplyAddr
  * @param int          $emailsPerBatch
  * @param int          $emailsBatch
  * @param int          $emailPause
  * @param bool         $simulationMode
  * @param array        $pluginRows
  */
 public function emailUsers($rows, $emailSubject, $emailBody, $emailAttach, $emailFromName, $emailFromAddr, $emailReplyName, $emailReplyAddr, $emailsPerBatch, $emailsBatch, $emailPause, $simulationMode, $pluginRows)
 {
     global $_CB_framework, $_CB_Backend_Title;
     _CBsecureAboveForm('showUsers');
     cbimport('cb.validator');
     outputCbTemplate(2);
     outputCbJs(2);
     $_CB_Backend_Title = array(0 => array('fa fa-envelope-o', CBTxt::T('Community Builder: Mass Mailer')));
     $editorSave = $_CB_framework->saveCmsEditorJS('emailbody');
     if ($editorSave) {
         $js = "\$( '.cbEmailUsersForm' ).submit( function() { " . $editorSave . "});";
     } else {
         $js = null;
     }
     cbValidator::outputValidatorJs($js);
     $emailsList = array();
     foreach (array_slice($rows, 0, 100) as $row) {
         $emailsList[] = htmlspecialchars($row->name) . ' <' . htmlspecialchars($row->email) . '>';
     }
     $return = '<form action="' . $_CB_framework->backendUrl('index.php') . '" method="post" name="adminForm" class="cb_form form-auto cbEmailUsersForm">' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('SEND_EMAIL_TO_TOTAL_USERS', 'Send Email to [total] users', array('[total]' => (int) count($rows))) . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . implode(', ', $emailsList) . (count($rows) > 100 ? ' <strong>' . CBTxt::Th('AND_COUNT_MORE_USERS', 'and [count] more users.', array('[count]' => (int) (count($rows) - 100))) . '</strong>' : null) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_SIMULATION_MODE_LABEL', 'Simulation Mode') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="checkbox" name="simulationmode" id="simulationmode"' . ($simulationMode ? ' checked="checked"' : null) . ' /> <label for="simulationmode">' . CBTxt::T('Do not send emails, just show me how it works') . '</label>' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_SIMULATION_MODE_TOOLTIP', 'Check this box to simulate email sending in a dry run mode. No emails are actually sent.'), CBTxt::T('MASS_MAILER_SIMULATION_MODE_LABEL', 'Simulation Mode'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_SUBJECT_LABEL', 'Email Subject') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailsubject" value="' . htmlspecialchars($emailSubject) . '" class="form-control required" size="60" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_SUBJECT_TOOLTIP', 'Type in the subject of the mass mailing (CB field substitutions are supported).'), CBTxt::T('MASS_MAILER_SUBJECT_LABEL', 'Email Subject'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_MESSAGE_LABEL', 'Email Message') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . $_CB_framework->displayCmsEditor('emailbody', $emailBody, 600, 200, 50, 7) . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_MESSAGE_TOOLTIP', 'Type in the main message body of your mass mailing (HTML editor and CB field substitutions are supported).'), CBTxt::T('MASS_MAILER_MESSAGE_LABEL', 'Email Message'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_ATTACHMENTS_LABEL', 'Email Attachments') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailattach" value="' . htmlspecialchars($emailAttach) . '" class="form-control" size="80" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_ATTACHMENTS_TOOLTIP', 'Absolute server path to file that should be attached to each email. Multiple files can be specified using a comma separator.'), CBTxt::T('MASS_MAILER_ATTACHMENTS_LABEL', 'Email Attachments'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('Substitutions for Subject, Message, and Attachments') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . CBTxt::T('You can use all CB substitutions as in most parts: e.g.: [cb:if team="winners"] Congratulations [cb:userfield field="name" /], you are in the winning team! [/cb:if]') . '</div>' . '</div>' . '</div>' . $this->_pluginRows($pluginRows) . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_FROM_NAME_LABEL', 'From Name') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailfromname" value="' . htmlspecialchars($emailFromName) . '" class="form-control" size="30" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_FROM_NAME_TOOLTIP', 'The name to be used in the From field of email. If left empty the CB and Joomla configuration defaults will be used.'), CBTxt::T('MASS_MAILER_FROM_NAME_LABEL', 'From Name'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_FROM_ADDRESS_LABEL', 'From Email Address') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailfromaddr" value="' . htmlspecialchars($emailFromAddr) . '" class="form-control" size="40" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_FROM_ADDRESS_TOOLTIP', 'The email address to be user in the From field of email. If left empty the CB and Joomla settings will be used.'), CBTxt::T('MASS_MAILER_FROM_ADDRESS_LABEL', 'From Email Address'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_REPLY_TO_NAME_LABEL', 'Reply-To Name') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailreplyname" value="' . htmlspecialchars($emailReplyName) . '" class="form-control" size="30" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_REPLY_TO_NAME_TOOLTIP', 'The Reply-To Name value to be used in the From field of email. If left empty the CB and Joomla settings will be used.'), CBTxt::T('MASS_MAILER_REPLY_TO_NAME_LABEL', 'Reply-To Name'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_REPLY_TO_ADDRESS_LABEL', 'Reply-To Email Address') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailreplyaddr" value="' . htmlspecialchars($emailReplyAddr) . '" class="form-control" size="40" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_REPLY_TO_ADDRESS_TOOLTIP', 'The Reply-To Email address to be used in the email.'), CBTxt::T('MASS_MAILER_REPLY_TO_ADDRESS_LABEL', 'Reply-To Email Address'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_EMAILS_PER_BATCH_LABEL', 'Emails per batch') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailsperbatch" value="' . htmlspecialchars($emailsPerBatch) . '" class="form-control required digits" size="12" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_EMAILS_PER_BATCH_TOOLTIP', 'The number of emails to be sent in each batch (default 50).'), CBTxt::T('MASS_MAILER_EMAILS_PER_BATCH_LABEL', 'Emails per batch'), false, 4) . '</div>' . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<label class="control-label col-sm-3">' . CBTxt::Th('MASS_MAILER_SECONDS_BETWEEN_BATCHES_LABEL', 'Seconds of pause between batches') . '</label>' . '<div class="cb_field col-sm-9">' . '<div>' . '<input type="text" name="emailpause" value="' . htmlspecialchars($emailPause) . '" class="form-control required digits" size="12" />' . getFieldIcons(2, false, false, CBTxt::T('MASS_MAILER_SECONDS_BETWEEN_BATCHES_TOOLTIP', 'The number of seconds to pause between batch sending (default is 30 sec).'), CBTxt::T('MASS_MAILER_SECONDS_BETWEEN_BATCHES_LABEL', 'Seconds of pause between batches'), false, 4) . '</div>' . '</div>' . '</div>' . '<input type="hidden" name="option" value="com_comprofiler" />' . '<input type="hidden" name="view" value="emailusers" />' . '<input type="hidden" name="boxchecked" value="0" />';
     foreach ($rows as $row) {
         $return .= '<input type="hidden" name="cid[]" value="' . (int) $row->id . '">';
     }
     $return .= cbGetSpoofInputTag('user') . '</form>';
     echo $return;
 }