Beispiel #1
0
// Nachschauen ob RSS ueberhaupt aktiviert ist bzw. das Modul oeffentlich zugaenglich ist
if ($gPreferences['enable_announcements_module'] != 1) {
    // das Modul ist deaktiviert
    $gMessage->show($gL10n->get('SYS_MODULE_DISABLED'));
}
//Objekt anlegen
$announcements = new ModuleAnnouncements();
/*** ab hier wird der RSS-Feed zusammengestellt**/
// create RSS feed object with channel information
$rss = new RSSfeed($gCurrentOrganization->getValue('org_longname') . ' - ' . $getHeadline, $gCurrentOrganization->getValue('org_homepage'), $gL10n->get('ANN_RECENT_ANNOUNCEMENTS_OF_ORGA', $gCurrentOrganization->getValue('org_longname')), $gCurrentOrganization->getValue('org_longname'));
//Wenn Ankündigungen vorhanden laden
if ($announcements->getDataSetCount() > 0) {
    $announcement = new TableAnnouncement($gDb);
    $rows = $announcements->getDataset(0, 10);
    // Dem RSSfeed-Objekt jetzt die RSSitems zusammenstellen und hinzufuegen
    foreach ($rows['recordset'] as $row) {
        // ausgelesene Ankuendigungsdaten in Announcement-Objekt schieben
        $announcement->clear();
        $announcement->setArray($row);
        // set data for attributes of this entry
        $title = $announcement->getValue('ann_headline');
        $description = $announcement->getValue('ann_description');
        $link = $g_root_path . '/adm_program/modules/announcements/announcements.php?id=' . $announcement->getValue('ann_id') . '&headline=' . $getHeadline;
        $author = $row['create_name'];
        $pubDate = date('r', strtotime($announcement->getValue('ann_timestamp_create')));
        // add entry to RSS feed
        $rss->addItem($title, $description, $link, $author, $pubDate);
    }
}
// jetzt nur noch den Feed generieren lassen
$rss->buildFeed();
        $result = $gDb->query($sql);
    }
    // show link to edit history
    $historyMenu->addItem('menu_item_edit_history', $g_root_path . '/adm_plugins/history_plugin/history_edit.php?hist_id=' . $getId . '&amp;?headline=' . $getHeadline, '<i class="fa fa-pencil" alt="' . $gL10n->get('SYS_EDIT_VAR', $getHeadline) . '" title="' . $gL10n->get('SYS_EDIT_VAR', $getHeadline) . '"></i><div class="iconDescription">Text bearbeiten</div>', '');
}
// Output Database Entry if available
if (check_db() == true) {
    // get all recordsets
    $historysArray = $historys->getDataSet();
    $history = new TableAnnouncement($gDb);
    if ($historysArray['numResults'] != 0) {
        /// show all history
        foreach ($historysArray['recordset'] as $row) {
            $history->clear();
            $history->setArray($row);
            $page->addHtml('
            <div class="panel panel-primary" id="hist_' . $history->getValue('hist_id') . '">
                <div class="panel-body">' . $history->getValue('hist_description') . '</div>
            </div>');
        }
        // Ende foreach
    } else {
        if (!$gCurrentUser->isWebmaster()) {
            $gMessage->show($gL10n->get('SYS_NO_DATA_FOUND'));
        }
    }
} else {
    $gMessage->show($gL10n->get('SYS_NO_DATA_FOUND'));
}
// show html of complete page
$page->show();
    if (!$announcement->editRight()) {
        $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
    }
}
if (isset($_SESSION['announcements_request'])) {
    // durch fehlerhafte Eingabe ist der User zu diesem Formular zurueckgekehrt
    // nun die vorher eingegebenen Inhalte ins Objekt schreiben
    $announcement->setArray($_SESSION['announcements_request']);
    unset($_SESSION['announcements_request']);
}
// create html page object
$page = new HtmlPage($headline);
// add back link to module menu
$announcementsMenu = $page->getMenu();
$announcementsMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'back.png');
// show form
$form = new HtmlForm('announcements_edit_form', $g_root_path . '/adm_program/modules/announcements/announcements_function.php?ann_id=' . $getAnnId . '&amp;headline=' . $getHeadline . '&amp;mode=1', $page);
$form->addInput('ann_headline', $gL10n->get('SYS_TITLE'), $announcement->getValue('ann_headline'), array('maxLength' => 100, 'property' => FIELD_REQUIRED));
// if current organization has a parent organization or is child organizations then show option to set this announcement to global
if ($gCurrentOrganization->getValue('org_org_id_parent') > 0 || $gCurrentOrganization->hasChildOrganizations()) {
    // show all organizations where this organization is mother or child organization
    $organizations = '- ' . $gCurrentOrganization->getValue('org_longname') . ',<br />- ';
    $organizations .= implode(',<br />- ', $gCurrentOrganization->getOrganizationsInRelationship(true, true, true));
    $form->addCheckbox('ann_global', $gL10n->get('SYS_ENTRY_MULTI_ORGA'), $announcement->getValue('ann_global'), array('helpTextIdLabel' => array('SYS_DATA_GLOBAL', $organizations)));
}
$form->addEditor('ann_description', $gL10n->get('SYS_TEXT'), $announcement->getValue('ann_description'), array('property' => FIELD_REQUIRED));
$form->addSubmitButton('btn_save', $gL10n->get('SYS_SAVE'), array('icon' => THEME_PATH . '/icons/disk.png'));
$form->addHtml(admFuncShowCreateChangeInfoById($announcement->getValue('ann_usr_id_create'), $announcement->getValue('ann_timestamp_create'), $announcement->getValue('ann_usr_id_change'), $announcement->getValue('ann_timestamp_change')));
// add form to html page and show page
$page->addHtml($form->show(false));
$page->show();
    // make html in description secure
    $_POST['ann_description'] = admFuncVariableIsValid($_POST, 'ann_description', 'html');
    // POST Variablen in das Ankuendigungs-Objekt schreiben
    foreach ($_POST as $key => $value) {
        if (strpos($key, 'ann_') === 0) {
            $announcement->setValue($key, $value);
        }
    }
    // Daten in Datenbank schreiben
    $return_code = $announcement->save();
    if ($return_code < 0) {
        $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
    } else {
        if ($getAnnId == 0) {
            $message = $gL10n->get('ANN_EMAIL_NOTIFICATION_MESSAGE', $gCurrentOrganization->getValue('org_longname'), $_POST['ann_headline'], $gCurrentUser->getValue('FIRST_NAME') . ' ' . $gCurrentUser->getValue('LAST_NAME'), date($gPreferences['system_date'], time()));
            $notification = new Email();
            $notification->adminNotfication($gL10n->get('ANN_EMAIL_NOTIFICATION_TITLE'), $message, $gCurrentUser->getValue('FIRST_NAME') . ' ' . $gCurrentUser->getValue('LAST_NAME'), $gCurrentUser->getValue('EMAIL'));
        }
    }
    unset($_SESSION['announcements_request']);
    $gNavigation->deleteLastUrl();
    header('Location: ' . $gNavigation->getUrl());
    exit;
} elseif ($getMode == 2) {
    // Ankuendigung loeschen, wenn diese zur aktuellen Orga gehoert
    if ($announcement->getValue('ann_org_shortname') == $gCurrentOrganization->getValue('org_shortname')) {
        $announcement->delete();
        // Loeschen erfolgreich -> Rueckgabe fuer XMLHttpRequest
        echo 'done';
    }
}
    // no announcements found
    if ($getId > 0) {
        $page->addHtml('<p>' . $gL10n->get('SYS_NO_ENTRY') . '</p>');
    } else {
        $page->addHtml('<p>' . $gL10n->get('SYS_NO_ENTRIES') . '</p>');
    }
} else {
    // get all recordsets
    $announcementsArray = $announcements->getDataSet($getStart, $announcementsPerPage);
    $announcement = new TableAnnouncement($gDb);
    // show all announcements
    foreach ($announcementsArray['recordset'] as $row) {
        $announcement->clear();
        $announcement->setArray($row);
        $page->addHtml('
        <div class="panel panel-primary" id="ann_' . $announcement->getValue('ann_id') . '">
            <div class="panel-heading">
                <div class="pull-left">
                    <img class="admidio-panel-heading-icon" src="' . THEME_PATH . '/icons/announcements.png" alt="' . $announcement->getValue('ann_headline') . '" />' . $announcement->getValue('ann_headline') . '
                </div>
                <div class="pull-right text-right">' . $announcement->getValue('ann_timestamp_create', $gPreferences['system_date']));
        // aendern & loeschen duerfen nur User mit den gesetzten Rechten
        if ($gCurrentUser->editAnnouncements()) {
            if ($announcement->editRight()) {
                $page->addHtml('
                            <a class="admidio-icon-link" href="' . $g_root_path . '/adm_program/modules/announcements/announcements_new.php?ann_id=' . $announcement->getValue('ann_id') . '&amp;headline=' . $getHeadline . '"><img
                                src="' . THEME_PATH . '/icons/edit.png" alt="' . $gL10n->get('SYS_EDIT') . '" title="' . $gL10n->get('SYS_EDIT') . '" /></a>');
            }
            // Loeschen darf man nur Ankuendigungen der eigenen Gliedgemeinschaft
            if ($announcement->getValue('ann_org_id') == $gCurrentOrganization->getValue('org_id')) {
                $page->addHtml('
    // no announcements found
    if ($getId > 0) {
        $page->addHtml('<p>' . $gL10n->get('SYS_NO_ENTRY') . '</p>');
    } else {
        $page->addHtml('<p>' . $gL10n->get('SYS_NO_ENTRIES') . '</p>');
    }
} else {
    // get all recordsets
    $announcementsArray = $announcements->getDataSet($getStart, $announcementsPerPage);
    $announcement = new TableAnnouncement($gDb);
    // show all announcements
    foreach ($announcementsArray['recordset'] as $row) {
        $announcement->clear();
        $announcement->setArray($row);
        $page->addHtml('
        <div class="panel panel-primary" id="ann_' . $announcement->getValue('ann_id') . '">
            <div class="panel-heading">
                <h2>' . $announcement->getValue('ann_headline') . '
                </h2>
                <div class="date-info"><h4>' . $announcement->getValue('ann_timestamp_create', $gPreferences['system_date']) . '<div class="date-actions">');
        // aendern & loeschen duerfen nur User mit den gesetzten Rechten
        if ($gCurrentUser->editAnnouncements()) {
            if ($announcement->editRight()) {
                // @ptabaden: changed icons
                $page->addHtml('
                            <a class="admidio-icon-link" href="' . $g_root_path . '/adm_program/modules/announcements/announcements_new.php?ann_id=' . $announcement->getValue('ann_id') . '&amp;headline=' . $getHeadline . '"><i class="fa fa-pencil" alt="' . $gL10n->get('SYS_EDIT') . '" title="' . $gL10n->get('SYS_EDIT') . '"></i></a>');
            }
            // Loeschen darf man nur Ankuendigungen der eigenen Gliedgemeinschaft
            // @ptabaden: changed icons
            if ($announcement->getValue('ann_org_id') == $gCurrentOrganization->getValue('org_id')) {
                $page->addHtml('
// Objekt anlegen
$plg_announcements = new ModuleAnnouncements();
echo '<div id="plugin_' . $plugin_folder . '" class="admidio-plugin-content">';
if ($plg_show_headline == 1) {
    echo '<h3>' . $gL10n->get('PLG_SIDEBAR_ANNOUNCEMENTS_HEADLINE') . '</h3>';
}
if ($plg_announcements->getDataSetCount() == 0) {
    echo $gL10n->get('SYS_NO_ENTRIES');
} else {
    // Daten holen
    $plg_getAnnouncements = $plg_announcements->getDataSet(0, $plg_announcements_count);
    $plg_announcement = new TableAnnouncement($gDb);
    foreach ($plg_getAnnouncements['recordset'] as $plg_row) {
        $plg_announcement->clear();
        $plg_announcement->setArray($plg_row);
        echo '<div><a class="' . $plg_link_class . '" href="' . $g_root_path . '/adm_program/modules/announcements/announcements.php?id=' . $plg_announcement->getValue("ann_id") . '&amp;headline=' . $gL10n->get('PLG_ANNOUNCEMENTS_HEADLINE') . '" target="' . $plg_link_target . '">';
        if ($plg_max_char_per_word > 0) {
            $plg_new_headline = "";
            unset($plg_words);
            // Woerter unterbrechen, wenn sie zu lang sind
            $plg_words = explode(" ", $plg_announcement->getValue('ann_headline'));
            foreach ($plg_words as $plg_key => $plg_value) {
                if (strlen($plg_value) > $plg_max_char_per_word) {
                    $plg_new_headline = $plg_new_headline . ' ' . substr($plg_value, 0, $plg_max_char_per_word) . '-<br />' . substr($plg_value, $plg_max_char_per_word);
                } else {
                    $plg_new_headline = $plg_new_headline . ' ' . $plg_value;
                }
            }
            echo $plg_new_headline . '</a></div>';
        } else {
            echo $plg_announcement->getValue('ann_headline') . '</a></div>';
//Objekt anlegen
$plg_announcements = new ModuleAnnouncements();
echo '<div id="plugin_' . $plugin_folder . '" class="admidio-plugin-content">';
if ($plg_show_headline == 1) {
    echo '<h3>' . $gL10n->get('PLG_SIDEBAR_ANNOUNCEMENTS_HEADLINE') . '</h3>';
}
if ($plg_announcements->getDataSetCount() == 0) {
    echo $gL10n->get('SYS_NO_ENTRIES');
} else {
    //Daten holen
    $plg_getAnnouncements = $plg_announcements->getDataSet(0, $plg_announcements_count);
    $plg_announcement = new TableAnnouncement($gDb);
    foreach ($plg_getAnnouncements['recordset'] as $plg_row) {
        $plg_announcement->clear();
        $plg_announcement->setArray($plg_row);
        echo '<a class="' . $plg_link_class . '" href="' . $g_root_path . '/adm_program/modules/announcements/announcements.php?id=' . $plg_announcement->getValue("ann_id") . '&amp;headline=' . $gL10n->get('PLG_ANNOUNCEMENTS_HEADLINE') . '" target="' . $plg_link_target . '">';
        if ($plg_max_char_per_word > 0) {
            $plg_new_headline = "";
            unset($plg_words);
            // Woerter unterbrechen, wenn sie zu lang sind
            $plg_words = explode(" ", $plg_announcement->getValue('ann_headline'));
            foreach ($plg_words as $plg_key => $plg_value) {
                if (strlen($plg_value) > $plg_max_char_per_word) {
                    $plg_new_headline = $plg_new_headline . ' ' . substr($plg_value, 0, $plg_max_char_per_word) . '-<br />' . substr($plg_value, $plg_max_char_per_word);
                } else {
                    $plg_new_headline = $plg_new_headline . ' ' . $plg_value;
                }
            }
            echo $plg_new_headline . '</a>';
        } else {
            echo $plg_announcement->getValue('ann_headline') . '</a>';
Beispiel #9
0
        $result = $gDb->query($sql);
    }
    // show link to edit Startseite
    $stsMenu->addItem('menu_item_edit_sts', $g_root_path . '/adm_plugins/sts_plugin/sts_edit.php?sts_id=' . $getId . '&amp;?headline=' . $getHeadline, '<i class="fa fa-pencil" alt="' . $gL10n->get('SYS_EDIT_VAR', $getHeadline) . '" title="' . $gL10n->get('SYS_EDIT_VAR', $getHeadline) . '"></i><div class="iconDescription">Text bearbeiten</div>', '');
}
// Output Database Entry if available
if (check_db() == true) {
    // get all recordsets
    $stssArray = $stss->getDataSet();
    $sts = new TableAnnouncement($gDb);
    if ($stssArray['numResults'] != 0) {
        /// show all sts
        foreach ($stssArray['recordset'] as $row) {
            $sts->clear();
            $sts->setArray($row);
            $page->addHtml('
            <div class="panel panel-primary" id="sts_' . $sts->getValue('sts_id') . '">
                <div class="panel-body">' . $sts->getValue('sts_description') . '</div>
            </div>');
        }
        // Ende foreach
    } else {
        if (!$gCurrentUser->isWebmaster()) {
            $gMessage->show($gL10n->get('SYS_NO_DATA_FOUND'));
        }
    }
} else {
    $gMessage->show($gL10n->get('SYS_NO_DATA_FOUND'));
}
// show html of complete page
$page->show();
        $result = $gDb->query($sql);
    }
    // show link to edit Support
    $supportMenu->addItem('menu_item_edit_support', $g_root_path . '/adm_plugins/support_plugin/support_edit.php?support_id=' . $getId . '&amp;?headline=' . $getHeadline, '<i class="fa fa-pencil" alt="' . $gL10n->get('SYS_EDIT_VAR', $getHeadline) . '" title="' . $gL10n->get('SYS_EDIT_VAR', $getHeadline) . '"></i><div class="iconDescription">Text bearbeiten</div>', '');
}
// Output Database Entry if available
if (check_db() == true) {
    // get all recordsets
    $supportsArray = $supports->getDataSet();
    $support = new TableAnnouncement($gDb);
    if ($supportsArray['numResults'] != 0) {
        /// show all support
        foreach ($supportsArray['recordset'] as $row) {
            $support->clear();
            $support->setArray($row);
            $page->addHtml('
            <div class="panel panel-primary" id="support_' . $support->getValue('support_id') . '">
                <div class="panel-body">' . $support->getValue('support_description') . '</div>
            </div>');
        }
        // Ende foreach
    } else {
        if (!$gCurrentUser->isWebmaster()) {
            $gMessage->show($gL10n->get('SYS_NO_DATA_FOUND'));
        }
    }
} else {
    $gMessage->show($gL10n->get('SYS_NO_DATA_FOUND'));
}
// show html of complete page
$page->show();