Esempio n. 1
0
 public function actionDeleteSortableWidget()
 {
     if (!isset($_POST['widgetLayoutName']) || !isset($_POST['widgetKey'])) {
         throw new CHttpException(400, 'Bad Request');
     }
     $widgetKey = $_POST['widgetKey'];
     $profile = self::getModelFromPost();
     list($widgetClass, $widgetUID) = SortableWidget::parseWidgetLayoutKey($widgetKey);
     $widgetLayoutName = $_POST['widgetLayoutName'];
     if (SortableWidget::subtypeIsValid($widgetLayoutName, $widgetClass)) {
         if (SortableWidget::deleteSortableWidget($profile, $widgetClass, $widgetUID, $widgetLayoutName)) {
             echo 'success';
             return;
         }
     }
     echo 'failure';
 }