include('common_admin_inc.htm'); define( 'MAX_EMAIL_ADDRESSES',20); $sAlert = array( 0 => 'Unspecified', // TicketPriority:UnSpecified 1 => 'Low Filter (All Priority Tickets and Information Notifications)', // TicketPriority:Low 2 => 'Medium Filter (Priority 1 and 2)', // TicketPriority:High 3 => 'High Filter (Priority 1 only)' // TicketPriority:Urgent ); class CNotification { var $guid; var $alertlevel; var $emailaddress; var $enabled; var $active; var $systemAccount; var $accountName; var $comment; function CNotification( $aGuid, $aAlertlevel, $aEmailaddress, $aAccountName, $aEnabled=true, $aSystemAccount=false, $aComment="" ) { $this->guid = $aGuid; $this->alertlevel = $aAlertlevel; $this->emailaddress = $aEmailaddress; $this->enabled = $aEnabled; $this->active = $aActive; $this->systemAccount = $aSystemAccount; $this->accountName = $aAccountName; $this->comment = $aComment; } }; // Handle the progress screen if opened and get the NEW data if ($_SERVER[REQUEST_METHOD] == "POST") { $operationInProgress = true; $status = new ReturnStatus(); error_log("\n\n\n_POST = ". print_r($_POST, true) ); if( isset($_GET['method']) ) { if( $_GET['method'] == 'createNotification' ) { $notification = new CNotification( 0, (int)$_POST['alertLevel'], $_POST['emailAddress'], '', true, false, $_POST['comment'] ); error_log( "My notification = ". print_r($notification, true ) ); add_notification($user, $notification); } else if( $_GET['method'] == 'modifyNotification' ) { $notification = new CNotification( $_POST['currentGuid'], (int)$_POST['modAlertLevel'], $_POST['modEmailAddress'], '', $_POST['modStatus'], false, $_POST['modComment'] ); update_notification($user, $notification); } else if( $_GET['method'] == 'modify1_Notification' ) { list($guid, $address) = explode(":", $_POST['modEmailAddress1']); $notification = new CNotification( $guid, (int)$_POST['modAlertLevel'], $address, $_POST['accountName'], $_POST['modStatus1'], true, $_POST['comment1']); update_notification($user, $notification); } else if( $_GET['method'] == 'deleteNotification' ) { delete_notification($user, $_POST['originalGuid'] ); } } print $status->out(); return; } else { // Load stuff up for the first time $addrs = get_notifications( $user ); $allAddrs=""; $buildInCount = 0; $activeCount = 0; $buildInActiveCount = 0; $buildInList; $nonBuildInList; foreach($addrs as $addr) { if( $addr->active ) { $activeCount++; } if( $addr->buildIn ) { $buildInCount++; $buildInList[] = $addr; if( $addr->active ) { $buildInActiveCount++; } } else { $nonBuildInList[] = $addr; } if( $allAddrs == "" ) { $allAddrs = $addr->emailaddress; } else { $allAddrs = $allAddrs.':'.$addr->emailaddress; } } $addrs = array_merge($buildInList, $nonBuildInList); } ?>