当前位置: 首页>>代码示例>>PHP>>正文


PHP DateHelper::toDbDateFormat方法代码示例

本文整理汇总了PHP中DateHelper::toDbDateFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP DateHelper::toDbDateFormat方法的具体用法?PHP DateHelper::toDbDateFormat怎么用?PHP DateHelper::toDbDateFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DateHelper的用法示例。


在下文中一共展示了DateHelper::toDbDateFormat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionMyprofile

 /**
  * <Jason>
  * <My profile of user, who created by admin>
  */
 public function actionMyprofile()
 {
     try {
         if (Yii::app()->user->role_id == ROLE_AGENT) {
             $this->redirect(Yii::app()->createAbsoluteUrl('member/agent/myprofile'));
         }
         $this->pageTitle = 'My Profile - ' . Yii::app()->params['title'];
         $this->layout = 'application.views.layouts.layout_user';
         $mUser = Users::model()->findByPk(Yii::app()->user->id);
         $old_upload_employment_pass_passport = $mUser->upload_employment_pass_passport;
         $old_scanned_passport = $mUser->scanned_passport;
         $mUser->scenario = 'myprofile_tenant';
         if (isset($_POST['Users'])) {
             $mUser->attributes = $_POST['Users'];
             $mUser->upload_employment_pass_passport = CUploadedFile::getInstance($mUser, 'upload_employment_pass_passport');
             $mUser->scanned_passport = CUploadedFile::getInstance($mUser, 'scanned_passport');
             $mUser->pass_expiry_date = DateHelper::toDbDateFormat($mUser->pass_expiry_date);
             if ($mUser->validate()) {
                 if ($_POST['Users']['newpassword'] != null && $_POST['Users']['password_confirm'] != null) {
                     if ($mUser->password_hash == md5($_POST['Users']['newpassword'])) {
                         $mUser->addError('newpassword', 'New password cannot be duplicate with current password.');
                     } else {
                         $mUser->password_hash = md5(trim($_POST['Users']['newpassword']));
                         $mUser->temp_password = $_POST['Users']['newpassword'];
                     }
                 }
                 if (!$mUser->getErrors()) {
                     //upload_employment_pass_passport
                     if (!is_null($mUser->upload_employment_pass_passport)) {
                         Users::save_upload_employment_pass_passport($mUser);
                     } else {
                         if (isset($_POST['delete_current_file']) && $_POST['delete_current_file'] == 'on') {
                             $path = Users::$folderUpload;
                             Users::deleteOldFile($mUser, 'upload_employment_pass_passport', $path);
                             $mUser->upload_employment_pass_passport = NULL;
                             $mUser->update(array('upload_employment_pass_passport'));
                         } else {
                             $mUser->upload_employment_pass_passport = $old_upload_employment_pass_passport;
                         }
                     }
                     //scanned_passport
                     if (!is_null($mUser->scanned_passport)) {
                         Users::save_scanned_passport($mUser);
                     } else {
                         if (isset($_POST['delete_scanned_passport']) && $_POST['delete_scanned_passport'] == 'on') {
                             $path = Users::$folderUpload;
                             Users::deleteOldFile($mUser, 'scanned_passport', $path);
                             $mUser->scanned_passport = NULL;
                             $mUser->update(array('scanned_passport'));
                         } else {
                             $mUser->scanned_passport = $old_scanned_passport;
                         }
                     }
                     if ($mUser->save('pass_expiry_date, nric_passportno_roc', 'email_not_login', 'first_name', 'password_hash', 'temp_password', 'contact_no', 'id_type', 'address')) {
                         Yii::app()->user->setFlash('success', "My Profile has changed!");
                         $mUser->newpassword = '';
                         $mUser->password_confirm = '';
                     }
                 }
             } else {
                 $mUser->scanned_passport = $old_scanned_passport;
                 $mUser->upload_employment_pass_passport = $old_upload_employment_pass_passport;
             }
         }
         $this->render('myprofile', array('model' => $mUser));
     } catch (Exception $exc) {
         throw new CHttpException('404', $exc->getMessage());
     }
 }
开发者ID:jasonhai,项目名称:onehome,代码行数:73,代码来源:TenantController.php


注:本文中的DateHelper::toDbDateFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。