/[drupal]/contributions/modules/sna/explore.php
ViewVC logotype

Contents of /contributions/modules/sna/explore.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (show annotations) (download) (as text)
Mon Sep 4 10:13:07 2006 UTC (3 years, 2 months ago) by aronnovak
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-5, DRUPAL-4-7
Changes since 1.4: +1 -186 lines
File MIME type: text/x-php
Realtime network generating capabilities added.
hook_cron() implemented - no dumb extra files that have to be added to crontab
1 <?php
2 // $Id$
3 /**
4 * All the jobs that should be done in cron-time
5 *
6 * @author Aron Novak <aaron@szentimre.hu>
7 * @version 0.1
8 * @package sna
9 */
10
11 /**
12 * Get sql access and important functions
13 */
14 require_once './includes/bootstrap.inc';
15 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
16 require_once 'common.php';
17
18 $at_start = res_start();
19 if (!function_exists('dba_open') && SNA_CACHE_ENABLED) {
20 die('Dba support is not available.');
21 }
22
23 clear_cache();
24 $edges = array();
25 $graph_source = variable_get('sna_data_source', GRAPH_SOURCE);
26 $build_edges = 'build_edges_from_' . $graph_source;
27 $num_interactions = $build_edges($edges);
28 $edges = transform_edges($edges);
29 if (!put_graph($edges)) {
30 die('Cannot save the network into file');
31 }
32 /* Cache the most popular vertex's minimal tree */
33 $most_popular = sort_by_popularity($edges);
34 $most_popular_size = sizeof($most_popular);
35 $size_cache = variable_get('sna_size_cache', NUM_CACHE);
36 $limit = $most_popular_size < $size_cache ? $most_popular_size : $size_cache;
37 $at_start = res_start();
38 for ($i = 0; $i < $limit; $i++) {
39 a_to_any($edges, $most_popular[$i][1], TRUE);
40 }
41 generate_graphviz_input($edges, $num_interactions);
42 generate_pajek_input($edges);
43
44 ?>

  ViewVC Help
Powered by ViewVC 1.1.2