本文整理汇总了PHP中Messages::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP Messages::getErrors方法的具体用法?PHP Messages::getErrors怎么用?PHP Messages::getErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Messages
的用法示例。
在下文中一共展示了Messages::getErrors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionSavemessage
public function actionSavemessage()
{
$subject = Yii::app()->Ini->v('subject');
$message = Yii::app()->Ini->v('message');
$to_usertype = Yii::app()->Ini->v('to_usertype');
$from_id = Yii::app()->user->getId();
$from_user_type = Yii::app()->user->role;
$to_id = Yii::app()->Ini->v('receiver_id');
$sent_date = date("Y-m-d H:i:s");
$messages = new Messages();
$messages->subject = $subject;
$messages->message = $message;
$messages->from_id = $from_id;
$messages->to_id = $to_id;
$messages->to_user_type = 'to_usertype';
$messages->from_user_type = $from_user_type;
$messages->date_sent = $sent_date;
$this->sendEmailNotification($subject, $message, $to_id, Yii::app()->name);
if ($messages->save()) {
$status = array('success' => true);
} else {
$status = array('success' => false, 'error_message' => print_r($messages->getErrors()));
}
$this->renderJSON($status);
}
示例2: savemessagewithAttachedProject
public function savemessagewithAttachedProject()
{
$subject = Yii::app()->Ini->v('subject');
$message = Yii::app()->Ini->v('message');
$project_id = Yii::app()->Ini->v('project_id');
$receiver_id = Yii::app()->Ini->v('receiver_id');
$from_id = Yii::app()->user->getId();
$from_user_type = Yii::app()->user->role;
$to_id = Yii::app()->Ini->v('receiver_id');
$sent_date = date("Y-m-d H:i:s");
$homeowner_details = Homeowners::model()->findByPk($from_id);
/*
get project info
*/
$concat_message = "";
$proj_info = Projects::model()->findByPk($project_id);
if (count($proj_info) > 0) {
$concat_message = "<br><br>Project Details:<br>\r\n\t\t\t\t<b>Description: </b>" . $proj_info->description . "<br>\r\n\t\t\t\t<b>Project Type: </b>" . $this->getProjectTypeName($proj_info->project_type_id) . "<br>\r\n\t\t\t\t<b>Start Date: </b>" . $proj_info->start_date . "<br>\r\n\t\t\t\t<b>Time Frame: </b>" . $proj_info->time_frame . "<br>\r\n\t\t\t\t<b>Budget: </b>" . $proj_info->budget . "<br>\r\n\t\t\t\t<b>Home Owner: </b> <a href='http://handyman.com/homeowner/profile/user/" . $homeowner_details->username . "'>" . $homeowner_details->firstname . " " . $homeowner_details->lastname . "</a><br>\r\n\t\t\t\tLearn more <a href='http://handyman.com/project/jobdetails/pj_id/" . $project_id . "'>here</a>.<br>\r\n\t\t\t\t";
}
$messages = new Messages();
$messages->subject = $subject;
$messages->message = $message . " " . $concat_message;
$messages->from_id = $from_id;
$messages->to_id = $to_id;
$messages->to_user_type = 'contractor';
$messages->from_user_type = $from_user_type;
$messages->date_sent = $sent_date;
$this->sendEmailNotification($subject, $message . " " . $concat_message, $to_id, Yii::app()->name);
if ($messages->save()) {
$status = array('success' => true);
} else {
$status = array('success' => false, 'error_message' => print_r($messages->getErrors()));
}
$this->renderJSON($status);
}
示例3: sendmsgtohomeowner
public function sendmsgtohomeowner($post)
{
$proj = new Messages();
$proj->subject = $post['msg_subject'];
$proj->message = $post['msg_content'];
$proj->from_id = Yii::app()->user->getId();
$proj->from_user_type = Yii::app()->user->role;
$proj->to_id = $post['project_owner2'];
$proj->to_user_type = 'homeowner';
$proj->date_sent = date("Y-m-d H:i:s");
if ($proj->save()) {
$status = array('success' => true);
$this->renderJSON($status);
} else {
print_r($proj->getErrors());
}
}