public static function get_message($condition, array $parameters)
    {
        $row = self::$db_querier->select_single_row_query('SELECT member.*, guestbook.*, guestbook.login as glogin
		FROM ' . GuestbookSetup::$guestbook_table . ' guestbook 
		LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = guestbook.user_id
		' . $condition, $parameters);
        $message = new GuestbookMessage();
        $message->set_properties($row);
        return $message;
    }
    private function build_view()
    {
        $user_accounts_config = UserAccountsConfig::load();
        $messages_number = GuestbookService::count();
        $page = AppContext::get_request()->get_getint('page', 1);
        $pagination = $this->get_pagination($messages_number, $page);
        $is_guest = !AppContext::get_current_user()->check_level(User::MEMBER_LEVEL);
        $result = PersistenceContext::get_querier()->select('SELECT member.*, guestbook.*, guestbook.login as glogin, ext_field.user_avatar
		FROM ' . GuestbookSetup::$guestbook_table . ' guestbook
		LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = guestbook.user_id
		LEFT JOIN ' . DB_TABLE_MEMBER_EXTENDED_FIELDS . ' ext_field ON ext_field.user_id = member.user_id
		ORDER BY guestbook.timestamp DESC
		LIMIT :number_items_per_page OFFSET :display_from', array('number_items_per_page' => $pagination->get_number_items_per_page(), 'display_from' => $pagination->get_display_from()));
        while ($row = $result->fetch()) {
            $message = new GuestbookMessage();
            $message->set_properties($row);
            //Avatar
            $user_avatar = !empty($row['user_avatar']) ? Url::to_rel($row['user_avatar']) : ($user_accounts_config->is_default_avatar_enabled() ? Url::to_rel('/templates/' . AppContext::get_current_user()->get_theme() . '/images/' . $user_accounts_config->get_default_avatar_name()) : '');
            $this->view->assign_block_vars('messages', array_merge($message->get_array_tpl_vars($page), array('C_AVATAR' => $row['user_avatar'] || $user_accounts_config->is_default_avatar_enabled(), 'C_USER_GROUPS' => !empty($row['groups']), 'U_AVATAR' => $user_avatar)));
            //user's groups
            if ($message->get_author_user()->get_groups()) {
                $groups_cache = GroupsCache::load();
                $user_groups = $message->get_author_user()->get_groups();
                foreach ($user_groups as $user_group_id) {
                    if ($groups_cache->group_exists($user_group_id)) {
                        $group = $groups_cache->get_group($user_group_id);
                        $this->view->assign_block_vars('messages.user_groups', array('C_GROUP_PICTURE' => !empty($group['img']), 'GROUP_PICTURE' => $group['img'], 'GROUP_NAME' => $group['name']));
                    }
                }
            }
        }
        $result->dispose();
        $this->view->put_all(array('C_NO_MESSAGE' => $result->get_rows_count() == 0, 'C_PAGINATION' => $messages_number > GuestbookConfig::load()->get_items_per_page(), 'PAGINATION' => $pagination->display()));
        if (GuestbookAuthorizationsService::check_authorizations()->write() && !AppContext::get_current_user()->is_readonly()) {
            $this->view->put('FORM', GuestbookFormController::get_view());
        } else {
            $this->view->put('MSG', MessageHelper::display($this->lang['error.post.unauthorized'], MessageHelper::WARNING));
        }
        return $this->view;
    }