当前位置: 首页>>代码示例>>PHP>>正文


PHP Line::cloneLine方法代码示例

本文整理汇总了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;
开发者ID:nagyist,项目名称:Tattle,代码行数:31,代码来源:lines.php

示例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());
     }
 }
开发者ID:nagyist,项目名称:Tattle,代码行数:29,代码来源:Graph.php


注:本文中的Line::cloneLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。