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


PHP Line::setWeight方法代码示例

本文整理汇总了PHP中Line::setWeight方法的典型用法代码示例。如果您正苦于以下问题:PHP Line::setWeight方法的具体用法?PHP Line::setWeight怎么用?PHP Line::setWeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Line的用法示例。


在下文中一共展示了Line::setWeight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSetGetWeight

 /**
  * Test set/get weight
  */
 public function testSetGetWeight()
 {
     $expected = 10;
     $object = new Line();
     $object->setWeight($expected);
     $this->assertEquals($expected, $object->getWeight());
 }
开发者ID:doit05,项目名称:relProject,代码行数:10,代码来源:LineTest.php

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

示例3: explode

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


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