2015-09-24 29 views
2

我是yii1的新手。在我的項目中,我使用TblExtendedGridView在表格中顯示數據。表單顯示我本地計算機中的數據。但是當項目在服務器中卸載時,該文件是空白的並且不顯示任何錯誤。 問題是什麼?表格在使用TbExtendedGridView時空白

'<?php 
$uniqid=md5(uniqid()); 
$this->widget('bootstrap.widgets.TbExtendedGridView', array(
    'id'=>'marketing-grid', 
    'dataProvider'=>$model->search(), 
    'filter'=>$model, 
    'type' => 'striped bordered', 
    'type' => 'striped bordered condensed', 
     'columns'=>array(
     array(
     'header'=>'#', 
      'value'=>'$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)', 
     ), 
     array(
     'name'=>'client_id', 
     'header'=>'Company', 
     'value'=>'$data->clientName->client_name', 
     'htmlOptions' => array('style'=>'width:200px'), 
     ), 
     array(
     'name'=>'client_contact_id', 
     'header'=>'Contacted', 
     'value'=>'$data->contactPerson->contact_name', 
     'htmlOptions' => array('style'=>'width:180px'), 
     ), 
     array(
     'name'=>'visited_date', 
     'header'=>'Visit Date', 
     'htmlOptions' => array('style'=>'width:100px'), 
     ), 
     array(
     'name'=>'possibility', 
     'header'=>'Probability', 
     'htmlOptions' => array('style'=>'width:100px'), 
     ), 
     'remarks', 
     array(
     'name'=>'next_visited_date', 
     'header'=>'Next Contact Date', 
     'htmlOptions' => array('style'=>'width:100px'), 
     ), 
     array(
     'name'=>'follow_up_by', 
     'header'=>'Follow Up By', 
     'value'=>'$data->followPerson->user_name', 
     'htmlOptions' => array('style'=>'width:180px'), 
     ), 
     ), 


     ), 
    ), 
)); ?>' 


'My controller is: 

     <?php 

    class MarketingController extends Controller 
    { 
     public $layout='//layouts/column1'; 
     public function actionIndex() 
     { 
      $this->actionAdmin(); 
     } 

     // Uncomment the following methods and override them if needed 

     public function filters() 
     { 
      return array(
       'accessControl', // perform access control for CRUD operations 
       'postOnly + delete', // we only allow deletion via POST request 
      ); 
     } 
     public function accessRules() 
     { 
      return array(
       array('allow', // allow all users to perform 'index' and 'view' actions 
        'actions'=>array('index','view','DynamicContact'), 
        'users'=>array('*'), 
       ), 
       array('allow', // allow authenticated user to perform 'create' and 'update' actions 
        'actions'=>array('admin','delete','create','update','DynamicContact'), 
        'users'=>array('@'), 
       ), 
       array('allow', // allow admin user to perform 'admin' and 'delete' actions 
        'actions'=>array('admin','delete','DynamicContact'), 
        'users'=>array('admin','@'), 
       ), 
       array('deny', // deny all users 
        'users'=>array('*'), 
       ), 
      ); 
     } 

     protected function performAjaxValidation($model) 
     { 
      if(isset($_POST['ajax']) && $_POST['ajax']==='marketing-form') 
      { 
       echo CActiveForm::validate($model); 
       Yii::app()->end(); 
      } 
     } 
     public function actionView($id) 
     { 

      EQuickDlgs::render('view',array('model'=>$this->loadModel($id))); 
     } 
     public function actionAdmin() 
     { 
      $model=new Marketing('search'); 
      $model->unsetAttributes(); // clear any default values 
      if(isset($_GET['Marketing'])) 
       $model->attributes=$_GET['Marketing']; 

      $this->render('admin',array(
       'model'=>$model, 
      )); 
     } 


     public function actionCreate() 
     { 

      $model=new Marketing; 

      // Uncomment the following line if AJAX validation is needed 
      $this->performAjaxValidation($model); 

      if(isset($_POST['Marketing'])) 
      { 
       $model->attributes=$_POST['Marketing']; 
       //print_r($_POST['User']); 
       //die; 

       if($model->save()) 
       { 
        EQuickDlgs::checkDialogJsScript(); 
        $this->redirect(array('marketing/admin','id'=>$model->marketing_id)); 


       } 
      } 

      EQuickDlgs::render('create',array(
       'model'=>$model, 
      )); 

     } 
     public function loadModel($id) 
     { 
      $model=Marketing::model()->findByPk($id); 
      if($model===null) 
       throw new CHttpException(404,'The requested page does not exist.'); 
      return $model; 
     } 

     public function actionUpdate($id) 
     { 
      $model=$this->loadModel($id); 

      // Uncomment the following line if AJAX validation is needed 
      // $this->performAjaxValidation($model); 
      if(isset($_POST['Marketing'])) 
      { 
       $model->attributes=$_POST['Marketing']; 
       if($model->save()) 
       { 
        //$this->redirect(array('view','id'=>$model->user_id)); 
        EQuickDlgs::checkDialogJsScript(); 
        $this->redirect(array('marketing/admin','id'=>$model->marketing_id)); 
       } 

      } 

      EQuickDlgs::render('update',array(
       'model'=>$model, 
      )); 
     } 

     public function actionDelete($id) 
     { 
      $this->loadModel($id)->delete(); 

      // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser 
      if(!isset($_GET['ajax'])) 
       $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); 
     } 

    }' 

    'And Model is : 
<?php 
class Marketing extends PMActiveRecord 
{ 
    /** 
    * @return string the associated database table name 
    */ 
    public function tableName() 
    { 
     return 'pm_mar_marketing'; 
    } 


    public function rules() 
    { 

     return array(
      array('client_id, client_contact_id, follow_up_by, visited_date, visit_type, next_visited_date, possibility, remarks', 'required'), 
      array('client_id, client_contact_id, follow_up_by, visit_type, crtd_by, updt_by, updt_cnt', 'numerical', 'integerOnly'=>true), 
      array('possibility', 'length', 'max'=>20), 
      // The following rule is used by search(). 
      // @todo Please remove those attributes that should not be searched. 
      array('marketing_id, client_id, client_contact_id, follow_up_by, visited_date, visit_type, next_visited_date, possibility, remarks', 'safe', 'on'=>'search'), 
     ); 
    } 


    public function relations() 
    { 

     return array(
     'clientName' => array(self::BELONGS_TO, 'Client', 'client_id'), 
     'contactPerson' => array(self::BELONGS_TO, 'ClientContact', 'client_contact_id'), 
     'followPerson' => array(self::BELONGS_TO, 'User', 'follow_up_by'), 
       'visitType' => array(self::BELONGS_TO, 'CodeValue', 'visit_type') 
     ); 
    } 

    /** 
    * @return array customized attribute labels (name=>label) 
    */ 
    public function attributeLabels() 
    { 
     return array(
      'marketing_id' => 'Marketing', 
      'client_id' => 'Client', 
        // 'client_id'=> 'Client', 
      'client_contact_id' => 'Contact Person', 
      //'client_contact_id' => 'Contact Person', 
      'follow_up_by' => 'Follow Up By', 
      'visited_date' => 'Visited Date', 
      'visitType.code_lbl' => 'Visit Type', 
      'next_visited_date' => 'Next Contact Date', 
      'possibility' => 'Probability', 
      'remarks' => 'Remarks', 
      'crtd_by' => 'Crtd By', 
      'crtd_dt' => 'Crtd Dt', 
      'updt_by' => 'Updt By', 
      'updt_dt' => 'Updt Dt', 
      'updt_cnt' => 'Updt Cnt', 
     ); 
    } 


    public function search() 
    { 
     // @todo Please modify the following code to remove attributes that should not be searched. 

     $criteria=new CDbCriteria; 
     $criteria->with = array('clientName','contactPerson','followPerson'); 

     $criteria->compare('marketing_id',$this->marketing_id); 
     $criteria->compare('clientName.client_name',$this->client_id,true); 
     $criteria->compare('contactPerson.contact_name',$this->client_contact_id,true); 
     $criteria->compare('followPerson.user_name',$this->follow_up_by,true); 
     $criteria->compare('visited_date',$this->visited_date,true); 
     //$criteria->compare('visit_type',$this->visit_type); 
     $criteria->compare('next_visited_date',$this->next_visited_date,true); 
     $criteria->compare('possibility',$this->possibility,true); 
     $criteria->compare('remarks',$this->remarks,true); 
     $criteria->compare('crtd_by',$this->crtd_by); 
     $criteria->compare('crtd_dt',$this->crtd_dt,true); 
     $criteria->compare('updt_by',$this->updt_by); 
     $criteria->compare('updt_dt',$this->updt_dt,true); 
     $criteria->compare('updt_cnt',$this->updt_cnt); 
     //$criteria -> join = 'INNER JOIN pm_marketing_user followPerson on t.follow_up_by= followPerson.user_id'; 

     return new CActiveDataProvider($this, array(
      'criteria'=>$criteria, 
     )); 
    } 


    public static function model($className=__CLASS__) 
    { 
     return parent::model($className); 
    } 
} 
' 
+1

在本地你正在使用Windows? – scaisEdge

+0

是的,我正在使用Windows。 –

+0

請顯示您的控制器和您的型號 – scaisEdge

回答

0

如果這happend只有白衣這個視圖類代碼文件的小寫/大寫檢查(Marketing.php我猜)

如果你的開發環境是Windows和produdction環境是類Unix,可以發生在你的模型中有marketing.php,並且你引用了Marketing.php,或者相反,這個工作在windows/dos中,因爲如果是insentisitve而不是在Unix中,比如OS

+0

在定義關係時,我提到的類名是大寫,即'Client',但類名是小寫,即'client' –

+0

像我建議你的答案.... – scaisEdge

+0

謝謝!!!!!!! –