Esempio n. 1
0
 /**
  * @return NewsArticleManger
  */
 public static function getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Esempio n. 2
0
function display_news($eventid = 1)
{
    global $sql_prefix;
    if (!config("enable_news", $eventid)) {
        return false;
    }
    $articles = NewsArticleManger::getInstance()->getArticles($eventid, true);
    if (count($articles) < 1) {
        return false;
    }
    $return = "<div class=\"news-section\"><h2>" . lang("News", "news") . "</h2>\n";
    foreach ($articles as $article) {
        $return .= "<article class='newsbox'>";
        $return .= "<header><h3>" . $article->getHeader() . "</h3><div class=\"meta\">" . date("d.m.Y H:i:s", $article->getCreateTime()) . "</div></header>\n";
        $return .= "<div class=\"content\">" . $article->getContent() . "</div>\n";
        $return .= "</article>\n";
    }
    $return .= "</div>";
    return $return;
}
Esempio n. 3
0
<?php

$manager = NewsArticleManger::getInstance();
$acl = acl_access("news", "", $sessioninfo->eventID);
$global_acl = acl_access("news", "", 1);
$content .= "<div class=\"newsadmin\">";
if ($action == "newsadmin" && ($acl == 'Admin' || $acl == 'Write')) {
    $articles = $manager->getArticles($sessioninfo->eventID);
    if (count($articles) > 0) {
        $content .= "<h2>" . _("Manage news articles") . "</h2>";
        $content .= "<table class='better-table'><tbody><tr><th>" . _("Name") . "</th><th>" . _("Actions") . "</th></tr>";
        foreach ($articles as $article) {
            $content .= "\n\t\t\t<tr>\n\t\t\t\t<td>" . $article->getHeader() . "\n\t\t\t\t" . ($article->isActive() ? " <span style=\"color:#01B501; font-style:italic;\">(" . _("Published") . ")</span>" : " <span style=\"color:#EA0505; font-style:italic;\">(" . _("Draft") . ")</span>") . "\n\t\t\t\t" . ($article->isGlobal() ? " <span style=\"color:#E29405; font-style:italic;\">(" . _("Global") . ")</span>" : "") . "\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<button onclick=\"window.location = '?module={$module}&amp;action=editArticle&amp;articleID=" . $article->getArticleID() . "';\">" . _("Edit") . "</button>\n\t\t\t\t\t<button onclick=\"window.location = '?module={$module}&amp;action=deleteArticle&amp;articleID=" . $article->getArticleID() . "';\">" . _("Delete") . "</button>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n";
        }
        // end foreach
        $content .= "</tbody></table>\n\n";
    }
    // end if
    $content .= "<div class=\"create-form\"><h2>" . _("Create new article") . "</h2>";
    $content .= "<form method=\"post\" action=\"?module=news&action=doAddArticle\">\n";
    $content .= "<input type=\"text\" name=\"articleHeader\" placeholder=\"" . _("Article header...") . "\" />\n";
    $content .= "<input type=\"submit\" value='" . lang("Add new article", "news") . "' />\n";
    $content .= "</form></div>";
    $content .= "";
} elseif ($action == "doAddArticle" && ($acl == 'Admin' || $acl == 'Write')) {
    $header = $_POST['articleHeader'];
    $global_article = $_POST['global_article'];
    // Check if the article should be global, and set var
    if (($global_acl == 'Admin' || $global_acl == 'Write') && $global_article == 'on') {
        $global_article = true;
    } else {