<?php /* * **************************************************************************************** * Copyright (c) 2013 Christopher W. Olsen <cwolsen@ubixtechnologies.com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions, the following disclaimer and the list of authors. Redistributions in binary * form must reproduce the above copyright notice, this list of conditions, the following * disclaimer and the list of authors in the documentation and/or other materials provided * with the distribution. Neither the name of the uBix Cube Project nor the names of its * contributors may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $Id: index.php 940 2017-09-07 20:12:42Z reddawg $ * * *************************************************************************************** */ /* Main include info */ ini_set ( 'include_path', $_SERVER ['DOCUMENT_ROOT'] . "/include/" ); include ("config.php"); /* Assign the page title */ $ubF->tpl->assign ( "PAGE_TITLE", "Dialer Preferences" ); /* Main defines */ $ubF->tpl->define ( array ( "index" => "admin/wrapper/default.html" ) ); $ubF->tpl->define ( array ( "menu" => "admin/dialer/menu.html" ) ); $ubF->tpl->define ( array ( "body" => "admin/dialer/main.html" ) ); $ubF->session->Validate ( 'U_D_', 1 ); $days_30_back = strtotime ( "-30 days", time () - 86399 ); $days_28_back = strtotime ( "-28 days", time () - 86399 ); $days_21_back = strtotime ( "-21 days", time () - 86399 ); $days_14_back = strtotime ( "-14 days", time () - 86399 ); $days_07_back = strtotime ( "-7 days", time () - 86399 ); $query = "SELECT * FROM dialer_stats WHERE (user_group = '" . $ubF->session->press1_group . "' OR user_group = '" . $ubF->session->dialer_group . "') AND date >= $days_30_back ORDER BY campaign_id, date DESC"; $broadcast_rows = ""; $dialer_rows = ""; $bc_calls_total = 0; $bc_spent_total = 0; $bc_optin_total = 0; $bc_optout_total = 0; $dc_calls_total = 0; $dc_spent_total = 0; $dc_optin_total = 0; $dc_optout_total = 0; $result = $ubF->DB['main']->query ( $query ); while ( $qData = $result->fetch_assoc () ) { if ( $qData ['type'] == 0 ) { $bc_calls_total += $qData ['calls']; $bc_spent_total += $qData ['spent']; $bc_optin_total += $qData ['opt_in']; $bc_optout_total += $qData ['opt_out']; } else { $dc_calls_total += $qData ['calls']; $dc_spent_total += $qData ['spent']; } if ( $qData ['date'] >= $days_07_back ) { if ( !isset ( $prev_id ) ) $prev_id = $qData ['campaign_id']; $r_type = $qData ['type']; if ( $prev_id == $qData ['campaign_id'] ) { $campaign_id = $qData ['campaign_id']; if ( strlen ( $qData ['campaign_name'] ) > 20 ) $campaign_name = substr ( $qData ['campaign_name'], 0, 17 ) . "..."; else $campaign_name = $qData ['campaign_name']; $campaign_date .= date ( "m/d/Y", $qData ['date'] ) . "<hr class=\"doHR\">"; $campaign_calls .= number_format ( $qData ['calls'] ) . "<hr class=\"doHR\">"; $opt_in .= $qData ['opt_in'] . "<hr class=\"doHR\">"; $opt_out .= $qData ['opt_out'] . "<hr class=\"doHR\">"; $spent .= "$" . number_format ( $qData ['spent'], 2 ) . "<hr class=\"doHR\">"; } else { if ( $r_type == 0 ) $broadcast_rows .= "<tr><td>" . $campaign_id . "</td><td>" . $campaign_name . "</td><td>" . $campaign_date . "</td><td>" . $campaign_calls . "</td><td>" . $opt_in . "</td><td>" . $opt_out . "</td><td>" . $spent . "</td></tr>"; else $dialer_rows .= "<tr><td>" . $campaign_id . "</td><td>" . $campaign_name . "</td><td>" . $campaign_date . "</td><td>" . $campaign_calls . "</td><td>" . $opt_in . "</td><td>" . $opt_out . "</td><td>" . $spent . "</td></tr>"; $campaign_id = $qData ['campaign_id']; if ( strlen ( $qData ['campaign_name'] ) > 20 ) $campaign_name = substr ( $qData ['campaign_name'], 0, 17 ) . "..."; else $campaign_name = $qData ['campaign_name']; $campaign_date = date ( "m/d/Y", $qData ['date'] ) . "<br>"; $campaign_calls = number_format ( $qData ['calls'] ) . "<br>"; $opt_in = $qData ['opt_in'] . "<br>"; $opt_out = $qData ['opt_out'] . "<br>"; $spent = "$" . number_format ( $qData ['spent'], 2 ) . "<br>"; $prev_id = $qData ['campaign_id']; } } } if ( $r_type == 0 ) $broadcast_rows .= "<tr><td>" . $campaign_id . "</td><td>" . $campaign_name . "</td><td>" . $campaign_date . "</td><td>" . $campaign_calls . "</td><td>" . $opt_in . "</td><td>" . $opt_out . "</td><td>" . $spent . "</td></tr>"; else $dialer_rows .= "<tr><td>" . $campaign_id . "</td><td>" . $campaign_name . "</td><td>" . $campaign_date . "</td><td>" . $campaign_calls . "</td><td>" . $opt_in . "</td><td>" . $opt_out . "</td><td>" . $spent . "</td></tr>"; if ( strlen ( $broadcast_rows ) == 0 ) $broadcast_rows = "<tr><td colspan=\"7\">No Data Available</td></tr>"; if ( strlen ( $dialer_rows ) == 0 ) $dialer_rows = "<tr><td colspan=\"7\">No Data Available</td></tr>"; $ubF->tpl->assign ( "BROADCAST_ROWS", $broadcast_rows ); $ubF->tpl->assign ( "DIALER_ROWS", $dialer_rows ); $ubF->tpl->assign ( "AS_BC_DAILY", number_format ( $bc_spent_total / 30, 2 ) ); $ubF->tpl->assign ( "AS_BC_WEEKLY", number_format ( $bc_spent_total / 4.28, 2 ) ); $ubF->tpl->assign ( "AS_BC_MONTHLY", number_format ( $bc_spent_total, 2 ) ); $ubF->tpl->assign ( "AC_BC_DAILY", number_format ( $bc_calls_total / 30, 2 ) ); $ubF->tpl->assign ( "AC_BC_WEEKLY", number_format ( $bc_calls_total / 4.28, 2 ) ); $ubF->tpl->assign ( "AC_BC_MONTHLY", number_format ( $bc_calls_total, 2 ) ); $ubF->tpl->assign ( "AI_BC_DAILY", number_format ( $bc_optin_total / 30, 2 ) ); $ubF->tpl->assign ( "AI_BC_WEEKLY", number_format ( $bc_optin_total / 4.28, 2 ) ); $ubF->tpl->assign ( "AI_BC_MONTHLY", number_format ( $bc_optin_total, 2 ) ); $ubF->tpl->assign ( "AO_BC_DAILY", number_format ( $bc_optout_total / 30, 2 ) ); $ubF->tpl->assign ( "AO_BC_WEEKLY", number_format ( $bc_optout_total / 4.28, 2 ) ); $ubF->tpl->assign ( "AO_BC_MONTHLY", number_format ( $bc_optout_total, 2 ) ); $ubF->tpl->assign ( "AS_DC_DAILY", number_format ( $dc_spent_total / 30, 2 ) ); $ubF->tpl->assign ( "AS_DC_WEEKLY", number_format ( $dc_spent_total / 4.28, 2 ) ); $ubF->tpl->assign ( "AS_DC_MONTHLY", number_format ( $dc_spent_total, 2 ) ); $ubF->tpl->assign ( "AC_DC_DAILY", number_format ( $dc_calls_total / 30, 2 ) ); $ubF->tpl->assign ( "AC_DC_WEEKLY", number_format ( $dc_calls_total / 4.28, 2 ) ); $ubF->tpl->assign ( "AC_DC_MONTHLY", number_format ( $dc_calls_total, 2 ) ); $ubF->tpl->assign ( "AI_DC_DAILY", number_format ( $dc_optin_total / 30, 2 ) ); $ubF->tpl->assign ( "AI_DC_WEEKLY", number_format ( $dc_optin_total / 4.28, 2 ) ); $ubF->tpl->assign ( "AI_DC_MONTHLY", number_format ( $dc_optin_total, 2 ) ); $ubF->tpl->assign ( "AO_DC_DAILY", number_format ( $dc_optout_total / 30, 2 ) ); $ubF->tpl->assign ( "AO_DC_WEEKLY", number_format ( $dc_optout_total / 4.28, 2 ) ); $ubF->tpl->assign ( "AO_DC_MONTHLY", number_format ( $dc_optout_total, 2 ) ); /* Parse and print */ $ubF->tpl->parse ( "MENU", array ( "menu" ) ); $ubF->tpl->parse ( "BODY", array ( "body" ) ); $ubF->tpl->parse ( "INDEX", array ( "index" ) ); $ubF->tpl->FastPrint ( "INDEX" ); ?>