/** * Called to save profile widget sort order * Expected POST data: * widgetOrder - an array of strings, each corresponding to a widget class name * Echoes: * 'failure' if the request action fails, 'success' otherwise */ public function actionSetWidgetOrder() { if (!isset($_POST['widgetOrder']) || !is_array($_POST['widgetOrder']) || !isset($_POST['widgetType'])) { echo 'Failure: invalid post params'; return; } $profile = self::getModelFromPost(); $widgetOrder = $_POST['widgetOrder']; $widgetType = $_POST['widgetType']; if (SortableWidget::setSortOrder($profile, $widgetOrder, $widgetType)) { echo 'success'; return; } echo 'Failure: failed to set sort order'; }