BUG 5648 solved. Dependent Fields work now in onload dynaform
This commit is contained in:
@@ -99,9 +99,10 @@ function G_Field ( form, element, name )
|
||||
};
|
||||
|
||||
this.updateDepententFields=function(event) {
|
||||
|
||||
var tempValue;
|
||||
if (me.dependentFields.length===0) return true;
|
||||
var fields=[],i,grid='',row=0;
|
||||
var fields=[],Fields = [],i,grid='',row=0;
|
||||
for(i in me.dependentFields) {
|
||||
if (me.dependentFields[i].dependentOf) {
|
||||
for (var j = 0; j < me.dependentFields[i].dependentOf.length; j++) {
|
||||
@@ -110,12 +111,35 @@ function G_Field ( form, element, name )
|
||||
var aAux = oAux.name.split('][');
|
||||
grid = aAux[0];
|
||||
row = aAux[1];
|
||||
eval("var oAux2 = {" + aAux[2] + ":'" + oAux.value() + "'}");
|
||||
fieldName = aAux[2];
|
||||
if (Fields.length > 0){
|
||||
aux = Fields;
|
||||
aux.push('?');
|
||||
if (aux.join('*').indexOf(fieldName + '*') == -1){
|
||||
Fields.push(fieldName);
|
||||
eval("var oAux2 = {" + fieldName + ":'" + oAux.value() + "'}");
|
||||
fields = fields.concat(oAux2);
|
||||
}
|
||||
}else{
|
||||
Fields.push(fieldName);
|
||||
eval("var oAux2 = {" + fieldName + ":'" + oAux.value() + "'}");
|
||||
fields = fields.concat(oAux2);
|
||||
}
|
||||
}
|
||||
else {
|
||||
aux = Fields;
|
||||
aux.push('?');
|
||||
oAux = me.dependentFields[i].dependentOf[0];
|
||||
if (Fields.length > 0){
|
||||
if (aux.join('*').indexOf(oAux.name + '*') == -1){
|
||||
Fields.push(oAux.name);
|
||||
fields = fields.concat(me.dependentFields[i].dependentOf);
|
||||
}
|
||||
}else{
|
||||
Fields.push(oAux.name);
|
||||
fields = fields.concat(me.dependentFields[i].dependentOf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,43 +157,40 @@ function G_Field ( form, element, name )
|
||||
var newcont;
|
||||
eval('newcont=' + response + ';');
|
||||
if (grid == '') {
|
||||
//alert('1');
|
||||
for(var i=0;i<newcont.length;i++) {
|
||||
//alert(newcont[i].name + '-' + newcont[i].value);
|
||||
var j=me.form.getElementIdByName(newcont[i].name);
|
||||
me.form.aElements[j].setValue(newcont[i].value);
|
||||
me.form.aElements[j].setContent(newcont[i].content);
|
||||
if (me.form.aElements[j].element.fireEvent) {
|
||||
me.form.aElements[j].updateDepententFields();
|
||||
/*if (me.form.aElements[j].element.fireEvent) {
|
||||
me.form.aElements[j].element.fireEvent("onchange");
|
||||
//alert ("fireEvent");
|
||||
} else {
|
||||
//alert ("initEvent");
|
||||
var evObj = document.createEvent('HTMLEvents');
|
||||
evObj.initEvent( 'change', true, true );
|
||||
me.form.aElements[j].element.dispatchEvent(evObj);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
//alert('2: ' + newcont.length);
|
||||
for(var i=0;i<newcont.length;i++) {
|
||||
var oAux = me.form.getElementByName(grid);
|
||||
if (oAux) {
|
||||
var oAux2 = oAux.getElementByName(row, newcont[i].name);
|
||||
if (oAux2) {
|
||||
oAux2.setContent(newcont[i].content);
|
||||
if (newcont[i].content.type == 'dropdown') {
|
||||
oAux2.setValue(newcont[i].value);
|
||||
}
|
||||
oAux2.setContent(newcont[i].content);
|
||||
oAux2.updateDepententFields();
|
||||
// this line is also needed to trigger the onchange event to trigger the calculation of
|
||||
// sumatory or average functions in text fields
|
||||
//if (i == (newcont.length-1)){
|
||||
if (oAux2.element.fireEvent) {
|
||||
/* if (oAux2.element.fireEvent) {
|
||||
oAux2.element.fireEvent("onchange");
|
||||
} else {
|
||||
var evObj = document.createEvent('HTMLEvents');
|
||||
evObj.initEvent( 'change', true, true );
|
||||
oAux2.element.dispatchEvent(evObj);
|
||||
}
|
||||
}*/
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -181,6 +202,8 @@ function G_Field ( form, element, name )
|
||||
// this checks the dependent fields that doesn't have assigned a value
|
||||
// but their master yes and their dependence must be fulfilled within one
|
||||
// onchange event
|
||||
|
||||
/*
|
||||
if (grid!='')
|
||||
{
|
||||
var checkCallServer;
|
||||
@@ -200,9 +223,9 @@ function G_Field ( form, element, name )
|
||||
var oAuxJs;
|
||||
for ( index in dependentList ){
|
||||
field = 'form[grid]['+ row +']['+dependentList[index]+']';
|
||||
// alert(field);
|
||||
|
||||
oAuxJs = document.getElementById(field);
|
||||
// alert (oAuxJs.value);
|
||||
|
||||
if ( oAuxJs!=null ){
|
||||
if (oAuxJs.value!="") {
|
||||
if ( oAuxJs.fireEvent ) {
|
||||
@@ -215,7 +238,7 @@ function G_Field ( form, element, name )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
return true;
|
||||
};
|
||||
this.setValue = function(newValue) {
|
||||
@@ -427,13 +450,13 @@ function G_Text( form, element, name, type )
|
||||
break;
|
||||
case "Alpha":
|
||||
if (keyCode==8) return true;
|
||||
patron =/[A-Za-z\sáéÃóúäëïöüñçÇÑÃ<EFBFBD>ÉÃ<EFBFBD>ÓÚÄËÃ<EFBFBD>ÖÜ]/;
|
||||
patron =/[A-Za-z\s<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]/;
|
||||
te = String.fromCharCode(keyCode);
|
||||
return patron.test(te);
|
||||
break;
|
||||
case "AlphaNum":
|
||||
if (keyCode==8) return true;
|
||||
patron =/[A-Za-z0-9\sáéÃóúäëïöüñçÇÑÃ<EFBFBD>ÉÃ<EFBFBD>ÓÚÄËÃ<EFBFBD>ÖÜ]/;
|
||||
patron =/[A-Za-z0-9\s<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]/;
|
||||
te = String.fromCharCode(keyCode);
|
||||
return patron.test(te);
|
||||
break;
|
||||
@@ -744,7 +767,7 @@ function G_Text( form, element, name, type )
|
||||
|
||||
if(this.validate=="Email")
|
||||
{
|
||||
var pat=/^[\w\_\-\.çñ]{2,255}@[\w\_\-]{2,255}\.[a-z]{1,3}\.?[a-z]{0,3}$/;
|
||||
var pat=/^[\w\_\-\.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]{2,255}@[\w\_\-]{2,255}\.[a-z]{1,3}\.?[a-z]{0,3}$/;
|
||||
if(!pat.test(this.element.value))
|
||||
{
|
||||
this.element.className=this.element.className.split(" ")[0]+" FormFieldInvalid";
|
||||
|
||||
@@ -324,16 +324,31 @@ var G_Grid = function(oForm, sGridName){
|
||||
aObjects = null;
|
||||
break;
|
||||
case 'select': //DROPDOWN
|
||||
var oNewSelect;
|
||||
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('select');
|
||||
if (aObjects){
|
||||
newID = aObjects[0].id.replace(/\[1\]/g, '\[' + currentRow + '\]');
|
||||
aObjects[0].id = newID;
|
||||
aObjects[0].name = newID;
|
||||
|
||||
oNewSelect = document.createElement(aObjects[0].tagName);
|
||||
oNewSelect.id = newID;
|
||||
oNewSelect.name = newID;
|
||||
oNewSelect.setAttribute('class','module_app_input___gray');
|
||||
|
||||
aAttributes = aObjects[0].attributes;
|
||||
for (a=0; a < aAttributes.length; a++){
|
||||
if (aAttributes[a].name.indexOf('pm:') != -1){
|
||||
oNewSelect.setAttribute(aAttributes[a].name,aAttributes[a].value);
|
||||
}
|
||||
}
|
||||
|
||||
attributes = elementAttributesNS(aObjects[0], 'pm');
|
||||
var MyAtt = attributes;
|
||||
if (attributes.defaultvalue != '' && typeof attributes.defaultvalue != 'undefined'){
|
||||
defaultValue = attributes.defaultvalue;
|
||||
//Set '' for Default Value when dropdown has dependent fields.
|
||||
if (attributes.dependent == '1') defaultValue = '';
|
||||
//if (attributes.dependent == '1') defaultValue = '';
|
||||
}else{
|
||||
defaultValue = '';
|
||||
}
|
||||
@@ -361,12 +376,14 @@ var G_Grid = function(oForm, sGridName){
|
||||
oAux.options.add(oOption);
|
||||
}
|
||||
}
|
||||
aObjects[0].innerHTML = ''; //Delete options
|
||||
oNewSelect.innerHTML = ''; //Delete options
|
||||
//aObjects[0].innerHTML = ''; //Delete options
|
||||
for (var r =0; r < oAux.options.length; r++){
|
||||
var xOption = document.createElement('OPTION');
|
||||
xOption.value = oAux.options[r].value;
|
||||
xOption.text = oAux.options[r].text;
|
||||
aObjects[0].options.add(xOption);
|
||||
//aObjects[0].options.add(xOption);
|
||||
oNewSelect.options.add(xOption);
|
||||
}
|
||||
}else{
|
||||
//Set Default Value if it's not a Dependent Field
|
||||
@@ -381,7 +398,8 @@ var G_Grid = function(oForm, sGridName){
|
||||
}
|
||||
oAux.options.add(oOption);
|
||||
}
|
||||
aObjects[0].innerHTML = ''; //Delete options
|
||||
//aObjects[0].innerHTML = ''; //Delete options
|
||||
oNewSelect.innerHTML = ''; //Delete options
|
||||
for (var r =0; r < oAux.options.length; r++){
|
||||
var xOption = document.createElement('OPTION');
|
||||
xOption.value = oAux.options[r].value;
|
||||
@@ -395,11 +413,15 @@ var G_Grid = function(oForm, sGridName){
|
||||
xOption.setAttribute('selected','selected');
|
||||
}
|
||||
}
|
||||
aObjects[0].options.add(xOption);
|
||||
//aObjects[0].options.add(xOption);
|
||||
oNewSelect.options.add(xOption);
|
||||
}
|
||||
}
|
||||
//TODO: Implement Default Value and Dependent Fields Trigger for grid dropdowns
|
||||
}
|
||||
parentSelect = aObjects[0].parentNode;
|
||||
parentSelect.removeChild(aObjects[0]);
|
||||
parentSelect.appendChild(oNewSelect);
|
||||
}
|
||||
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('input');
|
||||
if (aObjects.length > 0){
|
||||
@@ -448,6 +470,23 @@ var G_Grid = function(oForm, sGridName){
|
||||
}
|
||||
}
|
||||
}
|
||||
//Fire Update Dependent Fields for any item with dependentfields and not included in dependencie
|
||||
var xIsDependentOf = [];
|
||||
var exist = false;
|
||||
for (i=0; i < this.aFields.length; i++){
|
||||
oAux = this.getElementByName(currentRow, this.aFields[i].sFieldName);
|
||||
if (oAux.dependentFields.length > 0){
|
||||
exist = false;
|
||||
for (m=0; m < xIsDependentOf.length; m++)
|
||||
if (xIsDependentOf[m] == oAux.name) exist = true;
|
||||
for (j=0; j < oAux.dependentFields.length; j++){
|
||||
xIsDependentOf.push(oAux.dependentFields[j].name);
|
||||
}
|
||||
if (!exist){
|
||||
oAux.updateDepententFields();
|
||||
}
|
||||
}
|
||||
}
|
||||
//Fires OnAddRow Event
|
||||
if (this.onaddrow) {
|
||||
this.onaddrow(currentRow);
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
$G_FORM->id=urlDecode($_POST['form']);
|
||||
//$G_FORM->values=isset($_SESSION[$G_FORM->id]) ? $_SESSION[$G_FORM->id] : array();
|
||||
$newValues=($json->decode(urlDecode(stripslashes($_POST['fields']))));
|
||||
$newValues = array_unique($newValues);
|
||||
if (isset($_POST['grid'])) {
|
||||
$_POST['row'] = (int)$_POST['row'];
|
||||
$aAux = array();
|
||||
@@ -71,7 +72,6 @@
|
||||
unset($newValues[$sKey]->$aKeys[0]);
|
||||
}
|
||||
}
|
||||
|
||||
//Resolve dependencies
|
||||
//Returns an array ($dependentFields) with the names of the fields
|
||||
//that depends of fields passed through AJAX ($_GET/$_POST)
|
||||
@@ -82,7 +82,6 @@
|
||||
//Search dependent fields
|
||||
foreach($newValues[$r] as $k => $v) {
|
||||
if (!is_array($v)) {
|
||||
//echo 'NoASrray';
|
||||
$myDependentFields = subDependencies( $k , $G_FORM , $aux );
|
||||
$_SESSION[$G_FORM->id][$k] = $v;
|
||||
}
|
||||
@@ -96,8 +95,6 @@
|
||||
//$_SESSION[$G_FORM->id][$k] = $v;
|
||||
}
|
||||
}
|
||||
//g::pr($myDependentFields);
|
||||
|
||||
$G_FORM->values=isset($_SESSION[$G_FORM->id]) ? $_SESSION[$G_FORM->id] : array();
|
||||
|
||||
$dependentFields=array_unique($dependentFields);
|
||||
@@ -105,7 +102,6 @@
|
||||
//Parse and update the new content
|
||||
$template = PATH_CORE . 'templates/xmlform.html';
|
||||
$newContent=$G_FORM->getFields($template, (isset($_POST['row']) ? $_POST['row'] : -1));
|
||||
|
||||
//Returns the dependentFields's content
|
||||
$sendContent=array();
|
||||
$r=0;
|
||||
@@ -176,10 +172,10 @@
|
||||
for( $r=0 ; $r < sizeof($myDependentFields) ; $r++ ) {
|
||||
if ($myDependentFields[$r]=="") unset($myDependentFields[$r]);
|
||||
}
|
||||
$mD = $myDependentFields;
|
||||
foreach( $mD as $ki) {
|
||||
$myDependentFields = array_merge( $myDependentFields , subDependencies( $ki , $G_FORM , $aux ) );
|
||||
}
|
||||
// $mD = $myDependentFields;
|
||||
// foreach( $mD as $ki) {
|
||||
// $myDependentFields = array_merge( $myDependentFields , subDependencies( $ki , $G_FORM , $aux ) );
|
||||
// }
|
||||
}
|
||||
else {
|
||||
if (!array_key_exists( $k , $G_FORM->fields[$grid]->fields )) return array();
|
||||
@@ -194,7 +190,7 @@
|
||||
for( $r=0 ; $r < sizeof($myDependentFields) ; $r++ ) {
|
||||
if ($myDependentFields[$r]=="") unset($myDependentFields[$r]);
|
||||
}
|
||||
$mD = $myDependentFields;
|
||||
// $mD = $myDependentFields;
|
||||
// foreach( $mD as $ki) {
|
||||
// $myDependentFields = array_merge( $myDependentFields , subDependencies( $ki , $G_FORM , $aux, $grid) );
|
||||
// }
|
||||
|
||||
@@ -198,6 +198,7 @@ class XmlForm_Field {
|
||||
*/
|
||||
private function executePropel(&$owner, $row = -1)
|
||||
{
|
||||
//g::pr($row);
|
||||
if (! isset ( $owner->values [$this->name] )) {
|
||||
if ($row > - 1) {
|
||||
$owner->values [$this->name] = array ();
|
||||
@@ -206,18 +207,35 @@ class XmlForm_Field {
|
||||
}
|
||||
}
|
||||
if (! is_array ( $owner->values [$this->name] )) {
|
||||
//echo '1';
|
||||
$query = G::replaceDataField ( $this->sql, $owner->values );
|
||||
} else {
|
||||
$aAux = array ();
|
||||
foreach ( $owner->values as $key => $data ) {
|
||||
if (is_array ( $data )) {
|
||||
$aAux [$key] = isset ( $data [$row] ) ? $data [$row] : '';
|
||||
//echo '3:'.$key.' ';
|
||||
if (isset ( $data [$row] )){
|
||||
$qValue = $data [$row];
|
||||
}else{
|
||||
if (isset($owner->fields[$key]->selectedValue)){
|
||||
$qValue = $owner->fields[$key]->selectedValue;
|
||||
}else{
|
||||
$qValue = '';
|
||||
}
|
||||
}
|
||||
$aAux [$key] = $qValue;
|
||||
//$aAux [$key] = isset ( $data [$row] ) ? $data [$row] : '';
|
||||
} else {
|
||||
//echo '4'.$key.' ';
|
||||
$aAux [$key] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
//echo '2';
|
||||
//g::pr($aAux);
|
||||
$query = G::replaceDataField ( $this->sql, $aAux );
|
||||
}
|
||||
//echo $query;
|
||||
|
||||
$result = array ();
|
||||
if ($this->sqlConnection == 'dbarray') {
|
||||
@@ -2516,6 +2534,7 @@ class XmlForm_Field_Dropdown extends XmlForm_Field {
|
||||
var $saveLabel = 0;
|
||||
var $modeGridDrop = '';
|
||||
var $renderMode = '';
|
||||
var $selectedValue = '';
|
||||
function validateValue($value, &$owner)
|
||||
{
|
||||
/*$this->executeSQL( $owner );
|
||||
@@ -2533,12 +2552,15 @@ class XmlForm_Field_Dropdown extends XmlForm_Field {
|
||||
*/
|
||||
function render($value = NULL, $owner = NULL, $rowId = '', $onlyValue = false, $row = -1, $therow = -1)
|
||||
{
|
||||
//g::pr($owner->fields);
|
||||
//echo $row.' - '.$therow;
|
||||
//Returns value from a PMTable when it is exists.
|
||||
if (($this->pmconnection != '') && ($this->pmfield != '') && $value == NULL) {
|
||||
$value = $this->getPMTableValue($owner);
|
||||
}
|
||||
//Recalculate SQL options if $therow is not defined or the row id equal
|
||||
if ($therow == -1) {
|
||||
//echo 'Entro:'.$this->dependentFields;
|
||||
$this->executeSQL ( $owner, $row );
|
||||
} else {
|
||||
if ($row == $therow) {
|
||||
@@ -2584,6 +2606,7 @@ class XmlForm_Field_Dropdown extends XmlForm_Field {
|
||||
$html .= 'name="form' . $rowId . '[' . $this->name . ']" ';
|
||||
$html .= 'value="'.(($findValue != '') ? $findValue : $firstValue).'" />';
|
||||
}
|
||||
$this->selectedValue = ($findValue != '') ? $findValue : $firstValue;
|
||||
}else{ //VIEW MODE
|
||||
$findValue = '';
|
||||
$firstValue = '';
|
||||
@@ -3025,11 +3048,11 @@ class XmlForm_Field_Grid extends XmlForm_Field
|
||||
foreach ( $arrayKeys as $key ){
|
||||
if (isset($this->fields[$key]->defaultValue)){
|
||||
$emptyValue = $this->fields[$key]->defaultValue;
|
||||
if (isset($this->fields[$key]->dependentFields)){
|
||||
/** if (isset($this->fields[$key]->dependentFields)){
|
||||
if ($this->fields[$key]->dependentFields != ''){
|
||||
$emptyValue = '';
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}else{
|
||||
$emptyValue = '';
|
||||
}
|
||||
@@ -3064,10 +3087,25 @@ class XmlForm_Field_Grid extends XmlForm_Field
|
||||
if (! isset ( $values ) || ! is_array ( $values ) || sizeof ( $values ) == 0) {
|
||||
$values = array_keys ( $this->fields );
|
||||
}
|
||||
|
||||
if ($therow != -1){
|
||||
//Check if values arrary is complete to can flip.
|
||||
$xValues = array();
|
||||
$aRow = $values[$therow];
|
||||
for ($c=1; $c <= $therow; $c++){
|
||||
if ($c == $therow){
|
||||
$xValues[$therow] = $aRow;
|
||||
}else{
|
||||
foreach ($aRow as $key=>$value){
|
||||
$xValues[$c][$key] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
$values = $xValues;
|
||||
}
|
||||
$aValuekeys = array_keys ( $values );
|
||||
if (count ( $aValuekeys ) > 0 && ( int ) $aValuekeys [0] == 1)
|
||||
$values = $this->flipValues ( $values );
|
||||
//if ($therow == 1)g::pr($values);
|
||||
$this->rows = count ( reset ( $values ) );
|
||||
if (isset ( $owner->values )) {
|
||||
foreach ( $owner->values as $key => $value ) {
|
||||
@@ -4408,7 +4446,8 @@ class xmlformTemplate extends Smarty
|
||||
if (! is_array ( $value )) {
|
||||
if ($form->type == 'grid') {
|
||||
$aAux = array ();
|
||||
for($i = 0; $i < count ( $form->owner->values [$form->name] ); $i ++) {
|
||||
$index = ($therow >count ( $form->owner->values [$form->name] ))? $therow : count($form->owner->values [$form->name] );
|
||||
for($i = 0; $i < $index; $i ++) {
|
||||
$aAux [] = '';
|
||||
}
|
||||
$result ['form'] [$k] = $form->fields [$k]->renderGrid ( $aAux, $form );
|
||||
@@ -4416,10 +4455,9 @@ class xmlformTemplate extends Smarty
|
||||
$result ['form'] [$k] = $form->fields [$k]->render ( $value, $form );
|
||||
}
|
||||
} else {
|
||||
if (isset ( $form->owner )) {
|
||||
/*if (isset ( $form->owner )) {
|
||||
|
||||
if (count ( $value ) < count ( $form->owner->values [$form->name] )) {
|
||||
|
||||
$i = count ( $value );
|
||||
$j = count ( $form->owner->values [$form->name] );
|
||||
|
||||
@@ -4427,11 +4465,9 @@ class xmlformTemplate extends Smarty
|
||||
$value [] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
if ($v->type == 'grid') {
|
||||
|
||||
$result ['form'] [$k] = $form->fields [$k]->renderGrid ( $value, $form, $therow );
|
||||
} else {
|
||||
if ($v->type == 'dropdown') {
|
||||
|
||||
Reference in New Issue
Block a user