/**
  * Show HTML form to make special query
  *
  * @param array $mailGroup Recipient list DB record
  *
  * @return string HTML form to make a special query
  */
 public function cmd_specialQuery($mailGroup)
 {
     $out = "";
     $this->queryGenerator->init('dmail_queryConfig', $this->MOD_SETTINGS['queryTable']);
     if ($this->MOD_SETTINGS['queryTable'] && $this->MOD_SETTINGS['queryConfig']) {
         $this->queryGenerator->queryConfig = $this->queryGenerator->cleanUpQueryConfig(unserialize($this->MOD_SETTINGS['queryConfig']));
         $this->queryGenerator->extFieldLists['queryFields'] = 'uid';
         $out .= $this->queryGenerator->getSelectQuery();
         $out .= '<div style="padding-top: 20px;"></div>';
     }
     $this->queryGenerator->setFormName($this->formname);
     $this->queryGenerator->noWrap = '';
     $this->queryGenerator->allowedTables = $this->allowedTables;
     $tmpCode = $this->queryGenerator->makeSelectorTable($this->MOD_SETTINGS, 'table,query');
     $tmpCode .= '<input type="hidden" name="CMD" value="displayMailGroup" /><input type="hidden" name="group_uid" value="' . $mailGroup['uid'] . '" />';
     $tmpCode .= '<input type="submit" value="' . $this->getLanguageService()->getLL('dmail_updateQuery') . '" />';
     $out .= $this->doc->section($this->getLanguageService()->getLL('dmail_makeQuery'), $tmpCode);
     $theOutput = '<div style="padding-top: 20px;"></div>';
     $theOutput .= $this->doc->section($this->getLanguageService()->getLL('dmail_query'), $out);
     return $theOutput;
 }
 /**
  * show HTML form to make special query
  *
  * @param	array		$mailGroup: recipient list DB record
  * @return	string		HTML form to make a special query
  */
 function cmd_specialQuery($mailGroup)
 {
     $out = "";
     $this->queryGenerator->init('dmail_queryConfig', $this->MOD_SETTINGS['queryTable']);
     if ($this->MOD_SETTINGS['queryTable'] && $this->MOD_SETTINGS['queryConfig']) {
         $this->queryGenerator->queryConfig = unserialize($this->MOD_SETTINGS['queryConfig']);
         $this->queryGenerator->extFieldLists['queryFields'] = 'uid';
         $out .= $this->queryGenerator->getSelectQuery();
         $out .= $this->doc->spacer(20);
     }
     $this->queryGenerator->setFormName($this->formname);
     $this->queryGenerator->noWrap = '';
     $this->queryGenerator->allowedTables = $this->allowedTables;
     $tmpCode = $this->queryGenerator->makeSelectorTable($this->MOD_SETTINGS, 'table,query');
     $tmpCode .= '<input type="hidden" name="CMD" value="displayMailGroup" /><input type="hidden" name="group_uid" value="' . $mailGroup['uid'] . '" />';
     $tmpCode .= '<input type="submit" value="' . $GLOBALS['LANG']->getLL('dmail_updateQuery') . '" />';
     $out .= $this->doc->section($GLOBALS['LANG']->getLL('dmail_makeQuery'), $tmpCode);
     $theOutput = $this->doc->spacer(20);
     $theOutput .= $this->doc->section($GLOBALS['LANG']->getLL('dmail_query'), $out);
     return $theOutput;
 }
 /**
  * Construct the array of uid's from $table selected
  * by special query of mail group of such type
  *
  * @param MailSelect $queryGenerator The query generator object
  * @param string $table The table to select from
  * @param array $group The direct_mail group record
  *
  * @return string The resulting query.
  */
 static function getSpecialQueryIdList(MailSelect &$queryGenerator, $table, array $group)
 {
     $outArr = array();
     if ($group['query']) {
         $queryGenerator->init('dmail_queryConfig', $table, 'uid');
         $queryGenerator->queryConfig = unserialize($group['query']);
         $whereClause = $queryGenerator->getQuery($queryGenerator->queryConfig) . BackendUtility::deleteClause($table);
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($table . '.uid', $table, $whereClause);
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             $outArr[] = $row['uid'];
         }
         $GLOBALS['TYPO3_DB']->sql_free_result($res);
     }
     return $outArr;
 }