public function backfillPriority()
 {
     $this->needsApp();
     $this->breadcrumbs[] = array("text" => "Backfill Priority", "link" => "/apps/oneApp/backfillPriority");
     $this->smarty->assign('sideNav_current', 'backFill');
     $this->smarty->assign('app', $this->app);
     $this->smarty->assign('backfill', TRUE);
     $networks = array();
     $appHasTypes = array();
     foreach (Network::$NETWORKS as $type => $typeInfo) {
         $appHasTypes[$type] = false;
     }
     $appNetworks = NetworkUtil::getAllNetworksByAid($this->app->id);
     fb("appNetworks", $appNetworks);
     foreach ($appNetworks as $network) {
         $appHasTypes[$network->type] = true;
         $networks[] = $network;
     }
     fb("hasType", $appHasTypes);
     foreach (Network::$NETWORKS as $type => $typeInfo) {
         if (!$appHasTypes[$type]) {
             $network = new Network();
             $network->aid = '';
             $network->type = $type;
             $network->adsOn = 0;
             $network->weight = 0;
             $networks[] = $network;
         }
     }
     $compare = $this->makeSortFunction('priority', true);
     usort($networks, $compare);
     $this->smarty->assign('networks', $networks);
     fb('networks', $networks);
     $this->smarty->assign('networkTypes', Network::$NETWORKS);
     fb("smarty", $this->smarty->get_template_vars());
     return $this->smarty->fetch('../tpl/www/apps/appNetworks.tpl');
 }