From 5ad3cb63ce7b726b563bf6141891fb1431db3902 Mon Sep 17 00:00:00 2001 From: Julian Egelstaff Date: Sat, 9 Nov 2024 14:04:53 -0500 Subject: [PATCH] Improvements to filter terminology and display (respects linked option sorting order) --- modules/formulize/include/functions.php | 13 +++++++++++-- modules/formulize/language/english/main.php | 3 ++- modules/formulize/language/french/main.php | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/formulize/include/functions.php b/modules/formulize/include/functions.php index 99b02c061..46cdcd34d 100644 --- a/modules/formulize/include/functions.php +++ b/modules/formulize/include/functions.php @@ -4515,7 +4515,7 @@ function buildFilter($id, $element_identifier, $defaultText="", $formDOMId="", $ $checked = strstr($_POST[$id], $checkboxOption) ? "checked" : ""; $selected = $_POST[$id] === 'qsf_0_{BLANK}' ? "selected" : ""; } - $filter .= $multi ? "
\n" : "\n"; + $filter .= $multi ? "
\n" : "\n"; } } else { // not a filter for core use on list of entries screen, so if multi, set default text to "Any", otherwise use the "Choose an option" default, unless the user has specified something @@ -4645,7 +4645,16 @@ function buildFilter($id, $element_identifier, $defaultText="", $formDOMId="", $ $select_column = trim($select_column, ","); } - if ($dataResult = $xoopsDB->query("SELECT $select_column, t1.entry_id FROM ".$xoopsDB->prefix("formulize_".$sourceFormObject->getVar('form_handle'))." as t1 $limitConditionTable $extra_clause $conditionsfilter $conditionsfilter_oom $limitConditionWhere ORDER BY t1.`$source_element_handle`")) { + // setup the sort order based on ele_value[12], which is an element id number + $sortOrder = $ele_value[15] == 2 ? " DESC" : "ASC"; + if($ele_value[12]=="none" OR !$ele_value[12]) { + $sortOrderClause = " ORDER BY t1.`$source_element_handle` $sortOrder"; + } else { + list($sortHandle) = convertElementIdsToElementHandles(array($ele_value[12]), $sourceFormObject->getVar('id_form')); + $sortOrderClause = " ORDER BY t1.`$sortHandle` $sortOrder"; + } + + if ($dataResult = $xoopsDB->query("SELECT $select_column, t1.entry_id FROM ".$xoopsDB->prefix("formulize_".$sourceFormObject->getVar('form_handle'))." as t1 $limitConditionTable $extra_clause $conditionsfilter $conditionsfilter_oom $limitConditionWhere $sortOrderClause")) { $useValue = 'entryid'; if(count($linked_columns)>1) { $linked_column_count = count((array) $linked_columns); diff --git a/modules/formulize/language/english/main.php b/modules/formulize/language/english/main.php index b6abb6949..3ac890d37 100644 --- a/modules/formulize/language/english/main.php +++ b/modules/formulize/language/english/main.php @@ -718,10 +718,11 @@ define("_AM_FORMULIZE_PREVIOUS_OPTION", "Use a previous answer:"); define("_formulize_VALUE_WILL_BE_CALCULATED_AFTER_SAVE","This will be determined after the form is saved"); -define("_formulize_QSF_DefaultText", "Any"); +define("_formulize_QSF_DefaultText", "Show all"); define("_formulize_QDR_to", "to"); define("_formulize_QDR_go", "Go"); define("_formulize_BLANK_KEYWORD", "{BLANK}"); +define("_SHOW_BLANKS", "Show Blanks"); define("_formulize_ERROR_IN_LEFTRIGHT", "There appears to be an error in the PHP code that generates the text for this space. Please notify the webmaster."); diff --git a/modules/formulize/language/french/main.php b/modules/formulize/language/french/main.php index 61445233e..58b29b924 100644 --- a/modules/formulize/language/french/main.php +++ b/modules/formulize/language/french/main.php @@ -546,7 +546,7 @@ define("_formulize_PUBLISHINGOPTIONS", "Options de publication :"); define("_formulize_PUBLISHNOVE", "enlever 'Visualiser cette entrée' des liens du rapport (aussi les utilisateurs ne pourront plus voir les détails de chaque entrée)."); define("_formulize_PUBLISHREPORT", "Publier ce rapport à l'intention des autres utilisateurs."); -define("_formulize_QSF_DefaultText", "Tout"); +define("_formulize_QSF_DefaultText", "Afficher toutes"); define("_formulize_QUERYCONTROLS", "Contrôles des requêtes"); define("_formulize_RELENTRIES", "Related Entries:"); define("_formulize_REPORT_OFF", "Désactiver le mode rapport"); @@ -625,4 +625,6 @@ define("_formulize_FROM", "De :"); define("_formulize_TO", "À :"); +define("_SHOW_BLANKS", "Afficher les blancs"); + include_once XOOPS_ROOT_PATH.'/modules/formulize/language/english/main.php';