Пример #1
0
 /**
  * Deletes the profile image or profile banner
  */
 public function actionDeleteProfileImage()
 {
     $this->forcePostRequest();
     $space = $this->getSpace();
     //$space->getProfileImage()->delete();
     $type = Yii::app()->request->getParam('type', 'profile');
     $json = array('type' => $type);
     $image = NULL;
     if ($type == 'profile') {
         $image = new ProfileImage($space->guid, 'default_space');
     } elseif ($type == 'banner') {
         $image = new ProfileBannerImage($space->guid);
     }
     if ($image) {
         $image->delete();
         $json['defaultUrl'] = $image->getUrl();
     }
     $this->renderJson($json);
 }