Exemple #1
0
 static function update_comments($type, $id, $date_, $memo_)
 {
     if ($date_ == null) {
         Pah::delete_comments($type, $id);
         Pah::add_comments($type, $id, Yii::app()->dateFormatter->format('yyyy-MM-dd', time()), $memo_);
     } else {
         $criteria = new CDbCriteria();
         $criteria->addCondition("type=" . $type);
         $criteria->addCondition("id=" . $id);
         $criteria->addCondition("date_=" . $date_);
         $comment = PahComments::model()->find($criteria);
         $comment->memo_ = $memo_;
         if (!$comment->save()) {
             throw new Exception("Gagal menyimpan keterangan.");
         }
     }
 }