本文整理汇总了PHP中Line::cloneLine方法的典型用法代码示例。如果您正苦于以下问题:PHP Line::cloneLine方法的具体用法?PHP Line::cloneLine怎么用?PHP Line::cloneLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Line
的用法示例。
在下文中一共展示了Line::cloneLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: catch
fMessaging::create('affected', "/graphs.php", $line->getAlias());
fMessaging::create('success', "/graphs.php", 'The Line ' . $line->getAlias() . ' was successfully created');
fURL::redirect($graph_url);
} catch (fExpectedException $e) {
fMessaging::create('error', fURL::get(), $e->getMessage());
}
}
include VIEW_PATH . '/add_edit_line.php';
} elseif ('clone' == $action) {
$line_to_clone = new Line($line_id);
$graph_id = $line_to_clone->getGraphId();
$graph = new Graph($graph_id);
if (fRequest::isPost()) {
try {
fRequest::validateCSRFToken(fRequest::get('token'));
Line::cloneLine($line_id);
$graph_url = Graph::makeUrl('edit', $graph);
fMessaging::create('affected', $graph_url, $line_to_clone->getAlias());
fMessaging::create('success', $graph_url, 'The Line ' . $line_to_clone->getAlias() . ' was successfully cloned');
fURL::redirect($graph_url);
} catch (fExpectedException $e) {
fMessaging::create('error', fURL::get(), $e->getMessage());
}
}
$dashboard = new Dashboard($graph->getDashboardId());
$dashboard_id = $graph->getDashboardId();
$lines = Line::findAll($graph_id);
include VIEW_PATH . '/add_edit_graph.php';
} elseif ('reorder' == $action) {
$drag_order = fRequest::get('drag_order');
$error = false;
示例2: 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());
}
}