private function SendWishlist() { // prepare the email message $subject = "Some Gift Ideas"; $headers = 'From: My CBDB Admin admin@mycbdb.com' . "\r\n" . 'Reply-To: My CBDB Admin admin@mycbdb.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $email = "Here are a few of my gift wishes:\n"; // build the body of the email $wishes = Wish::model()->findAll(); foreach ($wishes as $w) { $email .= "\t" . $w->title . "\n"; } $email .= "Please come to my website to see more about " . "my collection and play some games."; Yii::log("My wishlist email message is [" . $email . "]", 'info', 'jobprocessor'); $wishgivers = User::model()->not_admin()->findAll(); foreach ($wishgivers as $wg) { Yii::log("Sending wishlist to " . $wg->username, 'info', 'jobprocessor'); //mail($email, $subject, $body, $headers); } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Wish::model()->with('type')->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }