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


PHP Appointment::setInstructions方法代碼示例

本文整理匯總了PHP中Appointment::setInstructions方法的典型用法代碼示例。如果您正苦於以下問題:PHP Appointment::setInstructions方法的具體用法?PHP Appointment::setInstructions怎麽用?PHP Appointment::setInstructions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Appointment的用法示例。


在下文中一共展示了Appointment::setInstructions方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: afterSave

 protected function afterSave()
 {
     /** @var $user User */
     $userId = $this->followUpUser ?: Yii::app()->user->id;
     $user = User::model()->findByPk($userId);
     if ($this->followUpDue) {
         if ($note = $this->followUpAppointment) {
             $note->app_start = date("Y-m-d", strtotime($this->followUpDue));
             $note->app_user = $user ? $user->use_id : $note->app_user;
             $note->calendarID = $user ? $user->use_branch : $note->calendarID;
         } else {
             if (!$user) {
                 throw new Exception('User for follow up is not selected');
             }
             $note = new Appointment();
             $note->app_type = Appointment::TYPE_VALUATION_FOLLOW_UP;
             $note->app_start = date("Y-m-d", strtotime($this->followUpDue));
             $note->app_user = $user->use_id;
             $note->calendarID = $user->use_branch;
             $note->app_subject = $this->property->address->toString(', ');
             $note->setInstructions([$this->dea_id]);
         }
         $existingFollowUps = Appointment::model()->findByAttributes(array("app_user" => $note->app_user, 'app_type' => Appointment::TYPE_VALUATION_FOLLOW_UP), array('order' => 'app_start DESC', 'condition' => 'DATE(app_start) = "' . date("Y-m-d", strtotime($note->app_start)) . '"'));
         if (!$existingFollowUps) {
             $note->app_start = date("Y-m-d", strtotime($note->app_start)) . " 09:00:00";
             // hardcoded time, not best solution ever
             $note->app_end = date("Y-m-d", strtotime($note->app_start)) . " 09:30:00";
         } else {
             $note->app_start = $existingFollowUps->app_end;
             $note->app_end = date("Y-m-d H:i:s", strtotime($note->app_start . " + 30 minutes"));
         }
         if ($note->save()) {
             $this->followUpAppointmentId = $note->app_id;
             $this->saveAttributes(['followUpAppointmentId']);
         } else {
             $this->addError("followUpUppointment", "Could not save follow up appointment");
         }
         $this->followUpAppointment = $note;
     }
     parent::afterSave();
 }
開發者ID:jankichaudhari,項目名稱:yii-site,代碼行數:41,代碼來源:Deal.php


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