Example #1
0
 public function getProfileImage($id, $view = null)
 {
     $profile = UserProfile::find()->where(['id' => $id])->one();
     if ($view != null) {
         if ($profile) {
             if ($profile->profile_image != null) {
                 $profile->module->ProfileImagePathPreview;
                 return $profile->module->ProfileImagePathPreview . '/' . $profile->profile_image;
             } else {
                 $bundle = userAsset::register($view);
                 return $bundle->baseUrl . '/img/user_profile.png';
             }
         } else {
             $bundle = userAsset::register($view);
             return $bundle->baseUrl . '/img/user_profile.png';
         }
     } else {
         if ($profile) {
             if ($profile->profile_image != null) {
                 $profile->module->ProfileImagePathPreview;
                 return $profile->module->ProfileImagePathPreview . '/' . $profile->profile_image;
             } else {
                 return null;
             }
         } else {
             return null;
         }
     }
 }
Example #2
0
 public function registerAssets()
 {
     $view = Yii::$app->getView();
     userAsset::register($view);
 }