Quellcode durchsuchen

#3660 - Add "Last Name" fileld for Persons

RomanL vor 4 Jahren
Ursprung
Commit
1d0f57a863

+ 22 - 17
modules/base/profile/classes/BxBaseModProfileModule.php

@@ -457,7 +457,7 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
         if (!$aContentInfo)
             return false;
         
-        $sDisplayName = bx_process_output($aContentInfo[$this->_oConfig->CNF['FIELD_NAME']]);
+        $sDisplayName = $this->getProfileName($aContentInfo);
         bx_alert($this->getName(), 'profile_name', $aContentInfo['profile_id'], 0, array('info' => $aContentInfo, 'display_name' => &$sDisplayName));
         
         return $sDisplayName;
@@ -1443,6 +1443,22 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
     {
         $this->_oTemplate->setCover($oPage,$aProfileInfo);
     }
+    
+    /** 
+     * Returns list of members by mode with limited number of records for React Jot
+     * @param string $sMode
+     * @param int $iStart
+     * @param int $iPerPage
+     * @return mixed
+     */
+    public function serviceGetMembers($sMode = 'active', $iStart = 0, $iPerPage = 10){
+        bx_import('SearchResult', $this->_aModule);
+        $sClass = $this->_aModule['class_prefix'] . 'SearchResult';
+        $o = new $sClass($sMode);
+
+        $o -> aCurrent['paginate'] = array('perPage' => $iPerPage, 'forceStart' => $iStart);
+        return $o -> getSearchData();
+    }
 
     /**
      * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. So make sure to make strict(===) checking.
@@ -1807,6 +1823,11 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
     {
         return parent::getEntryImageData($aContentInfo, $sField, $aTranscoders);
     }
+    
+    public function getProfileName ($aContentInfo)
+    {
+        return bx_process_output($aContentInfo[$this->_oConfig->CNF['FIELD_NAME']]);
+    }
 
 
     // ====== PROTECTED METHODS
@@ -1968,22 +1989,6 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
 
         return parent::_getContent($iContentId, $sFuncGetContent);
     }
-
-    /** 
-     * Returns list of members by mode with limited number of records for React Jot
-     * @param string $sMode
-     * @param int $iStart
-     * @param int $iPerPage
-     * @return mixed
-     */
-    public function serviceGetMembers($sMode = 'active', $iStart = 0, $iPerPage = 10){
-        bx_import('SearchResult', $this->_aModule);
-        $sClass = $this->_aModule['class_prefix'] . 'SearchResult';
-        $o = new $sClass($sMode);
-
-        $o -> aCurrent['paginate'] = array('perPage' => $iPerPage, 'forceStart' => $iStart);
-        return $o -> getSearchData();
-    }
 }
 
 /** @} */

+ 1 - 1
modules/base/profile/classes/BxBaseModProfileTemplate.php

@@ -135,7 +135,7 @@ class BxBaseModProfileTemplate extends BxBaseModGeneralTemplate
         $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $iContentId);
 
         // get profile's title
-        $sTitle = bx_process_output($aData[$CNF['FIELD_NAME']]);
+        $sTitle = $oModule->getProfileName($aData);
 
         $sText = $sSummary = '';
         if(!empty($CNF['FIELD_TEXT']) && !empty($aData[$CNF['FIELD_TEXT']])) {

+ 2 - 1
modules/boonex/persons/classes/BxPersonsConfig.php

@@ -42,6 +42,7 @@ class BxPersonsConfig extends BxBaseModProfileConfig
             'FIELD_ADDED' => 'added',
             'FIELD_CHANGED' => 'changed',
             'FIELD_NAME' => 'fullname',
+            'FIELD_LAST_NAME' => 'last_name',
             'FIELD_TITLE' => 'fullname',
             'FIELD_TEXT' => 'description',
             'FIELD_PICTURE' => 'picture',
@@ -52,7 +53,7 @@ class BxPersonsConfig extends BxBaseModProfileConfig
             'FIELD_VIEWS' => 'views',
             'FIELD_VOTES' => 'votes',
             'FIELD_COMMENTS' => 'comments',
-            'FIELDS_QUICK_SEARCH' => array('fullname'),
+            'FIELDS_QUICK_SEARCH' => array('fullname', 'last_name'),
             'FIELD_LOCATION' => 'location',
             'FIELD_LOCATION_PREFIX' => 'location',
             'FIELD_LABELS' => 'labels',

+ 4 - 0
modules/boonex/persons/classes/BxPersonsModule.php

@@ -70,6 +70,10 @@ class BxPersonsModule extends BxBaseModProfileModule
         return false;
     }
     
+    public function getProfileName ($aContentInfo)
+    {
+        return bx_process_output($aContentInfo[$this->_oConfig->CNF['FIELD_NAME']] . ($aContentInfo[$this->_oConfig->CNF['FIELD_LAST_NAME']] != '' ? ' ' . $aContentInfo[$this->_oConfig->CNF['FIELD_LAST_NAME']] : ''));
+    }
     
 }
 

+ 4 - 2
modules/boonex/persons/install/langs/en.xml

@@ -39,8 +39,10 @@
     <string name="_bx_persons_form_profile_input_allow_post_to"><![CDATA[Who can post to my profile]]></string>
     <string name="_bx_persons_form_profile_input_sys_allow_contact_to"><![CDATA[Who can contact me]]></string>
     <string name="_bx_persons_form_profile_input_allow_contact_to"><![CDATA[Who can contact me]]></string>
-	<string name="_bx_persons_form_profile_input_sys_fullname"><![CDATA[Full Name]]></string>
-	<string name="_bx_persons_form_profile_input_fullname"><![CDATA[Full Name]]></string>
+	<string name="_bx_persons_form_profile_input_sys_fullname"><![CDATA[Name]]></string>
+	<string name="_bx_persons_form_profile_input_fullname"><![CDATA[Name]]></string>
+    <string name="_bx_persons_form_profile_input_sys_last_name"><![CDATA[Last Name]]></string>
+	<string name="_bx_persons_form_profile_input_last_name"><![CDATA[Last Name]]></string>
 	<string name="_bx_persons_form_profile_input_fullname_err"><![CDATA[Profile name is mandatory and and cannot start with @]]></string>
 	<string name="_bx_persons_form_profile_input_sys_desc"><![CDATA[Description]]></string>
 	<string name="_bx_persons_form_profile_input_desc"><![CDATA[Description]]></string>

+ 28 - 22
modules/boonex/persons/install/sql/install.sql

@@ -10,6 +10,7 @@ CREATE TABLE IF NOT EXISTS `bx_persons_data` (
   `picture` int(11) NOT NULL,
   `cover` int(11) NOT NULL,
   `fullname` varchar(255) NOT NULL,
+  `last_name` varchar(255) NOT NULL,
   `description` text NOT NULL,
   `gender` varchar(255) DEFAULT NULL,
   `birthday` date DEFAULT NULL,
@@ -266,6 +267,7 @@ INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `ch
 ('bx_person', 'bx_persons', 'do_submit', '_bx_persons_form_profile_input_submit', '', 0, 'submit', '_bx_persons_form_profile_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0, ''),
 ('bx_person', 'bx_persons', 'description', '', '', 0, 'textarea', '_bx_persons_form_profile_input_sys_desc', '_bx_persons_form_profile_input_desc', '', 0, 0, 1, '', '', '', '', '', '', 'XssHtml', '', 1, 1, ''),
 ('bx_person', 'bx_persons', 'fullname', '', '', 0, 'text', '_bx_persons_form_profile_input_sys_fullname', '_bx_persons_form_profile_input_fullname', '', 1, 0, 0, '', '', '', 'ProfileName', '', '_bx_persons_form_profile_input_fullname_err', 'Xss', '', 1, 0, ''),
+('bx_person', 'bx_persons', 'last_name', '', '', 0, 'text', '_bx_persons_form_profile_input_sys_last_name', '_bx_persons_form_profile_input_last_name', '', 1, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0, ''),
 ('bx_person', 'bx_persons', 'cover', 'a:1:{i:0;s:21:"bx_persons_cover_crop";}', 'a:1:{s:21:"bx_persons_cover_crop";s:24:"_sys_uploader_crop_title";}', 0, 'files', '_bx_persons_form_profile_input_sys_cover', '_bx_persons_form_profile_input_cover', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0, ''),
 ('bx_person', 'bx_persons', 'picture', 'a:1:{i:0;s:23:"bx_persons_picture_crop";}', 'a:1:{s:23:"bx_persons_picture_crop";s:24:"_sys_uploader_crop_title";}', 0, 'files', '_bx_persons_form_profile_input_sys_picture', '_bx_persons_form_profile_input_picture', '', 0, 0, 0, '', '', '', '', '', '_bx_persons_form_profile_input_picture_err', '', '', 1, 0, ''),
 ('bx_person', 'bx_persons', 'location', '', '', 0, 'location', '_sys_form_input_sys_location', '_sys_form_input_location', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0, ''),
@@ -287,12 +289,13 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_person_add', 'gender', 2147483647, 1, 2),
 ('bx_person_add', 'birthday', 2147483647, 1, 3),
 ('bx_person_add', 'fullname', 2147483647, 1, 4),
-('bx_person_add', 'description', 2147483647, 1, 5),
-('bx_person_add', 'location', 2147483647, 1, 6),
-('bx_person_add', 'allow_view_to', 2147483647, 1, 7),
-('bx_person_add', 'allow_post_to', 2147483647, 1, 8),
-('bx_person_add', 'allow_contact_to', 2147483647, 1, 9),
-('bx_person_add', 'do_submit', 2147483647, 1, 10),
+('bx_person_add', 'last_name', 2147483647, 0, 5),
+('bx_person_add', 'description', 2147483647, 1, 6),
+('bx_person_add', 'location', 2147483647, 1, 7),
+('bx_person_add', 'allow_view_to', 2147483647, 1, 8),
+('bx_person_add', 'allow_post_to', 2147483647, 1, 9),
+('bx_person_add', 'allow_contact_to', 2147483647, 1, 10),
+('bx_person_add', 'do_submit', 2147483647, 1, 11),
 
 ('bx_person_delete', 'cover', 2147483647, 0, 0),
 ('bx_person_delete', 'picture', 2147483647, 0, 0),
@@ -304,12 +307,13 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_person_edit', 'gender', 2147483647, 1, 2),
 ('bx_person_edit', 'birthday', 2147483647, 1, 3),
 ('bx_person_edit', 'fullname', 2147483647, 1, 4),
-('bx_person_edit', 'description', 2147483647, 1, 5),
-('bx_person_edit', 'location', 2147483647, 1, 6),
-('bx_person_edit', 'allow_view_to', 2147483647, 1, 7),
-('bx_person_edit', 'allow_post_to', 2147483647, 1, 8),
-('bx_person_edit', 'allow_contact_to', 2147483647, 1, 9),
-('bx_person_edit', 'do_submit', 2147483647, 1, 10),
+('bx_person_edit', 'last_name', 2147483647, 0, 5),
+('bx_person_edit', 'description', 2147483647, 1, 6),
+('bx_person_edit', 'location', 2147483647, 1, 7),
+('bx_person_edit', 'allow_view_to', 2147483647, 1, 8),
+('bx_person_edit', 'allow_post_to', 2147483647, 1, 9),
+('bx_person_edit', 'allow_contact_to', 2147483647, 1, 10),
+('bx_person_edit', 'do_submit', 2147483647, 1, 11),
 
 ('bx_person_edit_cover', 'delete_confirm', 2147483647, 0, 1),
 ('bx_person_edit_cover', 'fullname', 2147483647, 0, 2),
@@ -320,20 +324,22 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_person_view', 'gender', 2147483647, 1, 1),
 ('bx_person_view', 'birthday', 2147483647, 1, 2),
 ('bx_person_view', 'fullname', 2147483647, 1, 3),
-('bx_person_view', 'profile_email', 192, 1, 4),
-('bx_person_view', 'profile_status', 192, 1, 5),
-('bx_person_view', 'profile_ip', 192, 1, 6),
-('bx_person_view', 'added', 192, 1, 7),
-('bx_person_view', 'changed', 192, 1, 8),
-('bx_person_view', 'friends_count', 2147483647, 1, 9),
-('bx_person_view', 'followers_count', 2147483647, 1, 10),
+('bx_person_view', 'last_name', 2147483647, 0, 4),
+('bx_person_view', 'profile_email', 192, 1, 5),
+('bx_person_view', 'profile_status', 192, 1, 6),
+('bx_person_view', 'profile_ip', 192, 1, 7),
+('bx_person_view', 'added', 192, 1, 8),
+('bx_person_view', 'changed', 192, 1, 9),
+('bx_person_view', 'friends_count', 2147483647, 1, 10),
+('bx_person_view', 'followers_count', 2147483647, 1, 11),
 
 ('bx_person_view_full', 'gender', 2147483647, 1, 1),
 ('bx_person_view_full', 'birthday', 2147483647, 1, 2),
 ('bx_person_view_full', 'fullname', 2147483647, 1, 3),
-('bx_person_view_full', 'description', 2147483647, 0, 4),
-('bx_person_view_full', 'profile_email', 192, 1, 5),
-('bx_person_view_full', 'profile_status', 192, 1, 6),
+('bx_person_view_full', 'last_name', 2147483647, 0, 4),
+('bx_person_view_full', 'description', 2147483647, 0, 5),
+('bx_person_view_full', 'profile_email', 192, 1, 6),
+('bx_person_view_full', 'profile_status', 192, 1, 7),
 
 ('bx_person_skills', 'skill_name', 2147483647, 1, 1),
 ('bx_person_skills_view', 'skill_name', 2147483647, 1, 1);

+ 4 - 2
modules/boonex/russian/data/langs/bx_persons/ru.xml

@@ -39,8 +39,10 @@
     <string name="_bx_persons_form_profile_input_allow_post_to"><![CDATA[Оставлять сообщения в профиле могут]]></string>
     <string name="_bx_persons_form_profile_input_sys_allow_contact_to"><![CDATA[Писать мне могут]]></string>
     <string name="_bx_persons_form_profile_input_allow_contact_to"><![CDATA[Писать мне могут]]></string>
-	<string name="_bx_persons_form_profile_input_sys_fullname"><![CDATA[Полное имя]]></string>
-	<string name="_bx_persons_form_profile_input_fullname"><![CDATA[Полное имя]]></string>
+	<string name="_bx_persons_form_profile_input_sys_fullname"><![CDATA[Имя]]></string>
+	<string name="_bx_persons_form_profile_input_fullname"><![CDATA[Имя]]></string>
+    <string name="_bx_persons_form_profile_input_sys_last_name"><![CDATA[Фамилия]]></string>
+	<string name="_bx_persons_form_profile_input_last_name"><![CDATA[Фамилия]]></string>
 	<string name="_bx_persons_form_profile_input_fullname_err"><![CDATA[Имя профиля обязательно для заполнения и не должно начинаться с @.]]></string>
 	<string name="_bx_persons_form_profile_input_sys_desc"><![CDATA[Описание]]></string>
 	<string name="_bx_persons_form_profile_input_desc"><![CDATA[Описание]]></string>