Example #1
0
 public function export_in_json()
 {
     $dashboard_id = $this->getDashboardId();
     $json_env = parent::export_in_json();
     // Find all the lines of this graph
     $graphs = Graph::findAll($dashboard_id);
     $json_graphs_array = array();
     foreach ($graphs as $graph_in_dashboard) {
         // Export them in JSON
         $json_graphs_array[] = $graph_in_dashboard->export_in_json();
     }
     // Implode them
     $json_graph = "\"graphs\":[";
     if (!empty($json_graphs_array)) {
         $json_graph .= implode(",", $json_graphs_array);
     }
     $json_graph .= "]";
     // Replace the last } of the json
     $json_env[strlen($json_env) - 1] = ",";
     // Concat the graph with its lines
     $json_env .= $json_graph . "}";
     return $json_env;
 }
                        deselectAll();
                        return false;" /></th>
            </tr>    
        </thead>
        <tbody>
            <?php 
$first = TRUE;
if ($filter_group_id == -1) {
    $dashboards = Dashboard::findAll();
} else {
    $dashboards = Dashboard::findAllByFilter($filter_group_id);
}
/* Filter Graphs */
foreach ($dashboards as $dashboard) {
    $dashboard_id = $dashboard->getDashboardId();
    $graphs = Graph::findAll($dashboard_id);
    $number_of_lines = 0;
    foreach ($graphs as $graph) {
        $number_of_lines = $number_of_lines + Line::countAllByFilter($graph->getGraphId(), $filter_text);
    }
    $number_of_graphs = Graph::countAllByFilter($dashboard_id, $filter_text);
    ?>
            <?php 
    if ($number_of_graphs > 0 || $number_of_lines > 0 || preg_match('/' . $filter_text . '/i', $dashboard->getName()) || preg_match('/' . $filter_text . '/i', $dashboard->getDescription())) {
        ?>
 
                <tr>
                    <td class="name">
                        <a href="<?php 
        echo Dashboard::makeURL('view', $dashboard);
        ?>
Example #3
0
            fMessaging::create('success', "/" . $url_redirect, 'The Graph "' . $graph_to_clone->getName() . '" was successfully cloned into the Dashboard "' . $dashboard->getName() . '"');
            fURL::redirect($url_redirect);
        } catch (fExpectedException $e) {
            fMessaging::create('error', fURL::get(), $e->getMessage());
        }
    }
    include VIEW_PATH . '/list_dashboards.php';
} elseif ('reorder' == $action) {
    $drag_order = fRequest::get('drag_order');
    $error = false;
    if (empty($drag_order)) {
        // In this case, the user clicks on the arrow
        $move = fRequest::getValid('move', array('previous', 'next'));
        $graph_to_move = new Graph($graph_id);
        $dashboard_id = $graph_to_move->getDashboardId();
        $graphs_in_dashboard = Graph::findAll($dashboard_id);
        $number_of_graphs = $graphs_in_dashboard->count(TRUE);
        $skip_next = false;
        for ($i = 0; $i < $number_of_graphs; $i++) {
            if (!$skip_next) {
                $current_graph = $graphs_in_dashboard[$i];
                if ($current_graph->getGraphId() != $graph_id) {
                    // This isn't the concerned graph
                    $current_graph->setWeight($i);
                } else {
                    if ('previous' == $move) {
                        if ($i > 0) {
                            $current_graph->setWeight($i - 1);
                            $previous_graph = $graphs_in_dashboard[$i - 1];
                            $previous_graph->setWeight($i);
                        }