Parcourir la source

Ticket #4413 - Report: Allow to use content related action titles.

AntonLV il y a 3 ans
Parent
commit
d80a2c4f73

+ 8 - 1
inc/classes/BxDolReport.php

@@ -282,7 +282,14 @@ class BxDolReport extends BxDolObject
 
 
     protected function _getTitleDoReport($bPerformed)
     protected function _getTitleDoReport($bPerformed)
     {
     {
-    	return $bPerformed && $this->isUndo() ? '_report_do_unreport' : '_report_do_report';
+        if($bPerformed && $this->isUndo())
+            return ['_report_do_unreport'];
+
+        $sSample = '_' . $this->_sSystem . '_txt_sample_single';
+        if(($$sSample = _t($sSample)) && strcmp($sSample, $$sSample) != 0)
+            return ['_report_do_report_with_sample', $$sSample];
+
+    	return ['_report_do_report'];
     }
     }
 
 
     protected function _getFormObject()
     protected function _getFormObject()

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

@@ -100,6 +100,7 @@
         <string name="_report_status_all"><![CDATA[All]]></string>
         <string name="_report_status_all"><![CDATA[All]]></string>
 	<string name="_report_counter"><![CDATA[{0}]]></string>
 	<string name="_report_counter"><![CDATA[{0}]]></string>
 	<string name="_report_do_report"><![CDATA[Report]]></string>
 	<string name="_report_do_report"><![CDATA[Report]]></string>
+        <string name="_report_do_report_with_sample"><![CDATA[Report {0}]]></string>
         <string name="_report_do_unreport"><![CDATA[Cancel report]]></string>
         <string name="_report_do_unreport"><![CDATA[Cancel report]]></string>
         <string name="_report_do_unreport_confirm"><![CDATA[Are you sure, you want to cancel your report?]]></string>
         <string name="_report_do_unreport_confirm"><![CDATA[Are you sure, you want to cancel your report?]]></string>
 	<string name="_report_do_report_by"><![CDATA[Reported by]]></string>
 	<string name="_report_do_report_by"><![CDATA[Reported by]]></string>

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

@@ -100,6 +100,7 @@
   <string name="_report_status_all"><![CDATA[Все]]></string>
   <string name="_report_status_all"><![CDATA[Все]]></string>
 	<string name="_report_counter"><![CDATA[{0}]]></string>
 	<string name="_report_counter"><![CDATA[{0}]]></string>
 	<string name="_report_do_report"><![CDATA[Пожаловаться]]></string>
 	<string name="_report_do_report"><![CDATA[Пожаловаться]]></string>
+        <string name="_report_do_report_with_sample"><![CDATA[Пожаловаться]]></string>
         <string name="_report_do_unreport"><![CDATA[Отменить жалобу]]></string>
         <string name="_report_do_unreport"><![CDATA[Отменить жалобу]]></string>
         <string name="_report_do_unreport_confirm"><![CDATA[Вы уверены, что хотите отменить свою жалобу?]]></string>
         <string name="_report_do_unreport_confirm"><![CDATA[Вы уверены, что хотите отменить свою жалобу?]]></string>
 	<string name="_report_do_report_by"><![CDATA[Пожаловались]]></string>
 	<string name="_report_do_report_by"><![CDATA[Пожаловались]]></string>

+ 3 - 3
template/scripts/BxBaseReport.php

@@ -232,7 +232,7 @@ class BxBaseReport extends BxDolReport
             'style_prefix' => $this->_sStylePrefix,
             'style_prefix' => $this->_sStylePrefix,
             'html_id' => $this->_aHtmlIds['do_link'],
             'html_id' => $this->_aHtmlIds['do_link'],
             'class' => $sClass,
             'class' => $sClass,
-            'title' => bx_html_attribute(_t($this->_getTitleDoReport($bReported))),
+            'title' => bx_html_attribute(call_user_func_array('_t', $this->_getTitleDoReport($bReported))),
         	'bx_if:show_onclick' => array(
         	'bx_if:show_onclick' => array(
                     'condition' => !$bDisabled,
                     'condition' => !$bDisabled,
                     'content' => array(
                     'content' => array(
@@ -264,7 +264,7 @@ class BxBaseReport extends BxDolReport
                 'condition' => isset($aParams['show_do_report_label']) && $aParams['show_do_report_label'] == true,
                 'condition' => isset($aParams['show_do_report_label']) && $aParams['show_do_report_label'] == true,
                 'content' => array(
                 'content' => array(
                     'style_prefix' => $this->_sStylePrefix,
                     'style_prefix' => $this->_sStylePrefix,
-                    'text' => _t($this->_getTitleDoReport($bReported))
+                    'text' => call_user_func_array('_t', $this->_getTitleDoReport($bReported))
                 )
                 )
             )
             )
         ));
         ));
@@ -434,7 +434,7 @@ class BxBaseReport extends BxDolReport
             'count' => $aData['count'], 
             'count' => $aData['count'], 
             'countf' => (int)$aData['count'] > 0 ? $this->_getCounterLabel($aData['count']) : '',
             'countf' => (int)$aData['count'] > 0 ? $this->_getCounterLabel($aData['count']) : '',
             'label_icon' => $this->_getIconDoReport($bPerformed),
             'label_icon' => $this->_getIconDoReport($bPerformed),
-            'label_title' => _t($this->_getTitleDoReport($bPerformed)),
+            'label_title' => call_user_func_array('_t', $this->_getTitleDoReport($bPerformed)),
             'disabled' => $bPerformed && !$bUndo,
             'disabled' => $bPerformed && !$bUndo,
         );
         );
     }
     }