Exemple #1
0
 static function update_comments($type, $id, $date_, $memo_)
 {
     if ($date_ == null) {
         Mt::delete_comments($type, $id);
         Mt::add_comments($type, $id, Yii::app()->dateFormatter->format('yyyy-MM-dd', time()), $memo_);
     } else {
         $criteria = new CDbCriteria();
         $criteria->addCondition("type=" . $type);
         $criteria->addCondition("id=" . $type_no);
         $criteria->addCondition("date_=" . $date);
         $comment = MtComments::model()->find($criteria);
         $comment->memo_ = $memo_;
         $comment->save();
     }
 }