Guest User

Untitled

a guest
Jan 24th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. class Inbox extends CActiveRecord
  2. {
  3. public $sender_id;
  4. public $msg_list;
  5. /**
  6. * Returns the static model of the specified AR class.
  7. * @return RegisterForm the static model class
  8. */
  9. public static function model($className=__CLASS__)
  10. {
  11. return parent::model($className);
  12. }
  13.  
  14. /**
  15. * @return string the associated database table name
  16. */
  17. public function tableName()
  18. {
  19. return 'inbox';
  20. }
  21.  
  22. public function primaryKey()
  23. {
  24. return 'id';
  25. // For composite primary key, return an array like the following
  26. // return array('pk1', 'pk2');
  27. }
  28. /**
  29. * @return array validation rules for model attributes.
  30. */
  31. public function rules()
  32. {
  33. // NOTE: you should only define rules for those attributes that
  34. // will receive user inputs.
  35. return array(
  36. array('sender_id, receiver_id,message','required'),
  37.  
  38. // The following rule is used by search().
  39. // Please remove those attributes that should not be searched.
  40. array('id, sender_id, receiver_id,message,date','on'=>'search'),
  41. );
  42. }
  43.  
  44. /**
  45. * @return array relational rules.
  46. */
  47. public function relations()
  48. {
  49. // NOTE: you may need to adjust the relation name and the related
  50. // class name for the relations automatically generated below.
  51. return array(
  52. );
  53. }
  54.  
  55. /**
  56. * @return array customized attribute labels (name=>label)
  57. */
  58. public function attributeLabels()
  59. {
  60. return array(
  61. 'id' => 'Id',
  62. 'sender_id' => 'Sender_id',
  63. 'receiver_id' => 'Receiver_id',
  64. 'message' => 'Message',
  65. 'date' => 'Date',
  66.  
  67. );
  68. }
  69.  
  70. /**
  71. * Retrieves a list of models based on the current search/filter conditions.
  72. * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  73. */
  74. public function search()
  75. {
  76. // Warning: Please modify the following code to remove attributes that
  77. // should not be searched.
  78.  
  79. $criteria=new CDbCriteria;
  80. $criteria->compare('id',$this->id,true);
  81. $criteria->compare('sender_id',$this->sender_id,true);
  82. $criteria->compare('receiver_id',$this->receiver_id,true);
  83. $criteria->compare('message',$this->message,true);
  84. $criteria->compare('date',$this->date,true);
  85. return new CActiveDataProvider(get_class($this), array(
  86. 'criteria'=>$criteria,
  87. ));
  88. }
  89. }
Add Comment
Please, Sign In to add comment