Browse Source

dashboard

windhamdavid 10 years ago
parent
commit
183f640fa4
4 changed files with 54 additions and 0 deletions
  1. 7 0
      functions.php
  2. 26 0
      inc/dashboard.php
  3. 0 0
      js/dashboard.js
  4. 21 0
      page-dashboard.php

+ 7 - 0
functions.php

@@ -78,6 +78,13 @@ function dw_scripts() {
 		//wp_enqueue_script( 'script-o', get_template_directory_uri() . '/js/script-o.js', '', '', true );
 		wp_enqueue_script( 'form', get_template_directory_uri() . '/js/form.js', '', '', true );
 	}
+	elseif ( is_page('dashboard') ) {
+		require( get_template_directory() . '/inc/dashboard.php' );
+		wp_enqueue_style( 'forms', get_template_directory_uri() . '/css/dashboard.css');
+		wp_enqueue_script('jquery', get_template_directory_uri() . '/js/jquery-2.1.1.min.js', array(), false, true);
+		//wp_enqueue_script( 'script-o', get_template_directory_uri() . '/js/script-o.js', '', '', true );
+		wp_enqueue_script( 'form', get_template_directory_uri() . '/js/dashboard.js', '', '', true );
+	}
 	
 	elseif ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
 		wp_enqueue_script( 'jquery', get_template_directory_uri() . '/js/script-o.js', '', '', true );

+ 26 - 0
inc/dashboard.php

@@ -0,0 +1,26 @@
+<?php
+
+function dw_wik_places() {
+	$token_auth = 'd97e3e8f34071515ad1f6e345f6035af';
+
+	$url = "https://davidawindham.com/wik/";
+	$url .= "?module=API&method=UserCountry.getCity";
+	$url .= "&idSite=1&period=month&date=yesterday";
+	$url .= "&format=PHP&filter_limit=20";
+	$url .= "&token_auth=$token_auth";
+
+	$fetched = file_get_contents($url);
+	$content = unserialize($fetched);
+
+	if (!$content) {
+	    print("Error, content fetched = " . $fetched);
+	}
+
+	foreach ($content as $row) {
+	    $keyword = htmlspecialchars(html_entity_decode(urldecode($row['label']), ENT_QUOTES), ENT_QUOTES);
+	    $hits = $row['nb_visits'];
+	    print("<b>$keyword</b> ($hits hits)<br>\n");
+	}
+}
+
+?>

+ 0 - 0
js/dashboard.js


+ 21 - 0
page-dashboard.php

@@ -0,0 +1,21 @@
+<?php get_header(); ?>
+
+	<div class="container" role="main">
+		<div id="content" class="single" >
+			<div class="row">
+				<div class="col-sm-6">			
+					<?php echo dw_wik_places()?>
+				</div>
+				<div class="col-sm-6">
+					
+				</div>
+			</div>
+			<div class="row">
+				<div class="col-sm-12">
+					<iframe id="map" width="100%" height="600px" src="https://davidawindham.com/wik/index.php?module=Widgetize&action=iframe&widget=1&moduleToWidgetize=UserCountryMap&actionToWidgetize=realtimeMap&idSite=1&period=day&date=today&disableLink=1&widget=1&token_auth=d97e3e8f34071515ad1f6e345f6035af" />
+				</div>
+			</div>
+		</div>
+	</div>
+
+<?php get_footer(); ?>