<?
$page_title = ($action == 'add' ? 'Add a Line' : 'Edit Line');
$tmpl->set('title', $page_title);
$breadcrumbs[] = array('name' => 'Dashboard', 'url' => Dashboard::makeURL('list'),'active' => false);
//$breadcrumbs[] = array('name' => 'Edit Dashboard', 'url' => Dashboard::makeURL('edit',$graph),'active' => false);
$breadcrumbs[] = array('name' => $graph->prepareName(), 'url' => Graph::makeURL('edit',$graph),'active'=> false);
$breadcrumbs[] = array('name' => $page_title, 'url' => fURL::getWithQueryString(),'active'=> true);
$tmpl->set('breadcrumbs',$breadcrumbs);
$tmpl->place('header');
if (isset($line_id)) {
  $query_string = "&line_id=$line_id";
} elseif (isset($graph_id)) {
  $query_string = "&graph_id=$graph_id";  
} else {
  $query_string = '';
}
?>
  <div class="row">
    <div class="span6">
      <form action="<?php 
echo fURL::get();
?>
?action=<? echo $action.$query_string; ?>" method="post">
        <div class="main" id="main">
          <fieldset>
                <div class="clearfix">
	      <label for="line-alias">Alias<em>*</em></label>
              <div class="input">
	        <input id="line-alias" class="span3" type="text" size="30" name="alias" value="<?php 
echo $line->encodeAlias();
?>
Example #2
0
                    <?php 
            $index++;
        }
        ?>
                </tbody></table>
        </div>
        <div id="filtered_graphs"></div>
    <?php 
        if ($number_of_graphs > 1) {
            ?>
    	<p class="text-info"><em>* You can also use "drag and drop" to reorder the graphs.</em></p>
    <?php 
        }
        ?>
    <?php 
    } catch (fEmptySetException $e) {
        ?>
	<p class="info">There are currently no Tattle graph available for this Dashboard . <a href="<?php 
        echo Graph::makeURL('add', $dashboard);
        ?>
">Add one now</a></p>
	<?php 
    }
}
?>
    </div>
  </div>
</div>
</div>
<?php 
$tmpl->place('footer');
          </thead>
          <tbody>
	<?php
	$first = TRUE;
	foreach ($graphs as $graph) {
		?>
    	<tr>
        <td><?=$graph->prepareWeight(); ?></td>
        <td><?=$graph->prepareName(); ?></td>
        <td><?=$graph->prepareDescription(); ?></td>
        <td><?=$graph->prepareVtitle(); ?></td>
        <td><?=$graph->prepareArea(); ?></td>        
        <td><a href="<?=Graph::makeURL('edit', $graph); ?>">Edit</a> |
        <a href="<?=Graph::makeURL('delete', $graph); ?>">Delete</a></td>
        </tr>
    <?php } ?>
    </tbody></table>
    <?
} catch (fEmptySetException $e) {
	?>
	<p class="info">There are currently no Tattle graph available for this Dashboard . <a href="<?=Graph::makeURL('add',$dashboard); ?>">Add one now</a></p>
	<?php
} }
?>
    </div>
  </div>
</div>
</div>
<?php
$tmpl->place('footer');        
Example #4
0
echo $graph->getStartsAtMidnight() ? 'checked="checked"' : '';
?>
 value="true"> Starts at midnight
           		</label>
           	</div>
            <div class="form-group">
                <label for="graph-custom-opts">Custom Options</label>
                  <input id="graph-custom-opts" class="form-control" type="text" size="30" name="custom_opts" value="<?php 
echo $graph->encodeCustom_Opts();
?>
" placeholder="options appended to the url e.g.: yMin=0&hideLegend=false" />
            </div>
	    <div class="actions">
	      <input class="btn btn-primary" type="submit" value="Save" />
              <a href="<?php 
echo Graph::makeURL('delete', $graph);
?>
" class="btn btn-default">Delete</a>
              <a href="<?php 
echo Dashboard::makeUrl('view', $dashboard);
?>
" class="btn btn-default">View</a>
              <div class="required"><em>*</em> Required field</div>
	      	  <input type="hidden" name="token" value="<?php 
echo fRequest::generateCSRFToken();
?>
" />
              <input type="hidden" name="user_id" value="<?php 
echo fSession::get('user_id');
?>
" />
Example #5
0
$tmpl->set('title', 'Delete Line');
$tmpl->place('header');
?>
<form action="<?php 
echo Line::makeURL('delete', $line);
?>
" method="post">
  <div class="main" id="main">
    <div class="warning">Are you sure you want to delete this line?
      <strong><?php 
echo $graph->prepareName();
?>
</strong>?
    </div>
    <div class="actions">
      <input class="btn danger" type="submit" value="Yes, delete this line" />
      <a class="btn" href="<?php 
echo Graph::makeURL('edit', $graph);
?>
">No, please keep it</a>
      <input type="hidden" name="token" value="<?php 
echo fRequest::generateCSRFToken();
?>
" />
    </div>
  </div>
</form>

<?php 
$tmpl->place('footer');
                 foreach ($units as $value) {
                   fHTML::printOption($value, $value, $graph->getUnit());
                 }
                ?>
                </select>
              </div>
            </div><!-- /clearfix -->
            <div class="clearfix">
                <label for="graph-custom-opts">Custom Options</label>
                <div class="input">
                  <input id="graph-custom-opts" class="span3" type="text" size="30" name="custom_opts" value="<?=$graph->encodeCustom_Opts(); ?>" />
              </div>
            </div><!-- /clearfix -->
	    <div class="actions">
	      <input class="btn primary" type="submit" value="Save" />
              <a href="<?=Graph::makeURL('delete',$graph); ?>" class="btn">Delete</a>
              <a href="<?=Dashboard::makeUrl('view',$dashboard); ?>" class="btn">View</a>
              <div class="required"><em>*</em> Required field</div>
	      <input type="hidden" name="token" value="<?=fRequest::generateCSRFToken(); ?>" />
              <input type="hidden" name="user_id" value="<?=fSession::get('user_id'); ?>" />
            </div>
         </fieldset>
       </div>
     </form>
    </div>
    <div class="span10">
    <?php if ($action == 'edit') {  ?>
        <img src="<?=Graph::drawGraph($graph,$dashboard); ?>">
    <p class="info"><a href="<?=Line::makeURL('add',$graph); ?>">Add Line</a></p>
 <?php
   try {
Example #7
0
                echo Graph::makeURL('reorder', $graph, 'previous');
                ?>
" onclick="$('#tableHider').show();
                                                    return true;"><i class="glyphicon glyphicon-arrow-up pointer" title="Previous"></i></a>
                                <?php 
            }
            ?>
                                <?php 
            if ($index == $number_of_graphs - 1) {
                ?>
                                <span class="disabled"><i class="glyphicon glyphicon-arrow-down pointer"></i></span>
                            <?php 
            } else {
                ?>
                                <a href="<?php 
                echo Graph::makeURL('reorder', $graph, 'next');
                ?>
" onclick="$('#tableHider').show();
                                                    return true;"><i class="glyphicon glyphicon-arrow-down pointer" title="Next"></i></a>
                                <?php 
            }
            ?>
                        </td>
                    <?php 
        }
        ?>
                </tr>
            <?php 
    }
    ?>
            <?php 
Example #8
0
        $array_of_weights = explode(",", $drag_order);
        $lines_in_graph = array();
        foreach ($array_of_weights as $new_weight) {
            $expl = explode(":", $new_weight);
            $current_line = new Line($expl[0]);
            if (empty($graph_id)) {
                $graph_id = $current_line->getGraphId();
            } else {
                // Check if all the lines are in the same graph
                if ($graph_id != $current_line->getGraphId()) {
                    $error = true;
                    break;
                }
            }
            $current_line->setWeight($expl[1]);
            $lines_in_graph[] = $current_line;
        }
    }
    if (!$error) {
        foreach ($lines_in_graph as $line_to_store) {
            $line_to_store->store();
        }
        $graph = new Graph($graph_id);
        $url_redirect = Graph::makeURL('edit', $graph);
        fMessaging::create("success", "/graphs.php", "The lines have been successfully reordered");
    } else {
        $url_redirect = Dashboard::makeURL('list');
        fMessaging::create("success", "/dashboard.php", "An error occured and the lines couldn't be reordered");
    }
    fURL::redirect($url_redirect);
}