/** * This action should be requested through XML HTTP REQUEST in order to save the state of * the widget wall of the logged user when a particular event occurs at the client-side. * * These events could be : * - 'add' : A widget has been inserted in the widget wall of the user. * - 'move' : A widget has been moved to an other position in the widget wall of the user. * - 'delete' : A widget has been removed from the widget wall of the user. * - 'minimize' : A widget has been minimized in the widget wall of the user. * * Parameters $c_0, $c_1 and $c_2 represent the information about the widgets'position in a column of the * user interface. Information about a column is organized as a list of string. Each string in the array * represents a widget string identifier e.g 'widgetContainer_miniClock'. The index of the string in the array * represents the position of the widget in the colum. For instance, the array('widgetContainer_miniClock', 'widgetContainer_tagCloud') * explains that the 'miniClock' widget is at the top of the column and that 'tagCloud' is just beneath it. * * @param string $widgetId The identifier of the widget that is concerned by the triggered event. (not used in each case) * @param string $action The event that occured in the widget wall of the user. The value of this parameter must be 'add', 'move', 'delete' or 'minimize'. * @param array $c_0 The left column information about the widget wall of the user. * @param array $c_1 The central column information about the widget wall of the user. * @param array $c_2 The right column information about the widget wall of the user. */ public function updateInterface($widgetInstanceId, $action, $c_0, $c_1, $c_2, $tabId) { $columns = array($c_0, $c_1, $c_2); if (!Auth::isAuth()) { throw new ServiceException(MwwException::ACTION, 'updateInterface', ServiceException::SERV_AUTH); } // Update the action following the requested action. switch ($action) { # Change This to addInstance case 'add': UserInterface::insertWidget(Auth::getUserId(), $widgetInstanceId, self::buildWidgetStates($columns), $tabId); break; case 'move': UserInterface::update(Auth::getUserId(), self::buildWidgetStates($columns)); break; case 'delete': UserInterface::deleteWidget(Auth::getUserId(), $widgetInstanceId, self::buildWidgetStates($columns)); break; case 'minimize': UserInterface::minimizeWidget(Auth::getUserId(), $widgetInstanceId); break; default: throw new BadArgumentException(MwwException::ACTION, 'Unknown action when trying to update user\'s interface.'); } }