Newsletter: Add custom link to media/post

This commit is contained in:
2020-05-13 19:23:39 +02:00
parent aa9ceb151f
commit 6b023d2546
10 changed files with 80 additions and 41 deletions

View File

@@ -194,7 +194,12 @@ class Spot extends Main
foreach($asNews as $asPost) {
if($asPost['type'] != 'message') {
$oEmail->oTemplate->newInstance('news');
$oEmail->oTemplate->setInstanceTag('news', 'local_server', $this->asContext['serv_name']);
$oEmail->oTemplate->setInstanceTags('news', array(
'local_server' => $this->asContext['serv_name'],
'project' => $this->oProject->getProjectCodeName(),
'type' => $asPost['type'],
'id' => $asPost['id_'.$asPost['type']])
);
$oEmail->oTemplate->addInstance($asPost['type'], $asPost);
$oEmail->oTemplate->setInstanceTag($asPost['type'], 'local_server', $this->asContext['serv_name']);
$iPostCount++;
@@ -391,9 +396,11 @@ class Spot extends Main
$sPriority = $asFeedTypeInfo['priority'];
if($bHistoMode) $sPriority = count($asFeedTypes) - 1 - $asFeedTypeInfo['priority'];
$iId = ($asFeed['unix_time'] * -1).'.'.$sPriority.$asFeed[Db::getId($asFeedTypeInfo['table'])];
$iTableId = $asFeed[Db::getId($asFeedTypeInfo['table'])];
$iId = ($asFeed['unix_time'] * -1).'.'.$sPriority.$iTableId;
$asFeeds[$iId] = $asFeed;
$asFeeds[$iId]['type'] = $sFeedType;
$asFeeds[$iId]['id'] = $iTableId;
}
}
@@ -415,11 +422,12 @@ class Spot extends Main
{
$asData = array(
Db::getId(Project::PROJ_TABLE) => $this->oProject->getProjectId(),
Db::getId(User::USER_TABLE) => $this->oUser->getUserId(),
'name' => mb_strtolower(trim($sName)),
'content' => trim($sPost),
'site_time' => date(Db::TIMESTAMP_FORMAT) //site time (Settings::TIMEZONE)
);
if($this->oUser->getUserId() > 0) $asData[Db::getId(User::USER_TABLE)] = $this->oUser->getUserId();
$iPostId = $this->oDb->insertRow(self::POST_TABLE, $asData);
$this->oUser->updateNickname($sName);