/** * action index * * @return void */ public function indexAction() { $allConfigs = \Sng\Recordsmanager\Utility\Config::getAllConfigs(2); if (empty($allConfigs)) { return null; } $this->currentConfig = $allConfigs[0]; $this->setCurrentConfig(); $this->buildCalendar(); $query = $this->buildQuery(); $query->setCheckPids(false); $query->setConfig($this->currentConfig); $query->setExportMode(true); $query->execQuery(); $this->exportRecords($query); $this->view->assign('moreThanSeven', version_compare(TYPO3_version, '7.0.0', '>=')); $this->view->assign('currentconfig', $this->currentConfig); $this->view->assign('arguments', $this->request->getArguments()); $this->view->assign('menuitems', $allConfigs); if ($query->getNbRows() > 0) { $this->view->assign('headers', $query->getHeaders()); $this->view->assign('rows', $query->getRows()); $this->view->assign('exportmodes', $this->getExportUrls()); } }
/** * action index * * @return void */ public function indexAction() { $allConfigs = \Sng\Recordsmanager\Utility\Config::getAllConfigs(1); if (empty($allConfigs)) { return null; } $this->currentConfig = $allConfigs[0]; $this->setCurrentConfig(); $arguments = $this->request->getArguments(); $temp_sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $addWhere = ' AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1) . ' '; $pids = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('count(' . $this->currentConfig['sqltable'] . '.pid) as "nbrecords",' . $this->currentConfig['sqltable'] . '.pid,pages.title', $this->currentConfig['sqltable'] . ',pages', 'pages.uid=' . $this->currentConfig['sqltable'] . '.pid AND ' . $this->currentConfig['sqltable'] . '.deleted=0 ' . $addWhere . 'GROUP BY ' . $this->currentConfig['sqltable'] . '.pid '); $content = ''; $pidsFind = array(); $pidsAdmin = array(); // All find PIDs if (count($pids) > 0) { foreach ($pids as $pid) { $rootline = $temp_sys_page->getRootLine($pid['pid']); $path = $temp_sys_page->getPathFromRootline($rootline, 30); $pidsFind[] = array('pid' => $pid['pid'], 'path' => $path, 'nbrecords' => $pid['nbrecords']); } } // Admin specified PIDs if ($this->currentConfig['insertdefaultpid'] != '') { $pids = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('pages.uid,pages.title', 'pages', 'pages.deleted=0 AND pages.uid IN (' . $this->currentConfig['insertdefaultpid'] . ')' . $addWhere); if (count($pids) > 0) { foreach ($pids as $pid) { $nb = count($GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', $this->currentConfig['sqltable'] . '', 'pid=' . $pid['uid'] . ' AND deleted=0 ')); $rootline = $temp_sys_page->getRootLine($pid['uid']); $path = $temp_sys_page->getPathFromRootline($rootline, 30); $pidsAdmin[] = array('pid' => $pid['uid'], 'path' => $path, 'nbrecords' => $nb); } } } $this->view->assign('pidsfind', $pidsFind); $this->view->assign('pidsadmin', $pidsAdmin); $this->view->assign('currentconfig', $this->currentConfig); $this->view->assign('arguments', $arguments); $this->view->assign('menuitems', $allConfigs); $this->view->assign('returnurl', $this->getReturnUrl()); // redirect to tce form if (!empty($arguments['create'])) { $this->redirectToForm($arguments['create']); } }
/** * action index * * @return void */ public function indexAction() { $allConfigs = \Sng\Recordsmanager\Utility\Config::getAllConfigs(0); if (empty($allConfigs)) { return null; } $this->currentConfig = $allConfigs[0]; $this->setCurrentConfig(); $query = $this->buildQuery(); $query->execQuery(); $this->view->assign('headers', $query->getHeaders()); $this->view->assign('rows', $query->getRows()); $this->view->assign('currentconfig', $this->currentConfig); $this->view->assign('arguments', $this->request->getArguments()); $this->view->assign('menuitems', $allConfigs); $this->view->assign('returnurl', rawurlencode($this->getReturnUrl())); $this->view->assign('deleteurl', $this->getDeleteUrl()); $this->view->assign('baseediturl', $this->getBaseEditUrl()); $this->view->assign('disableFields', implode(',', \tx_recordsmanager_flexfill::getDiffFieldsFromTable($this->currentConfig['sqltable'], $this->currentConfig['sqlfieldsinsert']))); }
/** * Exec the query (fill headers en rows arrays) */ public function execQuery() { $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($this->getQuery()); $first = true; $rows = array(); if ($this->isPowermail2()) { $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); $mailRepository = $objectManager->get('In2code\\Powermail\\Domain\\Repository\\MailRepository'); } while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { if ($this->isPowermail2()) { $mail = $mailRepository->findByUid($row['uid']); } if ($first) { $first = false; $this->headers = \Sng\Recordsmanager\Utility\Config::getResultRowTitles($row, $this->query['FROM']); if ($this->isPowermail1()) { $this->headers = array_intersect_key($this->headers, array_flip(\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->config['sqlfields']))); $powermailHeaders = \Sng\Recordsmanager\Utility\Powermail::getHeadersFromRow(\Sng\Recordsmanager\Utility\Powermail::getLastRecord($this->query)); $this->headers = array_merge($this->headers, $powermailHeaders); } if ($this->isPowermail2()) { $this->headers = array_intersect_key($this->headers, array_flip(\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->config['sqlfields']))); $powermailHeaders = array(); foreach ($mail->getAnswers() as $answer) { $powermailHeaders[] = $answer->getField()->getTitle(); } $this->headers = array_merge($this->headers, $powermailHeaders); } if ($this->exportMode === true && $this->config['type'] == 3) { $extraTsHeaders = array_keys(\Sng\Recordsmanager\Utility\Misc::loadAndExecTS($this->config['extrats'], $row, $this->query['FROM'])); $this->headers = array_merge($this->headers, array('recordsmanagerkey'), $extraTsHeaders); } } $records = \Sng\Recordsmanager\Utility\Config::getResultRow($row, $this->query['FROM'], $this->config['excludefields'], $this->exportMode); if ($this->isPowermail1()) { $records = array_merge($records, \Sng\Recordsmanager\Utility\Powermail::getRow($records, $powermailHeaders)); $records = array_intersect_key($records, $this->headers); } if ($this->isPowermail2()) { foreach ($mail->getAnswers() as $answer) { $records[] = $answer->getValue(); } $records = array_intersect_key($records, $this->headers); } if ($this->exportMode === true && $this->config['type'] == 3) { $arrayToEncode = array(); $arrayToEncode['uidconfig'] = $this->config['uid']; $arrayToEncode['uidrecord'] = $records['uid']; $arrayToEncode['uidserver'] = $_SERVER['SERVER_NAME']; $records['recordsmanagerkey'] = md5(serialize($arrayToEncode)); // add special typoscript value $markerValues = \Sng\Recordsmanager\Utility\Misc::convertToMarkerArray($records); $extraTs = str_replace(array_keys($markerValues), array_values($markerValues), $this->config['extrats']); $records = array_merge($records, \Sng\Recordsmanager\Utility\Misc::loadAndExecTS($extraTs, $row, $this->query['FROM'])); } $this->rows[] = $records; } $GLOBALS['TYPO3_DB']->sql_free_result($res); }