digest: add ARTICLE_LABELS

This commit is contained in:
Andrew Dolgov 2019-03-02 17:57:25 +03:00
parent a130da2d1a
commit da1b3e3ba1
3 changed files with 17 additions and 4 deletions

View File

@ -11,9 +11,10 @@ class Backend extends Handler {
$rv = Digest::prepare_headlines_digest($_SESSION['uid'], 1, 1000); $rv = Digest::prepare_headlines_digest($_SESSION['uid'], 1, 1000);
$rv[3] = "<pre>" . $rv[3] . "</pre>"; print "<h1>HTML</h1>";
print $rv[0];
print_r($rv); print "<h1>Plain text</h1>";
print "<pre>".$rv[3]."</pre>";
} }
private function display_main_help() { private function display_main_help() {

View File

@ -166,6 +166,15 @@ class Digest
$line['feed_title'] = $line['cat_title'] . " / " . $line['feed_title']; $line['feed_title'] = $line['cat_title'] . " / " . $line['feed_title'];
} }
$article_labels = Article::get_article_labels($line["ref_id"], $user_id);
$article_labels_formatted = "";
if (is_array($article_labels) && count($article_labels) > 0) {
$article_labels_formatted = implode(", ", array_map(function($a) {
return $a[1];
}, $article_labels));
}
$tpl->setVariable('FEED_TITLE', $line["feed_title"]); $tpl->setVariable('FEED_TITLE', $line["feed_title"]);
$tpl->setVariable('ARTICLE_TITLE', $line["title"]); $tpl->setVariable('ARTICLE_TITLE', $line["title"]);
$tpl->setVariable('ARTICLE_LINK', $line["link"]); $tpl->setVariable('ARTICLE_LINK', $line["link"]);
@ -174,6 +183,7 @@ class Digest
truncate_string(strip_tags($line["content"]), 300)); truncate_string(strip_tags($line["content"]), 300));
// $tpl->setVariable('ARTICLE_CONTENT', // $tpl->setVariable('ARTICLE_CONTENT',
// strip_tags($article_content)); // strip_tags($article_content));
$tpl->setVariable('ARTICLE_LABELS', $article_labels_formatted, true);
$tpl->addBlock('article'); $tpl->addBlock('article');
@ -181,6 +191,7 @@ class Digest
$tpl_t->setVariable('ARTICLE_TITLE', $line["title"]); $tpl_t->setVariable('ARTICLE_TITLE', $line["title"]);
$tpl_t->setVariable('ARTICLE_LINK', $line["link"]); $tpl_t->setVariable('ARTICLE_LINK', $line["link"]);
$tpl_t->setVariable('ARTICLE_UPDATED', $updated); $tpl_t->setVariable('ARTICLE_UPDATED', $updated);
$tpl_t->setVariable('ARTICLE_LABELS', $article_labels_formatted, true);
// $tpl_t->setVariable('ARTICLE_EXCERPT', // $tpl_t->setVariable('ARTICLE_EXCERPT',
// truncate_string(strip_tags($line["excerpt"]), 100)); // truncate_string(strip_tags($line["excerpt"]), 100));

View File

@ -6,7 +6,8 @@
<ul> <ul>
<!-- $BeginBlock article --> <!-- $BeginBlock article -->
<li><a href="${ARTICLE_LINK}">${ARTICLE_TITLE}</a> - ${ARTICLE_UPDATED} <li><a href="${ARTICLE_LINK}">${ARTICLE_TITLE}</a> &mdash; <strong>${ARTICLE_UPDATED}</strong>
<div style='font-style : italic'>${ARTICLE_LABELS}</div>
<div style='color : gray'>${ARTICLE_EXCERPT}</div> <div style='color : gray'>${ARTICLE_EXCERPT}</div>
<!-- $EndBlock article --> <!-- $EndBlock article -->
</ul> </ul>