function getFormHeader(&$tpl) { global $gorumroll, $scriptName, $noFileUpload, $onSubmit; if (isset($this->typ["formid"])) { $formId = $hiddenFieldPrefix = $this->typ["formid"]; $formAttrs = "id='{$formId}'"; } else { $formId = "gorumForm"; $hiddenFieldPrefix = ""; $formAttrs = "id='gorumForm'"; } if (!isset($noFileUpload)) { $formAttrs .= " ENCTYPE='multipart/form-data'"; } $tpl->assign("formAttrs", $formAttrs); if ($onSubmit) { JavaScript::addEvent("#{$formId}", "submit", $onSubmit); } $tpl->assign("scriptName", $scriptName); // A kovetkezo method beallitasa: $ctrl =& new AppController(array("method" => str_replace("_form", "", $gorumroll->method))); $tpl->assign("hiddens", $ctrl->generHiddenFields($hiddenFieldPrefix)); return $hiddenFieldPrefix; }
function generMultipleClassSelectionField($attr, $val, &$lllProp) { global $lll; $size = isset($val["size"]) ? $val["size"] : 1; $width = isset($val["width"]) ? $val["width"] : 0; $hasMany = FALSE; if (isset($val["get_values_callback"])) { eval('$objects=$this->base->' . $val["get_values_callback"] . ';'); } else { $hasMany = HasMany::construct($this->base, $attr, $val); if (isset($val["query"])) { // ha egy fuggvenyt adunk meg query-kent: if (!preg_match("{^SELECT.*}", $val["query"])) { eval("\$query={$val['query']};"); } else { $query = $val["query"]; } //echo $query; } elseif ($hasMany) { $query = $hasMany->getSelectFieldQuery(); } else { $query = "SELECT id, {$val['labelAttr']} FROM @{$val['class']}"; } if (isset($val["where"])) { // ha egy osztalyfuggvenyt adunk meg where feltetelkent: pl. "where"=>"\$this->base->getWhere()" if (strstr($val["where"], "\$this->base")) { eval("\$w={$val['where']};"); } else { $w = $val["where"]; } $query .= " WHERE {$w}"; } if (isset($val["ordered"])) { $query .= " ORDER BY {$val['ordered']}"; } //echo $query; $objects = new $val["class"](); loadObjectsSQL($objects, $query, $objects); } if (in_array("variablesize", $val)) { $count = count($objects); if (isset($val["nothing selected"])) { $count++; } $size = $count > $size ? $size : $count; } $labels = array(); $values = array(); if (isset($val["nothing selected"])) { $values[] = 0; $labels[] = $lll[$val["nothing selected"]]; } if (isset($val["labelFormat"])) { $labelAttrs = split(", *", $val["labelAttr"]); $e = "sprintf('{$val['labelFormat']}'"; foreach ($labelAttrs as $l) { $e .= ", \$obj->{$l}"; } $e .= ")"; } $default = array(); foreach ($objects as $obj) { $values[] = $obj->id; if ($obj->id && isset($val["labelFormat"])) { eval("\$temp={$e};"); $labels[] = $temp; } elseif ($obj->id) { $labels[] = $obj->{$val["labelAttr"]}; } else { $labels[] = $lll["nothingSelected"]; } if (!empty($obj->selected)) { $default[] = $obj->id; } } if (!$hasMany || get_class($hasMany) == "HasManyWithoutLinkClass" || in_array("overridedefault", $val)) { $default = in_array("nodefaultselected", $val) ? 0 : $this->base->{$attr}; } // if( is_array($this->base->{$attr})) // { // $default = in_array("nodefaultselected",$val) ? 0 : $this->base->{$attr}; // } // elseif( $this->base->{$attr} ) $default=$this->base->{$attr}; if (isset($val["onclick"])) { JavaScript::addEvent('#' . $attr, "click", $val["onclick"]); } if (isset($val["onchange"])) { JavaScript::addEvent('#' . $attr, "change", $val["onchange"]); } $showRelation = isset($val["show_relation"]) ? $val["show_relation"] : ""; $anyfield = isset($val["anyfield"]) ? $val["anyfield"] : ""; $asmSelect = isset($val["asmselect"]) ? $val["asmselect"] : ""; $asmSelectLabel = isset($val["asmselect_label"]) ? $val["asmselect_label"] : ""; $s = GenerWidget::generMultipleSelection($attr, $labels, $values, $default, $size, $width, $showRelation, $anyfield, $asmSelect, $asmSelectLabel); if (in_array("selectfilter", $val)) { $s = GenerWidget::generSelectFilterField($attr, $labels, $width) . $s; } return $s; }