Beispiel #1
0
** 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);
        //now loop through each resource and send the email alert
        foreach ($resourceIDArray as $resourceID) {