寻呼机不工作Yii

时间:2014-03-13 07:34:26

标签: php yii

您好我有一个建议名称的控制器,并将ID传递给视图以生成记录。这很好用。我的数据库中有很多记录,所以如果我点击第二页,它会给我error 400。请帮我解决这个问题。提前谢谢。

我的控制器操作:

public function actionSearch($id)
{
    $cust_id=$id;
    $criteria = new CDbCriteria();
    $criteria->condition = "md5(host_customer_id) = '$cust_id'";
    $details = NimsoftHost::model()->find($criteria);
    echo $details->host_customer_id;
    $criteria2 = new CDbCriteria();
    $criteria2->condition = "cust_id= '$details->host_customer_id'";
    $name = MasterCustomers::model()->find($criteria2);
    $dataProvider=new CActiveDataProvider('NimsoftHost',array(
        'criteria'   => $criteria,'pagination'=>array('pageSize'=>40,)));
    $model = new NimsoftHost();
    $this->render('index',array(
        'dataProvider'=>$dataProvider,'details'=>$details,'name'=>$name->cust_name,'model'=>$model));
}

我的观点:

<!--Content-->
<?php $details=$details;
?>
<h3><?php echo $name; ?></h3>
<div id="content">
<?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'nimsoft-host-form',
    //'enableAjaxValidation'=>true,
    'enableClientValidation' => true,
    'clientOptions' => array(
        'validateOnSubmit' => true,
        'validateOnChange' => true, // allow client validation for every field
    ), 
    'htmlOptions' => array('enctype' => 'multipart/form-data'),
)); ?>
    <?php $this->endWidget();?>
    <h3><?php echo htmlspecialchars($title); ?></h3>
    <h3><?php echo $title; ?></h3>
    <div style="padding: 10px;">
        <a href="<?php echo $this->createUrl('/Nimsoft/create?id='.$details->host_customer_id);?>" title="Create New Host" class="btn btn-primary circle_ok" style="text-decoration: none;" >Add New Host to Customer</a>
        <a href="<?php echo $this->createUrl('/Nimsoft/Search_all?id='.$details->host_customer_id);?>" title="View All Hosts" class="btn btn-primary circle_ok" style="text-decoration: none;" >View All Hosts</a>

        <div style="float:right">
            <?php
                echo CHtml::link('Upload Customer CSV', array('/Nimsoft/uploadCustomers?id='.$details->host_customer_id), array(
                'onclick'=>'return hs.htmlExpand(this, { objectType: "iframe", wrapperClassName: "full-size", align: "center" } )',
                    'class'=>'btn btn-primary',
                    'id'=>'upload_link',
                ));
            ?>                          
        </div>

        <div class="innerLR">
        <div class="row-fluid">
        <?php 
            $obj=$this->widget('zii.widgets.grid.CGridView', array(
            'dataProvider'=>$dataProvider,
            ////'afterAjaxUpdate'=>'\'changeTRColor()\'',
            //'itemView'=>'_view',
            'columns'=>array(
                array(            // display 'create_time' using an expression
                    'name'=>'host_name',
                    'value'=>'$data->host_name',
                ),
                array(
                    'name'=>'host_serviceid',
                    'value'=>'$data->host_serviceid',
                ),
                array(
                    'name'=>'status',
                    'value'=>'$data->status',
                ),
                array(
                'class'=>'CButtonColumn',
                'template'=>'{edit_date}{update}{delete}',
                'buttons' => array(
                'edit_date' => array( //the name {reply} must be same
                'label' => 'Edit Date', // text label of the button
                'url' => 'Yii::app()->createAbsoluteUrl("NimsoftHostsDetails/View", array("id"=>$data->host_id))', //Your URL According to your wish
                'imageUrl' => Yii::app()->baseUrl.'/images/icons/pencil.png',  // image URL of the button. If not set or false, a text link is used, The image must be 16X16 pixels
                ),
                ),)
            ),
        )); 
    ?>
   </div>

<html lang="en">
<head>
  <meta charset="utf-8">

</head>
<body>

</body>
</html>
    <div class="separator bottom"></div>
    </div>
</div>
<!-- // Content END -->
<div class="clearfix"></div>
<!-- // Sidebar menu & content wrapper END -->

<div id="footer" class="hidden-print">
<?php $this->renderPartial('application.views.layouts._footer_inc');  ?>
</div>
</div>
<script>
        // force highslide to reload content
        hs.preserveContent = false;
        hs.dimmingOpacity = 0.75;
        hs.zIndexCounter = 10000;
        hs.showCredits = false;

        // this will disable close when we click on other area than close button
        hs.onDimmerClick = function() {
            return false;
        }

</script>

1 个答案:

答案 0 :(得分:0)

首先,您需要对$dataProvider添加$criteria->order = 'cust_id';进行排序 逐页获取结果的所有部分。