18 require_once SQ_LIB_PATH.
'/config/prefs.inc';
34 var $pref_vars = Array (
35 'SQ_SEARCH_BACKEND_PAGE_SIZE' => Array(
36 'name' =>
'sch_pref_backend_page_size',
37 'description' =>
'Set how many results are displayed to a page when a keyword search is performed from the Quick Search box',
41 'SQ_SEARCH_BACKEND_RESULT_LIMIT' => Array(
42 'name' =>
'sch_pref_backend_result_limit',
43 'description' =>
'The maximum number of results displayed in backend search (0 = no limit)',
56 $this->
Prefs($pref_file);
73 $is_root = $GLOBALS[
'SQ_SYSTEM']->userRoot();
74 $is_admin = ($is_root || $GLOBALS[
'SQ_SYSTEM']->userSystemAdmin());
75 if (is_null($pref) || $pref ==
'SQ_SEARCH_BACKEND_PAGE_SIZE') {
77 $o->openField(translate($this->pref_vars[
'SQ_SEARCH_BACKEND_PAGE_SIZE'][
'name']));
80 if ($have_lock && $is_admin) {
81 text_box(
'prefs[SQ_SEARCH_BACKEND_PAGE_SIZE]', $this->pref_vars[
'SQ_SEARCH_BACKEND_PAGE_SIZE'][
'default'], 10);
83 echo array_get_index($this->pref_vars[
'SQ_SEARCH_BACKEND_PAGE_SIZE'],
'default', 5);
85 echo
' '.translate(
'asset(s)');
87 echo $o->note(translate(
'sch_pref_backend_page_size_note'));
88 if (is_null($pref)) $o->closeField();
91 if (is_null($pref) || $pref ==
'SQ_SEARCH_BACKEND_RESULT_LIMIT') {
93 $o->openField(translate($this->pref_vars[
'SQ_SEARCH_BACKEND_RESULT_LIMIT'][
'name']));
96 if ($have_lock && $is_admin) {
97 text_box(
'prefs[SQ_SEARCH_BACKEND_RESULT_LIMIT]', $this->pref_vars[
'SQ_SEARCH_BACKEND_RESULT_LIMIT'][
'default'], 10);
99 $result_limit = array_get_index($this->pref_vars[
'SQ_SEARCH_BACKEND_RESULT_LIMIT'],
'default', 0);
100 if ($result_limit ==
'0') {
101 echo translate(
'unlimited');
103 echo $result_limit.
' '.translate(
'asset(s)');
108 echo $o->note(translate(
'sch_pref_backend_result_limit_note'));
109 if (is_null($pref)) $o->closeField();
129 $is_root = $GLOBALS[
'SQ_SYSTEM']->userRoot();
130 $is_admin = ($is_root || $GLOBALS[
'SQ_SYSTEM']->userSystemAdmin());
131 if (!$is_admin)
return FALSE;
136 if (isset($_POST[
'prefs'][
'SQ_SEARCH_BACKEND_PAGE_SIZE'])) {
139 if (!is_numeric($_POST[
'prefs'][
'SQ_SEARCH_BACKEND_PAGE_SIZE'])) {
140 trigger_localised_error(
'SCH0029', E_USER_WARNING);
144 $page_size = (int)$_POST[
'prefs'][
'SQ_SEARCH_BACKEND_PAGE_SIZE'];
147 if ($page_size <= 0) {
148 trigger_localised_error(
'SCH0029', E_USER_WARNING);
152 $this->pref_vars[
'SQ_SEARCH_BACKEND_PAGE_SIZE'][
'default'] = $page_size;
157 if (isset($_POST[
'prefs'][
'SQ_SEARCH_BACKEND_RESULT_LIMIT'])) {
160 if (!is_numeric($_POST[
'prefs'][
'SQ_SEARCH_BACKEND_RESULT_LIMIT'])) {
161 trigger_localised_error(
'SCH0030', E_USER_WARNING);
165 $result_limit = (int)$_POST[
'prefs'][
'SQ_SEARCH_BACKEND_RESULT_LIMIT'];
168 if ($result_limit < 0) {
169 trigger_localised_error(
'SCH0030', E_USER_WARNING);
173 $this->pref_vars[
'SQ_SEARCH_BACKEND_RESULT_LIMIT'][
'default'] = $result_limit;