private static function loadThreeColLayout($userId, $tabTitle, $xmlLayout)
 {
     $xmlSections = $xmlLayout->getElementsByTagName('section');
     foreach ($xmlSections as $xmlSection) {
         $colPosition = $xmlSection->getAttribute('position');
         $xmlWidgets = $xmlSection->getElementsByTagName('widget');
         $rowPosition = 0;
         foreach ($xmlWidgets as $xmlWidget) {
             $widgetId = $xmlWidget->getAttribute('widgetid');
             $minimized = $xmlWidget->getAttribute('minimized');
             $widgetState = array(array('column' => $colPosition, 'position' => $rowPosition, 'minimized' => $minimized, 'widgetid' => $widgetId));
             # import the widget
             $widgetInstanceId = UserInterface::insertWidget($userId, $widgetId, $widgetState, $tabTitle);
             # import widget preferences
             $xmlProperties = $xmlWidget->getElementsByTagName('property');
             foreach ($xmlProperties as $xmlProperty) {
                 $xmlName = $xmlProperty->getElementsByTagName('name');
                 $xmlValue = $xmlProperty->getElementsByTagName('value');
                 if ($xmlName->length > 0 && $xmlValue->length > 0) {
                     $propertyName = $xmlName->item(0)->nodeValue;
                     $propertyValue = $xmlValue->item(0)->nodeValue;
                     UserInterface::updateWidgetPreferences($userId, $widgetInstanceId, array($propertyName => $propertyValue), array());
                 }
             }
             $rowPosition++;
         }
     }
 }
Esempio n. 2
0
 /**
  * The updatePreferences action acts as a service and should be triggered through an XML HTTP GET Request
  * in order to update the preferences of a widget for the user that is currently authenticated .
  *
  * @param string $widgetId The widget string database identifier.
  * @param unknown_type $widgetTags The tags associated to the widget by the user. Each tag is separated by a blank character (' ').
  */
 public function updatePreferences($widgetInstanceId, $widgetTags = null)
 {
     if (!Auth::isAuth()) {
         throw new ServiceException(MwwException::ACTION, 'updatePreferences', ServiceException::SERV_AUTH);
     }
     UserInterface::updateWidgetPreferences(Auth::getUserId(), $widgetInstanceId, self::buildWidgetPreferences($_POST), self::buildWidgetTags($widgetTags));
 }