질문/조언질답게시판

라이믹스 1.9.9.7에서 2.0.6으로 바로 덮어쓰기를 했습니다.

그러면서 예전에 만들었던 위젯에서 잘 나오던 페이지네이션이 안 나오고 있어서요;;

 

list_count를 3으로 했을 때, 원래대로라면 total_count가 13이 되고 total_page가 4로 나와야 하는데요.

total_count가 3으로 고정되고 total_page도 1밖에 안 됩니다ㅜ

짜놨었던 쿼리는 아래와 같은데요. xml을 수정해야 할지 아니면 다른 부분을 의심해봐야 할지 감이 잘 안 잡힙니다.

 

<query id="getMemberList" action="select">
    <tables>
        <table name="member" alias="member" />
        <table name="member_group_member" alias="member_group" />
    </tables>
    <columns>
        <column name="member.*" />
    </columns>
    <conditions>
        <condition operation="in" column="member_group.group_srl" var="selected_group_srl" notnull="notnull" />
        <condition operation="equal" column="member.member_srl" var="member_group.member_srl" pipe="and" notnull="notnull" />
        <group pipe="and">
            <condition operation="equal" column="denied" default="N" pipe="and" />
            <condition operation="in" column="member.member_srl" var="member_srls" pipe="and" />
        </group>
        <group pipe="and">
            <condition operation="like" column="member.user_id" var="s_user_id" />
            <condition operation="like" column="member.user_name" var="s_user_name" pipe="or" />
            <condition operation="like" column="member.nick_name" var="s_nick_name" pipe="or" />
            <condition operation="like" column="member.nick_name" var="html_nick_name" pipe="or" />
            <condition operation="like" column="member.email_address" var="s_email_address" pipe="or" />
            <condition operation="like" column="member.birthday" var="s_birthday" pipe="or" />
            <condition operation="like" column="member.extra_vars" var="s_extra_vars" pipe="or" />
            <condition operation="like_prefix" column="member.regdate" var="s_regdate" pipe="or" />
            <condition operation="like_prefix" column="member.last_login" var="s_last_login" pipe="or" />
            <condition operation="more" column="member.regdate" var="s_regdate_more" pipe="or" />
            <condition operation="less" column="member.regdate" var="s_regdate_less" pipe="or" />
            <condition operation="more" column="member.last_login" var="s_last_login_more" pipe="or" />
            <condition operation="less" column="member.last_login" var="s_last_login_less" pipe="or" />
        </group>
    </conditions>
    <groups>
        <group column="member.member_srl" />
    </groups>
    <navigation>
        <index var="sort_index" default="member.list_order" order="sort_order" />
        <list_count var="list_count" default="20" />
        <page_count var="page_count" default="10" />
        <page var="page" default="1" />
    </navigation>
</query>

 

  • profile
    단순 쿼리문이 아니라 $args값으로 어떻게 주었는지도 확인해봐야할 것 같은데요.

    쿼리 내용자체로만 보면 라이믹스 코어에서 제공한듯한 파일처럼 보이나 실제로 서드파티를 이용하신거라면 어떻게 쿼리를 호출햇는지 좀 더 정보가 필요할 것 같습니다.
  • profile profile

    네, 안 그래도 위젯 클래스 파일도 보여드려야겠다는 생각을 하고 있었어요ㅎㅎ

     

    <?php
        /**
         * @class ap_member_list
         * @brief 회원 목록 및 검색 위젯
         * @version 0.1
         **/
    
        class ap_member_list extends WidgetHandler
        {
            function proc($args)
            {
                // 언어 파일 로드
                Context::loadLang($this->widget_path . 'lang');
    
                // 위젯 설정에서 지정한 그룹을 별도로 목록화
                $target_groups = array();
                $oMemberModel = getModel('member');
                $_groups = explode(',', $args->target_group);
                if ( count($_groups) )
                {
                    for ( $i = 0; $i < count($_groups); $i++ )
                    {
                        $group_srl = trim($_groups[$i]);
                        if ( !$group_srl ) continue;
                        $target_groups[$group_srl] = $oMemberModel->getGroup($group_srl);
                    }
                }
                else
                {
                    $target_groups = $oMemberModel->getGroups(0);
                    if ( !$target_groups ) return;
                }
    
                // 회원 목록 변수 정리
                $obj = new stdClass();
                $obj->selected_group_srl = Context::get('selected_group_srl') ? Context::get('selected_group_srl') : implode(',', array_keys($target_groups));
    
                $obj->sort_index = Context::get('sort_index') ? Context::get('sort_index') : $args->sort_index;
                $obj->sort_order = Context::get('sort_order')? Context::get('sort_order') : $args->sort_order;
                $obj->list_count = $args->list_count ? (int)$args->list_count : 20;
                $obj->page_count = $args->page_count ? (int)$args->page_count : 10;
    $obj->page = Context::get('mpage') ? abs(Context::get('mpage')) : 1;
    
                // 회원 모듈 사용자정의 불러오기
                $_extra_keys = $oMemberModel->getJoinFormList();
                if ( count($_extra_keys) )
                {
                    $extra_keys = array();
                    foreach ( $_extra_keys as $key => $val )
                    {
                        if ( in_array($val->column_name, array_map('trim', explode(',', $args->extra_keys))) ) $extra_keys[$key] = $val;
                    }
                }
    
                // 검색 대상 정리
                $option_view = $args->option_view;
                $_option_arr = array_map('trim', explode(',', $option_view));
                $option_arr = array();
                foreach ( $_option_arr as $val )
                {
                    if ( !in_array($val, array('profile_image', 'signature', 'member_group', 'extra_vars')) ) $option_arr[$val] = Context::getLang($val);
                    if ( in_array($val, array('regdate', 'last_login')) )
                    {
                        $option_arr[$val] = Context::getLang('search_target_list')[$val];
                        $option_arr[$val.'_more'] = Context::getLang('search_target_list')[$val.'_more'];
                        $option_arr[$val.'_less'] = Context::getLang('search_target_list')[$val.'_less'];
                    }
                }
                $search_target_list = $option_arr;
                if ( count($extra_keys) )
                {
                    $extra_search_target_list = array();
                    foreach ( $extra_keys as $val )
                    {
                        $extra_search_target_list[$val->column_name] = $val->column_title;
                    }
                }
                $search_target_list = array_merge($search_target_list, $extra_search_target_list);
    
                // 회원 목록 및 검색 쿼리 실행
                $search_target = trim(Context::get('search_target'));
                $search_keyword = trim(Context::get('search_keyword'));
    
                if ( $search_target && $search_keyword )
                {
                    $s_target = 's_' . $search_target;
                    if ( in_array($search_target, array('regdate', 'last_login', 'birthday')) )
                    {
                        $obj->$s_target = preg_match('/[0-9]+/', $search_keyword) ? preg_replace('/[^0-9]/', '', $search_keyword) : $search_keyword;
                    }
                    else if ( in_array($search_target, array('regdate_more', 'last_login_more')) )
                    {
                        $obj->$s_target = preg_match('/[0-9]+/', $search_keyword) ? substr(preg_replace('/[^0-9]/', '', $search_keyword) . '00000000000000', 0, 14) : $search_keyword;
                    }
                    else if ( in_array($search_target, array('regdate_less', 'last_login_less')) )
                    {
                        $obj->$s_target = substr(preg_replace('/[^0-9]/', '', $search_keyword) . '00000000000000', 0, 14);
                    }
                    else if ( array_key_exists($search_target, $extra_search_target_list) && count($extra_keys) )
                    {
                        if ( count($extra_keys) === 1 )
                        {
                            $obj->s_extra_vars = str_replace(' ', '%', $search_keyword);
                        }
                        else
                        {
                            $_search_keyword = str_replace(' ', '%', $search_keyword);
                            $member_srls = array();
                            $_output = executeQueryArray('widgets.ap_member_list.getMembersWithExtraVars')->data;
                            foreach ( $_output as $key => $val )
                            {
                                $_extra_vars = unserialize($val->extra_vars);
                                $_extra_target = new stdClass();
                                foreach ( $_extra_vars as $eid => $var )
                                {
                                    if ( $eid === $search_target )
                                    {
                                        $vars = is_array($var) ? implode(', ', $var) : $var;
                                if ( stripos($vars, $_search_keyword) !== false ) $member_srls[] = $val->member_srl;
                                    }
                                }
                            }
                            $obj->member_srls = count($member_srls) ? $member_srls : 0;
                        }
                    }
                    else
                    {
                        $obj->$s_target = str_replace(' ', '%', $search_keyword);
                    }
                }
    
                // DB 쿼리 최종 실행
                $output = executeQueryArray('widgets.ap_member_list.getMemberList', $obj);
    
                // 위젯 변수 정리
                $member_list = new stdClass();
                $member_list->widget_cache = (int)preg_replace('/[^0-9]*/s', '', $args->widget_cache);
                $member_list->target_groups = $member_list->widget_cache ? null: $target_groups;
                $member_list->title = $args->title;
                $member_list->subtitle = $args->subtitle;
                $member_list->view_group_tab = $args->view_group_tab ? $args->view_group_tab : 'Y';
                $member_list->view_page_navigation = $args->view_page_navigation ? $args->view_page_navigation : 'Y';
                $member_list->ajax_use = $args->ajax ? $args->ajax : 'Y';
    
                // 위젯 스킨에 담을 변수를 위한 배열 변수 선언
                $member_list->item = array();
    
                // 그룹별 데이터 결과값 확인 후, 회원별로 추가 변수값 부가
                if ( $output->toBool() && $output->data )
                {
                    foreach ( $output->data as $key => $val )
                    {
                        $member_item = new stdClass();
                        $member_item->member_srl = $member_srl = $val->member_srl;
    
                        // 보기 옵션에 따라 변수 추가 배분
                        if ( strpos($option_view, 'profile_image') !== false ) $member_item->profile_info = $oMemberModel->getProfileImage($member_srl);
                        if ( strpos($option_view, 'nick_name') !== false ) $member_item->nick_name = $val->nick_name;
                        if ( strpos($option_view, 'user_id') !== false ) $member_item->user_id = $val->user_id;
                        if ( strpos($option_view, 'user_name') !== false ) $member_item->user_name = $val->user_name;
                        if ( strpos($option_view, 'email_address') !== false ) $member_item->email_address = $val->email_address;
                        if ( strpos($option_view, 'homepage') !== false ) $member_item->homepage = $val->homepage;
                        if ( strpos($option_view, 'blog') !== false ) $member_item->blog = $val->blog;
                        if ( strpos($option_view, 'birthday') !== false ) $member_item->birthday = $val->birthday;
                        if ( strpos($option_view, 'regdate') !== false ) $member_item->regdate = $val->regdate;
                        if ( strpos($option_view, 'last_login') !== false ) $member_item->last_login = $val->last_login;
                        if ( strpos($option_view, 'member_group') !== false ) $member_item->member_group = implode(', ', $oMemberModel->getMemberGroups($member_srl, 0));
                        if ( strpos($option_view, 'signature') !== false ) $member_item->signature = $oMemberModel->getSignature($member_srl);
                        // 사용자정의 가져오기
                        if ( strpos($option_view, 'extra_vars') !== false && count($extra_keys) )
                        {
                            $_extra_vars = unserialize($val->extra_vars);
                            $member_item->extra_vars = array();
    
                            foreach ( $extra_search_target_list as $name => $title )
                            {
                                foreach ( $_extra_vars as $eid => $var )
                                {
                                    if ( $eid === $name )
                                    {
                                        $vars = is_array($var) ? implode(', ', $var) : $var;
                                        $member_item->extra_vars[$name] = array(
                                            'title' => $title,
                                            'value' => $vars
                                        );
                                    }
                                }
                            }
    
                            if ( !count($member_item->extra_vars) )
                            {
                                foreach ( $extra_search_target_list as $name => $title )
                                {
                                    $member_item->extra_vars[$name] = array(
                                        'title' => $title,
                                        'value' => ''
                                    );
                                }
                            }
                        }
    
                        $member_list->item[] = $member_item;
                        continue;
                    }
                }
    
                // 위젯 스킨으로 변수 전달
                Context::set('member_list', $member_list);
                Context::set('option_view', array_map('trim', explode(',', $option_view)));
                Context::set('extra_keys', $extra_keys);
                if ( !$member_list->widget_cache ) Context::set('member_page', $output->page_navigation);
                Context::set('search_target_list', $search_target_list);
    
                // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)
                $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
    
                // 템플릿 파일을 지정
                $tpl_file = 'list';
    
                // 템플릿 컴파일
                $oTemplate = &TemplateHandler::getInstance();
                $output = $oTemplate->compile($tpl_path, $tpl_file);
                return $output;
            }
        }
    ?>

     

  • profile profile
    113번째줄 $output 디버깅찍으면?
  • profile profile
    133행 말씀이죠?
    그 부분에서 디버깅 찍었을 때 페이지네이션 문제가 생겼어요;;
  • profile profile
    2.0.7버전으로 릴리즈 되었으니 한번 업데이트 해보시길 바랍니다 :)
  • profile profile
    네, 이제 도로 잘 됩니다 ㅎㅎㅎ
  • profile
    그룹은 그룹별로 검색할때 필요한건가요?
  • profile profile
    네, 그룹별로 회원 목록 출력이 되거든요
  • profile

    JOIN과 GROUP BY가 섞여 있는 것을 보니, 라이믹스 develop 브랜치에서 며칠 전에 패치된 문제와 관련이 있을 수도 있습니다. 따끈따끈한 2.0.7로 업데이트해 보세요.^^

  • profile profile
    네, 2.0.7로 바꾸고 정상적으로 페이지네이션이 구현됩니다. 다행이네요:)