photoblog.pl
Załóż konto
Dodane 24 PAŹDZIERNIKA 2012
1138
Dodano: 24 PAŹDZIERNIKA 2012

cURL + GraphViz

 /* cURL + GraphViz */ 

 

 

 

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

 

class Graph extends CI_Controller {

 

 /**

  * Index Page for this controller.

  *

  * Maps to the following URL

  *   http://example.com/graph

  * - or -  

  *   http://example.com/graph/index

  * - or -

  * Since this controller is set as the default controller in 

  * config/routes.php, it's disayed at http://example.com/

  *

  * So any other public methods not prefixed with an underscore will

  * map to /graph/<method_name>

  * @see http://codeigniter.com/user_guide/general/urls.html

  */

 

 public function __construct() {

  parent::__construct();

  

  $this->load->model('strona');

  require_once 'Image/GraphViz.php';

 }

 

 public function index() {

  $this->db->where('poziom <=', 2);

  $wynik = $this->db->get('zasieg')->result();

 

  $gv = new Image_GraphViz();

 

  $nodeatts = array(

   'shape'   => "circle",

   'style'   => "filled",

   'fillcolor'  => "#00aa00", 

   'fixedsize'  => FALSE,

   'fontsize'  => 8,

   'margin'  => "0.1, 0.1",

   'splines'  => TRUE,

   'overlap'  => FALSE

  );

  $nodeatts2 = array(

   'shape'   => "ellipse",

   'style'   => "filled",

   'fillcolor'  => "#00aaaaaa",

   'fixedsize'  => FALSE,

   'fontsize'  => 8,

   'margin'  => "0.0001, 0.0001",

   'splines'  => TRUE,

   'overlap'  => FALSE,

  );

  $edgeatts = array(

   'arrowsize' => 0.6,

   'sametail' => TRUE,

   'len'  => 5

  );

  

  $nicki = array();

  for($i=0; $i<=count($wynik)-1; ++$i) {

   $gv->addNode($wynik[$i]->nick, $nodeatts);

   $nicki[] = $wynik[$i]->nick;

   if(!in_array($wynik[$i]->znajomy, $nicki)) $gv->addNode($wynik[$i]->znajomy, $nodeatts2);

 

   $gv->addEdge(array($wynik[$i]->nick => $wynik[$i]->znajomy), $edgeatts);

  }

  $gv->image('jpg', 'neato');

  

 }

 

}

 

/* End of file graph.php */

/* Location: ./application/controllers/graph.php */

 

Informacje o turbodymohardkor


Inni użytkownicy: kowalski33lucas25mati1990balanonymous02221bobo21jankowiakpaulimyskax3alexcvbogna123lollypoplollypop


Inni zdjęcia: Grecka przygoda na Evii activegames12 / 03 /25 xheroineemogirlxTruck1 Polska kowalski33... thevengefulone... thevengefulone... maxima24... maxima24... thevengefulone... maxima24... thevengefulone