diff --git a/View/Helper/UserSearchHelper.php b/View/Helper/UserSearchHelper.php index 4ef2d77..14068ac 100644 --- a/View/Helper/UserSearchHelper.php +++ b/View/Helper/UserSearchHelper.php @@ -53,7 +53,8 @@ public function __construct(View $View, $settings = array()) { $this->UsersLanguage = ClassRegistry::init('Users.UsersLanguage'); $this->userAttributes = Hash::combine( - $this->_View->viewVars['userAttributes'], '{n}.{n}.{n}.UserAttribute.key', '{n}.{n}.{n}' + Hash::get($this->_View->viewVars, 'userAttributes', array()), + '{n}.{n}.{n}.UserAttribute.key', '{n}.{n}.{n}' ); } @@ -61,10 +62,11 @@ public function __construct(View $View, $settings = array()) { * テーブルヘッダーの出力 * * @param bool $isEdit 編集の有無 + * @param bool $isSort ソートの有無 * @return string User value * @SuppressWarnings(PHPMD.BooleanArgumentFlag) */ - public function tableHeaders($isEdit = false) { + public function tableHeaders($isEdit = false, $isSort = true) { $output = ''; foreach ($this->_View->viewVars['displayFields'] as $fieldName) { @@ -81,15 +83,22 @@ public function tableHeaders($isEdit = false) { $output .= ''; if ($fieldName === 'room_role_key') { - $output .= $this->_View->Paginator->sort('RoomRole.level', __d('rooms', 'Room role')); + $label = __d('rooms', 'Room role'); + $key = 'RoomRole.level'; } else { $userAttribute = Hash::extract( $this->userAttributes, '{s}.UserAttribute[key=' . $fieldName . ']' ); - $output .= $this->_View->Paginator->sort( - $this->User->getOriginalUserField($fieldName), $userAttribute[0]['name'] - ); + $label = $userAttribute[0]['name']; + $key = $this->User->getOriginalUserField($fieldName); } + + if ($isSort) { + $output .= $this->_View->Paginator->sort($key, $label); + } else { + $output .= h($label); + } + $output .= ''; if ($isEdit) {