コード例 #1
0
ファイル: class.bean.Mobo.php プロジェクト: phpscr/baibaiba
 /**
  * 从其他数据源获取数据
  */
 public function freshChart()
 {
     $db = new MoboDB();
     $r = $db->selectBugEveryOne();
     //得到的格式是name,status,value 需要的格式是 {{State:"张三",freq:{New:1,fixed:2,closed:3}}}
     $series = array();
     foreach ($r as $rr) {
         if ($rr["status"] == "1") {
             $series[$rr["name"]]["NEW"] = (int) $rr["value"];
         } else {
             if ($rr["status"] == "3") {
                 $series[$rr["name"]]["InProgress"] = (int) $rr["value"];
             } else {
                 if ($rr["status"] == "4") {
                     $series[$rr["name"]]["Reopened"] = (int) $rr["value"];
                 } else {
                     if ($rr["status"] == "5") {
                         $series[$rr["name"]]["Resolved"] = (int) $rr["value"];
                     } else {
                         if ($rr["status"] == "6") {
                             $series[$rr["name"]]["Closed"] = (int) $rr["value"];
                         }
                     }
                 }
             }
         }
     }
     $series1 = array();
     $series2 = array();
     foreach ($series as $k => $s) {
         $series1["State"] = $k;
         $series1["freq"] = array_merge(array("NEW" => 0, "InProgress" => 0, "Reopened" => 0, "Resolved" => 0, "Closed" => 0), $s);
         array_push($series2, $series1);
     }
     $this->chart->data["series"] = $series2;
     return $this->chart->getChartJson();
 }
コード例 #2
0
 public function freshChart()
 {
     $db = new MoboDB();
     $r = $db->selectBugEveryOne();
     //得到的格式是name,status,value 需要的格式是 {{State:"张三",freq:{New:1,fixed:2,closed:3}}}
     $series = array();
     foreach ($r as $rr) {
         if ($rr["status"] == "1") {
             $series[$rr["name"]]["NEW"] = (int) $rr["value"];
         } else {
             if ($rr["status"] == "3") {
                 $series[$rr["name"]]["正在处理"] = (int) $rr["value"];
             } else {
                 if ($rr["status"] == "4") {
                     $series[$rr["name"]]["重新打开"] = (int) $rr["value"];
                 } else {
                     if ($rr["status"] == "5") {
                         $series[$rr["name"]]["已解决"] = (int) $rr["value"];
                     } else {
                         if ($rr["status"] == "6") {
                             $series[$rr["name"]]["已关闭"] = (int) $rr["value"];
                         }
                     }
                 }
             }
         }
     }
     $series1 = array();
     $series2 = array();
     foreach ($series as $k => $s) {
         $series1["State"] = $k;
         $series1["freq"] = array_merge(array("NEW" => 0, "正在处理" => 0, "重新打开" => 0, "已解决" => 0, "已关闭" => 0), $s);
         array_push($series2, $series1);
     }
     return $series2;
 }