function Populate() { if (substr($this->sName, -2) == '[]') { $sName = substr($this->sName, 0, strlen($this->sName) - 2); $nVal = 0; for ($nIdx = 0; $nIdx < count($this->aInputs); $nIdx++) { $sValue = VDGetValue($sName . '[' . $nVal . ']', true); if ($this->aInputs[$nIdx]->sType == 'select' && isset($this->aInputs[$nIdx]->oNode->aAttrs['multiple'])) { $this->aInputs[$nIdx]->ClearMultiple(); while ($sValue !== null && $this->aInputs[$nIdx]->SetValue($sValue)) { $nVal++; $sValue = VDGetValue($sName . '[' . $nVal . ']', true); } } else { if ($this->aInputs[$nIdx]->SetValue($sValue)) { $nVal++; } } } } else { $sValue = VDGetValue($this->sName, true); foreach ($this->aInputs as $nIdx => $mTmp) { $this->aInputs[$nIdx]->ClearMultiple(); $this->aInputs[$nIdx]->SetValue($sValue); } } }
function Populate($sForm = '') { $oMatrix =& new CVDInputMatrix(); foreach ($this->aInputs as $nIdx => $mTmp) { $aPhpName = $oMatrix->ProcessInput($this->aInputs[$nIdx]->aPhpName); $sValue = VDGetValue($aPhpName, true, $sForm); if ($this->aInputs[$nIdx]->sType == 'select' && isset($this->aInputs[$nIdx]->oNode->aAttrs['multiple'])) { $this->aInputs[$nIdx]->ClearMultiple(); while ($this->aInputs[$nIdx]->SetValue($sValue)) { $oMatrix->Commit(); $aPhpNameNew = $oMatrix->ProcessInput($this->aInputs[$nIdx]->aPhpName); if ($aPhpNameNew == $aPhpName) { $sValue = null; } else { $aPhpName = $aPhpNameNew; $sValue = VDGetValue($aPhpName, true, $sForm); } } $oMatrix->Rollback(); } else { if ($this->aInputs[$nIdx]->SetValue($sValue) || is_array($sValue)) { $oMatrix->Commit(); } else { $oMatrix->Rollback(); } } } }