N°3123 - DisplayBock BlockCvs

This commit is contained in:
Eric
2020-12-08 16:29:16 +01:00
parent 10c3f9f633
commit b8a42843e0
10 changed files with 149 additions and 33 deletions

View File

@@ -212,47 +212,47 @@ function SetObjectBreadCrumbEntry(DBObject $oObj, WebPage $oPage)
function DisplaySearchSet($oP, $oFilter, $bSearchForm = true, $sBaseClass = '', $sFormat = '', $bDoSearch = true, $bSearchFormOpen = true)
{
//search block
$oBlockForm=null;
if ($bSearchForm)
{
$oBlockForm = null;
if ($bSearchForm) {
$aParams = array('open' => $bSearchFormOpen, 'table_id' => '1');
if (!empty($sBaseClass))
{
if (!empty($sBaseClass)) {
$aParams['baseClass'] = $sBaseClass;
}
$oBlockForm = new DisplayBlock($oFilter, 'search', false /* Asynchronous */, $aParams);
if (!$bDoSearch)
{
if (!$bDoSearch) {
$oBlockForm->Display($oP, 0);
}
}
if ($bDoSearch)
{
$oBlock = new DisplayBlock($oFilter, 'list', false);
if ($bDoSearch) {
if (strtolower($sFormat) == 'csv') {
$oBlock = new DisplayBlock($oFilter, 'csv', false);
// Adjust the size of the Textarea containing the CSV to fit almost all the remaining space
$oP->add_ready_script(" $('#1>textarea').height($('#1').parent().height() - $('#0').outerHeight() - 30).width( $('#1').parent().width() - 20);"); // adjust the size of the block
} else {
$oBlock = new DisplayBlock($oFilter, 'list', false);
// Breadcrumb
//$iCount = $oBlock->GetDisplayedCount();
$sPageId = "ui-search-".$oFilter->GetClass();
$sLabel = MetaModel::GetName($oFilter->GetClass());
$oP->SetBreadCrumbEntry($sPageId, $sLabel, '', '', 'fas fa-search', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
// Breadcrumb
//$iCount = $oBlock->GetDisplayedCount();
$sPageId = "ui-search-".$oFilter->GetClass();
$sLabel = MetaModel::GetName($oFilter->GetClass());
$oP->SetBreadCrumbEntry($sPageId, $sLabel, '', '', 'fas fa-search', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
}
if ($bSearchForm) {
//add search block
$sTableId = utils::ReadParam('_table_id_', null, false, 'raw_data');
if($sTableId=='')
{
if ($sTableId == '') {
$sTableId = 'result_1';
}
$aExtraParams['table_id']=$sTableId;
$oUIBlockForm=$oBlockForm->GetDisplay($oP,'search_1');
$aExtraParams['table_id'] = $sTableId;
$oUIBlockForm = $oBlockForm->GetDisplay($oP, 'search_1');
//add result block
$oUIBlock=$oBlock->GetDisplay($oP, $sTableId);
$oUIBlock = $oBlock->GetDisplay($oP, $sTableId);
$oUIBlock->AddCSSClasses("display_block sf_results_area");
//$oUIBlockForm->AddSubBlock($oUIBlock);
$oP->AddUiBlock($oUIBlockForm);
$oP->AddUiBlock($oUIBlock);
}
else {
} else {
$oBlock->Display($oP, 1);
}
}