Exemplo n.º 1
0
 /**
  * This function wraps HTML comments around the content.
  * The comments contain the uids of assigned direct mail categories.
  * It is called as "USER_FUNC" from TS.
  *
  * @param    string $content Incoming HTML code which will be wrapped
  * @param    array|null $conf Pointer to the conf array (TS)
  *
  * @return    string        content of the email with dmail boundaries
  */
 public function insert_dMailer_boundaries($content, $conf = array())
 {
     if (isset($conf['useParentCObj']) && $conf['useParentCObj']) {
         $this->cObj = $conf['parentObj']->cObj;
     }
     // this check could probably be moved to TS
     if ($GLOBALS['TSFE']->config['config']['insertDmailerBoundaries']) {
         if ($content != '') {
             // setting the default
             $categoryList = '';
             if (intval($this->cObj->data['module_sys_dmail_category']) >= 1) {
                 // if content type "RECORDS" we have to strip off
                 // boundaries from indcluded records
                 if ($this->cObj->data['CType'] == 'shortcut') {
                     $content = $this->stripInnerBoundaries($content);
                 }
                 // get categories of tt_content element
                 $foreignTable = 'sys_dmail_category';
                 $select = "{$foreignTable}.uid";
                 $localTableUidList = intval($this->cObj->data['uid']);
                 $mmTable = 'sys_dmail_ttcontent_category_mm';
                 $whereClause = '';
                 $orderBy = $foreignTable . '.uid';
                 $res = $this->cObj->exec_mm_query_uidList($select, $localTableUidList, $mmTable, $foreignTable, $whereClause, '', $orderBy);
                 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
                     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                         $categoryList .= $row['uid'] . ',';
                     }
                     $GLOBALS['TYPO3_DB']->sql_free_result($res);
                     $categoryList = rtrim($categoryList, ",");
                 }
             }
             // wrap boundaries around content
             $content = $this->cObj->wrap($categoryList, $this->boundaryStartWrap) . $content . $this->boundaryEnd;
         }
     }
     return $content;
 }