本文整理汇总了PHP中Graph::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Graph::getName方法的具体用法?PHP Graph::getName怎么用?PHP Graph::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph::getName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: catch
fRequest::validateCSRFToken(fRequest::get('token'));
$graph->store();
fMessaging::create('affected', $manage_url, $graph->getName());
fMessaging::create('success', $manage_url, 'The Graph ' . $graph->getName() . ' was successfully created');
fURL::redirect(Graph::makeUrl('edit', $graph));
} catch (fExpectedException $e) {
fMessaging::create('error', fURL::get(), $e->getMessage());
}
}
include VIEW_PATH . '/add_edit_graph.php';
} elseif ('delete' == $action) {
$class_name = 'Graph';
try {
$obj = new Graph($graph_id);
$dashboard = new Dashboard($obj->getDashboardId());
$delete_text = 'Are you sure you want to delete the graph : <strong>' . $obj->getName() . '</strong>?';
if (fRequest::isPost()) {
fRequest::validateCSRFToken(fRequest::get('token'));
$obj->delete();
$lines = Line::findAll($graph_id);
foreach ($lines as $line) {
$line->delete();
}
fMessaging::create('success', Dashboard::makeUrl('edit', $dashboard), 'The graph for ' . $dashboard->getName() . ' was successfully deleted');
fURL::redirect(Dashboard::makeUrl('edit', $dashboard));
}
} catch (fNotFoundException $e) {
fMessaging::create('error', Dashboard::makeUrl('edit', $dashboard), 'The line requested could not be found');
fURL::redirect(Dashboard::makeUrl('edit', $dashboard));
} catch (fExpectedException $e) {
fMessaging::create('error', fURL::get(), $e->getMessage());
示例2: catch
fMessaging::create('success', fURL::get(), 'The Graph ' . $graph_to_clone->getName() . ' was successfully cloned');
fURL::redirect(Dashboard::makeURL('edit', $dashboard));
} catch (fExpectedException $e) {
fMessaging::create('error', fURL::get(), $e->getMessage());
}
}
include VIEW_PATH . '/add_edit_dashboard.php';
} elseif ('clone_into' == $action) {
if (fRequest::isPost()) {
$graph_to_clone = new Graph($graph_id);
$dashboard = new Dashboard($dashboard_dest_id);
try {
fRequest::validateCSRFToken(fRequest::get('token'));
Graph::cloneGraph($graph_id, $dashboard_dest_id);
$url_redirect = Dashboard::makeURL('list');
fMessaging::create('affected', $url_redirect, $graph_to_clone->getName());
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();
示例3: __construct
/**
* Constructor for GraphTraversal.
* @param Graph $graph Graph to be traversed.
*/
public function __construct(&$graph)
{
parent::__construct($graph->getName(), $graph->isDirected());
}
示例4: catch
fMessaging::create('error', Graph::makeUrl('edit', $graph), 'The line requested could not be found');
fURL::redirect(Graph::makeUrl('edit', $graph));
} catch (fExpectedException $e) {
fMessaging::create('error', fURL::get(), $e->getMessage());
}
include VIEW_PATH . '/delete.php';
// --------------------------------- //
} elseif ('edit' == $action) {
try {
$line = new Line($line_id);
$graph = new Graph($line->getGraphId());
if (fRequest::isPost()) {
$line->populate();
fRequest::validateCSRFToken(fRequest::get('token'));
$line->store();
fMessaging::create('affected', fURL::get(), $graph->getName());
fMessaging::create('success', fURL::getWithQueryString(), 'The Line ' . $line->getAlias() . ' was successfully updated');
}
} catch (fNotFoundException $e) {
fMessaging::create('error', Graph::makeUrl('edit', $graph), 'The Line requested, ' . fHTML::encode($line_id) . ', could not be found');
fURL::redirect(Graph::makeUrl('edit', $graph));
} catch (fExpectedException $e) {
fMessaging::create('error', fURL::get(), $e->getMessage());
}
include VIEW_PATH . '/add_edit_line.php';
// --------------------------------- //
} elseif ('add' == $action) {
$line = new Line();
$graph = new Graph($graph_id);
if (fRequest::isPost()) {
try {
示例5: getGraph
/**
* Load a graph using its ID
* @param $id integer
* @return Graph if found, otherwise NULL
*/
public function getGraph($id)
{
global $master_db_handle;
foreach ($this->graphCache as $graphName => $graph) {
if ($graph->getID() == $id) {
return $graph;
}
}
$statement = $master_db_handle->prepare('SELECT ID, Plugin, Type, Active, Readonly, Name, DisplayName, Scale, Halfwidth, Position FROM Graph WHERE ID = ?');
$statement->execute(array($id));
if ($row = $statement->fetch()) {
$graph = new Graph($row['ID'], $this, $row['Type'], $row['Name'], $row['DisplayName'], $row['Active'], $row['Readonly'], $row['Position'], $row['Scale'], $row['Halfwidth'] == 1);
$this->graphCache[$graph->getName()] = $graph;
return $graph;
}
return null;
}
示例6: catch
fRequest::validateCSRFToken(fRequest::get('token'));
$graph->store();
fMessaging::create('affected', fURL::get(), $graph->getName());
fMessaging::create('success', fURL::getWithQueryString(), 'The Graph ' . $graph->getName() . ' was successfully updated');
//fURL::redirect($manage_url);
}
} catch (fNotFoundException $e) {
fMessaging::create('error', $manage_url, 'The Graph requested, ' . fHTML::encode($graph_id) . ', could not be found');
fURL::redirect($manage_url);
} catch (fExpectedException $e) {
fMessaging::create('error', fURL::get(), $e->getMessage());
}
include VIEW_PATH . '/add_edit_graph.php';
// --------------------------------- //
} elseif ('add' == $action) {
$graph = new Graph();
$dashboard = new Dashboard($dashboard_id);
if (fRequest::isPost()) {
try {
$graph->populate();
fRequest::validateCSRFToken(fRequest::get('token'));
$graph->store();
fMessaging::create('affected', $manage_url, $graph->getName());
fMessaging::create('success', $manage_url, 'The Graph ' . $graph->getName() . ' was successfully created');
fURL::redirect(Dashboard::makeUrl('edit', $dashboard));
} catch (fExpectedException $e) {
fMessaging::create('error', fURL::get(), $e->getMessage());
}
}
include VIEW_PATH . '/add_edit_graph.php';
}
示例7: cloneGraph
public static function cloneGraph($graph_id, $dashboard_id = NULL)
{
$graph_to_clone = new Graph($graph_id);
if (empty($dashboard_id)) {
$dashboard_id = $graph_to_clone->getDashboardId();
}
$graph = new Graph();
$clone_name = 'Clone of ' . $graph_to_clone->getName();
// If it's too long, we truncate
if (strlen($clone_name) > 255) {
$clone_name = substr($clone_name, 0, 255);
}
$graph->setName($clone_name);
$graph->setArea($graph_to_clone->getArea());
$graph->setVtitle($graph_to_clone->getVtitle());
$graph->setDescription($graph_to_clone->getDescription());
$graph->setDashboardId($dashboard_id);
$graph->setWeight($graph_to_clone->getWeight());
$graph->setTimeValue($graph_to_clone->getTimeValue());
$graph->setUnit($graph_to_clone->getUnit());
$graph->setCustomOpts($graph_to_clone->getCustomOpts());
$graph->setStartsAtMidnight($graph_to_clone->getStartsAtMidnight());
$graph->store();
// Clone of the lines
$lines = Line::findAll($graph_id);
foreach ($lines as $line_to_clone) {
Line::cloneLine($line_to_clone->getLineId(), TRUE, $graph->getGraphId());
}
}