/pages/social-report.php
PHP | 882 lines | 828 code | 28 blank | 26 comment | 176 complexity | a485a67fb016c5efcc1dd3cb13c96e7e MD5 | raw file
- <?php
- if ($fromDate == '') { $fromDate = '20100101'; };
- if ($toDate == '') { $toDate = '20200131'; };
- $result = $sql->que("SELECT * FROM socnet_engage WHERE dat>='" .$fromDate. "' AND dat<='" .$toDate. "' ORDER BY dat ASC");
- ?>
- <h1>Social Networking Data</h1>
- <script src="http://code.highcharts.com/highcharts.js" type="text/javascript"></script>
- <script src="http://code.highcharts.com/modules/exporting.js" type="text/javascript"></script>
- <script src="/resources/scripts/excanvas.min.js" type="text/javascript"></script>
- <div id="holder-social-data" style="height:550px;"></div>
- <br /><br />
- <p>
- <a id="button-search" class="notice" href="#update-data">Update</a>
- <a id="button-reset" class="notice" href="#reset-data">Reset</a>
- <br /><br />
- <select id="filter-select-code" class="update-list">
- <option value="connect">Connections</option>
- <option value="activity">Activity</option>
- <option value="distribution">Distribution</option>
- </select>
- <select id="filter-select-sub" class="update-list">
- <option value="Post">Posts</option>
- <option value="Connection">Connections</option>
- <option value="Share">Sharing</option>
- <option value="Reply">Replies</option>
- <option value="Feedback">Feedback</option>
- </select>
- <select id="filter-select-client" class="update-list">
- <option value="SSI">Softek</option>
- <option value="ILM">Illuminate</option>
- <option value="OTK">Ontrack</option>
- </select>
- <select id="filter-select-site" class="update-list">
- <option value="Facebook">Facebook</option>
- <option value="Twitter">Twitter</option>
- <option value="LinkedIn">LinkedIn</option>
- <option value="Google+">Google+</option>
- <option value="Millennium Medic">Millennium Medic</option>
- </select>
- <select id="filter-select-type" class="update-list">
- <option value="line">Jagged Lines</option>
- <option value="spline">Smooth Lines</option>
- <option value="column">Columns</option>
- <option value="area">Area</option>
- <option value="bar">Bars</option>
- </select>
- </p>
-
- <script>
- $.buildGraph = function(code, type){
- // SET CLIENT TITLE
- var sSite = $('#filter-select-site').val();
-
- if (sSite === 'Millennium Medic') {
- $('#filter-select-client').val('OTK');
- } else if (sSite === 'Millennium Medic') {
- $('#filter-select-client').val('OTK');
- }
-
- var sClient = $('#filter-select-client').val();
-
- if (sClient==='OTK') { setCLIENT = 'OnTrack'; }
- else if (sClient==='ILM') { setCLIENT = 'Illuminate'; }
- else if (sClient==='SSI') { setCLIENT = 'Softek'; }
- else {
- setCLIENT = 'All Sites';
- }
-
- var sSub = $('#filter-select-sub').val();
-
- // SET DATA TYPE
- if (code==='connect') {
- <?php
- while ($row = pg_fetch_array($result)) {
- $mos = $mos."'".$row['dsc']."', ";
- $sFb = $sFb.$row['s_fb_conx'].", ";
- $iFb = $iFb.$row['i_fb_conx'].", ";
- $oFb = $oFb.$row['o_fb_conx'].", ";
- $sTw = $sTw.$row['s_tw_conx'].", ";
- $iTw = $iTw.$row['i_tw_conx'].", ";
- $oTw = $oTw.$row['o_tw_conx'].", ";
- $sLi = $sLi.$row['s_li_conx'].", ";
- $iGp = $iGp.$row['i_gp_conx'].", ";
- $oGp = $oGp.$row['o_gp_conx'].", ";
- $oMm = $oMm.$row['o_mm_conx'].", ";
- } pg_result_seek($result, 0);
- ?>
- var setTITLE = 'Connections';
- var setSUBTITLE = 'each month';
-
- chart = new Highcharts.Chart({
- chart: {
- renderTo: 'holder-social-data',
- defaultSeriesType: type,
- margin: [60, 10, 95, 50]
- },
- colors: [
- '#0099EE',
- '#0022CC',
- '#EE8800',
- '#AABBBB',
- '#FF6600',
- '#FFCC00',
- '#445555',
- '#990000'
- ],
- title: {
- text: setTITLE,
- },
- subtitle: {
- text: setSUBTITLE,
- },
- xAxis: {
- categories: [
- <?php echo substr($mos, 0, -2); ?>
- ],
- labels: {
- rotation: -90,
- align: 'center',
- y: 23,
- x: 3
- },
- plotBands: [
- {
- from: 3,
- to: 4,
- color: 'rgba(68, 170, 213, .1)',
- label: {
- text: 'CHC Campaign',
- align: "center",
- verticalAlign: "bottom",
- y: -8
- }
- },
- {
- from: 5,
- to: 6,
- color: 'rgba(68, 170, 213, .1)',
- label: {
- text: 'RSNA Campaign',
- align: "center",
- verticalAlign: "bottom",
- y: -8
- }
- },
- {
- from: 8,
- to: 9,
- color: 'rgba(68, 170, 213, .1)',
- label: {
- text: 'HIMSS Campaign',
- align: "center",
- verticalAlign: "bottom",
- y: -8
- }
- },
- {
- from: 16,
- to: 17,
- color: 'rgba(68, 170, 213, .1)',
- label: {
- text: 'CHC Campaign',
- align: "center",
- verticalAlign: "bottom",
- y: -8
- }
- },
- {
- from: 18,
- to: 19,
- color: 'rgba(68, 170, 213, .1)',
- label: {
- text: 'RSNA Campaign',
- align: "center",
- verticalAlign: "bottom",
- y: -8
- }
- },
- {
- from: 21,
- to: 22,
- color: 'rgba(68, 170, 213, .1)',
- label: {
- text: 'HIMSS Campaign',
- align: "center",
- verticalAlign: "bottom",
- y: -8
- }
- }
- ],
- plotLines: [{
- value: 2.75,
- width: 1,
- color: '#808080',
- label: {
- text: 'Social Networking Push',
- align: "center",
- verticalAlign: "top",
- y: 75
- }
- }]
- },
- yAxis: {
- min: 0,
- title: {
- text: setTITLE
- }
- },
- tooltip: {
- formatter: function() {
- return '<b>'+ this.series.name +'</b><br />'+
- this.x +': '+ this.y +'';
- }
- },
- credits: { enabled: false },
- legend: {
- align: 'center',
- floating: false,
- verticalAlign: 'bottom',
- borderWidth: 0,
- y: 10
- },
- plotOptions: {
- spline: {
- lineWidth: 2,
- states: {
- hover: {
- lineWidth: 4
- }
- },
- marker: {
- enabled: false,
- states: {
- hover: {
- enabled: true,
- symbol: 'circle',
- radius: 5,
- lineWidth: 1
- }
- }
- },
- }
- },
- series: [
- {
- name: 'SSI Facebook Friends',
- data: [<?php echo substr($sFb, 0, -2); ?>]
- },
- {
- name: 'ILM Facebook Page Likes',
- data: [<?php echo substr($iFb, 0, -2); ?>]
- },
- {
- name: 'OTK Facebook Page Likes',
- data: [<?php echo substr($oFb, 0, -2); ?>]
- },
- {
- name: 'SSI Twitter Followers',
- data: [<?php echo substr($sTw, 0, -2); ?>]
- },
- {
- name: 'ILM Twitter Followers',
- data: [<?php echo substr($iTw, 0, -2); ?>]
- },
- {
- name: 'OTK Twitter Followers',
- data: [<?php echo substr($oTw, 0, -2); ?>]
- },
- {
- name: 'LinkedIn Followers',
- data: [<?php echo substr($sLi, 0, -2); ?>]
- },
- {
- name: 'ILM Google+ Followers',
- data: [<?php echo substr($iGp, 0, -2); ?>]
- },
- {
- name: 'OTK Google+ Followers',
- data: [<?php echo substr($oGp, 0, -2); ?>]
- },
- {
- name: 'Mill. Medic Subscribers',
- data: [<?php echo substr($oMm, 0, -2); ?>]
- }
- ]
- });
-
- } else if (code==='activity') {
- var gConx = [];
- var gPost = [];
- var gReply = [];
- var gChare = [];
- var gLink = [];
- // FACEBOOK
- if (sSite=='Facebook') {
- var tConx = 'Page Likes / Friends';
- var tPost = 'Posts';
- var tReply = 'Comments or Likes';
- var tChare = 'Shares';
- var tLink = 'Links to Web';
- if (sClient=='ILM') {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'gConx.push('.$row['i_fb_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gPost.push('.$row['i_fb_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gReply.push('.$row['i_fb_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gChare.push('.$row['i_fb_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gLink.push('.$row['fb_link'].'); '; } pg_result_seek($result, 0);
- ?>
- } else if (sClient=='OTK') {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'gConx.push('.$row['o_fb_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gPost.push('.$row['o_fb_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gReply.push('.$row['o_fb_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gChare.push('.$row['o_fb_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gLink.push('.$row['fb_link'].'); '; } pg_result_seek($result, 0);
- ?>
- } else {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'gConx.push('.$row['s_fb_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gPost.push('.$row['s_fb_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gReply.push('.$row['s_fb_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gChare.push('.$row['s_fb_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gLink.push('.$row['fb_link'].'); '; } pg_result_seek($result, 0);
- ?>
- }
- }
- // TWITTER
- else if (sSite=='Twitter') {
- var tConx = 'Followers';
- var tPost = 'Posts';
- var tReply = 'Mentions';
- var tChare = 'Re-tweets';
- var tLink = 'Links to Web';
- if (sClient=='ILM') {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'gConx.push('.$row['i_tw_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gPost.push('.$row['i_tw_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gReply.push('.$row['i_tw_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gChare.push('.$row['i_tw_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gLink.push('.$row['tw_link'].'); '; } pg_result_seek($result, 0);
- ?>
- } else if (sClient=='OTK') {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'gConx.push('.$row['o_tw_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gPost.push('.$row['o_tw_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gReply.push('.$row['o_tw_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gChare.push('.$row['o_tw_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gLink.push('.$row['tw_link'].'); '; } pg_result_seek($result, 0);
- ?>
- } else {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'gConx.push('.$row['s_tw_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gPost.push('.$row['s_tw_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gReply.push('.$row['s_tw_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gChare.push('.$row['s_tw_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gLink.push('.$row['tw_link'].'); '; } pg_result_seek($result, 0);
- ?>
- }
- }
- // LINKEDIN
- else if (sSite=='LinkedIn') {
- var tConx = 'Followers';
- var tPost = 'Updates or Msgs Sent';
- var tReply = 'Comments or Replies';
- var tChare = 'Shares';
- var tLink = 'Links to Web';
- if (sClient=='ILM') {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'gConx.push('.$row['s_li_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gPost.push('.$row['i_li_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gReply.push('.$row['i_li_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gChare.push('.$row['i_li_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gLink.push('.$row['li_link'].'); '; } pg_result_seek($result, 0);
- ?>
- } else if (sClient=='OTK') {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'gConx.push('.$row['s_li_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gPost.push('.$row['o_li_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gReply.push('.$row['o_li_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gChare.push('.$row['o_li_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gLink.push('.$row['li_link'].'); '; } pg_result_seek($result, 0);
- ?>
- } else {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'gConx.push('.$row['s_li_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gPost.push('.$row['s_li_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gReply.push('.$row['s_li_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gChare.push('.$row['s_li_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gLink.push('.$row['li_link'].'); '; } pg_result_seek($result, 0);
- ?>
- }
- }
- // GOOGLE
- else if (sSite=='Google+') {
- var tConx = 'Followers';
- var tPost = 'Updates';
- var tReply = 'Comments or +1s';
- var tChare = 'Shares';
- var tLink = 'Links to Web';
- if (sClient=='ILM') {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'gConx.push('.$row['i_gp_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gPost.push('.$row['i_gp_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gReply.push('.$row['i_gp_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gChare.push('.$row['i_gp_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gLink.push('.$row['gp_link'].'); '; } pg_result_seek($result, 0);
- ?>
- } else {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'gConx.push('.$row['o_gp_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gPost.push('.$row['o_gp_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gReply.push('.$row['o_gp_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gChare.push('.$row['o_gp_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gLink.push('.$row['gp_link'].'); '; } pg_result_seek($result, 0);
- ?>
- }
- }
- // MEDIC
- else if (sSite=='Millennium Medic') {
- var tConx = 'Subscribers';
- var tPost = 'Posts';
- var tReply = 'Comments';
- var tChare = 'Shares';
- var tLink = 'Links to Web';
- <?php
- while ($row = pg_fetch_array($result)) { echo 'gConx.push('.$row['o_mm_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gPost.push('.$row['o_mm_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gReply.push('.$row['o_mm_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gChare.push('.$row['o_mm_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'gLink.push('.$row['mm_link'].'); '; } pg_result_seek($result, 0);
- ?>
- }
-
- var setTITLE = 'Profile Activity';
- var setSUBTITLE = sClient+' '+sSite;
-
- chart = new Highcharts.Chart({
- chart: {
- renderTo: 'holder-social-data',
- defaultSeriesType: type,
- margin: [60, 10, 95, 50]
- },
- colors: [
- '#0099EE',
- '#0022CC',
- '#EE8800',
- '#AABBBB',
- '#FF6600',
- '#FFCC00',
- '#445555',
- '#990000'
- ],
- title: {
- text: setTITLE,
- },
- subtitle: {
- text: setSUBTITLE,
- },
- xAxis: {
- categories: [<?php
- while ($row = pg_fetch_array($result)) {
- echo "'".$row['dsc']."', ";
- } pg_result_seek($result, 0); ?>
- ],
- labels: {
- rotation: -90,
- align: 'center',
- y: 23,
- x: 3
- },
- plotBands: [
- {
- from: 3,
- to: 4,
- color: 'rgba(68, 170, 213, .1)',
- label: {
- text: 'CHC Campaign',
- align: "center",
- verticalAlign: "bottom",
- y: -8
- }
- },
- {
- from: 5,
- to: 6,
- color: 'rgba(68, 170, 213, .1)',
- label: {
- text: 'RSNA Campaign',
- align: "center",
- verticalAlign: "bottom",
- y: -8
- }
- },
- {
- from: 8,
- to: 9,
- color: 'rgba(68, 170, 213, .1)',
- label: {
- text: 'HIMSS Campaign',
- align: "center",
- verticalAlign: "bottom",
- y: -8
- }
- },
- {
- from: 16,
- to: 17,
- color: 'rgba(68, 170, 213, .1)',
- label: {
- text: 'CHC Campaign',
- align: "center",
- verticalAlign: "bottom",
- y: -8
- }
- },
- {
- from: 18,
- to: 19,
- color: 'rgba(68, 170, 213, .1)',
- label: {
- text: 'RSNA Campaign',
- align: "center",
- verticalAlign: "bottom",
- y: -8
- }
- },
- {
- from: 21,
- to: 22,
- color: 'rgba(68, 170, 213, .1)',
- label: {
- text: 'HIMSS Campaign',
- align: "center",
- verticalAlign: "bottom",
- y: -8
- }
- }
- ],
- plotLines: [{
- value: 2.75,
- width: 1,
- color: '#808080',
- label: {
- text: 'Social Networking Push',
- align: "center",
- verticalAlign: "top",
- y: 75
- }
- }]
- },
- yAxis: {
- min: -1,
- title: {
- text: setTITLE
- }
- },
- tooltip: {
- formatter: function() {
- return '<b>'+ this.series.name +'</b><br />'+
- this.x +': '+ this.y +'';
- }
- },
- credits: { enabled: false },
- legend: {
- align: 'center',
- floating: false,
- verticalAlign: 'bottom',
- borderWidth: 0,
- y: 10
- },
- plotOptions: {
- spline: {
- lineWidth: 2,
- states: {
- hover: {
- lineWidth: 4
- }
- },
- marker: {
- enabled: false,
- states: {
- hover: {
- enabled: true,
- symbol: 'circle',
- radius: 5,
- lineWidth: 1
- }
- }
- },
- }
- },
- series: [
- { name: tConx, data: gConx },
- { name: tPost, data: gPost },
- { name: tReply, data: gReply },
- { name: tChare, data: gChare },
- { name: tLink, data: gLink }
- ]
- });
-
- } else if (code==='distribution') {
- var sFb = 0;
- var sTw = 0;
- var sLi = 0;
- var sMm = 0;
- var sGp = 0;
-
- var iFb = 0;
- var iTw = 0;
- var iLi = 0;
- var iMm = 0;
- var iGp = 0;
-
- var oFb = 0;
- var oTw = 0;
- var oLi = 0;
- var oMm = 0;
- var oGp = 0;
-
- if (sSub==='Post') {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'sFb = sFb + parseInt('.$row['s_fb_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'sTw = sTw + parseInt('.$row['s_tw_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'sLi = sLi + parseInt('.$row['s_li_post'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'sMm = sMm + parseInt('.$row['s_mm_post'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'sGp = sGp + parseInt('.$row['s_gp_post'].'); '; } pg_result_seek($result, 0);
-
- while ($row = pg_fetch_array($result)) { echo 'iFb = iFb + parseInt('.$row['i_fb_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'iTw = iTw + parseInt('.$row['i_tw_post'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'iLi = iLi + parseInt('.$row['i_li_post'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'iMm = iMm + parseInt('.$row['i_mm_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'iGp = iGp + parseInt('.$row['i_gp_post'].'); '; } pg_result_seek($result, 0);
-
- while ($row = pg_fetch_array($result)) { echo 'oFb = oFb + parseInt('.$row['o_fb_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oTw = oTw + parseInt('.$row['o_tw_post'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'oLi = oLi + parseInt('.$row['o_li_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oMm = oMm + parseInt('.$row['o_mm_post'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oGp = oGp + parseInt('.$row['o_gp_post'].'); '; } pg_result_seek($result, 0);
- ?>
- } else if (sSub==='Share') {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'sFb = sFb + parseInt('.$row['s_fb_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'sTw = sTw + parseInt('.$row['s_tw_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'sLi = sLi + parseInt('.$row['s_li_chare'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'sMm = sMm + parseInt('.$row['s_mm_chare'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'sGp = sGp + parseInt('.$row['s_gp_chare'].'); '; } pg_result_seek($result, 0);
-
- while ($row = pg_fetch_array($result)) { echo 'iFb = iFb + parseInt('.$row['i_fb_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'iTw = iTw + parseInt('.$row['i_tw_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'iLi = iLi + parseInt('.$row['i_li_chare'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'iMm = iMm + parseInt('.$row['i_mm_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'iGp = iGp + parseInt('.$row['i_gp_chare'].'); '; } pg_result_seek($result, 0);
-
- while ($row = pg_fetch_array($result)) { echo 'oFb = oFb + parseInt('.$row['o_fb_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oTw = oTw + parseInt('.$row['o_tw_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oLi = oLi + parseInt('.$row['o_li_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oMm = oMm + parseInt('.$row['o_mm_chare'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oGp = oGp + parseInt('.$row['o_gp_chare'].'); '; } pg_result_seek($result, 0);
- ?>
- } else if (sSub==='Reply') {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'sFb = sFb + parseInt('.$row['s_fb_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'sTw = sTw + parseInt('.$row['s_tw_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'sLi = sLi + parseInt('.$row['s_li_reply'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'sMm = sMm + parseInt('.$row['s_mm_reply'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'sGp = sGp + parseInt('.$row['s_gp_reply'].'); '; } pg_result_seek($result, 0);
-
- while ($row = pg_fetch_array($result)) { echo 'iFb = iFb + parseInt('.$row['i_fb_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'iTw = iTw + parseInt('.$row['i_tw_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'iLi = iLi + parseInt('.$row['i_li_reply'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'iMm = iMm + parseInt('.$row['i_mm_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'iGp = iGp + parseInt('.$row['i_gp_reply'].'); '; } pg_result_seek($result, 0);
-
- while ($row = pg_fetch_array($result)) { echo 'oFb = oFb + parseInt('.$row['o_fb_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oTw = oTw + parseInt('.$row['o_tw_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oLi = oLi + parseInt('.$row['o_li_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oMm = oMm + parseInt('.$row['o_mm_reply'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oGp = oGp + parseInt('.$row['o_gp_reply'].'); '; } pg_result_seek($result, 0);
- ?>
- } else if (sSub==='Connection') {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'sFb = sFb + parseInt('.$row['s_fb_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'sTw = sTw + parseInt('.$row['s_tw_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'sLi = sLi + parseInt('.$row['s_li_conx'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'sMm = sMm + parseInt('.$row['s_mm_conx'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'sGp = sGp + parseInt('.$row['s_gp_conx'].'); '; } pg_result_seek($result, 0);
-
- while ($row = pg_fetch_array($result)) { echo 'iFb = iFb + parseInt('.$row['i_fb_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'iTw = iTw + parseInt('.$row['i_tw_conx'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'iLi = iLi + parseInt('.$row['i_li_conx'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'iMm = iMm + parseInt('.$row['i_mm_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'iGp = iGp + parseInt('.$row['i_gp_conx'].'); '; } pg_result_seek($result, 0);
-
- while ($row = pg_fetch_array($result)) { echo 'oFb = oFb + parseInt('.$row['o_fb_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oTw = oTw + parseInt('.$row['o_tw_conx'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'oLi = oLi + parseInt('.$row['o_li_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oMm = oMm + parseInt('.$row['o_mm_conx'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oGp = oGp + parseInt('.$row['o_gp_conx'].'); '; } pg_result_seek($result, 0);
- ?>
- } else if (sSub==='Feedback') {
- <?php
- while ($row = pg_fetch_array($result)) { echo 'sFb = sFb + parseInt('.$row['s_fb_ratep'].') + parseInt('.$row['s_fb_raten'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'sTw = sTw + parseInt('.$row['s_tw_ratep'].') + parseInt('.$row['s_tw_raten'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'sLi = sLi + parseInt('.$row['s_li_ratep'].') + parseInt('.$row['s_li_raten'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'sMm = sMm + parseInt('.$row['s_mm_ratep'].') + parseInt('.$row['s_mm_raten'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'sGp = sGp + parseInt('.$row['s_gp_ratep'].') + parseInt('.$row['s_gp_raten'].'); '; } pg_result_seek($result, 0);
-
- while ($row = pg_fetch_array($result)) { echo 'iFb = iFb + parseInt('.$row['i_fb_ratep'].') + parseInt('.$row['i_fb_raten'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'iTw = iTw + parseInt('.$row['i_tw_ratep'].') + parseInt('.$row['i_tw_raten'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'iLi = iLi + parseInt('.$row['i_li_ratep'].') + parseInt('.$row['i_li_raten'].'); '; } pg_result_seek($result, 0);
- //while ($row = pg_fetch_array($result)) { echo 'iMm = iMm + parseInt('.$row['i_mm_ratep'].') + parseInt('.$row['i_mm_raten'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'iGp = iGp + parseInt('.$row['i_gp_ratep'].') + parseInt('.$row['i_gp_raten'].'); '; } pg_result_seek($result, 0);
-
- while ($row = pg_fetch_array($result)) { echo 'oFb = oFb + parseInt('.$row['o_fb_ratep'].') + parseInt('.$row['o_fb_raten'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oTw = oTw + parseInt('.$row['o_tw_ratep'].') + parseInt('.$row['o_tw_raten'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oLi = oLi + parseInt('.$row['o_li_ratep'].') + parseInt('.$row['o_li_raten'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oMm = oMm + parseInt('.$row['o_mm_ratep'].') + parseInt('.$row['o_mm_raten'].'); '; } pg_result_seek($result, 0);
- while ($row = pg_fetch_array($result)) { echo 'oGp = oGp + parseInt('.$row['o_gp_ratep'].') + parseInt('.$row['o_gp_raten'].'); '; } pg_result_seek($result, 0);
- ?>
- }
-
- var tFb = sFb + iFb + oFb;
- var tTw = sTw + iTw + oTw;
- var tLi = sLi + iLi + oLi;
- var tMm = sMm + iMm + oMm;
- var tGp = sGp + iGp + oGp;
-
- var setTITLE = sSub+' Distribution';
-
- chart = new Highcharts.Chart({
- chart: {
- renderTo: 'holder-social-data',
- defaultSeriesType: 'column',
- margin: [60, 10, 50, 50]
- },
- title: {
- text: setTITLE
- },
- xAxis: {
- categories: ['Softek', 'Illuminate', 'OnTrack']
- },
- yAxis: {
- min: 0,
- title: {
- text: sSub+'(s)'
- }
- },
- tooltip: {
- formatter: function() {
- var s;
- if (this.point.name) { // the pie chart
- s = ''+ this.series.name +': '+ this.y +' ('+ Math.round(this.percentage) +'%)';
- } else {
- s = ''+ this.series.name +': '+ this.y +' ('+ Math.round(this.percentage) +'%)';
- }
- return s;
- }
- },
- credits: { enabled: false },
- legend: {
- align: 'center',
- floating: false,
- verticalAlign: 'bottom',
- borderWidth: 0,
- y: 10
- },
- plotOptions: {
- column: {
- stacking: 'percent'
- }
- },
- series: [
- {
- type: 'column',
- name: 'Facebook',
- color: '#006',
- data: [ sFb, iFb, oFb ]
- }, {
- type: 'column',
- name: 'Twitter',
- color: '#0784C6',
- data: [ sTw, iTw, oTw ]
- }, {
- type: 'column',
- name: 'LinkedIn',
- color: '#0047A1',
- data: [ sLi, iLi, oLi ]
- }, {
- type: 'column',
- name: 'Google+',
- color: '#F60',
- data: [ sGp, iGp, oGp ]
- }, {
- type: 'column',
- name: 'M. Medic',
- color: '#C30000',
- data: [ sMm, iMm, oMm ]
- }, {
- type: 'pie',
- name: 'Total',
- data: [
- {
- name: 'Facebook',
- y: tFb,
- color: '#006'
- }, {
- name: 'Twitter',
- y: tTw,
- color: '#0784C6'
- }, {
- name: 'LinkedIn',
- y: tLi,
- color: '#0047A1'
- }, {
- name: 'Google+',
- y: tGp,
- color: '#F60'
- }, {
- name: 'M. Medic',
- y: tMm,
- color: '#C30000'
- }
- ],
- center: [470, 250],
- size: 200,
- showInLegend: false,
- dataLabels: {
- enabled: false
- }
- }
- ]
- });
- } // END TYPE CHECK
- };
- $.resetData = function(list, filter){
- $('#filter-select-client').val('ALL').hide();
- $('#filter-select-code').val('connect').show();
- $('#filter-select-type').val('spline').hide();
- $('#filter-select-site').val('SSI').hide();
- $('#filter-select-sub').val('Post').hide();
- $.updateData();
- };
- $.updateData = function(){
- var setCODE = $('#filter-select-code').val();
- var setTYPE = $('#filter-select-type').val();
- if (setCODE==='connect') {
- $('#filter-select-client').hide();
- $('#filter-select-type').show();
- $('#filter-select-site').hide();
- $('#filter-select-sub').hide();
- } else if (setCODE==='activity') {
- $('#filter-select-client').show();
- $('#filter-select-type').show();
- $('#filter-select-site').show();
- $('#filter-select-sub').hide();
- } else if (setCODE==='distribution') {
- $('#filter-select-client').hide();
- $('#filter-select-type').hide();
- $('#filter-select-site').hide();
- $('#filter-select-sub').show();
- }
- $.buildGraph(setCODE, setTYPE);
- };
- $(function() {
- $.resetData();
-
- $('.body').keyup( function (e){
- if (e.keyCode === 13) { // RETURN
- e.preventDefault();
- $.updateData();
- }
- });
- $('#button-search').click(function(e){
- e.preventDefault();
- $.updateData();
- });
- $('#button-reset').click(function(e){
- e.preventDefault();
- $.resetData();
- });
- });
- </script>