//mon model
class Assign extends CActiveRecord
{
public $duration;
public static function model($className=__CLASS__)
{
return parent::model($className);
}
public function tableName()
{
return 'assignment';
}
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('Username, Justification, Dateoperation,Duration', 'required'),
array('Justification', 'length', 'max'=>50),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('AssignId, Ticketcode, Username, Justification, Dateoperation,Duration', 'safe', 'on'=>'search'),
);
}
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(
);
}
public function attributeLabels()
{
return array(
'AssignId' => 'Assign',
'Ticketcode' => 'Ticket',
'Username' => 'User Account',
'Justification' => 'Justification',
'Dateoperation' => 'Dateoperation',
'Duration' => 'duration',
);
}
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('AssignId',$this->AssignId);
$criteria->compare('Ticketcode',$this->Ticketcode);
$criteria->compare('Username',$this->Username);
$criteria->compare('Justification',$this->Justification,true);
$criteria->compare('Dateoperation',$this->Dateoperation,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
}
//mon form
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'assign-form',
'enableAjaxValidation'=>false,
)); ?>
<?php echo $form->errorSummary($model); ?>
<div class="row">
<?php echo $form->labelEx($model,'Username'); ?>
<?php echo $form->textField($model,'Username'); ?>
<?php echo $form->error($model,'Username'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'Justification'); ?>
<?php echo $form->textArea($model,'Justification'); ?>
<?php echo $form->error($model,'Justification'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'Dateoperation'); ?>
<?php echo $form->textField($model,'Dateoperation'); ?>
<?php echo $form->error($model,'Dateoperation'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'Duration'); ?>
<?php echo $form->textField($model,'duration'); ?>
<!--?php echo $form->error($model,'Ticketcode'); ?-->
</div>
<div class="row buttons">
<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
//ma vue
<div class="view">
<b><?php echo CHtml::encode($data->getAttributeLabel('AssignId')); ?>:</b>
<?php echo CHtml::link(CHtml::encode($data->AssignId), array('view', 'id'=>$data->AssignId)); ?>
<br />
<b><?php echo CHtml::encode($data->getAttributeLabel('Username')); ?>:</b>
<?php echo CHtml::encode('Username'); ?>
<br />
<b><?php echo CHtml::encode($data->getAttributeLabel('Justification')); ?>:</b>
<?php echo CHtml::encode($data->Justification); ?>
<br />
<b><?php echo CHtml::encode($data->getAttributeLabel('Dateoperation')); ?>:</b>
<?php echo CHtml::encode($data->Dateoperation); ?>
<br />
<b><?php echo CHtml::encode($data->getAttributeLabel('Duration')); ?>:</b>
<?php echo CHtml::encode($data->duration); ?>
<br />
</div>alors comment customize ce formulaire. a+

Help












