RomanL 8 năm trước cách đây
mục cha
commit
a1e7a31447

+ 2 - 1
modules/boonex/english/data/langs/system/en.xml

@@ -94,7 +94,8 @@
 	<string name="_Read more"><![CDATA[Read more]]></string>
 	<string name="_Reset"><![CDATA[Reset]]></string>
 	<string name="_Search"><![CDATA[Search]]></string>
-	<string name="_Section"><![CDATA[Section]]></string>
+  <string name="_search_in_all_section"><![CDATA[Search in all sections]]></string>
+  <string name="_Section"><![CDATA[Section]]></string>
 	<string name="_Select_one"><![CDATA[Select one...]]></string>
 	<string name="_Select_all"><![CDATA[Select all]]></string>
 	<string name="_Show"><![CDATA[Show]]></string>

+ 1 - 0
modules/boonex/russian/data/langs/system/ru.xml

@@ -94,6 +94,7 @@
 	<string name="_Read more"><![CDATA[Читать ещё]]></string>
 	<string name="_Reset"><![CDATA[Сбросить]]></string>
 	<string name="_Search"><![CDATA[Поиск]]></string>
+  <string name="_search_in_all_section"><![CDATA[Искать во всех отделах]]></string>
 	<string name="_Section"><![CDATA[Отдел]]></string>
 	<string name="_Select_one"><![CDATA[Выберите один...]]></string>
 	<string name="_Select_all"><![CDATA[Выбрать всё]]></string>

+ 14 - 3
template/scripts/BxBaseSearch.php

@@ -18,6 +18,8 @@ class BxBaseSearch extends BxDolSearch
 
     public function __construct($aChoice, $oTemplate)
     {
+        if (!is_array($aChoice) && $aChoice != '')
+            $aChoice = array($aChoice);
         parent::__construct($aChoice);
 
         $this->_oTemplate = $oTemplate ? $oTemplate : BxDolTemplate::getInstance();
@@ -31,13 +33,13 @@ class BxBaseSearch extends BxDolSearch
         if (false === $sTitle)
             $sTitle = _t( "_Search");
 
-        $aValues = $this->getKeyTitlesPairs ();
+        $aValues = array_merge(array('' => _t('_search_in_all_section')), $this->getKeyTitlesPairs());
         if (bx_get('type'))
             $aValue = bx_process_input(bx_get('type'));
         elseif (bx_get('section'))
             $aValue = bx_process_input(bx_get('section'));
         else
-            $aValue = array_keys($aValues);
+            $aValue = '';
 
         $sIdForm = $this->_sIdForm . ($this->_bLiveSearch ? $this->_sSuffixLiveSearch : '');
         $sIdResults = $this->_sIdResults . ($this->_bLiveSearch ? $this->_sSuffixLiveSearch : '');
@@ -60,7 +62,7 @@ class BxBaseSearch extends BxDolSearch
                     'value' => $this->_bLiveSearch ? 1 : 0,
                 ),
                 'section' => array(
-                    'type' => 'checkbox_set',
+                    'type' => 'select',
                     'name' => 'section',
                     'caption' => _t('_Section'),
                     'values' => $aValues,
@@ -105,6 +107,15 @@ class BxBaseSearch extends BxDolSearch
         $sIdResults = $this->_sIdResults . ($this->_bLiveSearch ? $this->_sSuffixLiveSearch : '');
         return '<div id="' . $sIdResults . '">' . $sCode . '</div>';
     }
+    
+    protected function getKeyTitlesPairs ()
+    {
+        $a = array();
+        foreach ($this->aClasses as $sKey => $r)
+            if ($this->_sMetaType || $r['GlobalSearch'])
+                $a[$sKey] = _t($r['title']);
+        return $a;
+    }
 }
 
 /** @} */