diff --git a/src/controllers/AdminController.php b/src/controllers/AdminController.php index 9a947e39d..b4b07decd 100755 --- a/src/controllers/AdminController.php +++ b/src/controllers/AdminController.php @@ -542,7 +542,6 @@ class AdminController extends Controller implements CrawlConstants foreach ($this->model("profile")->profile_fields as $field) { if (isset($_REQUEST[$field])) { if ($field != "ROBOT_DESCRIPTION" && - $field != "MEMCACHE_SERVERS" && $field != "PROXY_SERVERS") { if (in_array($field, $color_fields)) { $clean_value = @@ -560,11 +559,10 @@ class AdminController extends Controller implements CrawlConstants } $data[$field] = $clean_value; $profile[$field] = $data[$field]; - if ($field == "MEMCACHE_SERVERS" || $field == "PROXY_SERVERS"){ - $mem_array = preg_split("/(\s)+/", $clean_value); - $profile[$field] = - $this->convertArrayLines( - $mem_array, "|Z|", true); + if ($field == "PROXY_SERVERS") { + $proxy_array = preg_split("/(\s)+/", $clean_value); + $profile[$field] =$this->convertArrayLines( + $proxy_array, "|Z|", true); } } if (!isset($data[$field])) { @@ -592,30 +590,40 @@ class AdminController extends Controller implements CrawlConstants * @param array $comparison_fields those fields of the entity * in question ( for example, users) which we can search both with * string comparison operators and equality operators - * @param array $equal_comparison_fields those fields of the entity in - * question which can only be search by equality/inequality operators * @param string $field_postfix suffix to append onto field names in * case there are multiple forms on the same page */ public function tableSearchRequestHandler(&$data, $activity, - $comparison_fields = [], $equal_comparison_fields = [], - $field_postfix = "") + $comparison_fields = [], $field_postfix = "") { $data['FORM_TYPE'] = "search"; $activity_postfix = $activity . $field_postfix; - $data['COMPARISON_TYPES'] = [ + $data['EQUAL_COMPARISON_TYPES'] = [ + "=" => tl('admin_controller_equal'), + "!=" => tl('admin_controller_not_equal'), + ]; + $data['INEQUALITY_COMPARISON_TYPES'] = array_merge( + $data['EQUAL_COMPARISON_TYPES'], [ + "<" => tl('admin_controller_less_than'), + "<=" => tl('admin_controller_less_equal'), + ">" => tl('admin_controller_greater_than'), + ">=" => tl('admin_controller_greater_equal'), + ]); + $data['BETWEEN_COMPARISON_TYPES'] = [ + 'BETWEEN' => tl('admin_controller_between'), + 'NOT BETWEEN' => tl('admin_controller_not_between'), + ]; + $data['COMPARISON_TYPES'] = array_merge( + $data['EQUAL_COMPARISON_TYPES'],[ "=" => tl('admin_controller_equal'), "!=" => tl('admin_controller_not_equal'), "CONTAINS" => tl('admin_controller_contains'), "BEGINS WITH" => tl('admin_controller_begins_with'), "ENDS WITH" => tl('admin_controller_ends_with'), - ]; + ]); $_SESSION['SEARCH'][$activity_postfix]['COMPARISON_TYPES'] = $data['COMPARISON_TYPES']; - $data['EQUAL_COMPARISON_TYPES'] = [ - "=" => tl('admin_controller_equal'), - "!=" => tl('admin_controller_not_equal'), - ]; + $_SESSION['SEARCH'][$activity_postfix]['EQUAL_COMPARISON_TYPES'] = $data['EQUAL_COMPARISON_TYPES']; $data['SORT_TYPES'] = [ @@ -626,51 +634,100 @@ class AdminController extends Controller implements CrawlConstants $_SESSION['SEARCH'][$activity_postfix]['SORT_TYPES'] = $data['SORT_TYPES']; $paging = ""; - foreach ($comparison_fields as $comparison_start) { - $comparison = $comparison_start."_comparison"; + $comparisons_all = $comparison_fields['ALL_FIELDS'] ?? []; + $equal_comparison_fields = $comparison_fields['EQUAL_COMPARISON_TYPES'] + ?? []; + $between_comparison_fields = + $comparison_fields['BETWEEN_COMPARISON_TYPES'] ?? []; + $timestamp_comparison_fields = + $comparison_fields['TIMESTAMP_COMPARISON_TYPES'] ?? []; + $inequality_comparison_fields = + $comparison_fields['INEQUALITY_COMPARISON_TYPES'] ?? []; + $between_fields = array_merge($between_comparison_fields, + $timestamp_comparison_fields); + foreach ($comparisons_all as $comparison_start) { + $comparison = $comparison_start . "_comparison"; $comparison_types = (in_array($comparison_start, - $equal_comparison_fields)) - ? 'EQUAL_COMPARISON_TYPES' : 'COMPARISON_TYPES'; + $equal_comparison_fields)) ? 'EQUAL_COMPARISON_TYPES' : + ((in_array($comparison_start, $inequality_comparison_fields)) ? + 'INEQUALITY_COMPARISON_TYPES' : + ((in_array($comparison_start, $between_fields)) ? + 'BETWEEN_COMPARISON_TYPES' : 'COMPARISON_TYPES')); + $default_type = ($comparison_types == 'BETWEEN_COMPARISON_TYPES') ? + "BETWEEN" : "="; $data[$comparison] = (isset($_REQUEST[$comparison]) && isset($data[$comparison_types][ $_REQUEST[$comparison]])) ? $_REQUEST[$comparison] : - "="; + $default_type; $_SESSION['SEARCH'][$activity_postfix]['COMPARISON_FIELDS' ][$comparison] = $data[$comparison]; $paging .= "&$comparison=". urlencode($data[$comparison]); } - foreach ($comparison_fields as $sort_start) { - $sort = $sort_start."_sort"; + foreach ($comparisons_all as $sort_start) { + $sort = $sort_start . "_sort"; $data[$sort] = (isset($_REQUEST[$sort]) && isset($data['SORT_TYPES'][ $_REQUEST[$sort]])) ? $_REQUEST[$sort] : "NONE"; $_SESSION['SEARCH'][$activity_postfix]['SORT'][$sort] = $data[$sort]; - $paging .= "&$sort=".urlencode($data[$sort]); + $paging .= "&$sort=" . urlencode($data[$sort]); } $search_array = []; - foreach ($comparison_fields as $field) { - $field_name = $field.$field_postfix; - $field_comparison = $field."_comparison"; - $field_sort = $field."_sort"; - $data[$field_name] = (isset($_REQUEST[$field_name])) ? - $this->clean($_REQUEST[$field_name], "string") : - ""; - $_SESSION['SEARCH'][$activity_postfix]['FIELD_NAMES' - ][$field_name] = $data[$field_name]; - if ($field_name=='access' && $data[$field_name] >= 10) { - $search_array[] = ["status", - $data[$field_comparison], $data[$field_name]/10, - $data[$field_sort]]; + foreach ($comparisons_all as $field) { + $field_comparison = $field . "_comparison"; + $field_sort = $field . "_sort"; + $is_timestamp_type = in_array($field, $timestamp_comparison_fields); + $is_between_type = in_array($field, $between_comparison_fields); + if ($is_between_type || $is_timestamp_type) { + $low = "_low"; + $field_name_low = $field. $low . $field_postfix; + $data[$field_name_low] = (isset($_REQUEST[$field_name_low]) && + $_REQUEST[$field_name_low] != '-1') ? + $this->clean($_REQUEST[$field_name_low], "string") : + ""; + $high = "_high"; + $field_name_high = $field. $high . $field_postfix; + $data[$field_name_high] = (isset($_REQUEST[$field_name_high]) && + $_REQUEST[$field_name_high] != '-1') ? + $this->clean($_REQUEST[$field_name_high], "string") : + ""; + $_SESSION['SEARCH'][$activity_postfix]['FIELD_NAMES' + ][$field_name_low] = $data[$field_name_low]; + $_SESSION['SEARCH'][$activity_postfix]['FIELD_NAMES' + ][$field_name_high] = $data[$field_name_high]; + if ($is_timestamp_type) { + $search_array[] = [$field, $data[$field_comparison], + strtotime($data[$field_name_low]), + strtotime($data[$field_name_high]), $data[$field_sort]]; + } else { + $search_array[] = [$field, + $data[$field_comparison], $data[$field_name_low], + $data[$field_name_high], $data[$field_sort]]; + } + $paging .= "&$field_name_low=" . urlencode( + $data[$field_name_low]). "&$field_name_high=" . + urlencode($data[$field_name_high]); } else { - $search_array[] = [$field, - $data[$field_comparison], $data[$field_name], - $data[$field_sort]]; + $field_name = $field . $field_postfix; + $data[$field_name] = (isset($_REQUEST[$field_name]) && + $_REQUEST[$field_name] != '-1') ? + $this->clean($_REQUEST[$field_name], "string") : + ""; + $_SESSION['SEARCH'][$activity_postfix]['FIELD_NAMES' + ][$field_name] = $data[$field_name]; + if ($field_name == 'access' && $data[$field_name] >= 10) { + $search_array[] = ["status", + $data[$field_comparison], $data[$field_name]/10, + $data[$field_sort]]; + } else { + $search_array[] = [$field, + $data[$field_comparison], $data[$field_name], + $data[$field_sort]]; + } + $paging .= "&$field_name=" . urlencode($data[$field_name]); } - $paging .= "&$field_name=". - urlencode($data[$field_name]); } $data['PAGING'] = $paging; $_SESSION['SEARCH'][$activity_postfix]['SEARCH_ARRAY'] = diff --git a/src/controllers/Controller.php b/src/controllers/Controller.php index 5957a1681..744e4c67a 100755 --- a/src/controllers/Controller.php +++ b/src/controllers/Controller.php @@ -468,7 +468,9 @@ abstract class Controller foreach ($search_array as $search_data) { list($column_name, $comparison, $search_value, $sort) = $search_data; - if ($search_value == "") {continue; } + if ($search_value == "") { + continue; + } if (isset($args[$column_name])) { $column_name = $args[$column_name]; } diff --git a/src/controllers/components/AccountaccessComponent.php b/src/controllers/components/AccountaccessComponent.php index 28c74c6b5..446565877 100644 --- a/src/controllers/components/AccountaccessComponent.php +++ b/src/controllers/components/AccountaccessComponent.php @@ -749,8 +749,9 @@ class AccountaccessComponent extends Component $search_array = $parent->tableSearchRequestHandler($data, "manageUsers", - ['user', 'first', 'last', 'email', 'status'], - ['status'], "_name"); + ['ALL_FIELDS' => + ['user', 'first', 'last', 'email', 'status'], + 'EQUAL_COMPARISON_TYPES' => ['status']], "_name"); if (empty($_SESSION['LAST_SEARCH']['manageUsers_name']) || (!empty($_SESSION['LAST_SEARCH']['manageUsers_name']) && isset($_REQUEST['user_name'])) ) { @@ -1126,7 +1127,7 @@ class AccountaccessComponent extends Component break; case "search": $search_array = $parent->tableSearchRequestHandler($data, - "manageRoles", ['name']); + "manageRoles", ['ALL_FIELDS' => ['name']]); if (empty($_SESSION['LAST_SEARCH']['manageRoles']) || isset($_REQUEST['name'])) { $_SESSION['LAST_SEARCH']['manageRoles'] = diff --git a/src/controllers/components/CrawlComponent.php b/src/controllers/components/CrawlComponent.php index aa2ce4408..2bd525c1a 100644 --- a/src/controllers/components/CrawlComponent.php +++ b/src/controllers/components/CrawlComponent.php @@ -555,7 +555,7 @@ class CrawlComponent extends Component implements CrawlConstants case "search": $search_array = $parent->tableSearchRequestHandler($data, - "mixCrawls", ['name']); + "mixCrawls", ['ALL_FIELDS' => ['name']]); if (empty($_SESSION['LAST_SEARCH']['mixCrawls']) || isset($_REQUEST['name'])) { $_SESSION['LAST_SEARCH']['mixCrawls'] = @@ -1285,7 +1285,7 @@ class CrawlComponent extends Component implements CrawlConstants case 'search': $search_array = $parent->tableSearchRequestHandler($data, - "manageClassifiers", ['name']); + "manageClassifiers", ['ALL_FIELDS' => ['name']]); if (empty($_SESSION['LAST_SEARCH']['manageClassifiers']) || isset($_REQUEST['name'])) { $_SESSION['LAST_SEARCH']['manageClassifiers'] = @@ -2133,7 +2133,7 @@ class CrawlComponent extends Component implements CrawlConstants break; case "search": $search_array = $parent->tableSearchRequestHandler($data, - "scrapers", ['name']); + "scrapers", ['ALL_FIELDS' => ['name']]); if (empty($_SESSION['LAST_SEARCH']['scrapers']) || isset($_REQUEST['name'])) { $_SESSION['LAST_SEARCH']['scrapers'] = diff --git a/src/controllers/components/SocialComponent.php b/src/controllers/components/SocialComponent.php index a4eb528e4..9d5deb27f 100644 --- a/src/controllers/components/SocialComponent.php +++ b/src/controllers/components/SocialComponent.php @@ -698,10 +698,10 @@ class SocialComponent extends Component implements CrawlConstants tl('social_component_banned_status'); $search_array = $parent->tableSearchRequestHandler($data, - $search_name, - ['name', 'owner', 'register', 'access','voting', - 'lifetime'], - ['register', 'access', 'voting', 'lifetime']); + $search_name, ['ALL_FIELDS' => ['name', 'owner', + 'register', 'access','voting', 'lifetime'], + 'EQUAL_COMPARISON_TYPES' => + ['register', 'access', 'voting', 'lifetime']]); if (empty($_SESSION['LAST_SEARCH'][$search_name]) || isset($_REQUEST['name'])) { $_SESSION['LAST_SEARCH'][$search_name] = diff --git a/src/controllers/components/StoreComponent.php b/src/controllers/components/StoreComponent.php index 7583a7498..1ce13cdcd 100644 --- a/src/controllers/components/StoreComponent.php +++ b/src/controllers/components/StoreComponent.php @@ -73,6 +73,7 @@ class StoreComponent extends Component "08" => "08", "09" => "09", "10" => "10", "11" => "11", "12" => "12" ]; + $search_array = []; $user_id = $_SESSION['USER_ID']; $username = $signin_model->getUserName($user_id); $data["USER"] = $user_model->getUser($username); @@ -110,6 +111,7 @@ class StoreComponent extends Component tl('store_component_script_failure'); } } + $data['FORM_TYPE'] = 'purchaseCredits'; switch ($arg) { case "purchaseCredits": @@ -149,12 +151,48 @@ class StoreComponent extends Component tl('store_component_credits_purchased'), []); break; + case "search": + $data["FORM_TYPE"] = "search"; + $search_array = + $parent->tableSearchRequestHandler($data, + "manageCredits", ['ALL_FIELDS' => + ['amount', 'timestamp', 'type'], + 'EQUAL_COMPARISON_TYPES' => ['type'], + 'BETWEEN_COMPARISON_TYPES' => ['amount'], + 'TIMESTAMP_COMPARISON_TYPES' => ['timestamp'] + ]); + if (empty($_SESSION['LAST_SEARCH']['manageCredits']) || + isset($_REQUEST['type'])) { + $_SESSION['LAST_SEARCH']['manageCredits'] = + $_SESSION['SEARCH']['manageCredits']; + unset($_SESSION['SEARCH']['manageCredits']); + } else { + $default_search = true; + } + break; + } + if ($search_array == [] || !empty($default_search)) { + if (!empty($_SESSION['LAST_SEARCH']['manageCredits'])) { + if (!empty($_REQUEST['arg']) && $_REQUEST['arg'] == 'search') { + $search_array = $parent->restoreLastSearchFromSession($data, + 'manageCredits'); + } else if (!empty($_REQUEST['context'])) { + $search_array = $_SESSION['LAST_SEARCH']['manageCredits'][ + 'SEARCH_ARRAY']; + $data['PAGING'] = + $_SESSION['LAST_SEARCH']['manageCredits']['PAGING']; + } + } + if ($search_array == []) { + $search_array[] = ["timestamp", "", "", "ASC"]; + } } - $search_array = [["timestamp", "", "", "DESC"]]; $parent->pagingLogic($data, $credit_model, "TRANSACTIONS", C\DEFAULT_ADMIN_PAGING_NUM, $search_array, "", ["USER_ID" => $user_id]); - $data['SCRIPT'] .= "setDisplay('admin-form-row', false);"; + if ($data['FORM_TYPE'] == 'purchaseCredits') { + $data['SCRIPT'] .= "setDisplay('admin-form-row', false);"; + } return $data; } /** @@ -211,6 +249,7 @@ class StoreComponent extends Component unset($_REQUEST['CALCULATE']); unset($_REQUEST['arg']); } + $initial_display_state = 'false'; if (isset($_REQUEST['CALCULATE']) || (isset($_REQUEST['arg']) && $_REQUEST['arg'] == "addadvertisement")) { if (empty($_REQUEST['NAME']) || @@ -237,6 +276,7 @@ class StoreComponent extends Component $start_date + (($data['DURATION'] - 1) * C\ONE_DAY)); $_REQUEST['END_DATE'] = $data['END_DATE']; $this->initializeAdKeywords($data, $start_date, $data['DURATION']); + $initial_display_state = 'true'; } $user_id = $_SESSION['USER_ID']; $is_admin = $role_model->checkUserRole($user_id, C\ADMIN_ROLE); @@ -385,8 +425,10 @@ class StoreComponent extends Component $search_array = $parent->tableSearchRequestHandler($data, "manageAdvertisements", - ['name', 'description', 'destination', 'keywords', - 'budget', 'start_date', 'end_date']); + ['ALL_FIELDS' => ['name', 'description', 'destination', + 'keywords', 'budget', 'start_date', 'end_date'], + 'BETWEEN_COMPARISON_TYPES' => ['budget', 'start_date', + 'end_date']]); if (empty($_SESSION['LAST_SEARCH']['manageAdvertisements']) || isset($_REQUEST['name'])) { $_SESSION['LAST_SEARCH']['manageAdvertisements'] = @@ -424,7 +466,8 @@ class StoreComponent extends Component C\DEFAULT_ADMIN_PAGING_NUM, $search_array, "", ["USER_ID" => $user_id, "ADMIN" => $is_admin]); if ($data['FORM_TYPE'] == 'addadvertisement') { - $data['SCRIPT'] .= "setDisplay('admin-form-row', false);"; + $data['SCRIPT'] .= "setDisplay('admin-form-row', + $initial_display_state);"; } return $data; } diff --git a/src/controllers/components/SystemComponent.php b/src/controllers/components/SystemComponent.php index bf6cbad68..569cc6e89 100755 --- a/src/controllers/components/SystemComponent.php +++ b/src/controllers/components/SystemComponent.php @@ -510,8 +510,9 @@ class SystemComponent extends Component break; case "search": $search_array = $parent->tableSearchRequestHandler($data, - "manageLocales", ['name', 'tag', 'mode', 'active'], - ['active']); + "manageLocales", ['ALL_FIELDS' => + ['name', 'tag', 'mode', 'active'], + 'EQUAL_COMPARISON_TYPES' => ['active']]); if (empty($_SESSION['LAST_SEARCH']["manageLocales"]) || isset($_REQUEST['name'])) { $_SESSION['LAST_SEARCH']["manageLocales"] = diff --git a/src/css/search.css b/src/css/search.css index 70107a31b..43b80e13f 100755 --- a/src/css/search.css +++ b/src/css/search.css @@ -346,6 +346,7 @@ a.echo-link:hover border: 1px dashed #ccc; border-radius: 8px; } + .very-narrow-field { width: 1in; @@ -380,6 +381,17 @@ a.echo-link:hover { width: 200px; } +.range-field +{ + border: 1px solid gray; + display:inline-block; + margin: 3px; + padding: 3px; +} +.range-field hr +{ + width: 7%; +} .tall-text-area { height: 4in; diff --git a/src/locale/ar/configure.ini b/src/locale/ar/configure.ini index b06e624d1..8455d8b98 100755 --- a/src/locale/ar/configure.ini +++ b/src/locale/ar/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/bn/configure.ini b/src/locale/bn/configure.ini index 28c042571..63d6465c9 100755 --- a/src/locale/bn/configure.ini +++ b/src/locale/bn/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/de/configure.ini b/src/locale/de/configure.ini index b399a5703..abb89002f 100755 --- a/src/locale/de/configure.ini +++ b/src/locale/de/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/en_US/configure.ini b/src/locale/en_US/configure.ini index da58867bb..54454139c 100644 --- a/src/locale/en_US/configure.ini +++ b/src/locale/en_US/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "Chat Bot" system_component_is_replica = "Replica Server" admin_controller_equal = "Equals" admin_controller_not_equal = "Not equals" +admin_controller_less_than = "Less Than" +admin_controller_less_equal = "Less Equal" +admin_controller_greater_than = "Greater Than" +admin_controller_greater_equal = "Greater Equal" +admin_controller_between = "Between" +admin_controller_not_between = "Not Between" admin_controller_contains = "Contains" admin_controller_begins_with = "Begins with" admin_controller_ends_with = "Ends with" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "Using the Purchase button charges the ab managecredits_element_program_terms = "Program Terms" managecredits_element_purchase = "Purchase" managecredits_element_script_failure = "No Working Credit Card Script Found!" +managecredits_element_search = "Search" +advertisement_init_ledger = "Starting Balance" +advertisement_buy_credits = "Buy Credits" +advertisement_buy_ad = "Buy Ad" +social_component_join_group_fee = "Join discussion group fee " ; ; GroupElement.php group_element_auto_logout_one_minute = "Auto-logout in One Minute!!" diff --git a/src/locale/en_US/statistics.txt b/src/locale/en_US/statistics.txt index 5a165df53..b6bef56f0 100755 --- a/src/locale/en_US/statistics.txt +++ b/src/locale/en_US/statistics.txt @@ -1 +1 @@ -d:100; \ No newline at end of file +d:99; \ No newline at end of file diff --git a/src/locale/es/configure.ini b/src/locale/es/configure.ini index 0fdc83d4c..61ce48fc8 100755 --- a/src/locale/es/configure.ini +++ b/src/locale/es/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/fa/configure.ini b/src/locale/fa/configure.ini index 1014788d7..a23d9fad5 100755 --- a/src/locale/fa/configure.ini +++ b/src/locale/fa/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/fr_FR/configure.ini b/src/locale/fr_FR/configure.ini index 4b6158d4b..1eb0b1503 100755 --- a/src/locale/fr_FR/configure.ini +++ b/src/locale/fr_FR/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/he/configure.ini b/src/locale/he/configure.ini index 82b5bcc94..3ad4fc812 100755 --- a/src/locale/he/configure.ini +++ b/src/locale/he/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/hi/configure.ini b/src/locale/hi/configure.ini index f83c2ed21..98162abe4 100755 --- a/src/locale/hi/configure.ini +++ b/src/locale/hi/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/in_ID/configure.ini b/src/locale/in_ID/configure.ini index a41179380..cce871ba9 100755 --- a/src/locale/in_ID/configure.ini +++ b/src/locale/in_ID/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/it/configure.ini b/src/locale/it/configure.ini index 986576f86..3bc267a14 100755 --- a/src/locale/it/configure.ini +++ b/src/locale/it/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/ja/configure.ini b/src/locale/ja/configure.ini index 86d5c76db..8f0dac9b8 100755 --- a/src/locale/ja/configure.ini +++ b/src/locale/ja/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/kn/configure.ini b/src/locale/kn/configure.ini index dce34fc89..91d9e3367 100755 --- a/src/locale/kn/configure.ini +++ b/src/locale/kn/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/ko/configure.ini b/src/locale/ko/configure.ini index 5cb13d9c7..23fd09177 100755 --- a/src/locale/ko/configure.ini +++ b/src/locale/ko/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/nl/configure.ini b/src/locale/nl/configure.ini index 97b24ab6e..990699a15 100644 --- a/src/locale/nl/configure.ini +++ b/src/locale/nl/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "is gelijk aan" admin_controller_not_equal = "niet gelijken" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "bevat" admin_controller_begins_with = "begint met" admin_controller_ends_with = "eindigt met" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/nl/statistics.txt b/src/locale/nl/statistics.txt index 9b45e4585..b76794965 100644 --- a/src/locale/nl/statistics.txt +++ b/src/locale/nl/statistics.txt @@ -1 +1 @@ -d:55; \ No newline at end of file +d:54; \ No newline at end of file diff --git a/src/locale/pl/configure.ini b/src/locale/pl/configure.ini index 7c41941ae..95da3ed69 100755 --- a/src/locale/pl/configure.ini +++ b/src/locale/pl/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/pt/configure.ini b/src/locale/pt/configure.ini index 25823690c..8ec6cf9bc 100755 --- a/src/locale/pt/configure.ini +++ b/src/locale/pt/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/ru/configure.ini b/src/locale/ru/configure.ini index 3104cb863..4b1484acd 100755 --- a/src/locale/ru/configure.ini +++ b/src/locale/ru/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/te/configure.ini b/src/locale/te/configure.ini index 0c401efa4..9ead1bf4d 100644 --- a/src/locale/te/configure.ini +++ b/src/locale/te/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "సమానం" admin_controller_not_equal = "సమానం కాదు" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "కలిగిఉన్నది" admin_controller_begins_with = "దీనితో ప్రారంభమవుతుంది" admin_controller_ends_with = "దీనితో ముగుస్తుంది" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/th/configure.ini b/src/locale/th/configure.ini index da27c6ecf..6dbd111e7 100755 --- a/src/locale/th/configure.ini +++ b/src/locale/th/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/tr/configure.ini b/src/locale/tr/configure.ini index b73db01f2..00f4acb0c 100755 --- a/src/locale/tr/configure.ini +++ b/src/locale/tr/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/vi_VN/configure.ini b/src/locale/vi_VN/configure.ini index d3ff1bc0c..8b64d41e2 100755 --- a/src/locale/vi_VN/configure.ini +++ b/src/locale/vi_VN/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/locale/zh_CN/configure.ini b/src/locale/zh_CN/configure.ini index 253b58e45..ebbb59954 100755 --- a/src/locale/zh_CN/configure.ini +++ b/src/locale/zh_CN/configure.ini @@ -45,6 +45,12 @@ admin_controller_chatbot = "" system_component_is_replica = "" admin_controller_equal = "" admin_controller_not_equal = "" +admin_controller_less_than = "" +admin_controller_less_equal = "" +admin_controller_greater_than = "" +admin_controller_greater_equal = "" +admin_controller_between = "" +admin_controller_not_between = "" admin_controller_contains = "" admin_controller_begins_with = "" admin_controller_ends_with = "" @@ -910,6 +916,11 @@ managecredits_element_charge_warning = "" managecredits_element_program_terms = "" managecredits_element_purchase = "" managecredits_element_script_failure = "" +managecredits_element_search = "" +advertisement_init_ledger = "" +advertisement_buy_credits = "" +advertisement_buy_ad = "" +social_component_join_group_fee = "" ; ; GroupElement.php group_element_auto_logout_one_minute = "" diff --git a/src/models/CreditModel.php b/src/models/CreditModel.php index 61fd52a5a..a51ab4a4d 100644 --- a/src/models/CreditModel.php +++ b/src/models/CreditModel.php @@ -75,7 +75,7 @@ class CreditModel extends Model */ public function whereCallback($args = null) { - return "USER_ID = '".$args['USER_ID']."'"; + return "USER_ID = '" . $args['USER_ID'] . "'"; } /** * Gets the ad credit balance for the supplied user id diff --git a/src/models/Model.php b/src/models/Model.php index d91781466..23a73c08f 100755 --- a/src/models/Model.php +++ b/src/models/Model.php @@ -502,44 +502,64 @@ class Model implements CrawlConstants } else { $field_name = $row[0]; } - $comparison = $row[1]; - $value = $row[2]; - $sort_dir = $row[3]; - if ($value != "" && (!in_array($row[0], $any_fields) - || $value != "-1")) { - if ($where == "") { - $where = " WHERE "; + if (in_array($row[1], ['BETWEEN', 'NOT_BETWEEN'])) { + list(, $comparison, $value_low, $value_high, $sort_dir,) = $row; + if ($value_low != "" || $value_high != "") { + if ($where == "") { + $where = " WHERE "; + } + $where .= $where_and; + if ($value_low != "" && $value_high == "") { + $where .= "$field_name >= '" . + $db->escapeString($value_low) . "'"; + } else if ($value_low == "" && $value_high != "") { + $where .= "$field_name <= '" . + $db->escapeString($value_high) . "'"; + } else if ($value_low != "" && $value_high != "") { + $where .= $field_name . " ". $comparison . " '" . + $db->escapeString($value_low) . "' AND '". + $db->escapeString($value_high) . "'"; + } + $where_and = " AND "; } - $where .= $where_and; - switch ($comparison) { - case "=": - $where .= "$field_name='". - $db->escapeString($value)."'"; - break; - case "!=": - $where .= "$field_name!='". - $db->escapeString($value)."'"; - break; - case "CONTAINS": - $where .= "LOWER($field_name) LIKE LOWER('%". - $db->escapeString($value)."%')"; - break; - case "BEGINS WITH": - $where .= "LOWER($field_name) LIKE LOWER('". - $db->escapeString($value)."%')"; - break; - case "ENDS WITH": - $where .= "LOWER($field_name) LIKE LOWER('%". - $db->escapeString($value)."')"; - break; + } else { + list(, $comparison, $value, $sort_dir,) = $row; + if ($value != "" && (!in_array($row[0], $any_fields) + || $value != "-1")) { + if ($where == "") { + $where = " WHERE "; + } + $where .= $where_and; + switch ($comparison) { + case "=": + $where .= "$field_name='" . + $db->escapeString($value) . "'"; + break; + case "!=": + $where .= "$field_name!='". + $db->escapeString($value)."'"; + break; + case "CONTAINS": + $where .= "LOWER($field_name) LIKE LOWER('%". + $db->escapeString($value)."%')"; + break; + case "BEGINS WITH": + $where .= "LOWER($field_name) LIKE LOWER('". + $db->escapeString($value)."%')"; + break; + case "ENDS WITH": + $where .= "LOWER($field_name) LIKE LOWER('%". + $db->escapeString($value)."')"; + break; + } + $where_and = " AND "; } - $where_and = " AND "; } if (in_array($sort_dir, $sort_types)) { if ($order_by == "") { $order_by = " ORDER BY "; } - $order_by .= $order_by_comma.$field_name." ".$sort_dir; + $order_by .= $order_by_comma . $field_name . " " . $sort_dir; $order_by_comma = ", "; } } diff --git a/src/views/elements/ManageadvertisementsElement.php b/src/views/elements/ManageadvertisementsElement.php index aa41ecb5f..0b75ff48e 100644 --- a/src/views/elements/ManageadvertisementsElement.php +++ b/src/views/elements/ManageadvertisementsElement.php @@ -560,11 +560,17 @@ class ManageadvertisementsElement extends Element tl('manageadvertisements_element_description') => "description", tl('manageadvertisements_element_destination_url') => "destination", tl('manageadvertisements_element_keywords') => "keywords", - tl('manageadvertisements_element_budget') => "budget", - tl('manageadvertisements_element_start_date') => "start_date", - tl('manageadvertisements_element_end_date') => "end_date", + tl('manageadvertisements_element_budget') => ["budget", + $data['BETWEEN_COMPARISON_TYPES']], + tl('manageadvertisements_element_start_date') => ["start_date", + $data['BETWEEN_COMPARISON_TYPES']], + tl('manageadvertisements_element_end_date') => ["end_date", + $data['BETWEEN_COMPARISON_TYPES']], + ]; + $dropdowns = ['budget' => "range", "start_date" => "date", + "end_date" => "date", ]; $view->helper("searchform")->render($data, $controller, $activity, - $view, $title, $fields); + $view, $title, $fields, $dropdowns); } } diff --git a/src/views/elements/ManagecreditsElement.php b/src/views/elements/ManagecreditsElement.php index 1544d0593..5f0cd6067 100644 --- a/src/views/elements/ManagecreditsElement.php +++ b/src/views/elements/ManagecreditsElement.php @@ -53,8 +53,12 @@ class ManagecreditsElement extends Element <?php $data['TABLE_TITLE'] = tl('managecredits_element_transactions'); $data['ACTIVITY'] = 'manageCredits'; - $data['FORM_TYPE'] = "purchaseCredits"; - $data['NO_SEARCH'] = true; + if (empty($data['FORM_TYPE'])) { + $data['FORM_TYPE'] = "purchaseCredits"; + } + if (in_array($data['FORM_TYPE'], ['search'])) { + $data['DISABLE_ADD_TOGGLE'] = true; + } $data['VIEW'] = $this->view; $num_columns = 4; ?> @@ -203,4 +207,36 @@ class ManagecreditsElement extends Element </table> </form><?php } + /** + * Draws the search for credit transactions forms + * + * @param array $data consists of values of locale fields set + * so far as well as values of the drops downs on the form + */ + public function renderSearchForm($data) + { + $controller = "admin"; + $activity = "manageCredits"; + $view = $this->view; + $title = tl('managecredits_element_search'); + $fields = [ + tl('managecredits_element_type') => ["type", + $data['EQUAL_COMPARISON_TYPES']], + tl('managecredits_element_amount') => ["amount", + $data['BETWEEN_COMPARISON_TYPES']], + tl('managecredits_element_date') => ["timestamp", + $data['BETWEEN_COMPARISON_TYPES']] + ]; + $dropdowns = [ + 'amount' => "range", + 'type' => ['advertisement_init_ledger' => + tl('advertisement_init_ledger'), + 'advertisement_buy_credits' => tl('advertisement_buy_credits'), + 'advertisement_buy_ad' => tl('advertisement_buy_ad'), + 'social_component_join_group_fee' => + tl('social_component_join_group_fee')], + 'timestamp' => "date"]; + $view->helper("searchform")->render($data, $controller, $activity, + $view, $title, $fields, $dropdowns); + } } diff --git a/src/views/helpers/SearchformHelper.php b/src/views/helpers/SearchformHelper.php index a8aa7f405..5a45a8b43 100644 --- a/src/views/helpers/SearchformHelper.php +++ b/src/views/helpers/SearchformHelper.php @@ -54,6 +54,11 @@ class SearchformHelper extends Helper * @param string $title what to display as the header of this form * @param array $fields a list of searchable fields * @param array $dropdowns which fields should be rendered as dropdowns + * this array has the format field_name => dropdown_array + * If dropdown_array is a string among time, date, datetime-locale + * then a date picker variant will be used for the item. Otherwise, + * dropdown_array is assume to be in the form value => + * value translation into locale string * @param string $postfix string to tack on to form variables (might use * to make var names unique on page) */ @@ -61,7 +66,7 @@ class SearchformHelper extends Helper $fields, $dropdowns = [], $postfix = "") { $base_url = htmlentities(B\controllerUrl($controller, true)) . - C\CSRF_TOKEN."=".$data[C\CSRF_TOKEN] . "&a=$activity"; + C\CSRF_TOKEN . "=" . $data[C\CSRF_TOKEN] . "&a=$activity"; $old_base_url = $base_url; $browse = false; if (isset($data['browse'])) { @@ -71,6 +76,8 @@ class SearchformHelper extends Helper ?> <h2><?= $title . " " ?> </h2><?php $item_sep = ($_SERVER["MOBILE"]) ? "<br />" : "</td><td>"; + $item_sep_center = ($_SERVER["MOBILE"]) ? "<br />" : + "</td><td class='center'>"; ?> <form id="search-form" method="get" autocomplete="off"> <input type="hidden" name="c" value="<?= $controller ?>" /> @@ -106,12 +113,33 @@ class SearchformHelper extends Helper $view->helper("options")->render( "{$name}-comparison", "${name}_comparison", $comparison_types, $data["{$name}_comparison"]); - e($item_sep); + e($item_sep_center); $out_name = $name; if ($postfix != "") { $out_name = $name."_$postfix"; } - if (isset($dropdowns[$name])) { + if (isset($dropdowns[$name]) && in_array($dropdowns[$name], + ['date', 'time'])) { + e("<div class='range-field' ><input type='". + $dropdowns[$name]. "' " . + "id='{$name}-id-low' name='".$out_name . "_low' ". + "value='".$data[$out_name . "_low"] . + "' class='narrow-field' /> <hr /> "); + e("<input type='". $dropdowns[$name]. "' " . + "id='{$name}-id-high' name='" . $out_name . "_high' ". + "value='" . $data[$out_name . "_high"] . + "' class='narrow-field' /></div>"); + } else if (isset($dropdowns[$name]) && in_array($dropdowns[$name], + ['range'])) { + e("<div class='range-field' ><input type='number' " . + "id='{$name}-id-low' name='".$out_name."_low' ". + "value='" . $data[$out_name . "_low"]. + "' class='narrow-field' /> <hr /> "); + e("<input type='number' " . + "id='{$name}-id-high' name='" . $out_name."_high' ". + "value='" . $data[$out_name . "_high"] . + "' class='narrow-field' /></div>"); + } else if (isset($dropdowns[$name])) { $dropdowns[$name] = ['-1' => tl('searchform_helper_any')] + $dropdowns[$name];