本文整理汇总了PHP中Line::getGraphId方法的典型用法代码示例。如果您正苦于以下问题:PHP Line::getGraphId方法的具体用法?PHP Line::getGraphId怎么用?PHP Line::getGraphId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Line
的用法示例。
在下文中一共展示了Line::getGraphId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cloneLine
public static function cloneLine($line_id, $ignore_clone_name = FALSE, $graph_id = NULL)
{
$line_to_clone = new Line($line_id);
if (empty($graph_id)) {
$graph_id = $line_to_clone->getGraphId();
}
$line = new Line();
if ($ignore_clone_name) {
$clone_alias = $line_to_clone->getAlias();
} else {
$clone_alias = 'Clone of ' . $line_to_clone->getAlias();
// If it's too long, we truncate
if (strlen($clone_alias) > 255) {
$clone_alias = substr($clone_alias, 0, 255);
}
}
$line->setAlias($clone_alias);
$line->setTarget($line_to_clone->getTarget());
$line->setColor($line_to_clone->getColor());
$line->setGraphId($graph_id);
$line->setWeight($line_to_clone->getWeight());
$line->store();
}
示例2: catch
$line->delete();
fMessaging::create('success', Graph::makeUrl('edit', $graph), 'The line for ' . $graph->getName() . ' was successfully deleted');
fURL::redirect(Graph::makeUrl('edit', $graph));
}
} catch (fNotFoundException $e) {
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_line.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');
//fURL::redirect($manage_url);
}
} 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';
示例3: array
<?php
include 'inc/init.php';
fAuthorization::requireLoggedIn();
fRequest::overrideAction();
$action = fRequest::getValid('action', array('list', 'add', 'edit', 'delete', 'view'));
$line_id = fRequest::get('line_id', 'integer');
$graph_id = fRequest::get('graph_id', 'integer');
if ('delete' == $action) {
$class_name = 'Line';
try {
$obj = new Line($line_id);
$graph = new Graph($obj->getGraphId());
$delete_text = 'Are you sure you want to delete the line : <strong>' . $obj->getAlias() . '</strong>?';
if (fRequest::isPost()) {
fRequest::validateCSRFToken(fRequest::get('token'));
$obj->delete();
fMessaging::create('success', Graph::makeUrl('edit', $graph), 'The line for ' . $graph->getName() . ' was successfully deleted');
fURL::redirect(Graph::makeUrl('edit', $graph));
}
} catch (fNotFoundException $e) {
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);
示例4: explode
}
}
}
} else {
$skip_next = false;
}
}
} else {
// In this case the user has used the drag and drop functionnality
$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();
}