, Joe Johnson LICENSE: AGPLv2 # # CHANGELOG: # 220825-1600 - First build # $report_name="VERM reports"; $startMS = microtime(); #$version = '2.14-873'; #$build = '230127-1750'; header ("Content-type: text/html; charset=utf-8"); require("dbconnect_mysqli.php"); require("functions.php"); require("VERM_options.php"); # Get $VERM_default_report_queue from here $PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; $PHP_SELF=$_SERVER['PHP_SELF']; $PHP_SELF = preg_replace('/\.php.*/i','.php',$PHP_SELF); if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method,agent_whisper_enabled,report_default_format,enable_pause_code_limits,allow_web_debug,admin_screen_colors,admin_web_directory FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysqli_num_rows($rslt); if ($qm_conf_ct > 0) { $row=mysqli_fetch_row($rslt); $non_latin = $row[0]; $outbound_autodial_active = $row[1]; $slave_db_server = $row[2]; $reports_use_slave_db = $row[3]; $SSenable_languages = $row[4]; $SSlanguage_method = $row[5]; $agent_whisper_enabled = $row[6]; $SSreport_default_format = $row[7]; $SSenable_pause_code_limits = $row[8]; $SSallow_web_debug = $row[9]; $SSadmin_screen_colors = $row[10]; $SSadmin_web_directory = $row[11]; } if ($SSallow_web_debug < 1) {$DB=0;} ##### END SETTINGS LOOKUP ##### ########################################### if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) { mysqli_close($link); $use_slave_server=1; $db_source = 'S'; require("dbconnect_mysqli.php"); echo "\n"; } # $report_name = 'Vicidial Enhanced Reporting Module'; require("../$SSadmin_web_directory/screen_colors.php"); if ($non_latin < 1) { $PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_USER); $PHP_AUTH_PW = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_PW); } else { $PHP_AUTH_USER = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_USER); $PHP_AUTH_PW = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_PW); } $stmt="SELECT selected_language from vicidial_users where user='$PHP_AUTH_USER';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $sl_ct = mysqli_num_rows($rslt); if ($sl_ct > 0) { $row=mysqli_fetch_row($rslt); $VUselected_language = $row[0]; } $auth=0; $reports_auth=0; $admin_auth=0; $auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'REPORTS',1,0); if ( ($auth_message == 'GOOD') or ($auth_message == '2FA') ) { $auth=1; if ($auth_message == '2FA') { header ("Content-type: text/html; charset=utf-8"); echo _QXZ("Your session is expired").". "._QXZ("Click here to log in").".\n"; exit; } } if ($auth > 0) { $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 7 and view_reports='1';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $admin_auth=$row[0]; $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 6 and view_reports='1';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $reports_auth=$row[0]; if ($reports_auth < 1) { $VDdisplayMESSAGE = _QXZ("You are not allowed to view reports"); Header ("Content-type: text/html; charset=utf-8"); echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; exit; } if ( ($reports_auth > 0) and ($admin_auth < 1) ) { $ADD=999999; $reports_only_user=1; } } else { $VDdisplayMESSAGE = _QXZ("Login incorrect, please try again"); if ($auth_message == 'LOCK') { $VDdisplayMESSAGE = _QXZ("Too many login attempts, try again in 15 minutes"); Header ("Content-type: text/html; charset=utf-8"); echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; exit; } if ($auth_message == 'IPBLOCK') { $VDdisplayMESSAGE = _QXZ("Your IP Address is not allowed") . ": $ip"; Header ("Content-type: text/html; charset=utf-8"); echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; exit; } Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\""); Header("HTTP/1.0 401 Unauthorized"); echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n"; exit; } #### COMPILE QUEUE GROUPS SECTION #### $stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER';"; if ($DB) {$MAIN.="|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $LOGuser_group = $row[0]; $stmt="SELECT allowed_queue_groups from vicidial_user_groups where user_group='$LOGuser_group';"; $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $LOGallowed_queue_groups = $row[0]; $LOGallowed_queue_groupsSQL=''; if ( (!preg_match('/\-ALL\-GROUPS\-/i',$LOGallowed_queue_groups)) and (strlen($LOGallowed_queue_groups) > 3) ) { $rawLOGallowed_queue_groupsSQL = preg_replace("/ \-/",'',$LOGallowed_queue_groups); $rawLOGallowed_queue_groupsSQL = preg_replace("/ /","','",$rawLOGallowed_queue_groupsSQL); $LOGallowed_queue_groupsSQL = "and queue_group IN('---ALL---','$rawLOGallowed_queue_groupsSQL')"; $whereLOGallowed_queue_groupsSQL = "where queue_group IN('---ALL---','$rawLOGallowed_queue_groupsSQL')"; } else {$admin_viewable_groupsALL=1;} $stmt="select * from vicidial_queue_groups where active='Y' $LOGallowed_queue_groupsSQL order by queue_group, queue_group_name;"; $rslt=mysql_to_mysqli($stmt, $link); $queue_dropdown_array=array(); while ($row=mysqli_fetch_array($rslt)) { $queue_dropdown_array["$row[queue_group]"]=$row["queue_group_name"]; } ######################################## if (isset($_GET["widget_type"])) {$widget_type=$_GET["widget_type"];} elseif (isset($_POST["widget_type"])) {$widget_type=$_POST["widget_type"];} if (isset($_GET["widget_id"])) {$widget_id=$_GET["widget_id"];} elseif (isset($_POST["widget_id"])) {$widget_id=$_POST["widget_id"];} if (isset($_GET["wallboard_report_id"])) {$wallboard_report_id=$_GET["wallboard_report_id"];} elseif (isset($_POST["wallboard_report_id"])) {$wallboard_report_id=$_POST["wallboard_report_id"];} if (isset($_GET["vicidial_queue_group"])) {$vicidial_queue_group=$_GET["vicidial_queue_group"];} elseif (isset($_POST["vicidial_queue_group"])) {$vicidial_queue_group=$_POST["vicidial_queue_group"];} ### QUEUE GROUP CAMPAIGNS/INGROUPS - COMPILED FOR DROP-DOWNS # $vicidial_queue_group=RemoveEmptyArrayStrings($vicidial_queue_group); if ($non_latin < 1) { $widget_type=preg_replace('/[^-_0-9a-zA-Z]/','',$widget_type); $widget_id=preg_replace('/[^-_0-9a-zA-Z]/','',$widget_id); $wallboard_report_id=preg_replace('/[^-_0-9a-zA-Z]/','',$wallboard_report_id); $vicidial_queue_group=preg_replace('/[^-_0-9a-zA-Z]/','',$vicidial_queue_group); } else { $widget_type=preg_replace('/[^-_0-9\p{L}]/u','',$widget_type); $widget_id=preg_replace('/[^-_0-9\p{L}]/u','',$widget_id); $wallboard_report_id=preg_replace('/[^-_0-9\p{L}]/u','',$wallboard_report_id); $vicidial_queue_group=preg_replace('/[^-_0-9\p{L}]/u','',$vicidial_queue_group); } if (!$vicidial_queue_group) {$vicidial_queue_group=$VERM_default_report_queue;} if (!$wallboard_report_id) {$wallboard_report_id="AGENTS_AND_QUEUES";} # FILL IN DEFAULT WIDGETS IF THEY DON'T EXIST IN THE MAIN QUEUE REPORT. $queue_dropdown_array["$vicidial_queue_group"]="$vicidial_queue_group"; if ($VERM_default_outb_widget_queue && !$queue_dropdown_array["$VERM_default_outb_widget_queue"]) {$queue_dropdown_array["$VERM_default_outb_widget_queue"]="$VERM_default_outb_widget_queue";} if ($VERM_default_inb_widget_queue1 && !$queue_dropdown_array["$VERM_default_inb_widget_queue1"]) {$queue_dropdown_array["$VERM_default_inb_widget_queue1"]="$VERM_default_inb_widget_queue1";} if ($VERM_default_inb_widget_queue2 && !$queue_dropdown_array["$VERM_default_inb_widget_queue2"]) {$queue_dropdown_array["$VERM_default_inb_widget_queue2"]="$VERM_default_inb_widget_queue2";} if ($vicidial_queue_group) { $vqg_stmt="select included_campaigns, included_inbound_groups, queue_group_name from vicidial_queue_groups where queue_group='$vicidial_queue_group'"; $vqg_rslt=mysql_to_mysqli($vqg_stmt, $link); if(mysqli_num_rows($vqg_rslt)>0) { $vqg_row=mysqli_fetch_array($vqg_rslt); $queue_group_name=$vqg_row["queue_group_name"]; $included_campaigns=trim(preg_replace('/\s\-$/', '', $vqg_row["included_campaigns"])); $included_campaigns_array=sort(explode(" ", $included_campaigns)); $included_campaigns_ct=count($included_campaigns_array); $included_campaigns_clause="and campaign_id in ('".preg_replace('/\s/', "', '", $included_campaigns)."')"; $included_inbound_groups=trim(preg_replace('/\s\-$/', '', $vqg_row["included_inbound_groups"])); $included_inbound_groups_array=sort(explode(" ", $included_inbound_groups)); $included_inbound_groups_ct=count($included_inbound_groups_array); $included_inbound_groups_clause="and group_id in ('".preg_replace('/\s/', "', '", $included_inbound_groups)."')"; $where_included_inbound_groups_clause="where group_id in ('".preg_replace('/\s/', "', '", $included_inbound_groups)."')"; } } /* Commenting this out - unnecessary $campaign_id_stmt="select campaign_id, campaign_name from vicidial_campaigns where campaign_id is not null $included_campaigns_clause order by campaign_name"; # $LOGallowed_campaignsSQL, removed for now per Matt's assurances $campaign_id_rslt=mysql_to_mysqli($campaign_id_stmt, $link); if (mysqli_num_rows($campaign_id_rslt)>0) {$queue_dropdown_array["ALL-OUTBOUND"]="ALL OUTBOUND IN QUEUE GROUP";} while($campaign_id_row=mysqli_fetch_array($campaign_id_rslt)) { $queue_dropdown_array["$campaign_id_row[campaign_id]"]=$campaign_id_row["campaign_name"]; $atomic_queue_str.=$campaign_id_row["campaign_name"]; } $ingroups_id_stmt="select group_id, group_name from vicidial_inbound_groups $where_included_inbound_groups_clause order by group_name"; #where group_id in ('".implode("', '", $allowed_ingroups_array)."') $included_inbound_groups_clause $ingroups_id_rslt=mysql_to_mysqli($ingroups_id_stmt, $link); if (mysqli_num_rows($ingroups_id_rslt)>0) {$queue_dropdown_array["ALL-INBOUND"]="ALL INBOUND IN QUEUE GROUP";} while($ingroups_id_row=mysqli_fetch_array($ingroups_id_rslt)) { $queue_dropdown_array["$ingroups_id_row[group_id]"]=$ingroups_id_row["group_name"]; $atomic_queue_str.=$ingroups_id_row["group_name"]; } */ /* $report_stmt="select * from wallboard_reports where wallboard_report_id='$wallboard_report_id'" $report_rslt=mysql_to_mysqli($report_stmt, $link); if(mysqli_num_rows($report_rslt)>0) { } else { echo "Invalid report ID"; die; } $widgets_stmt= */ #### DEFINE THE WIDGET TYPES, MORE FOR REFERENCE ATP #### $text_widgets_array=array("CLOCK", "TEXT", "OFFERED_CALLS", "LONGEST_WAIT", "LOST_CALLS", "ANSWERED_CALLS"); $circle_widgets_array=array("N_WAITING_CALLS", "LOST_CALLS_GRAPH", "N_ANSWERED_CALLS", "N_OFFERED_CALLS", "N_LONGEST_WAIT", "N_AGENTS_ON_CALL", "LOST_PCT", "ANSWERED_PCT", "AGENTS_READY", "SLA_LEVEL_PCT"); $table_widgets_array=array("LIVE_AGENTS", "LIVE_CALLS", "LIVE_QUEUES"); $bar_chart_widgets_array=array("BAR_GRAPH_SLA"); $mixed_widgets_array=array("LIVE_AGENT_INFO", "LIVE_QUEUE_INFO", "AVG_QUEUE_INFO"); $other_widgets_array=array("LOGO"); # Specific to each page/view $wallboard_views=array(); $wallboard_views[0]=array( "view_name" => "Queues", "view_id" => "queues", "data_refresh_rate" => 10, "columns" => 8 ); $wallboard_views[1]=array( "view_name" => "Agents", "view_id" => "agents", "data_refresh_rate" => 10, "columns" => 7 ); $view_widgets=array( # widget_width (colspan) = X # widget_is_row = Y # widget_type = # widget_queue = # widget_order = ); $widget_id=$view_id."_widget_".$widget_order; $view_widgets["queues"][0]=array( "widget_id" => "queues_widget_0", "widget_type" => "LOGO", "widget_width" => 2, "widget_title" => "", "widget_order" => 1, "widget_is_row" => "N" ); $view_widgets["queues"][1]=array( "widget_id" => "queues_widget_1", "widget_type" => "TEXT", "widget_width" => 5, "widget_title" => "", "widget_order" => 2, "widget_is_row" => "N" ); $view_widgets["queues"][2]=array( "widget_id" => "queues_widget_2", "widget_type" => "SLA_LEVEL_PCT", "widget_width" => 1, "widget_title" => substr(_QXZ("SLA Level %"), 0, 20), "widget_order" => 3, "widget_is_row" => "N" ); $view_widgets["queues"][3]=array( "widget_id" => "queues_widget_3", "widget_type" => "LIVE_QUEUE_INFO", "widget_queue" => "$VERM_default_outb_widget_queue", "widget_width" => 1, "widget_title" => substr(_QXZ("$VERM_default_outb_widget_queue_name"), 0, 20), "widget_order" => 4, "widget_is_row" => "N" ); $view_widgets["queues"][4]=array( "widget_id" => "queues_widget_4", "widget_type" => "LIVE_QUEUE_INFO", "widget_queue" => "$VERM_default_inb_widget_queue1", "widget_width" => 1, "widget_title" => substr(_QXZ("$VERM_default_inb_widget_queue1_name"), 0, 20), "widget_order" => 5, "widget_is_row" => "N" ); $view_widgets["queues"][5]=array( "widget_id" => "queues_widget_5", "widget_type" => "LIVE_QUEUE_INFO", "widget_queue" => "$VERM_default_inb_widget_queue2", "widget_width" => 1, "widget_title" => substr(_QXZ("$VERM_default_inb_widget_queue2"), 0, 20), "widget_order" => 6, "widget_is_row" => "N" ); $view_widgets["queues"][6]=array( "widget_id" => "queues_widget_6", "widget_type" => "N_WAITING_CALLS", "widget_width" => 1, "widget_title" => substr(_QXZ("N Waiting Calls"), 0, 20), "widget_order" => 7, "widget_is_row" => "N" ); $view_widgets["queues"][7]=array( "widget_id" => "queues_widget_7", "widget_type" => "OFFERED_CALLS", "widget_width" => 1, "widget_title" => substr(_QXZ("Offered Calls"), 0, 20), "widget_order" => 8, "widget_is_row" => "N" ); $view_widgets["queues"][8]=array( "widget_id" => "queues_widget_8", "widget_type" => "ANSWERED_CALLS", "widget_width" => 1, "widget_title" => substr(_QXZ("Answered Calls"), 0, 20), "widget_order" => 9, "widget_is_row" => "N" ); $view_widgets["queues"][9]=array( "widget_id" => "queues_widget_9", "widget_type" => "LOST_CALLS", "widget_width" => 1, "widget_title" => substr(_QXZ("Lost Calls"), 0, 20), "widget_order" => 10, "widget_is_row" => "N" ); $view_widgets["queues"][10]=array( "widget_id" => "queues_widget_10", "widget_type" => "LONGEST_WAIT", "widget_width" => 1, "widget_title" => substr(_QXZ("Longest Wait"), 0, 20), "widget_order" => 11, "widget_is_row" => "N" ); $view_widgets["queues"][11]=array( "widget_id" => "queues_widget_11", "widget_type" => "LIVE_QUEUES", "widget_width" => 1, "widget_title" => substr(_QXZ("Live Campaigns"), 0, 20), "widget_order" => 12, "widget_is_row" => "Y" ); $view_widgets["queues"][12]=array( "widget_id" => "queues_widget_12", "widget_type" => "LIVE_CALLS", "widget_width" => 1, "widget_title" => substr(_QXZ("Live Calls"), 0, 20), "widget_order" => 13, "widget_is_row" => "Y", "widget_rowspan" => 2 ); ########## $view_widgets["agents"][0]=array( "widget_id" => "agent_widget_0", "widget_type" => "LOGO", "widget_width" => 2, "widget_title" => "", "widget_order" => 1, "widget_is_row" => "N" ); $view_widgets["agents"][1]=array( "widget_id" => "agent_widget_1", "widget_type" => "N_WAITING_CALLS", "widget_width" => 1, "widget_title" => substr(_QXZ("N Waiting Calls"), 0, 20), "widget_order" => 2, "widget_is_row" => "N" ); $view_widgets["agents"][2]=array( "widget_id" => "agent_widget_2", "widget_type" => "AGENTS_READY", "widget_width" => 1, "widget_title" => substr(_QXZ("Agents Ready"), 0, 20), "widget_order" => 3, "widget_is_row" => "N" ); $view_widgets["agents"][3]=array( "widget_id" => "agent_widget_3", "widget_type" => "N_AGENTS_ON_CALL", "widget_width" => 1, "widget_title" => substr(_QXZ("Agents On Call"), 0, 20), "widget_order" => 4, "widget_is_row" => "N" ); $view_widgets["agents"][4]=array( "widget_id" => "agent_widget_4", "widget_type" => "N_ANSWERED_CALLS", "widget_width" => 1, "widget_title" => substr(_QXZ("N Answered Calls"), 0, 20), "widget_order" => 5, "widget_is_row" => "N" ); $view_widgets["agents"][5]=array( "widget_id" => "agent_widget_5", "widget_type" => "CLOCK", "widget_width" => 1, "widget_title" => substr(_QXZ("Clock"), 0, 20), "widget_order" => 6, "widget_is_row" => "N" ); $view_widgets["agents"][6]=array( "widget_id" => "agent_widget_6", "widget_type" => "LIVE_AGENTS", "widget_width" => 1, "widget_title" => substr(_QXZ("Live Agents"), 0, 20), "widget_order" => 7, "widget_is_row" => "Y", "widget_rowspan" => 3 ); # These should come from the previous lines; $report_name="Agents and Queues"; $report_views=count($view_widgets); # "Views" = pages $current_page="Queues"; $page_change_rate="30"; $view_name=""; $data_refresh_rate="10"; #$current_view ?> <?php echo _QXZ("$report_name"); ?> - Wallboard
     "; } echo "      "; ?> $current_page     [X]          "; #echo "" # echo ""; ?>
\n"; $table_width=100; echo ""; # Make header/footer column to define widths echo ""; $total_width=0; $columns=$wallboard_views[$v]["columns"]; for ($p=1; $p<=$columns; $p++) { $current_column_width=round($table_width*$p/$columns)-$total_width; echo "\n"; $total_width+=$current_column_width; } echo "\n"; $view_id=$wallboard_views[$v]["view_id"]; if ($view_widgets["$view_id"]) { # print_r($view_widgets["$view_id"]); $current_cell_position=0; $ins_stmts="\n"; while($current_cell_position<$columns) { echo ""; $current_cell_position++; } echo ""; } #"widget_type" => "LOGO", #"widget_width" => 2, #"widget_title" => "", #"widget_order" => 1, #"widget_is_row" => "N" # QUERY WIDGETS TABLE USING WALLBOARD_ID and VIEW_ID # echo echo "
 
\n"; echo $ins_stmts; echo "\n"; } ?>