/**
  * Display the view
  */
 public function display()
 {
     $valid_links = array();
     $links = FormulaHelper::getLinksForModule($this->tmodule, $this->package);
     // loop over all the $links and if we don't have any fields, don't pass it down
     $current_fields = array();
     //Preload the related fields from the first relationship
     if (!empty($links)) {
         reset($links);
         $selected_link = isset($links[$this->selLink]) ? $links[$this->selLink] : $links[key($links)];
         foreach ($links as $link_key => $link) {
             $rfields = FormulaHelper::getRelatableFieldsForLink($link, $this->package, array("number"));
             if (!empty($rfields)) {
                 $valid_links[$link_key] = $link['label'];
                 if ($link === $selected_link || empty($current_fields)) {
                     $current_fields = $rfields;
                 }
             }
         }
     }
     $this->ss->assign("rmodules", $valid_links);
     $this->ss->assign("rfields", $current_fields);
     $this->ss->assign("tmodule", $this->tmodule);
     $this->ss->assign("selLink", $this->selLink);
     $this->ss->assign("rollup_types", array("Sum" => "Sum", "Ave" => "Average", "Min" => "Minimum", "Max" => "Maximum"));
     $this->ss->assign("rollupType", $this->type);
     $this->ss->display('modules/ExpressionEngine/tpls/rollupWizard.tpl');
 }
 function display()
 {
     $rmodules = array();
     $links = FormulaHelper::getLinksForModule($this->tmodule, $this->package);
     $rfields = array();
     foreach ($links as $lname => $link) {
         $rmodules[$lname] = $link['label'];
     }
     //Preload the related fields from the first relationship
     if (!empty($links)) {
         reset($links);
         $link = isset($links[$this->selLink]) ? $links[$this->selLink] : $links[key($links)];
         $rfields = FormulaHelper::getRelatableFieldsForLink($link, $this->package);
     }
     $this->ss->assign("rmodules", $rmodules);
     $this->ss->assign("rfields", $rfields);
     $this->ss->assign("tmodule", $this->tmodule);
     $this->ss->assign("selLink", $this->selLink);
     $this->ss->assign("rollup_types", array("rollupSum" => "Sum", "rollupMin" => "Minimum", "rollupMax" => "Maximum", "rollupAverage" => "Average"));
     $this->ss->display('modules/ExpressionEngine/tpls/selectRelatedField.tpl');
 }