Example #1
0
             $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":
     switch ($_SERVER['REQUEST_METHOD']) {
         case "GET":
             $db = new Database();
             $result = $db->query("SELECT DISTINCT(occur_date) FROM `dreams` ORDER BY occur_date DESC");
             if ($db->affected_rows > 0) {
                 while ($dream = $result->fetch_assoc()) {
                     $date = DateTime::createFromFormat('Y-m-d', $dream['occur_date'], new DateTimeZone('Australia/Melbourne'));