Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php /* ATOM/digitalnature */
- // The template for the "page" post type. It acts for pages just like single.php does for posts
- // pagename.php, page-slug.php or page-id.php can override it.
- get_header();
- ?>
- <!-- main content: primary + sidebar(s) -->
- <div id="mask-3" class="clear-block">
- <div id="mask-2">
- <div id="mask-1">
- <!-- primary content -->
- <div id="primary-content">
- <div class="blocks clear-block">
- <?php $app->action('before_primary'); ?>
- <?php
- $args=array(
- 'orderby' => 'name',
- 'order' => 'ASC'
- );
- $categories=get_categories($args);
- foreach($categories as $category) {
- //echo '<p>Category: <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </p> ';
- //echo '<p> Description:'. $category->description . '</p>';
- //echo '<p> Post Count: '. $category->count . '</p>';
- $data_genre.="['".$category->name."',".$category->count."],";
- }
- $data_genre=substr($data_genre, 0, -1); //suppression de la derniere virgule !
- //echo $data_genre;
- ?>
- <!--Load the AJAX API-->
- <script type="text/javascript" src="https://www.google.com/jsapi"></script>
- <script type="text/javascript">
- // Load the Visualization API and the piechart package.
- google.load('visualization', '1.0', {'packages':['corechart']});
- // Set a callback to run when the Google Visualization API is loaded.
- google.setOnLoadCallback(drawChart);
- // Callback that creates and populates a data table,
- // instantiates the pie chart, passes in the data and
- // draws it.
- function drawChart() {
- // Create the data table.
- var data = new google.visualization.DataTable();
- data.addColumn('string', 'Topping');
- data.addColumn('number', 'Slices');
- data.addRows([
- <?php echo $data_genre; ?>
- ]);
- // Set chart options
- var options = {'title':'Statistiques par Genre',
- 'width':600,
- 'height':500};
- // Instantiate and draw our chart, passing in some options.
- var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
- chart.draw(data, options);
- }
- </script>
- <!--Div that will hold the pie chart-->
- <div id="chart_div"></div>
- <?php
- //query_posts('showposts=60','&orderby=title&order=asc');
- query_posts( 'posts_per_page=-1'.'&orderby=title&order=asc');
- $tableau_pays=array();
- $tableau_pays_cpt=array();
- while ( have_posts() ) : the_post(); ?>
- <?php
- $values = get_post_custom_values("dvd_pays");
- //if (isset($values[0])) {}
- $pays="";
- if(strpos($values[0],"/") || strpos($values[0],",")) {
- if(strpos($values[0],"/")) $pays_tab=explode("/",$values[0]);
- if(strpos($values[0],",")) $pays_tab=explode(",",$values[0]);
- for($j=0;$j<count($pays_tab);$j++) {
- //$key=array_search(trim($pays[$j]),$tableau_pays);
- $pays="";
- if(strtolower(trim($pays_tab[$j]))=="france") $pays="FR";
- if(strtolower(trim($pays_tab[$j]))=="usa" || strtolower(trim($pays_tab[$j]))=="us" || strtolower(trim($pays_tab[$j]))=="etats-unis") $pays="US";
- if(strtolower(trim($pays_tab[$j]))=="allemagne") $pays="DE";
- if(strtolower(trim($pays_tab[$j]))=="australie") $pays="AU";
- if(strtolower(trim($pays_tab[$j]))=="irlande") $pays="IE";
- if(strtolower(trim($pays_tab[$j]))=="royaume-uni") $pays="GB";
- if(strtolower(trim($pays_tab[$j]))=="hong-kong") $pays="HK";
- if(strtolower(trim($pays_tab[$j]))=="japon") $pays="JP";
- if(strtolower(trim($pays_tab[$j]))=="italie") $pays="IT";
- if(strtolower(trim($pays_tab[$j]))=="espagne") $pays="ES";
- if(strtolower(trim($pays_tab[$j]))=="canada") $pays="CA";
- if(strtolower(trim($pays_tab[$j]))=="belgique") $pays="BE";
- if(strtolower(trim($pays_tab[$j]))=="nouvelle-zélande") $pays="NZ";
- //if(strlen($pays)<1) echo $pays_tab[$j]."<br>";
- $key=array_search($pays,$tableau_pays);
- if($key==false) {
- $i++;
- $tableau_pays[$i]=trim($pays);
- $tableau_pays_cpt[$i]=1;
- //echo "i : ".$i;
- } else {
- //ce genre est deja enregistré dans le tableau a l'index key
- $tableau_pays_cpt[$key]++;
- }
- }
- }else {
- //$key=array_search(trim($values[0]),$tableau_pays);
- if(strtolower(trim($values[0]))=="france") $pays="FR";
- if(strtolower(trim($values[0]))=="usa" || strtolower(trim($values[0]))=="us" || strtolower(trim($values[0]))=="etats-unis") $pays="US";
- if(strtolower(trim($values[0]))=="allemagne") $pays="DE";
- if(strtolower(trim($values[0]))=="australie") $pays="AU";
- if(strtolower(trim($values[0]))=="irlande") $pays="IE";
- if(strtolower(trim($values[0]))=="royaume-uni") $pays="GB";
- if(strtolower(trim($values[0]))=="hong-kong") $pays="HK";
- if(strtolower(trim($values[0]))=="japon") $pays="JP";
- if(strtolower(trim($values[0]))=="italie") $pays="IT";
- if(strtolower(trim($values[0]))=="espagne") $pays="ES";
- if(strtolower(trim($values[0]))=="canada") $pays="CA";
- if(strtolower(trim($values[0]))=="belgique") $pays="BE";
- if(strtolower(trim($values[0]))=="nouvelle-zélande") $pays="NZ";
- //if(strlen($pays)<1) echo $values[0]."<br>";
- $key=array_search(trim($pays),$tableau_pays);
- //echo $key;
- if($key==false) {
- $i++;
- $tableau_pays[$i]=$pays;
- $tableau_pays_cpt[$i]=1;
- //echo "i : ".$i;
- } else {
- //ce genre est deja enregistré dans le tableau a l'index key
- $tableau_pays_cpt[$key]++;
- }
- //echo $values[0].'<br>';
- }
- endwhile;
- //echo count($tableau_pays);
- for($j=1;$j<=count($tableau_pays);$j++) {
- /*
- $a = DecHex(mt_rand(0,15)); $b = DecHex(mt_rand(0,15)); $c = DecHex(mt_rand(0,15)); $d = DecHex(mt_rand(0,15)); $e = DecHex(mt_rand(0,15)); $f = DecHex(mt_rand(0,15)); $hexac = $a . $b . $c . $d . $e . $f;
- $couleur_chart.=$hexac.'|';
- */
- //data.setValue(0, 0, 'Germany');
- $index=$j-1;
- $data_pays.="data.setValue(".$index.", 0, '".$tableau_pays[$j]."');";
- $data_pays.="data.setValue(".$index.", 1, ".$tableau_pays_cpt[$j].");";
- }
- $nbr_rows=count($tableau_pays);
- //echo $data_pays;
- ?>
- <script type='text/javascript'>
- google.load('visualization', '1', {'packages': ['geochart']});
- google.setOnLoadCallback(drawRegionsMap);
- function drawRegionsMap() {
- var data = new google.visualization.DataTable();
- data.addRows(6);
- <?php echo "data.addRows(".$nbr_rows.");"; ?>
- data.addColumn('string', 'Pays');
- data.addColumn('number', 'Films');
- <?php echo $data_pays; ?>
- var options = {};
- var container = document.getElementById('map_canvas');
- var geochart = new google.visualization.GeoChart(container);
- geochart.draw(data, options);
- };
- </script>
- <!--Div that will hold the Map-->
- <div id='map_canvas'></div>
- <?php $app->action('after_primary'); ?>
- </div>
- </div>
- <!-- /primary content -->
- <?php get_sidebar(); ?>
- </div>
- </div>
- </div>
- <!-- /main content -->
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement