当前位置: 首页>>代码示例>>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;未经允许,请勿转载。