當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Messages::getErrors方法代碼示例

本文整理匯總了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);
 }
開發者ID:seph-krueger,項目名稱:handyman,代碼行數:25,代碼來源:HomeownerController.php

示例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);
 }
開發者ID:seph-krueger,項目名稱:handyman,代碼行數:35,代碼來源:ContractorajaxController.php

示例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());
     }
 }
開發者ID:seph-krueger,項目名稱:handyman,代碼行數:17,代碼來源:ProjectajaxController.php


注:本文中的Messages::getErrors方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。