<?php

/**
 * This is the model class for table "paper_weight_final".
 *
 * The followings are the available columns in table 'paper_weight_final':
 * @property integer $id_paper
 * @property string $created_date
 * @property integer $created_id
 * @property string $update_date
 * @property integer $update_id
 * @property integer $status
 * @property integer $kriteria_penguasaan
 * @property integer $kriteria_sistematika
 * @property integer $kriteria_tanyajawab
 * @property integer $kriteria_etika
 */
class PaperWeightFinal extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'paper_weight_final';
	}

	/**
	 * @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('created_date', 'required'),
			array('created_id, update_id, status, kriteria_penguasaan, kriteria_sistematika, kriteria_tanyajawab, kriteria_etika', 'numerical', 'integerOnly'=>true),
			array('update_date', 'safe'),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('id_paper, created_date, created_id, update_date, update_id, status, kriteria_penguasaan, kriteria_sistematika, kriteria_tanyajawab, kriteria_etika', '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(
			'id_paper' => 'Id Paper',
			'created_date' => 'Created Date',
			'created_id' => 'Created',
			'update_date' => 'Update Date',
			'update_id' => 'Update',
			'status' => 'Status',
			'kriteria_penguasaan' => 'Kriteria Penguasaan',
			'kriteria_sistematika' => 'Kriteria Sistematika',
			'kriteria_tanyajawab' => 'Kriteria Tanyajawab',
			'kriteria_etika' => 'Kriteria Etika',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models
	 * based on the search/filter conditions.
	 */
	public function search()
	{
		// @todo Please modify the following code to remove attributes that should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id_paper',$this->id_paper);
		$criteria->compare('created_date',$this->created_date,true);
		$criteria->compare('created_id',$this->created_id);
		$criteria->compare('update_date',$this->update_date,true);
		$criteria->compare('update_id',$this->update_id);
		$criteria->compare('status',$this->status);
		$criteria->compare('kriteria_penguasaan',$this->kriteria_penguasaan);
		$criteria->compare('kriteria_sistematika',$this->kriteria_sistematika);
		$criteria->compare('kriteria_tanyajawab',$this->kriteria_tanyajawab);
		$criteria->compare('kriteria_etika',$this->kriteria_etika);

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

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return PaperWeightFinal the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
