コード例 #1
0
ファイル: Container.php プロジェクト: preinboth/direct_mail
 /**
  * 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 $conf : pointer to the conf array (TS)
  * @return    string        content of the email with dmail boundaries
  */
 function insert_dMailer_boundaries($content, $conf)
 {
     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 != '') {
             $categoryList = '';
             // setting the default
             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
                 $foreign_table = 'sys_dmail_category';
                 $select = "{$foreign_table}.uid";
                 $local_table_uidlist = intval($this->cObj->data['uid']);
                 $mm_table = 'sys_dmail_ttcontent_category_mm';
                 $whereClause = '';
                 $orderBy = $foreign_table . '.uid';
                 $res = $this->cObj->exec_mm_query_uidList($select, $local_table_uidlist, $mm_table, $foreign_table, $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;
 }