Beispiel #1
0
 /**
  * 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);
 }
Beispiel #2
0
 /**
  * Get url to delete a record
  *
  * @return string
  */
 public function getDeleteUrl()
 {
     $arguments = $this->request->getArguments();
     $returnUrl = $this->getReturnUrl();
     $deleteUrl = 'tce_db.php?cmd["+table+"]["+id+"][delete]=1&redirect=' . rawurlencode($returnUrl) . '&vC=' . $GLOBALS['BE_USER']->veriCode() . '&prErr=1&uPT=1';
     if (\Sng\Recordsmanager\Utility\Misc::intFromVer(TYPO3_version) >= 4005000) {
         $deleteUrl .= \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction');
     }
     return $deleteUrl;
 }