<?php

$alertDaysInAdvanceID = $_POST['alertDaysInAdvanceID'];
$daysInAdvanceNumber = $_POST['daysInAdvanceNumber'];
if ($alertDaysInAdvanceID != '') {
    $instance = new AlertDaysInAdvance(new NamedArguments(array('primaryKey' => $alertDaysInAdvanceID)));
} else {
    $instance = new AlertDaysInAdvance();
}
$instance->daysInAdvanceNumber = $daysInAdvanceNumber;
try {
    $instance->save();
} catch (Exception $e) {
    echo $e->getMessage();
}
Example #2
0
** This file is part of CORAL.
**
** CORAL is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
**
** CORAL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License along with CORAL.  If not, see <http://www.gnu.org/licenses/>.
**
**************************************************************************************************************************
*/
session_start();
include_once 'directory.php';
$util = new Utility();
$config = new Configuration();
if ($config->settings->enableAlerts == 'Y') {
    $alertDaysInAdvance = new AlertDaysInAdvance();
    //returns array of all days in advance objects
    $alertDaysArray = $alertDaysInAdvance->all();
    $resourceIDArray = array();
    //loop through each of the days, e.g. 30, 60, 90
    foreach ($alertDaysArray as $alertDays) {
        //get resources that fit this criteria
        if (is_numeric($alertDays->daysInAdvanceNumber)) {
            foreach ($alertDays->getResourcesToAlert() as $resource) {
                $resourceIDArray[] = $resource->resourceID;
            }
        }
    }
    if (count($resourceIDArray) > 0) {
        //now get unique resource IDs out
        $resourceIDArray = array_unique($resourceIDArray);
<?php

$alertEmailAddress = new AlertEmailAddress();
$alertDaysInAdvance = new AlertDaysInAdvance();
$emailAddressArray = $alertEmailAddress->allAsArray();
$daysInAdvanceArray = $alertDaysInAdvance->allAsArray();
echo "<div class='adminRightHeader'>" . _("Alert Settings") . "</div>";
if (count($emailAddressArray) > 0) {
    ?>
			<table class='linedDataTable'>
				<tr>
				<th style='width:100%;'><?php 
    echo _("Email Address");
    ?>
</th>
				<th style='width:20px;'>&nbsp;</th>
				<th style='width:20px;'>&nbsp;</th>
				</tr>
				<?php 
    foreach ($emailAddressArray as $emailAddress) {
        echo "<tr>";
        echo "<td>" . $emailAddress['emailAddress'] . "</td>";
        echo "<td><a href='ajax_forms.php?action=getAdminAlertEmailForm&alertEmailAddressID=" . $emailAddress['alertEmailAddressID'] . "&height=128&width=260&modal=true' class='thickbox'><img src='images/edit.gif' alt='" . _("edit") . "' title='" . _("edit") . "'></a></td>";
        echo "<td><a href='javascript:deleteAlert(\"AlertEmailAddress\", " . $emailAddress['alertEmailAddressID'] . ");'><img src='images/cross.gif' alt='" . _("remove") . "' title='" . _("remove") . "'></a></td>";
        echo "</tr>";
    }
    ?>
			</table>
			<?php 
} else {
    echo _("(none found)") . "<br />";