\n";
- $aMapCriteria = array();
- $aList = MetaModel::GetZListItems($sClassName, 'standard_search');
- $aConsts = $oSet->ListConstantFields(); // Some fields are constants based on the query/context
- $sClassAlias = $oSet->GetFilter()->GetClassAlias();
- foreach($aList as $sFilterCode)
- {
- //$oAppContext->Reset($sFilterCode); // Make sure the same parameter will not be passed twice
- $sHtml .= '
';
- $sFilterValue = isset($aConsts[$sClassAlias][$sFilterCode]) ? $aConsts[$sClassAlias][$sFilterCode] : '';
- $sFilterValue = utils::ReadParam($sFilterCode, $sFilterValue, false, 'raw_data');
- $sFilterOpCode = null; // Use the default 'loose' OpCode
- if (empty($sFilterValue))
- {
- if (isset($aMapCriteria[$sFilterCode]))
- {
- if (count($aMapCriteria[$sFilterCode]) > 1)
- {
- $sFilterValue = Dict::S('UI:SearchValue:Mixed');
- }
- else
- {
- $sFilterValue = $aMapCriteria[$sFilterCode][0]['value'];
- $sFilterOpCode = $aMapCriteria[$sFilterCode][0]['opcode'];
- }
- // Todo: Investigate...
- if ($sFilterCode != 'company')
- {
- $oUnlimitedFilter->AddCondition($sFilterCode, $sFilterValue, $sFilterOpCode);
- }
- }
- }
-
- $oAttDef = MetaModel::GetAttributeDef($sClassName, $sFilterCode);
- if ($oAttDef->IsExternalKey(EXTKEY_ABSOLUTE))
- {
- $oKeyAttDef = $oAttDef->GetFinalAttDef();
- $sKeyAttClass = $oKeyAttDef->GetHostClass();
- $sKeyAttCode = $oKeyAttDef->GetCode();
-
- $sTargetClass = $oKeyAttDef->GetTargetClass();
- $oSearch = new DBObjectSearch($sTargetClass);
- $oSearch->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', true);
- $oAllowedValues = new DBObjectSet($oSearch);
-
- $iFieldSize = $oKeyAttDef->GetMaxSize();
- $iMaxComboLength = $oKeyAttDef->GetMaximumComboLength();
- $sHtml .= " ";
- $aExtKeyParams = $aExtraParams;
- $aExtKeyParams['iFieldSize'] = $oKeyAttDef->GetMaxSize();
- $aExtKeyParams['iMinChars'] = $oKeyAttDef->GetMinAutoCompleteChars();
- $sHtml .= UIExtKeyWidget::DisplayFromAttCode($oPage, $sKeyAttCode, $sKeyAttClass, $oAttDef->GetLabel(), $oAllowedValues, $sFilterValue, $sSearchFormId.'search_'.$sFilterCode, false, $sFilterCode, '', $aExtKeyParams, true);
- }
- else
- {
- $aAllowedValues = MetaModel::GetAllowedValues_flt($sClassName, $sFilterCode, $aExtraParams);
- if (is_null($aAllowedValues))
- {
- // Any value is possible, display an input box
- $sHtml .= " \n";
- }
- else
- {
- //Enum field, display a multi-select combo
- $sValue = "\n";
- $sHtml .= " $sValue\n";
- }
- }
- unset($aExtraParams[$sFilterCode]);
-
- // Finally, add a tooltip if one is defined for this attribute definition
- $sTip = $oAttDef->GetHelpOnSmartSearch();
- if (strlen($sTip) > 0)
- {
- $sTip = addslashes($sTip);
- $sTip = str_replace(array("\n", "\r"), " ", $sTip);
- // :input does represent in form visible input (INPUT, SELECT, TEXTAREA)
- $oPage->add_ready_script("$('form#fs_$sSearchFormId :input[name={$sFilterCode}]').qtip( { content: '$sTip', show: 'mouseover', hide: 'mouseout', style: { name: 'dark', tip: 'leftTop' }, position: { corner: { target: 'rightMiddle', tooltip: 'leftTop' }} } );");
- }
- $index++;
- $sHtml .= '
';
- }
- $sHtml .= "
\n";
- $sHtml .= "