想给depositor模块增加搜索功能,无法实现,请指教!
2015-04-16 16:04:19
天罗地网
  • 访问次数: 31
  • 注册日期: 2015-03-02
  • 最后登录: 2017-02-28
  • 我的积分: 245
  • 门派等级: 无门派

按照trade模块依葫芦画瓢,点搜索没有反应,在depositor模块config里面加了


                         
                        $config
                        ->
                        depositor
                        ->
                        search
                        [
                        'module'
                        ] = 
                        'depositor'
                        ; 
                         
                        $config
                        ->
                        depositor
                        ->
                        search
                        [
                        'fields'
                        ][
                        'abbr'
                        ] = 
                        $lang
                        ->
                        depositor
                        ->
                        abbr
                        ; 
                        //$
                         
                        $config
                        ->
                        depositor
                        ->
                        search
                        [
                        'fields'
                        ][
                        'date'
                        ]      = 
                        $lang
                        ->
                        depositor
                        ->
                        date
                        ; 
                        $config
                        ->
                        depositor
                        ->
                        search
                        [
                        'fields'
                        ][
                        'id'
                        ]        = 
                        $lang
                        ->
                        depositor
                        ->
                        id
                        ; 
                         
                         
                         
                        $config
                        ->
                        depositor
                        ->
                        search
                        [
                        'params'
                        ][
                        'abbr'
                        ]    = 
                        array
                        (
                        'operator' 
                        => 
                        'include'
                        , 
                        'control' 
                        => 
                        'input'
                        , 
                        'values' 
                        => 
                        ''
                        ); 
                         
                        $config
                        ->
                        depositor
                        ->
                        search
                        [
                        'params'
                        ][
                        'date'
                        ]      = 
                        array
                        (
                        'operator' 
                        => 
                        '>='
                        , 
                        'control' 
                        => 
                        'input'
                        , 
                        'values' 
                        => 
                        ''
                        , 
                        'class' 
                        => 
                        'date'
                        ); 
                        $config
                        ->
                        depositor
                        ->
                        search
                        [
                        'params'
                        ][
                        'id'
                        ]        = 
                        array
                        (
                        'operator' 
                        => 
                        '='
                        , 
                        'control' 
                        => 
                        'input'
                        , 
                        'values' 
                        => 
                        ''
                        ); 

mode


                        public function 
                        getList(
                        $mode
                        , 
                        $orderBy 
                        = 
                        'id_desc'
                        , 
                        $pager 
                        = 
                        null
                        ) 
                        { 
                         
                        if
                        (
                        $this
                        ->
                        session
                        ->
                        tradeQuery 
                        === 
                        false
                        ) 
                        $this
                        ->
                        session
                        ->set(
                        'tradeQuery'
                        , 
                        ' 1 = 1'
                        ); 
                         
                        $tradeQuery 
                        = 
                        $this
                        ->loadModel(
                        'search'
                        , 
                        'sys'
                        )->replaceDynamic(
                        $this
                        ->
                        session
                        ->
                        tradeQuery
                        ); 
                         
                        return 
                        $this
                        ->
                        dao
                        ->select(
                        '*'
                        )->from(
                        TABLE_DEPOSITOR
                        ) ->beginIF(
                        $mode 
                        == 
                        'bysearch'
                        )->andWhere(
                        $tradeQuery
                        )->fi() 
                         ->orderBy(
                        $orderBy
                        )->page(
                        $pager
                        )->fetchAll(
                        'id'
                        ); 
                        }
browse.html


                        <?php include 
                        '../../common/view/header.html.php'
                        ;
                        ?>
                         
                        <?php 
                        js::
                        set
                        (
                        'mode'
                        , 
                        $mode
                        );
                        ?>
                         
                        <?php 
                        $vars 
                        = 
                        "mode=
                        {
                        $mode
                        }
                        &orderBy=%s&recTotal=
                        {
                        $pager
                        ->
                        recTotal
                        }
                        &recPerPage=
                        {
                        $pager
                        ->
                        recPerPage
                        }
                        &pageID=
                        {
                        $pager
                        ->
                        pageID
                        }
                        "
                        ;
                        ?>
                         
                        <
                        li 
                        id=
                        'bysearchTab'
                        >
                        <?php echo 
                        html::
                        a
                        (
                        '#'
                        , 
                        "<i class='icon-search icon'></i>" 
                        . 
                        $lang
                        ->
                        search
                        ->
                        common
                        )
                        ?>
                        </
                        li
                        >

control


                        public function 
                        browse(
                        $mode 
                        = 
                        'all'
                        ,
                        $orderBy 
                        = 
                        'id_desc'
                        , 
                        $recTotal 
                        = 
                        0
                        , 
                        $recPerPage 
                        = 
                        20
                        , 
                        $pageID 
                        = 
                        1
                        ) 
                        { 
                         
                        $this
                        ->
                        app
                        ->loadClass(
                        'pager'
                        , 
                        $static 
                        = 
                        true
                        ); 
                         
                        $pager 
                        = 
                        new 
                        pager(
                        $recTotal
                        , 
                        $recPerPage
                        , 
                        $pageID
                        ); 
                         
                         
                        $this
                        ->loadModel(
                        'search'
                        , 
                        'sys'
                        ); 
                         
                        $this
                        ->
                        config
                        ->
                        depositor
                        ->
                        search
                        [
                        'actionURL'
                        ] = 
                        $this
                        ->createlink(
                        'depositor'
                        , 
                        'browse'
                        , 
                        'mode=bysearch'
                        ); 
                         
                        $this
                        ->
                        config
                        ->
                        depositor
                        ->
                        search
                        [
                        'params'
                        ][
                        'abbr'
                        ][
                        'values'
                        ] = 
                        array
                        (
                        '' 
                        => 
                        ''
                        ) + 
                        $this
                        ->
                        depositor
                        ->getPairs(); 
                         
                         
                        $this
                        ->
                        config
                        ->
                        depositor
                        ->
                        search
                        [
                        'params'
                        ][
                        'id'
                        ][
                        'values'
                        ]  = 
                        array
                        (
                        '' 
                        => 
                        ''
                        ) ; 
                         
                        $this
                        ->
                        search
                        ->setSearchParams(
                        $this
                        ->
                        config
                        ->
                        depositor
                        ->
                        search
                        );


天罗地网 最后编辑, 2015-04-16 16:05:17
沙发
2015-04-19 16:22:04
王春生
  • 访问次数: 940
  • 注册日期: 2014-05-02
  • 最后登录: 2026-01-06
  • 我的积分: 1314
  • 门派等级: 无门派
代码自己要学会调试,查找错误日志。我们没有资源帮大家调试代码。请理解。
板凳
2015-04-19 18:00:56
天罗地网
  • 访问次数: 31
  • 注册日期: 2015-03-02
  • 最后登录: 2017-02-28
  • 我的积分: 245
  • 门派等级: 无门派
不是要调试代码,我换个方式问问,如何给browse view增加搜索功能
#3
2015-04-19 18:32:11
王春生
  • 访问次数: 940
  • 注册日期: 2014-05-02
  • 最后登录: 2026-01-06
  • 我的积分: 1314
  • 门派等级: 无门派
你可以购买我们的技术支持服务。
1/1