3

彼らのサイトで与えられた指示に基づいて、dhtmlxをyiiフレームワークに統合しました.( DHTMLX With YII )

ここに私のコントローラーファイルコード、

include_once(YII_BASE_PATH . "/dhtmlx/connector/grid_connector.php");
 include_once(YII_BASE_PATH . "/dhtmlx/connector/scheduler_connector.php");
 include_once(YII_BASE_PATH . "/dhtmlx/connector/db_phpyii.php");
 
class EventsController extends Controller
{
          public function accessRules()
    {
        return array(
            array('allow',  // allow all users to perform 'index' and 'view' actions
                'actions'=>array('index','view','grid','scheduler'),
                'users'=>array('*'),
            ),
            array('allow', // allow authenticated user to perform 'create' and 'update' actions
                'actions'=>array('create','update'),
                'users'=>array('@'),
            ),
            array('allow', // allow admin user to perform 'admin' and 'delete' actions
                'actions'=>array('admin','delete'),
                'users'=>array('admin'),
            ),
            array('deny',  // deny all users
                'users'=>array('*'),
            ),
        );
    }


           public function actionGrid()
        {            
            // $this->render('grid'); //loads the 'grid' view that we will create later
               $model = new Events();   
               
               $this->render('grid',array(
                    'model'=>$model,
                ));
        }
        
        public function actionGrid_data()
        {
                //$model = new Events;
            $grid = new GridConnector(Events::model(), "PHPYii");
            $grid->configure("-","event_id", "start_date, end_date, event_name");
            $grid->render();
        }
}

================================================== ============================

私のビューファイル

<script src="<?php echo AT::getAdminBaseUrl()?>/dhtmlx/grid/dhtmlxcommon.js"    type="text/javascript" charset="utf-8"></script>
<script src="<?php echo AT::getAdminBaseUrl()?>/dhtmlx/grid/dhtmlxgrid.js"  type="text/javascript" charset="utf-8"></script>
<script src="<?php echo AT::getAdminBaseUrl()?>/dhtmlx/grid/dhtmlxgridcell.js"  type="text/javascript" charset="utf-8"></script>

<script src="<?php echo AT::getAdminBaseUrl()?>/dhtmlx/dhtmlxdataprocessor.js"  type="text/javascript" charset="utf-8"></script>
<script src="<?php echo AT::getAdminBaseUrl()?>/dhtmlx/connector/connector.js"  type="text/javascript" charset="utf-8"></script>

<link rel="stylesheet" href="<?php echo AT::getAdminBaseUrl()?>/dhtmlx/grid/dhtmlxgrid.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="<?php echo AT::getAdminBaseUrl()?>/dhtmlx/grid/skins/dhtmlxgrid_dhx_skyblue.css" type="text/css" media="screen" title="no title" charset="utf-8">  

        
<div id="grid_here" style="width:600px; height:400px;"> </div>
 <?php 
                                    // $this->widget('zii.widgets.CListView', array(
                                        // 'dataProvider'=>$dataProvider,
                                        // 'itemView'=>'_view',
                                    // )); 
                                ?>
        <script type="text/javascript">
          mygrid = new dhtmlXGridObject('grid_here'); 
          mygrid.setHeader("Start date,End date,Text");
          mygrid.init();                           
          mygrid.loadXML("./grid_data"); //refers to the 'Grid_data' action we created in the previous step
 
          var dp = new dataProcessor("./grid_data"); //refers to the 'Grid_data' action as well
          dp.init(mygrid);
 
        </script>

================================================== =========================

私のモーダルファイル

<?php

/**
 * This is the model class for table "vendor".
 *
 * The followings are the available columns in table 'vendor':
 * @property integer $id
 * @property string $vendor_name
 * @property string $vendor_description
 * @property string $status
 */
class Events extends CActiveRecord
{
    /**
     * Returns the static model of the specified AR class.
     * @param string $className active record class name.
     * @return Vendor the static model class
     */
    public static function model($className=__CLASS__)
    {
        return parent::model($className);
    }

    /**
     * @return string the associated database table name
     */
    public function tableName()
    {
        return 'events';
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules()
    {
        // NOTE: you should only define rules for those attributes that
        // will receive user inputs.
        return array(
            array('event_name', 'length', 'max'=>255),
                      // The following rule is used by search().
            // Please remove those attributes that should not be searched.
                    array('start_date,end_date,event_name', 'safe', 'on'=>'search'),
        );
    }

    /**
     * @return array relational rules.
     */
    public function relations()
    {
        // NOTE: you may need to adjust the relation name and the related
        // class name for the relations automatically generated below.
        return array(
        );
    }

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels()
    {
        return array(
            'event_id' => 'Event Id',
                    'start_date' => 'Start Date',
                    'end_date' => 'End Date',
                    'event_name' => 'Event Name',
            
        );
    }

    /**
     * Retrieves a list of models based on the current search/filter conditions.
     * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
     */
    public function search()
    {
        // Warning: Please modify the following code to remove attributes that
        // should not be searched.

        $criteria=new CDbCriteria;

        $criteria->compare('event_id',$this->event_id);
        $criteria->compare('start_date',$this->start_date,true);
        $criteria->compare('end_date',$this->end_date,true);
        $criteria->compare('event_name',$this->event_name,true);
              

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

アクション グリッドを実行すると、以下のようなポップアップ ウィンドウにエラーが表示されます。

ここに画像の説明を入力

何が問題なのかわからない。'$grid = new GridConnector(Events::model(), "PHPYii"); 'これが問題の原因であるとは思えません。

どうすればこれを解決できますか? 誰でも私を助けることができますか?

4

2 に答える 2

0

質問を見てください: Strict Standards: Only variables should be assigned by reference PHP 5.4

の 16 行目で、厳密な基準を使用して参照演算子を使用してオブジェクトを渡しているようです/dhtmlx/connector/db_phpyii.php

于 2013-04-03T10:58:43.343 に答える