Here is the problem I am having:
I am using CJuiDateTimePicker I can create a new record but for some reason the darn thing is not updating the record if I change it. Anyone know why?
<?php Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
$this->widget('CJuiDateTimePicker',array(
'model'=>$model, //Model object
'attribute'=>'wo_date', //attribute name
'mode'=>'datetime', //use "time","date" or "datetime" (default)
'options'=>array(
'dateFormat'=>'yy-mm-dd',
),
'language' =>'',
// jquery plugin options
));
?>
My Model
<?php
/**
* This is the model class for table "pms".
*
* The followings are the available columns in table 'pms':
* @property integer $id
* @property integer $asset_id
* @property string $Subject
* @property integer $scheduled_maintenance
* @property integer $unscheduled_maintenance
* @property string $StartTime
* @property string $EndTime
* @property integer $IsAllDayEvent
* @property string $RecurringRule
* @property string $completion_date
* @property string $downtime
* @property string $description_of_work
* @property integer $company_id
* @property string $wo_date
* @property string $wo_type
* @property string $wo_terms
* @property string $wo_rate
* The followings are the available model relations:
* @property Companies $company
* @property Assets $asset
*/
class Pms extends CActiveRecord
{
/**
* Returns the static model of the specified AR class.
* @return Pms 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 'pms';
}
/**
* @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('asset_id, Subject, StartTime, description_of_work, company_id', 'required'),
array('asset_id, scheduled_maintenance, unscheduled_maintenance, company_id,IsAllDayEvent', 'numerical', 'integerOnly'=>true),
array('Subject', 'length', 'max'=>255),
array('downtime, wo_terms, wo_rate', 'length', 'max'=>77),
array('wo_type', 'length', 'max'=>255),
array('wo_type', 'length', 'max'=>255),
array('StartTime, EndTime,wo_date','update', 'safe'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, asset_id, Subject, scheduled_maintenance, unscheduled_maintenance, StartTime, EndTime, completion_date, downtime, Color,description_of_work,wo_date, wo_type, wo_terms, wo_rate, company_id', '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(
'company' => array(self::BELONGS_TO, 'Companies', 'company_id'),
'asset' => array(self::BELONGS_TO, 'Assets', 'asset_id'),
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'id' => 'ID',
'asset_id' => 'Asset',
'Subject' => 'Subject',
'scheduled_maintenance' => 'Scheduled Maintenance',
'unscheduled_maintenance' => 'Unscheduled Maintenance',
'schduled_date' => 'StarTime',
'EndTime'=>'EndTime',
'completion_date' => 'Completion Date',
'downtime' => 'Downtime',
'description_of_work' => 'Description Of Work',
'company_id' => 'Company',
'wo_date' => 'Wo Date',
'wo_type' => 'Wo Type',
'wo_terms' => 'Wo Terms',
'wo_rate' => 'Wo Rate',
);
}
/**
* 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('id',$this->id);
$criteria->compare('asset_id',$this->asset_id);
$criteria->compare('Subject',$this->Subject,true);
$criteria->compare('scheduled_maintenance',$this->scheduled_maintenance);
$criteria->compare('unscheduled_maintenance',$this->unscheduled_maintenance);
$criteria->compare('StartTime',$this->StartTime,true);
$criteria->compare('EndTime',$this->EndTime,true);
$criteria->compare('downtime',$this->downtime,true);
$criteria->compare('description_of_work',$this->description_of_work,true);
$criteria->compare('company_id',$this->company_id);
$criteria->compare('wo_date',$this->wo_date,true);
$criteria->compare('wo_type',$this->wo_type,true);
$criteria->compare('wo_terms',$this->wo_terms,true);
$criteria->compare('wo_rate',$this->wo_rate,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'pagination'=>array('pageSize'=>10),
));
}
}