/** * index action for the module controller * This will render the HTML needed for ExtJS application * * @return void */ public function indexAction() { $pageType = ''; $record = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('doktype', 'pages', 'uid =' . $this->pageId); if (!empty($record['doktype']) && $record['doktype'] == 254) { $pageType = 'folder'; } elseif (!empty($record['doktype'])) { $pageType = 'page'; } $configuration = array('pageId' => $this->pageId, 'pageType' => $pageType, 'emailShowUrl' => Tools::buildFrontendUri('show', array(), 'Email')); $this->view->assign('configuration', $configuration); }
/** * Return all markers and their values as associative array * @param Email $email * @return string[] */ private function getMarkers(Email $email) { $markers = $email->getRecipientData(); // Add predefined markers $authCode = $email->getAuthCode(); $markers['newsletter_view_url'] = Tools::buildFrontendUri('show', array('c' => $authCode), 'Email'); $markers['newsletter_unsubscribe_url'] = Tools::buildFrontendUri('unsubscribe', array('c' => $authCode), 'Email'); return $markers; }
private function getLinkAuthCode(Email $email, $url, $isPreview, $isPlainText = false) { global $TYPO3_DB; $url = html_entity_decode($url); // First check in our local cache if (isset($this->linksCache[$url])) { $linkId = $this->linksCache[$url]; } elseif ($isPreview) { $linkId = count($this->linksCache); } else { // Look for the link database, it may already exist $res = $TYPO3_DB->sql_query('SELECT uid FROM tx_newsletter_domain_model_link WHERE url = ' . $TYPO3_DB->fullQuoteStr($url, 'tx_newsletter_domain_model_link') . ' AND newsletter = ' . $TYPO3_DB->fullQuoteStr($this->newsletter->getUid(), 'tx_newsletter_domain_model_link') . ' LIMIT 1'); $row = $TYPO3_DB->sql_fetch_row($res); if ($row) { $linkId = $row[0]; } else { $TYPO3_DB->exec_INSERTquery('tx_newsletter_domain_model_link', array('pid' => $this->newsletter->getPid(), 'url' => $url, 'newsletter' => $this->newsletter->getUid())); $linkId = $TYPO3_DB->sql_insert_id(); } } // Store link in cache $this->linksCache[$url] = $linkId; $authCode = md5($email->getAuthCode() . $linkId); $newUrl = Tools::buildFrontendUri('clicked', array(), 'Link') . '&n=' . $this->newsletter->getUid() . '&l=' . $authCode . ($isPlainText ? '&p=1' : ''); return $newUrl; }
/** * Return HTML code showing an extract of recipients (first X recipients) */ public function getExtract($limit = 30) { if ($this->getError()) { $out = 'Error: ' . $this->getError(); } else { $i = 0; while ($row = $this->getRecipient()) { // Dump formatted table header if ($i == 0) { $out .= '<tr>'; foreach (array_keys($row) as $key) { $out .= '<th style="padding-right: 1em;">' . $this->getFieldTitle($key) . '</th>'; } $out .= '</tr>'; } $out .= '<tr style="border: 1px grey solid; border-collapse: collapse;">'; foreach ($row as $field) { $out .= '<td style="padding-right: 1em;">' . $field . '</td>'; } $out .= '</tr>'; if (++$i == $limit) { break; } } $out = '<table style="border: 1px grey solid; border-collapse: collapse;">' . $out . '</table>'; $authCode = \TYPO3\CMS\Core\Utility\GeneralUtility::stdAuthCode($this->_getCleanProperties()); $uriXml = Tools::buildFrontendUri('export', array('uidRecipientList' => $this->getUid(), 'authCode' => $authCode, 'format' => 'xml'), 'RecipientList'); $uriCsv = Tools::buildFrontendUri('export', array('uidRecipientList' => $this->getUid(), 'authCode' => $authCode, 'format' => 'csv'), 'RecipientList'); $out .= '<p><strong>' . $i . '/' . $this->getCount() . '</strong> recipients (<a href="' . $uriXml . '">export XML</a>, ' . '<a href="' . $uriCsv . '">export CSV</a>' . ')</p>'; } $out = '<h4>' . $this->getTitle() . '</h4>' . $out; return $out; }