public function deleteNetwork()
 {
     $this->needsApp();
     $this->printHeader = false;
     $this->printFooter = false;
     $nid = $_REQUEST['nid'];
     $network = new Network($nid);
     $network->delete();
     $networks = $this->networks = NetworkUtil::getNetworksByAidIndexNid($this->app->id);
     unset($networks[$nid]);
     App::setPriorities($networks);
     $sum = App::setWeights($networks);
     $url = '/apps/oneApp/appNetworks?aid=' . $this->app->id;
     if ($sum != 100) {
         $url .= '&showNoNetworkRunning=true';
     }
     fb("sum", $sum);
     fb('url', $url);
     $this->redirect($url);
 }
 public function getNetworksIndexNid()
 {
     if ($this->networks == null) {
         $this->networks = NetworkUtil::getNetworksByAidIndexNid($this->id);
     }
     return $this->networks;
 }
 public static function getReportsByAid($aid, $startDate, $endDate, $numCat = 4)
 {
     return ReportUtil::getReportsByIdAndGroup('aid', $aid, 'type', $startDate, $endDate, NetworkUtil::getNetworksByAid($aid), $numCat);
 }