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


PHP BOL_AvatarService::findByUserId方法代码示例

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


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

示例1: afterAvatarChange

 public function afterAvatarChange(OW_Event $event)
 {
     $params = $event->getParams();
     $userId = $params['userId'];
     $avatar = $this->avatarService->findByUserId($userId);
     $uAvatar = new UAVATARS_BOL_Avatar();
     $uAvatar->avatarId = $avatar->id;
     $uAvatar->userId = $userId;
     $avatarPath = $this->avatarService->getAvatarPath($userId, 3);
     $tmpPath = OW::getPluginManager()->getPlugin("uavatars")->getPluginFilesDir() . uniqid("tmp-") . '.jpg';
     if (!OW::getStorage()->copyFileToLocalFS($avatarPath, $tmpPath)) {
         return;
     }
     $photoStatus = $avatar->status == "active" ? "approved" : "approval";
     $photoId = $this->photoBridge->addPhoto($userId, $tmpPath, "", null, false, $photoStatus);
     @unlink($tmpPath);
     if (empty($photoId)) {
         return;
     }
     $uAvatar->photoId = $photoId;
     $uAvatar->timeStamp = time();
     $avatarPreview = $this->avatarService->getAvatarPath($userId, 2);
     $fileName = $this->uAvatarsService->storeAvatarImage($avatarPreview);
     if (empty($fileName)) {
         return;
     }
     if (!empty($uAvatar->fileName)) {
         $userfilesDir = OW::getPluginManager()->getPlugin('uavatars')->getUserFilesDir();
         OW::getStorage()->removeFile($userfilesDir . $uAvatar->fileName);
     }
     $uAvatar->fileName = $fileName;
     $this->uAvatarsService->saveAvatar($uAvatar);
 }
开发者ID:jorgemunoz8807,项目名称:havanabook,代码行数:33,代码来源:plugin.php

示例2: afterAvatarChange

 public function afterAvatarChange(OW_Event $event)
 {
     $params = $event->getParams();
     $userId = $params['userId'];
     $avatar = $this->avatarService->findByUserId($userId);
     if ($params['upload']) {
         $uAvatar = new UAVATARS_BOL_Avatar();
         $uAvatar->avatarId = $avatar->id;
         $uAvatar->userId = $userId;
         $avatarPath = $this->avatarService->getAvatarPath($userId, 3);
         $photoId = $this->photoBridge->addPhoto($userId, $avatarPath);
         if (empty($photoId)) {
             return;
         }
         $uAvatar->photoId = $photoId;
         $uAvatar->timeStamp = time();
     } else {
         $uAvatar = $this->uAvatarsService->findLastByUserId($userId);
     }
     $avatarPreview = $this->avatarService->getAvatarPath($userId, 2);
     $fileName = $this->uAvatarsService->storeAvatarImage($avatarPreview);
     if (empty($fileName)) {
         return;
     }
     if (!empty($uAvatar->fileName)) {
         $userfilesDir = OW::getPluginManager()->getPlugin('uavatars')->getUserFilesDir();
         OW::getStorage()->removeFile($userfilesDir . $uAvatar->fileName);
     }
     $uAvatar->fileName = $fileName;
     $this->uAvatarsService->saveAvatar($uAvatar);
 }
开发者ID:vazahat,项目名称:dudex,代码行数:31,代码来源:plugin.php


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