public static function saveTabAsXml($title)
 {
     //echo Auth::getUserId();
     header('Content-Type: application/xml');
     header('Content-Disposition: attachment; filename=widget_space_' . $title . '.xml');
     header('Content-Transfer-Encoding: binary');
     $r = WidgetSpace::getManifest(Auth::getUserId(), array($title));
     echo $r->saveXML();
 }
 public function addDefaultWidget($username)
 {
     $userId = UsersManagement::getUserIdByLogin($username);
     WidgetSpace::loadWidgetSpace($userId, DEFAULT_WIDGET_SPACE_ON_SIGNIN);
 }
 public static function addAnonymousUser()
 {
     do {
         # Create a new random user
         $suffix = '';
         for ($i = 0; $i < 8; $i++) {
             $suffix .= chr(ord('a') + rand(0, 25));
         }
         $password = $suffix;
         $login = ANONYMOUS_PREFIX . $suffix;
     } while (self::getUserIdByLogin($login) === false);
     #Check if this user exist
     # Add user as an anonymous user
     UsersManagement::addUser(array('username' => $login, 'password' => $suffix, 'confirm_password' => $suffix, 'openid' => '', 'rights' => 0, 'copname' => 'cop1'), true, 1);
     # Add ui for the new anonymous account
     $userId = self::getUserIdByLogin($login);
     WidgetSpace::loadWidgetSpace($userId, DEFAULT_WIDGET_SPACE_ON_SIGNIN);
     return array('login' => $login, 'password' => $password);
 }