Esempio n. 1
0
 /**
  * Show the list of existing directmail records, which haven't been sent
  *
  * @return	string		HTML
  */
 public function cmd_news()
 {
     // Here the list of subpages, news, is rendered
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,doktype,title,abstract', 'pages', 'pid=' . intval($this->id) . ' AND doktype IN (' . $GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'] . ')' . ' AND ' . $this->perms_clause . BackendUtility::BEenableFields('pages') . BackendUtility::deleteClause('pages'), '', 'sorting');
     if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
         $theOutput = $this->doc->section($this->getLanguageService()->getLL('nl_select'), $this->getLanguageService()->getLL('nl_select_msg1'), 0, 1);
     } else {
         $outLines = array();
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             $languages = $this->getAvailablePageLanguages($row['uid']);
             $createDmailLink = BackendUtility::getModuleUrl('DirectMailNavFrame_DirectMail') . '&id=' . $this->id . '&createMailFrom_UID=' . $row['uid'] . '&fetchAtOnce=1&CMD=info';
             $pageIcon = $this->iconFactory->getIconForRecord('pages', $row, Icon::SIZE_SMALL) . ' ' . htmlspecialchars($row['title']);
             $previewHTMLLink = $previewTextLink = $createLink = '';
             foreach ($languages as $languageUid => $lang) {
                 $langParam = DirectMailUtility::getLanguageParam($languageUid, $this->params);
                 $createLangParam = $languageUid ? '&createMailFrom_LANG=' . $languageUid : '';
                 $langIconOverlay = count($languages) > 1 ? $lang['flagIcon'] : null;
                 $langTitle = count($languages) > 1 ? ' - ' . $lang['title'] : '';
                 $plainParams = $this->implodedParams['plainParams'] . $langParam;
                 $htmlParams = $this->implodedParams['HTMLParams'] . $langParam;
                 $htmlIcon = $this->iconFactory->getIcon('direct_mail_preview_html', Icon::SIZE_SMALL, $langIconOverlay);
                 $plainIcon = $this->iconFactory->getIcon('direct_mail_preview_plain', Icon::SIZE_SMALL, $langIconOverlay);
                 $createIcon = $this->iconFactory->getIcon('direct_mail_newmail', Icon::SIZE_SMALL, $langIconOverlay);
                 $previewHTMLLink .= '<a href="#" onClick="' . BackendUtility::viewOnClick($row['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($row['uid']), '', '', $htmlParams) . '" title="' . htmlentities($GLOBALS['LANG']->getLL('nl_viewPage_HTML') . $langTitle) . '">' . $htmlIcon . '</a>';
                 $previewTextLink .= '<a href="#" onClick="' . BackendUtility::viewOnClick($row['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($row['uid']), '', '', $plainParams) . '" title="' . htmlentities($GLOBALS['LANG']->getLL('nl_viewPage_TXT') . $langTitle) . '">' . $plainIcon . '</a>';
                 $createLink .= '<a href="' . $createDmailLink . $createLangParam . '" title="' . htmlentities($GLOBALS['LANG']->getLL("nl_create") . $langTitle) . '">' . $createIcon . '</a>';
             }
             switch ($this->params['sendOptions']) {
                 case 1:
                     $previewLink = $previewTextLink;
                     break;
                 case 2:
                     $previewLink = $previewHTMLLink;
                     break;
                 case 3:
                     // also as default
                 // also as default
                 default:
                     $previewLink = $previewHTMLLink . '&nbsp;&nbsp;' . $previewTextLink;
             }
             $outLines[] = [count($languages) > 1 ? $pageIcon : '<a href="' . $createDmailLink . '">' . $pageIcon . '</a>', $createLink, '<a onclick="' . htmlspecialchars(BackendUtility::editOnClick('&edit[pages][' . $row['uid'] . ']=edit', $this->doc->backPath)) . '" href="#" title="' . $GLOBALS['LANG']->getLL("nl_editPage") . '">' . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL) . '</a>', $previewLink];
         }
         $out = DirectMailUtility::formatTable($outLines, array(), 0, array(1, 1, 1, 1));
         $theOutput = $this->doc->section($this->getLanguageService()->getLL('dmail_dovsk_crFromNL') . BackendUtility::cshItem($this->cshTable, 'select_newsletter', $GLOBALS['BACK_PATH']), $out, 1, 1, 0, true);
     }
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
     return $theOutput;
 }