diff --git a/application/classes/actions/ActionProfile.class.php b/application/classes/actions/ActionProfile.class.php index 989e01b9..ec87bac8 100644 --- a/application/classes/actions/ActionProfile.class.php +++ b/application/classes/actions/ActionProfile.class.php @@ -732,7 +732,7 @@ class ActionProfile extends Action { /** * Получаем список заметок */ - $aResult=$this->User_GetUserNotesByUserId($this->oUserProfile->getId(),$iPage,Config::Get('module.user.usernote_per_page')); + $aResult=$this->User_GetUsersByNoteAndUserId($this->oUserProfile->getId(),$iPage,Config::Get('module.user.usernote_per_page')); $aNotes=$aResult['collection']; /** * Формируем постраничность @@ -742,7 +742,7 @@ class ActionProfile extends Action { * Загружаем переменные в шаблон */ $this->Viewer_Assign('aPaging',$aPaging); - $this->Viewer_Assign('aNotes',$aNotes); + $this->Viewer_Assign('aUsersList',$aNotes); $this->Viewer_AddHtmlTitle($this->Lang_Get('user_menu_profile').' '.$this->oUserProfile->getLogin()); $this->Viewer_AddHtmlTitle($this->Lang_Get('user_menu_profile_notes')); /** diff --git a/application/classes/modules/user/User.class.php b/application/classes/modules/user/User.class.php index ac1489d6..9905e63c 100644 --- a/application/classes/modules/user/User.class.php +++ b/application/classes/modules/user/User.class.php @@ -1390,6 +1390,20 @@ class ModuleUser extends Module { } return array('collection'=>$aResult,'count'=>$iCount); } + /** + * Возвращает список пользователей к которым юзер оставлял заметку + * + * @param int $iUserId ID пользователя + * @param int $iCurrPage Номер страницы + * @param int $iPerPage Количество элементов на страницу + * + * @return array('collection'=>array,'count'=>int) + */ + public function GetUsersByNoteAndUserId($iUserId,$iCurrPage,$iPerPage) { + $aUsersId=$this->oMapper->GetUsersByNoteAndUserId($iUserId,$iCount,$iCurrPage,$iPerPage); + $aResult=$this->GetUsersAdditionalData($aUsersId); + return array('collection'=>$aResult,'count'=>$iCount); + } /** * Возвращает количество заметок у пользователя * diff --git a/application/classes/modules/user/mapper/User.mapper.class.php b/application/classes/modules/user/mapper/User.mapper.class.php index 160bd288..e2cab54d 100644 --- a/application/classes/modules/user/mapper/User.mapper.class.php +++ b/application/classes/modules/user/mapper/User.mapper.class.php @@ -983,6 +983,32 @@ class ModuleUser_MapperUser extends Mapper { } return $aReturn; } + /** + * Возвращает список ID пользователей к которым юзер оставлял заметки + * + * @param int $iUserId ID пользователя + * @param int $iCount Возвращает общее количество элементов + * @param int $iCurrPage Номер страницы + * @param int $iPerPage Количество элементов на страницу + * @return array + */ + public function GetUsersByNoteAndUserId($iUserId,&$iCount,$iCurrPage,$iPerPage) { + $sql = " + SELECT target_user_id + FROM + ".Config::Get('db.table.user_note')." + WHERE + user_id = ?d + ORDER BY id DESC + LIMIT ?d, ?d "; + $aReturn=array(); + if ($aRows=$this->oDb->selectPage($iCount,$sql,$iUserId,($iCurrPage-1)*$iPerPage, $iPerPage)) { + foreach ($aRows as $aRow) { + $aReturn[]=$aRow['target_user_id']; + } + } + return $aReturn; + } /** * Возвращает количество заметок у пользователя * diff --git a/application/frontend/skin/developer/actions/ActionProfile/created.notes.tpl b/application/frontend/skin/developer/actions/ActionProfile/created.notes.tpl index 69b7416a..98b8f57a 100644 --- a/application/frontend/skin/developer/actions/ActionProfile/created.notes.tpl +++ b/application/frontend/skin/developer/actions/ActionProfile/created.notes.tpl @@ -9,30 +9,5 @@ {block name='layout_content'} {include file='navs/nav.user.created.tpl'} - {if $aNotes} - - {else} - {include file='alert.tpl' mAlerts=$aLang.common.empty sAlertStyle='empty'} - {/if} - - {include file='pagination.tpl' aPaging=$aPaging} + {include file='user_list.tpl'} {/block} \ No newline at end of file