function _moduleContent(&$smarty, $module_name)
{
    global $arrConf;
    //folder path for custom templates
    $local_templates_dir = getWebDirModule($module_name);
    //conexion resource
    $pDB = new paloDB($arrConf['elastix_dsn']["elastix"]);
    //user credentials
    global $arrCredentials;
    $action = getAction();
    $content = "";
    switch ($action) {
        case "new_announcement":
            $content = viewFormAnnouncement($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "view":
            $content = viewFormAnnouncement($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "view_edit":
            $content = viewFormAnnouncement($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "save_new":
            $content = saveNewAnnouncement($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "save_edit":
            $content = saveEditAnnouncement($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "delete":
            $content = deleteAnnouncement($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "reloadAasterisk":
            $content = reloadAasterisk($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        default:
            // report
            $content = reportAnnouncement($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
    }
    return $content;
}
        </nav>

        <!-- Page Content -->
        <div id="page-wrapper">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <h1 class="page-header">Announcements</h1>
                        <a href="addAnnouncement.php" class="btn btn-primary"><i class="fa fa-plus"></i> Add Announcement</a>
                        
                        <p>                             
                            <?php 
include "../../databaseInfo.php";
if (isset($_POST["annID"]) && isset($_POST["announcementName"]) && isset($_POST["imageFileName"])) {
    if (unlink('../../images/' . $_POST["imageFileName"])) {
        if (deleteAnnouncement($_POST["annID"])) {
            generatePage("success", $_POST["announcementName"]);
        } else {
            generatePage("fail", $_POST["announcementName"]);
        }
    } else {
        generatePage("fail_delete_img", $_POST["announcementName"]);
    }
} else {
    generatePage("", "");
}
function deleteAnnouncement($announcementID)
{
    try {
        $connection = new PDO("mysql:host=" . DB_HOST_NAME . ";dbname=" . DB_NAME . ";charset=utf8", DB_USER_NAME, DB_PASSWORD);
        // Exceptions fire when occur
// Add the new announcement if one is being added //
if ($_POST["addannouncement"] == 1 && $_POST["title"] != "" && $_POST["message"] != "") {
    $_POST["date"] = date("Y-m-d");
    $query = mysql_query("INSERT INTO schoolbulletins (title, message, bulletindate) VALUES('{$_POST['title']}', '{$_POST['message']}', '{$_POST['date']}')") or die("ManageAnnouncements.php: Unable to insert new announcement - " . mysql_error());
}
// Edit the announcement if one is being edited //
if ($_POST["editannouncement"] == 1 && $_POST["title"] != "" && $_POST["message"] != "" && $_POST["date"] != "") {
    $query = mysql_query("UPDATE `schoolbulletins` SET `title`='{$_POST['title']}', `message`='{$_POST['message']}', `bulletindate`='" . converttodb($_POST["date"]) . "' WHERE `sbulletinid`='{$_POST['announcementid']}' LIMIT 1") or die("ManageAnnouncements.php: Unable to update the announcement information - " . mysql_error());
}
// Delete the announcement(s) that the announcement has requested as well as the classes belonging to those announcements //
if ($_POST["deleteannouncement"] == 1) {
    require_once "DeleteFunctions.php";
    $delete = $_POST["delete"];
    for ($i = 0; $i < sizeof($delete); $i++) {
        deleteAnnouncement($delete[$i]);
    }
}
print "<script language='JavaScript'>\n\n  // Function to make sure the announcement wants to delete the announcement(s) //\n  function validate()\n  {\n   if( document.announcements.selectannouncement.value > 0 )\n   {\n\tvar confirmed = confirm(\"Are you sure you want to delete this announcement?\");\n\n\tif( confirmed == true )\n\t{\n\t document.announcements.submit();\n\t}\n   }\n   else\n   {\n\talert('You must select a announcement to delete.');\n   }\n  }\n\n\n  // Function to make sure only one checkbox has been selected //\n  function checkboxes()\n  {\n   if( document.announcements.selectannouncement.value == 1 )\n   {\n\tdocument.announcements.submit();\n   }\n   else\n   {\n\tif( document.announcements.selectannouncement.value > 1 )\n\t{\n\t alert('You can only edit one announcement at a time.');\n\t}\n\telse\n\t{\n\t alert('You must select a announcement to edit.');\n\t}\n   }\n  }\n\n\n  // Function to keep track of how many checkboxes are checked //\n  function updateboxes(row)\n  {\n   row = row + 2;\n   if(document.announcements.elements[row].checked)\n   {\n\tdocument.announcements.selectannouncement.value = Math.round(document.announcements.selectannouncement.value) + 1;\n   }\n   else\n   {\n\tdocument.announcements.selectannouncement.value = Math.round(document.announcements.selectannouncement.value) - 1;\n   }\n  }\n </script>\n\n <h1>Manage Announcements</h1>\n <br><br>\n <table align='center' width='600' cellspacing='0' cellpadding='0' border='0'>\n <tr>\n <td>\n <form name='announcements' action='./index.php' method='POST'>\n  <input type='button' value='Add' onClick='document.announcements.page2.value=18;document.announcements.submit();'>\n  <input type='button' value='Edit' onClick='document.announcements.page2.value=19;checkboxes();'>\n  <input type='button' value='Delete' onClick='document.announcements.deleteannouncement.value=1;validate();'>\n  <br><br>\n  <table cellspacing='0' width='600' cellpadding='8' class='dynamiclist'>\n   <tr class='header'>\n\t<td>&nbsp;</td>\n\t<th>Title</th>\n\t<th>Message</th>\n\t<th>Date</th>\n   </tr>";
// Get the total number of announcements to know how many pages to have //
$query = mysql_query("SELECT COUNT(*) FROM schoolbulletins") or die("ManageAnnouncements.php: Unable to retrieve total number of announcements - " . mysql_error());
$numrows = mysql_result($query, 0);
$numpages = ceil($numrows / 25);
if ($_POST["onpage"] == "") {
    $_POST["onpage"] = 1;
}
// Get and display the announcements //
$query = mysql_query("SELECT * FROM schoolbulletins ORDER BY bulletindate DESC") or die("ManageAnnouncements.php: Unable to retrieve the announcements - " . mysql_error());
$row = 0;
$actualrow = 0;
while ($announcement = mysql_fetch_row($query)) {
                echo 'Database write unsuccessful';
            } else {
                header('Location: /announcements.php');
            }
            break;
        case "update":
            $arg = array('value' => $post['value'], 'title' => $post['title'], 'message' => $post['message'], 'start_date' => $post['start_date'], 'end_date' => $post['end_date']);
            $result = updateAnnouncement($arg);
            if ($result == FALSE) {
                return 'Announcement not updated!';
            } else {
                header('Location: /announcements.php');
            }
            break;
        case "delete":
            $result = deleteAnnouncement($post['value']);
            if ($result == FALSE) {
                return 'Announcement not deleted!';
            } else {
                header('Location: /announcements.php');
            }
            break;
        default:
    }
} else {
    $announcements = Announcement::find('all');
}
/**
 * Local Functions
 */
function addAnnouncement($arr = '')