Example #1
0
             include_once "includes/graph.class.json.php";
             if (!isset($_GET['date_from'])) {
                 die;
             }
             $dateFrom = DateTime::createFromFormat($date_format, $_GET['date_from'], new DateTimeZone(TIME_ZONE));
             $graph = new Graph();
             $graph->alchemyApiKey = ALCHEMY_API_KEY;
             $graph->dateFrom = $dateFrom->format('Y-m-d');
             $graph->maxDreams = MAX_DISPLAYED_DREAMS;
             $graph->maxKeywords = 30;
             $graph->minTagValue = MIN_TAG_VALUE;
             if (isset($_GET['date_to'])) {
                 $dateTo = DateTime::createFromFormat($date_format, $_GET['date_to'], new DateTimeZone(TIME_ZONE));
                 $graph->dateTo = $dateTo->format('Y-m-d');
             }
             $graph->build();
             $data = $graph->render();
             $data->date_from = date($date_format, strtotime($graph->dateFrom));
             $data->date_to = date($date_format, strtotime($graph->dateTo));
             $response->result = $data;
             if (isset($_SESSION['submission']) && $_SESSION['submission'] == 1) {
                 $highlightColor = "#cc3300";
                 $dream = (object) array('id' => '-1', 'user_id' => '-1', 'description' => 'Your dream here', 'color' => $highlightColor, 'color2' => $highlightColor, 'index' => $graph->getNodeCount(), 'interactive' => false, 'node_type' => 'dream', 'tags' => array(), 'value' => 0);
                 $dreams[] = $dream;
                 $nodes[] = $dream;
                 unset($_SESSION['submission']);
             }
             break;
     }
     break;
 case "dates":