Example #1
0
 function processContent(&$tpl)
 {
     global $lll, $upperTemplate, $gorumuser, $gorumroll;
     $hiddenFieldPrefix = $this->getFormHeader($tpl);
     $tpl->assign("zebraForm", $this->zebraForm);
     $tpl->assign("listAndMethod", "{$gorumroll->list}-{$gorumroll->method}");
     $class = $gorumroll->getClass();
     $method = $gorumroll->method;
     if ($smartForm = in_array("smartform", $this->typ) || in_array("{$method}: smartform", $this->typ)) {
         JavaScript::addInclude(GORUM_JS_DIR . "/usableforms.js");
         JavaScript::addOnload("prepareForm();");
     }
     $lllGlobProp =& new LllGlobalProperties($this->base);
     $tpl->assign("title", $lllGlobProp->getLabel($method));
     $attributeList = isset($this->typ["order"]) ? $this->typ["order"] : array_keys($this->typ["attributes"]);
     //print_r($attributeList);
     $rows = array();
     $indexes = array();
     $j = 0;
     foreach ($attributeList as $attr) {
         if (!($val =& $this->typ["attributes"][$attr])) {
             continue;
         }
         $visibility = $this->base->getVisibility($val, $attr);
         if ($visibility == Form_invisible) {
             continue;
         }
         $displayType = FormFieldType::getFormDisplayType($val, $method, $attr);
         if (in_array($displayType, array("section", "txtsection", "freepart"))) {
             $this->{"gener{$displayType}Field"}($rows[$j], $attr, $val);
             $indexes[$attr] = $j;
             $j++;
             continue;
         }
         // Ahelyett, hogy a processMethodban initeznenk, itt allitjuk
         // az attributumot defaultra, ha nincs beszettelve:
         if (!isset($this->base->{$attr})) {
             $this->base->{$attr} = $this->base->getDefault($this->typ, $attr);
         }
         if ($visibility == Form_hidden || $visibility == Form_readonly && !in_array("nohidden", $val)) {
             $tpl->hiddens .= GenerWidget::generHiddenField($attr, $this->base->{$attr}, $hiddenFieldPrefix);
         }
         if (!$displayType || $visibility == Form_hidden) {
             continue;
         }
         $lllProp =& new LllProperties($this->base, $attr);
         $s = $this->generField($displayType, $attr, $val, $lllProp);
         if (!isset($val["fieldgroup"])) {
             $rows[$j]["type"] = $displayType;
             $this->generCommonFieldProperties($rows[$j], $attr, $val, $lllProp);
             $rows[$j]["field"] = $s;
             $indexes[$attr] = $j;
             $j++;
         } else {
             // ha egy mezo-csoport tagja, akkor csak hozzafuzzuk az elozo mezohoz
             // es nem noveljuk a szamlalot:
             if (isset($lll[$class . "_" . $attr])) {
                 $s = $lll[$class . "_" . $attr] . $s;
             }
             $rows[$j - 1]["field"] .= $s;
         }
     }
     $submits = array();
     $this->getFormSubmit($submits);
     $this->addJavaScripts();
     $tpl->assign("additionalHiddens", $this->base->getAdditionalHiddens($tpl));
     $tpl->assign("additionalContent", "");
     $tpl->assign("rows", $rows);
     $tpl->assign("indexes", $indexes);
     $tpl->assign("submits", $submits);
     //var_dump($tpl);die();
     return ok;
 }
Example #2
0
 function fieldExistsInForm(&$typ, $attr)
 {
     global $gorumroll;
     if (!@($attrInfo =& $typ["attributes"][$attr])) {
         return FALSE;
         // ha nincs ilyen attr
     }
     if (($visibility = $this->getVisibility($attrInfo, $attr)) == Form_invisible || $visibility == Form_readonly && in_array("nohidden", $attrInfo)) {
         return FALSE;
         // ha invisible
     }
     if ($visibility == Form_hidden || $visibility == Form_readonly) {
         return TRUE;
     }
     if (!FormFieldType::getFormDisplayType($attrInfo, $gorumroll->method, $attr)) {
         return FALSE;
         // ha egyaltalan nincs is a formban
     }
     return TRUE;
 }