本文整理汇总了PHP中selector::group方法的典型用法代码示例。如果您正苦于以下问题:PHP selector::group方法的具体用法?PHP selector::group怎么用?PHP selector::group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selector
的用法示例。
在下文中一共展示了selector::group方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: release_send
public function release_send()
{
$buffer = outputBuffer::current('HTTPOutputBuffer');
$buffer->charset('utf-8');
$buffer->contentType('text/xml');
$buffer->push('<?xml version="1.0" encoding="utf-8"?>');
$iDispId = (int) getRequest('param0');
$iReleaseId = $this->getNewReleaseInstanceId($iDispId);
$arrPostData = getRequest("data_values");
$objectsColl = umiObjectsCollection::getinstance();
$controller = cmsController::getInstance();
$oDispatch = $objectsColl->getObject($iDispId);
$oRelease = $objectsColl->getObject($iReleaseId);
if (!$oDispatch instanceof umiObject || !$oRelease instanceof umiObject) {
$buffer->push("<error>Не указан идентификатор рассылки</error>");
$buffer->end();
}
if ($oRelease->getValue('status')) {
$buffer->push("<error>Этот выпуск уже был отправлен</error>");
$buffer->end();
}
$arrRecipients = array();
if (!getSession('umi_send_list_' . $iReleaseId)) {
$sel = new selector('objects');
$sel->types("object-type")->name("dispatches", "subscriber");
$sel->where("subscriber_dispatches")->equals($iDispId);
$sel->option('return')->value('id');
$sel->group("name");
foreach ($sel->result() as $recipient) {
$arrRecipients[] = $recipient['id'];
}
$_SESSION['umi_send_list_' . $iReleaseId] = $arrRecipients;
$_SESSION['umi_send_list_' . $iReleaseId . '_count'] = count($arrRecipients);
} else {
$arrRecipients = getSession('umi_send_list_' . $iReleaseId);
}
$delay = getSession('umi_send_list_' . $iReleaseId . '_delay');
$iTotal = (int) getSession('umi_send_list_' . $iReleaseId . '_count');
if ($delay and time() < $delay) {
$iSended = $iTotal - count($arrRecipients);
$sResult = <<<END
<release dispatch="{$iDispId}">
\t<total>{$iTotal}</total>
\t<sended>{$iSended}</sended>
</release>
END;
$buffer->push($sResult);
$buffer->end();
}
$sHost = $controller->getCurrentDomain()->getHost();
$oMailer = new umiMail();
$arrMailBlocks = array();
$arrMailBlocks['header'] = $oDispatch->getName();
$arrMailBlocks['messages'] = "";
list($sReleaseFrm, $sMessageFrm) = def_module::loadTemplatesForMail("dispatches/release", "release_body", "release_message");
$sel = new selector('objects');
$sel->types("object-type")->name("dispatches", "message");
$sel->where("release_reference")->equals($iReleaseId);
if ($sel->length()) {
foreach ($sel->result() as $oNextMsg) {
if ($oNextMsg instanceof umiObject) {
$arrMsgBlocks = array();
$arrMsgBlocks['body'] = $oNextMsg->getValue('body');
$arrMsgBlocks['header'] = $oNextMsg->getValue('header');
$arrMailBlocks['messages'] .= def_module::parseTemplateForMail($sMessageFrm, $arrMsgBlocks, false, $oNextMsg->getId());
$oNextAttach = $oNextMsg->getValue('attach_file');
if ($oNextAttach instanceof umiFile && !$oNextAttach->getIsBroken()) {
$oMailer->attachFile($oNextAttach);
}
}
}
} else {
unset($_SESSION[$iDispId . '_new_templater']);
$buffer->push("<error>В выпуске нет сообщений</error>");
$buffer->end();
}
$oMailer->setFrom(regedit::getInstance()->getVal("//settings/email_from"), regedit::getInstance()->getVal("//settings/fio_from"));
$oMailer->setSubject($arrMailBlocks['header']);
$delay = 0;
$max_messages = (int) mainConfiguration::getinstance()->get('modules', 'dispatches.max_messages_in_hour');
if ($max_messages && $iTotal >= $max_messages) {
$delay = floor(3600 / $max_messages);
}
$aSended = array();
$iPacketSize = 5;
//TODO: add to settings
foreach ($arrRecipients as $recipient_id) {
--$iPacketSize;
$oNextMailer = clone $oMailer;
$oNextSbs = new umiSubscriber($recipient_id);
$sRecipientName = $oNextSbs->getValue('lname') . " " . $oNextSbs->getValue('fname') . " " . $oNextSbs->getValue('father_name');
$mail = $oNextSbs->getValue('email');
if (!strlen($mail)) {
$mail = $oNextSbs->getName();
}
$arrMailBlocks['unsubscribe_link'] = "http://" . $sHost . "/dispatches/unsubscribe/" . $oNextSbs->getId() . '/?email=' . $mail;
$sMailBody = def_module::parseTemplateForMail($sReleaseFrm, $arrMailBlocks, false, $oNextSbs->getId());
$oNextMailer->setContent($sMailBody);
$oNextMailer->addRecipient($mail, $sRecipientName);
if (!(defined('CURRENT_VERSION_LINE') && CURRENT_VERSION_LINE == 'demo')) {
//.........这里部分代码省略.........